mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-05 23:03:38 +00:00
fix accelerator key handling
This commit is contained in:
parent
e4779d8af2
commit
777b894c06
|
@ -674,8 +674,11 @@ instance HandleAction MouseClick where
|
||||||
DoubleClick -> do
|
DoubleClick -> do
|
||||||
tool <- STM.readTVar toolTVar
|
tool <- STM.readTVar toolTVar
|
||||||
mode <- STM.readTVar modeTVar
|
mode <- STM.readTVar modeTVar
|
||||||
|
modifs <- STM.readTVar modifiersTVar
|
||||||
case tool of
|
case tool of
|
||||||
Selection -> do
|
Selection
|
||||||
|
| null modifs
|
||||||
|
-> do
|
||||||
STM.writeTVar mouseHoldTVar Nothing
|
STM.writeTVar mouseHoldTVar Nothing
|
||||||
let
|
let
|
||||||
mbSubdivide :: Maybe Document
|
mbSubdivide :: Maybe Document
|
||||||
|
@ -951,11 +954,8 @@ instance HandleAction KeyboardPress where
|
||||||
vars@( Variables {..} )
|
vars@( Variables {..} )
|
||||||
( KeyboardPress keyCode ) = do
|
( KeyboardPress keyCode ) = do
|
||||||
|
|
||||||
modifiers <- STM.atomically do
|
|
||||||
!modifiers <- STM.readTVar modifiersTVar
|
|
||||||
for_ ( modifierKey keyCode ) \ modifier ->
|
for_ ( modifierKey keyCode ) \ modifier ->
|
||||||
( STM.writeTVar modifiersTVar ( Set.insert modifier modifiers ) )
|
STM.atomically $ STM.modifyTVar' modifiersTVar ( Set.insert modifier )
|
||||||
pure modifiers
|
|
||||||
|
|
||||||
case keyCode of
|
case keyCode of
|
||||||
|
|
||||||
|
@ -981,14 +981,6 @@ instance HandleAction KeyboardPress where
|
||||||
GTK.widgetQueueDraw viewportDrawingArea
|
GTK.widgetQueueDraw viewportDrawingArea
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
||||||
-- todo: these should be handled by accelerator,
|
|
||||||
-- but those are not working currently
|
|
||||||
GDK.KEY_Delete -> handleAction uiElts vars Delete
|
|
||||||
|
|
||||||
GDK.KEY_s
|
|
||||||
| any ( \case { Control _ -> True; _ -> False } ) modifiers
|
|
||||||
-> handleAction uiElts vars Save
|
|
||||||
|
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
@ -40,25 +40,25 @@ handleEvents :: UIElements -> Variables -> IO ()
|
||||||
handleEvents elts@( UIElements { viewport = Viewport {..}, .. } ) vars = do
|
handleEvents elts@( UIElements { viewport = Viewport {..}, .. } ) vars = do
|
||||||
|
|
||||||
-- Mouse events
|
-- Mouse events
|
||||||
onWidgetMouseEvent viewportDrawingArea ViewportOrigin
|
afterWidgetMouseEvent viewportDrawingArea ViewportOrigin
|
||||||
onWidgetMouseEvent rulerCornerDrawingArea ( RulerOrigin RulerCorner )
|
afterWidgetMouseEvent rulerCornerDrawingArea ( RulerOrigin RulerCorner )
|
||||||
onWidgetMouseEvent leftRulerDrawingArea ( RulerOrigin LeftRuler )
|
afterWidgetMouseEvent leftRulerDrawingArea ( RulerOrigin LeftRuler )
|
||||||
onWidgetMouseEvent topRulerDrawingArea ( RulerOrigin TopRuler )
|
afterWidgetMouseEvent topRulerDrawingArea ( RulerOrigin TopRuler )
|
||||||
|
|
||||||
-- Keyboard events
|
-- Keyboard events
|
||||||
void $ GTK.onWidgetKeyPressEvent window ( handleKeyboardPressEvent elts vars )
|
void $ GTK.afterWidgetKeyPressEvent window ( handleKeyboardPressEvent elts vars )
|
||||||
void $ GTK.onWidgetKeyReleaseEvent window ( handleKeyboardReleaseEvent elts vars )
|
void $ GTK.afterWidgetKeyReleaseEvent window ( handleKeyboardReleaseEvent elts vars )
|
||||||
|
|
||||||
-- Window quit
|
-- Window quit
|
||||||
void $ GTK.onWidgetDestroy window ( quitEverything window )
|
void $ GTK.onWidgetDestroy window ( quitEverything window )
|
||||||
|
|
||||||
where
|
where
|
||||||
onWidgetMouseEvent :: GTK.DrawingArea -> ActionOrigin -> IO ()
|
afterWidgetMouseEvent :: GTK.DrawingArea -> ActionOrigin -> IO ()
|
||||||
onWidgetMouseEvent drawingArea eventOrigin = do
|
afterWidgetMouseEvent drawingArea eventOrigin = do
|
||||||
void $ GTK.onWidgetMotionNotifyEvent drawingArea ( handleMotionEvent elts vars eventOrigin )
|
void $ GTK.afterWidgetMotionNotifyEvent drawingArea ( handleMotionEvent elts vars eventOrigin )
|
||||||
void $ GTK.onWidgetScrollEvent drawingArea ( handleScrollEvent elts vars eventOrigin )
|
void $ GTK.afterWidgetScrollEvent drawingArea ( handleScrollEvent elts vars eventOrigin )
|
||||||
void $ GTK.onWidgetButtonPressEvent drawingArea ( handleMouseButtonEvent elts vars eventOrigin )
|
void $ GTK.afterWidgetButtonPressEvent drawingArea ( handleMouseButtonEvent elts vars eventOrigin )
|
||||||
void $ GTK.onWidgetButtonReleaseEvent drawingArea ( handleMouseButtonRelease elts vars eventOrigin )
|
void $ GTK.afterWidgetButtonReleaseEvent drawingArea ( handleMouseButtonRelease elts vars eventOrigin )
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Mouse events.
|
-- Mouse events.
|
||||||
|
|
Loading…
Reference in a new issue