aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2026-01-05 14:26:32 -0700
committerJosh Rahm <rahm@google.com>2026-01-05 14:26:32 -0700
commit12f8ef6dbf8618aaa304d239fbfd3c1b7b4494d3 (patch)
tree2339993cbbef50de134926d425d6a0203b9c858b
parent796558e57a040932e7ba9e219729267231f3139b (diff)
downloadmontis-12f8ef6dbf8618aaa304d239fbfd3c1b7b4494d3.tar.gz
montis-12f8ef6dbf8618aaa304d239fbfd3c1b7b4494d3.tar.bz2
montis-12f8ef6dbf8618aaa304d239fbfd3c1b7b4494d3.zip
[reog] Add separate Link.hs file.
This file is a sibling to the Config file. It just provides the cold/hot start bindings for the plugin. This keeps the Config file clean and doesn't pollute it with non-config ceremony.
-rw-r--r--plug/src/Config.hs14
-rw-r--r--plug/src/Link.hs18
2 files changed, 19 insertions, 13 deletions
diff --git a/plug/src/Config.hs b/plug/src/Config.hs
index 50133b4..8ec06dd 100644
--- a/plug/src/Config.hs
+++ b/plug/src/Config.hs
@@ -1,4 +1,4 @@
-module Config () where
+module Config (config) where
import Control.Monad.IO.Class (liftIO)
import Data.Bits (shiftL, (.&.))
@@ -9,18 +9,6 @@ import Montis.Standard.Drag (DragConfig (DragConfig))
import Montis.Standard.Keys (KeysConfig (KeysConfig), subkeys)
import Montis.Standard.Mouse (MouseConfig (MouseConfig))
-foreign export ccall "plugin_cold_start"
- coldStart :: MontisColdStart
-
-foreign export ccall "plugin_hot_start"
- hotStart :: MontisHotStart
-
-coldStart :: MontisColdStart
-coldStart = coldStartMontis config
-
-hotStart :: MontisHotStart
-hotStart = hotStartMontis config
-
keys :: KeyEvent -> Montis Bool
keys ev
| keyEvent_modifiers ev .&. mod1Mask == 0 = return False
diff --git a/plug/src/Link.hs b/plug/src/Link.hs
new file mode 100644
index 0000000..4ac3f5c
--- /dev/null
+++ b/plug/src/Link.hs
@@ -0,0 +1,18 @@
+-- | Module that provides the start hooks using the config required to link the
+-- plugin's shared library.
+module Link () where
+
+import Config (config)
+import Montis.Core
+
+foreign export ccall "plugin_cold_start"
+ coldStart :: MontisColdStart
+
+foreign export ccall "plugin_hot_start"
+ hotStart :: MontisHotStart
+
+coldStart :: MontisColdStart
+coldStart = coldStartMontis config
+
+hotStart :: MontisHotStart
+hotStart = hotStartMontis config