Skip to content

Commit

Permalink
Merge pull request kmonad#723 from rvl/master
Browse files Browse the repository at this point in the history
Fix build with GHC 9.6
  • Loading branch information
slotThe committed Jul 26, 2023
2 parents 41a41c8 + 3851f2b commit 5bdd05a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/KMonad/Keyboard/IO/Linux/DeviceSource.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ lsOpen :: (HasLogFunc e)
-> FilePath -- ^ The path to the device file
-> RIO e DeviceFile
lsOpen pr pt = do
#if MIN_VERSION_unix(2,8,0)
h <- liftIO . openFd pt ReadOnly $
#else
h <- liftIO . openFd pt ReadOnly Nothing $
h <- liftIO $ openFd pt
ReadOnly
#if !MIN_VERSION_unix(2,8,0)
Nothing
#endif
OpenFileFlags False False False False False
defaultFileFlags
hd <- liftIO $ fdToHandle h
logInfo "Initiating ioctl grab"
ioctl_keyboard h True `onErr` IOCtlGrabError pt
Expand Down
9 changes: 7 additions & 2 deletions src/KMonad/Keyboard/IO/Linux/UinputSink.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE CPP #-}
{-|
Module : KMonad.Keyboard.IO.Linux.UinputSink
Description : Using Linux's uinput interface to emit events
Expand Down Expand Up @@ -141,8 +142,12 @@ send_event u (Fd h) e@(LinuxKeyEvent (s', ns', typ, c, val)) = do
usOpen :: HasLogFunc e => UinputCfg -> RIO e UinputSink
usOpen c = do
when (null $ c ^. keyboardName) $ throwM EmptyNameError
fd <- liftIO . openFd "/dev/uinput" WriteOnly Nothing $
OpenFileFlags False False False True False
fd <- liftIO $ openFd "/dev/uinput"
WriteOnly
#if !MIN_VERSION_unix(2,8,0)
Nothing
#endif
defaultFileFlags
logInfo "Registering Uinput device"
acquire_uinput_keysink fd c `onErr` UinputRegistrationError (c ^. keyboardName)
flip (maybe $ pure ()) (c^.postInit) $ \cmd -> do
Expand Down

0 comments on commit 5bdd05a

Please sign in to comment.