Python Xlib.X.MotionNotify() Examples
The following are 30
code examples of Xlib.X.MotionNotify().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Xlib.X
, or try the search function
.
Example #1
Source File: pyxhook.py From Python-Programs with GNU General Public License v3.0 | 6 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift":False, "caps":False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile('^[a-z0-9]$|^minus$|^equal$|^bracketleft$|^bracketright$|^semicolon$|^backslash$|^apostrophe$|^comma$|^period$|^slash$|^grave$') self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.contextEventMask = [X.KeyPress,X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #2
Source File: event.py From deepin-remote-assistance with GNU General Public License v3.0 | 6 votes |
def handle_event(self, event): # KeyPress event if event.type == X.KeyPress: keyname = xrobot.get_keyname(event) self.keyPressed.emit(keyname) # KeyRelease event elif event.type == X.KeyRelease: keyname = xrobot.get_keyname(event) self.keyReleased.emit(keyname) # ButtonPress event elif event.type == X.ButtonPress: self.buttonPressed.emit(event.root_x, event.root_y, event.time) # ButtonRelease event elif event.type == X.ButtonRelease: self.buttonReleased.emit(event.root_x, event.root_y, event.time) # MotionNotify event elif event.type == X.MotionNotify: self.cursorPositionChanged.emit(event.root_x, event.root_y)
Example #3
Source File: mouse.py From deepin-remote-assistance with GNU General Public License v3.0 | 5 votes |
def handle_mouse_event(event): '''Listening mouse event and send it to browser''' try: if not client_dbus or not client_dbus.remoting_connected: return if not client_dbus.main_window.root.getCaptureCursor(): return offsetX = client_dbus.main_window.root.getCursorX() offsetY = client_dbus.main_window.root.getCursorY() width = int(client_dbus.main_window.root.getVideoWidth()) height = int(client_dbus.main_window.root.getVideoHeight()) except AttributeError as e: print(e) return msg = { 'type': event.type, 'x': offsetX, 'y': offsetY, 'w': width, 'h': height, } if event.type == X.ButtonPress or event.type == X.ButtonRelease: msg['button'] = button_ids[event.detail] elif event.type != X.MotionNotify: # Ignore KeyPress/KeyRelease event return send_message(json.dumps(msg))
Example #4
Source File: xmouse.py From iris with Mozilla Public License 2.0 | 5 votes |
def moveTo(self, location: Location): """ Mouse move to specific Location :param location :x,y coordinates where to click """ fake_input(self.display, X.MotionNotify, x=location.x, y=location.y) self.display.sync()
Example #5
Source File: _pyautogui_x11.py From xbmc with GNU General Public License v3.0 | 5 votes |
def _moveTo(x, y): fake_input(_display, X.MotionNotify, x=x, y=y) _display.sync()
Example #6
Source File: pyxhook.py From PythonP2PBotnet with MIT License | 5 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print "* received swapped protocol data, cowardly ignored" return if not len(reply.data) or ord(reply.data[0]) < 2: # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and release events # do not give mouse position info (event.root_x and event.root_y have # bogus info). self.mousemoveevent(event) #print "processing events...", event.type
Example #7
Source File: pyxhook.py From PythonP2PBotnet with MIT License | 5 votes |
def HookMouse(self): pass # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress events # don't carry that info. #self.contextEventMask[1] = X.MotionNotify
Example #8
Source File: pyxhook.py From PythonP2PBotnet with MIT License | 5 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift":False, "caps":False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile('^[a-z0-9]$|^minus$|^equal$|^bracketleft$|^bracketright$|^semicolon$|^backslash$|^apostrophe$|^comma$|^period$|^slash$|^grave$') self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.contextEventMask = [X.KeyPress,X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #9
Source File: pyxhook.py From MouseTracks with GNU General Public License v3.0 | 5 votes |
def HookMouse(self): # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress # events don't carry that info. # self.contextEventMask[1] = X.MotionNotify pass
Example #10
Source File: pyxhook.py From MouseTracks with GNU General Public License v3.0 | 5 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift": False, "caps": False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile('|'.join(( '^[a-z0-9]$', '^minus$', '^equal$', '^bracketleft$', '^bracketright$', '^semicolon$', '^backslash$', '^apostrophe$', '^comma$', '^period$', '^slash$', '^grave$' ))) self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.MouseMovement = lambda x: True self.contextEventMask = [X.KeyPress, X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #11
Source File: record_demo.py From python-xlib with GNU Lesser General Public License v2.1 | 5 votes |
def record_callback(reply): if reply.category != record.FromServer: return if reply.client_swapped: print("* received swapped protocol data, cowardly ignored") return if not len(reply.data) or reply.data[0] < 2: # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value(data, record_dpy.display, None, None) if event.type in [X.KeyPress, X.KeyRelease]: pr = event.type == X.KeyPress and "Press" or "Release" keysym = local_dpy.keycode_to_keysym(event.detail, 0) if not keysym: print("KeyCode%s" % pr, event.detail) else: print("KeyStr%s" % pr, lookup_keysym(keysym)) if event.type == X.KeyPress and keysym == XK.XK_Escape: local_dpy.record_disable_context(ctx) local_dpy.flush() return elif event.type == X.ButtonPress: print("ButtonPress", event.detail) elif event.type == X.ButtonRelease: print("ButtonRelease", event.detail) elif event.type == X.MotionNotify: print("MotionNotify", event.root_x, event.root_y) # Check if the extension is present
Example #12
Source File: draw.py From python-xlib with GNU Lesser General Public License v2.1 | 5 votes |
def loop(self): current = None while 1: e = self.d.next_event() # Window has been destroyed, quit if e.type == X.DestroyNotify: sys.exit(0) # Some part of the window has been exposed, # redraw all the objects. if e.type == X.Expose: for o in self.objects: o.expose(e) # Left button pressed, start to draw if e.type == X.ButtonPress and e.detail == 1: current = Movement(self, e) self.objects.append(current) # Left button released, finish drawing if e.type == X.ButtonRelease and e.detail == 1 and current: current.finish(e) current = None # Mouse movement with button pressed, draw if e.type == X.MotionNotify and current: current.motion(e) if e.type == X.ClientMessage: if e.client_type == self.WM_PROTOCOLS: fmt, data = e.data if fmt == 32 and data[0] == self.WM_DELETE_WINDOW: sys.exit(0) # A drawed objects, consisting of either a single # rhomboid, or two rhomboids connected by a winding line
Example #13
Source File: draw-proto.py From python-xlib with GNU Lesser General Public License v2.1 | 5 votes |
def loop(self): current = None while 1: e = self.d.next_event() # Window has been destroyed, quit if e.type == X.DestroyNotify: sys.exit(0) # Some part of the window has been exposed, # redraw all the objects. if e.type == X.Expose: for o in self.objects: o.expose(e) # Left button pressed, start to draw if e.type == X.ButtonPress and e.detail == 1: current = Movement(self, e) self.objects.append(current) # Left button released, finish drawing if e.type == X.ButtonRelease and e.detail == 1 and current: current.finish(e) current = None # Mouse movement with button pressed, draw if e.type == X.MotionNotify and current: current.motion(e) # A drawed objects, consisting of either a single # rhomboid, or two rhomboids connected by a winding line
Example #14
Source File: pyxhook.py From Tickeys-linux with MIT License | 5 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print("* received swapped protocol data, cowardly ignored") return if not len(reply.data) or ord(reply.data[0]) < 2: # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and release events # do not give mouse position info (event.root_x and event.root_y have # bogus info). hookevent = self.mousemoveevent(event) self.MouseMovement(hookevent) #print "processing events...", event.type
Example #15
Source File: pyxhook.py From Tickeys-linux with MIT License | 5 votes |
def HookMouse(self): pass # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress events # don't carry that info. #self.contextEventMask[1] = X.MotionNotify
Example #16
Source File: pyxhook.py From Tickeys-linux with MIT License | 5 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift":False, "caps":False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile('^[a-z0-9]$|^minus$|^equal$|^bracketleft$|^bracketright$|^semicolon$|^backslash$|^apostrophe$|^comma$|^period$|^slash$|^grave$') self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.MouseMovement = lambda x: True self.contextEventMask = [X.KeyPress,X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #17
Source File: pyxhook.py From py-keylogger with MIT License | 5 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print "* received swapped protocol data, cowardly ignored" return if not len(reply.data) or ord(reply.data[0]) < 2: # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and release events # do not give mouse position info (event.root_x and event.root_y have # bogus info). self.mousemoveevent(event) #print "processing events...", event.type
Example #18
Source File: pyxhook.py From py-keylogger with MIT License | 5 votes |
def HookMouse(self): pass # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress events # don't carry that info. #self.contextEventMask[1] = X.MotionNotify
Example #19
Source File: pyxhook.py From py-keylogger with MIT License | 5 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift":False, "caps":False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile('^[a-z0-9]$|^minus$|^equal$|^bracketleft$|^bracketright$|^semicolon$|^backslash$|^apostrophe$|^comma$|^period$|^slash$|^grave$') self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.contextEventMask = [X.KeyPress,X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #20
Source File: _pyautogui_x11.py From Dindo-Bot with MIT License | 5 votes |
def _moveTo(x, y): fake_input(_display, X.MotionNotify, x=x, y=y) _display.sync()
Example #21
Source File: pyxhook.py From botnet-lab with MIT License | 5 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print "* received swapped protocol data, cowardly ignored" return if not len(reply.data) or ord(reply.data[0]) < 2: # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and release events # do not give mouse position info (event.root_x and event.root_y have # bogus info). self.mousemoveevent(event) # print "processing events...", event.type
Example #22
Source File: pyxhook.py From botnet-lab with MIT License | 5 votes |
def HookMouse(self): pass # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress events # don't carry that info. # self.contextEventMask[1] = X.MotionNotify
Example #23
Source File: pyxhook.py From botnet-lab with MIT License | 5 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift": False, "caps": False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile( '^[a-z0-9]$|^minus$|^equal$|^bracketleft$|^bracketright$|^semicolon$|^backslash$|^apostrophe$|^comma$|^period$|^slash$|^grave$') self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.contextEventMask = [X.KeyPress, X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #24
Source File: pyxhook.py From clix with MIT License | 5 votes |
def HookMouse(self): # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress # events don't carry that info. # self.contextEventMask[1] = X.MotionNotify pass
Example #25
Source File: pyxhook.py From clix with MIT License | 5 votes |
def __init__(self): threading.Thread.__init__(self) self.finished = threading.Event() # Give these some initial values self.mouse_position_x = 0 self.mouse_position_y = 0 self.ison = {"shift": False, "caps": False} # Compile our regex statements. self.isshift = re.compile('^Shift') self.iscaps = re.compile('^Caps_Lock') self.shiftablechar = re.compile('|'.join(( '^[a-z0-9]$', '^minus$', '^equal$', '^bracketleft$', '^bracketright$', '^semicolon$', '^backslash$', '^apostrophe$', '^comma$', '^period$', '^slash$', '^grave$' ))) self.logrelease = re.compile('.*') self.isspace = re.compile('^space$') # Assign default function actions (do nothing). self.KeyDown = lambda x: True self.KeyUp = lambda x: True self.MouseAllButtonsDown = lambda x: True self.MouseAllButtonsUp = lambda x: True self.MouseMovement = lambda x: True self.contextEventMask = [X.KeyPress, X.MotionNotify] # Hook to our display. self.local_dpy = display.Display() self.record_dpy = display.Display()
Example #26
Source File: _pyautogui_x11.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _moveTo(x, y): fake_input(_display, X.MotionNotify, x=x, y=y) _display.sync()
Example #27
Source File: pyxhook.py From Python-Programs with GNU General Public License v3.0 | 5 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print ("* received swapped protocol data, cowardly ignored") return if not len(reply.data) or reply.data[0] < 2: # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and release events # do not give mouse position info (event.root_x and event.root_y have # bogus info). self.mousemoveevent(event) #print "processing events...", event.type
Example #28
Source File: pyxhook.py From Python-Programs with GNU General Public License v3.0 | 5 votes |
def HookMouse(self): pass # We don't need to do anything here anymore, since the default mask # is now set to contain X.MotionNotify # need mouse motion to track pointer position, since ButtonPress events # don't carry that info. #self.contextEventMask[1] = X.MotionNotify
Example #29
Source File: pyxhook.py From MouseTracks with GNU General Public License v3.0 | 4 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print("* received swapped protocol data, cowardly ignored") return try: # Get int value, python2. intval = ord(reply.data[0]) except TypeError: # Already bytes/ints, python3. intval = reply.data[0] if (not reply.data) or (intval < 2): # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value( data, self.record_dpy.display, None, None ) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and # release events do not give mouse position info # (event.root_x and event.root_y have bogus info). hookevent = self.mousemoveevent(event) self.MouseMovement(hookevent) # print("processing events...", event.type)
Example #30
Source File: pyxhook.py From clix with MIT License | 4 votes |
def processevents(self, reply): if reply.category != record.FromServer: return if reply.client_swapped: print("* received swapped protocol data, cowardly ignored") return try: # Get int value, python2. intval = ord(reply.data[0]) except TypeError: # Already bytes/ints, python3. intval = reply.data[0] if (not reply.data) or (intval < 2): # not an event return data = reply.data while len(data): event, data = rq.EventField(None).parse_binary_value( data, self.record_dpy.display, None, None ) if event.type == X.KeyPress: hookevent = self.keypressevent(event) self.KeyDown(hookevent) elif event.type == X.KeyRelease: hookevent = self.keyreleaseevent(event) self.KeyUp(hookevent) elif event.type == X.ButtonPress: hookevent = self.buttonpressevent(event) self.MouseAllButtonsDown(hookevent) elif event.type == X.ButtonRelease: hookevent = self.buttonreleaseevent(event) self.MouseAllButtonsUp(hookevent) elif event.type == X.MotionNotify: # use mouse moves to record mouse position, since press and # release events do not give mouse position info # (event.root_x and event.root_y have bogus info). hookevent = self.mousemoveevent(event) self.MouseMovement(hookevent) # print("processing events...", event.type)