|
@@ -1,9 +1,40 @@
|
|
|
try:
|
|
|
+ import Xlib.X
|
|
|
import Xlib.protocol.event
|
|
|
except ImportError:
|
|
|
pass
|
|
|
|
|
|
|
|
|
+class SelectFogAction:
|
|
|
+
|
|
|
+ def __init__(self):
|
|
|
+ self._button = Xlib.X.Button1
|
|
|
+
|
|
|
+ def execute(self, extended_controls, xkeyevent):
|
|
|
+ engine_geometry = extended_controls._engine_window.get_geometry()
|
|
|
+ smaller_dimension = min(engine_geometry.width, engine_geometry.height)
|
|
|
+ attr = dict(
|
|
|
+ window=extended_controls.engine_window,
|
|
|
+ detail=self._button,
|
|
|
+ state=xkeyevent.state,
|
|
|
+ event_x=int(engine_geometry.width/2-smaller_dimension/2+smaller_dimension*0.619), # 908,
|
|
|
+ event_y=int(engine_geometry.height/2-smaller_dimension/2+smaller_dimension*0.453), # 1064,
|
|
|
+ # apparently root_x & root_y do not need to correspond with event_x/y.
|
|
|
+ # attributes are still required to be set.
|
|
|
+ root_x=0, # xkeyevent.root_x,
|
|
|
+ root_y=0, # xkeyevent.root_y,
|
|
|
+ child=xkeyevent.child,
|
|
|
+ root=xkeyevent.root,
|
|
|
+ time=xkeyevent.time, # X.CurrentTime
|
|
|
+ same_screen=xkeyevent.same_screen,
|
|
|
+ )
|
|
|
+ if isinstance(xkeyevent, Xlib.protocol.event.KeyPress):
|
|
|
+ e = Xlib.protocol.event.ButtonPress(**attr)
|
|
|
+ else:
|
|
|
+ e = Xlib.protocol.event.ButtonRelease(**attr)
|
|
|
+ extended_controls.engine_window.send_event(e)
|
|
|
+
|
|
|
+
|
|
|
class RewriteKeyEventAction:
|
|
|
|
|
|
def __init__(self, keysym=None):
|