Skip to content

Commit

Permalink
Merge pull request #76 from slotThe/setClassHint
Browse files Browse the repository at this point in the history
Add `setClassHint`
  • Loading branch information
liskin authored Apr 29, 2021
2 parents 6285080 + ba1c0b9 commit a4ee862
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

* Added `xrrGetMonitors` and `XRRMonitorInfo` (#42)

* Added `setClassHint` (#76)

## 1.9.2 (2020-08-25)

* Make sure that X11 search paths determined by autoconf are actually passed
Expand Down
12 changes: 12 additions & 0 deletions Graphics/X11/Xlib/Extras.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,18 @@ getClassHint d w = allocaBytes (#{size XClassHint}) $ \ p -> do
foreign import ccall unsafe "XlibExtras.h XGetClassHint"
xGetClassHint :: Display -> Window -> Ptr ClassHint -> IO Status

-- | Set the @WM_CLASS@ property for the given window.
setClassHint :: Display -> Window -> ClassHint -> IO ()
setClassHint dpy win (ClassHint name cl) =
allocaBytes (#{size XClassHint}) $ \ptr -> do
withCString name $ \c_name -> withCString cl $ \c_cl -> do
#{poke XClassHint, res_name } ptr c_name
#{poke XClassHint, res_class} ptr c_cl
xSetClassHint dpy win ptr

foreign import ccall unsafe "XlibExtras.h XSetClassHint"
xSetClassHint :: Display -> Window -> Ptr ClassHint -> IO ()

------------------------------------------------------------------------
-- WM Hints

Expand Down

0 comments on commit a4ee862

Please sign in to comment.