Python Xlib.X.ButtonRelease() Examples
The following are 30
code examples of Xlib.X.ButtonRelease().
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 makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse " + str(event.detail) + " " if event.type == X.ButtonPress: MessageName = MessageName + "down" elif event.type == X.ButtonRelease: MessageName = MessageName + "up" return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
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: pyxhook.py From Tickeys-linux with MIT License | 6 votes |
def makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse " + str(event.detail) + " " if event.type == X.ButtonPress: MessageName = MessageName + "down" elif event.type == X.ButtonRelease: MessageName = MessageName + "up" else: MessageName = "mouse moved" return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
Example #4
Source File: pyxhook.py From PythonP2PBotnet with MIT License | 6 votes |
def makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse " + str(event.detail) + " " if event.type == X.ButtonPress: MessageName = MessageName + "down" elif event.type == X.ButtonRelease: MessageName = MessageName + "up" return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
Example #5
Source File: childwin.py From python-xlib with GNU Lesser General Public License v2.1 | 6 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) # Button released, add or subtract elif e.type == X.ButtonRelease: if e.detail == 1: print("Moving child window.") self.childWindow.configure( x=e.event_x - self.childWidth // 2, y=e.event_y - self.childHeight // 2 ) self.d.flush() # Somebody wants to tell us something elif 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)
Example #6
Source File: pyxhook.py From py-keylogger with MIT License | 6 votes |
def makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse " + str(event.detail) + " " if event.type == X.ButtonPress: MessageName = MessageName + "down" elif event.type == X.ButtonRelease: MessageName = MessageName + "up" return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
Example #7
Source File: pyxhook.py From botnet-lab with MIT License | 6 votes |
def makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse " + str(event.detail) + " " if event.type == X.ButtonPress: MessageName = MessageName + "down" elif event.type == X.ButtonRelease: MessageName = MessageName + "up" return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
Example #8
Source File: interface.py From autokey with GNU General Public License v3.0 | 6 votes |
def __sendMouseClick(self, xCoord, yCoord, button, relative): # Get current pointer position so we can return it there pos = self.rootWindow.query_pointer() if relative: focus = self.localDisplay.get_input_focus().focus focus.warp_pointer(xCoord, yCoord) xtest.fake_input(focus, X.ButtonPress, button, x=xCoord, y=yCoord) xtest.fake_input(focus, X.ButtonRelease, button, x=xCoord, y=yCoord) else: self.rootWindow.warp_pointer(xCoord, yCoord) xtest.fake_input(self.rootWindow, X.ButtonPress, button, x=xCoord, y=yCoord) xtest.fake_input(self.rootWindow, X.ButtonRelease, button, x=xCoord, y=yCoord) self.rootWindow.warp_pointer(pos.root_x, pos.root_y) self.__flush()
Example #9
Source File: interface.py From autokey with GNU General Public License v3.0 | 5 votes |
def __sendMouseClickRelative(self, xoff, yoff, button): # Get current pointer position pos = self.rootWindow.query_pointer() xCoord = pos.root_x + xoff yCoord = pos.root_y + yoff self.rootWindow.warp_pointer(xCoord, yCoord) xtest.fake_input(self.rootWindow, X.ButtonPress, button, x=xCoord, y=yCoord) xtest.fake_input(self.rootWindow, X.ButtonRelease, button, x=xCoord, y=yCoord) self.rootWindow.warp_pointer(pos.root_x, pos.root_y) self.__flush()
Example #10
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 #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: interface.py From autokey with GNU General Public License v3.0 | 5 votes |
def _paste_using_mouse_button_2(self): """Paste using the mouse: Press the second mouse button, then release it again.""" focus = self.localDisplay.get_input_focus().focus xtest.fake_input(focus, X.ButtonPress, X.Button2) xtest.fake_input(focus, X.ButtonRelease, X.Button2) logger.debug("Mouse Button2 event sent.")
Example #13
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 #14
Source File: pyxhook.py From MouseTracks with GNU General Public License v3.0 | 5 votes |
def makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse {} ".format(event.detail) if event.type == X.ButtonPress: MessageName = "{} down".format(MessageName) elif event.type == X.ButtonRelease: MessageName = "{} up".format(MessageName) else: MessageName = "mouse moved" return pyxhookmouseevent( storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName )
Example #15
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 #16
Source File: _pyautogui_x11.py From xbmc with GNU General Public License v3.0 | 5 votes |
def _mouseUp(x, y, button): _moveTo(x, y) assert button in BUTTON_NAME_MAPPING.keys(), "button argument not in ('left', 'middle', 'right', 4, 5, 6, 7)" button = BUTTON_NAME_MAPPING[button] fake_input(_display, X.ButtonRelease, button) _display.sync()
Example #17
Source File: xmouse.py From iris with Mozilla Public License 2.0 | 5 votes |
def _mouseUp(self, location: Location, button: str): """ Mouse button Up :param location :x,y coordinates where to click :param button 'left','middle','right' """ self.moveTo(location) assert ( button in self.MOUSE_BUTTONS.keys() ), "button argument not in ('left', 'middle', 'right', 4, 5, 6, 7)" button = self.MOUSE_BUTTONS[button] fake_input(self.display, X.ButtonRelease, button) self.display.sync()
Example #18
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 #19
Source File: shapewin.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) # Button released, add or subtract elif e.type == X.ButtonRelease: if e.detail == 1: self.window.shape_mask(shape.SO.Union, shape.SK.Bounding, e.event_x - self.add_size // 2, e.event_y - self.add_size // 2, self.add_pm) elif e.detail == 3: self.window.shape_mask(shape.SO.Subtract, shape.SK.Bounding, e.event_x - self.sub_size // 2, e.event_y - self.sub_size // 2, self.sub_pm) # Shape has changed elif e.type == self.d.extension_event.ShapeNotify: print('Shape change') # Somebody wants to tell us something elif 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)
Example #20
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 #21
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 #22
Source File: _pyautogui_x11.py From Dindo-Bot with MIT License | 5 votes |
def _getMouseEvent(): screen = _display.screen() window = screen.root window.grab_pointer(1, X.PointerMotionMask|X.ButtonReleaseMask|X.ButtonPressMask, X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE, X.CurrentTime) e = _display.next_event() _display.ungrab_pointer(X.CurrentTime) if e.type == X.ButtonPress: e = MOUSE_EVENT[e.detail] + '_down' elif e.type == X.ButtonRelease: e = MOUSE_EVENT[e.detail] + '_up' else: e = 'moving' return e
Example #23
Source File: _pyautogui_x11.py From Dindo-Bot with MIT License | 5 votes |
def _mouseUp(x, y, button): _moveTo(x, y) assert button in BUTTON_NAME_MAPPING.keys(), "button argument not in ('left', 'middle', 'right', 4, 5, 6, 7)" button = BUTTON_NAME_MAPPING[button] fake_input(_display, X.ButtonRelease, button) _display.sync()
Example #24
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 #25
Source File: recipe-578082.py From code with MIT License | 5 votes |
def mouse_click_up(button): Xlib.ext.xtest.fake_input(d,X.ButtonRelease, button) d.sync()
Example #26
Source File: recipe-578104.py From code with MIT License | 5 votes |
def click_up(button): #Simulates a up click. Button is an int Xlib.ext.xtest.fake_input(d,X.ButtonRelease, button) d.sync()
Example #27
Source File: pyxhook.py From clix with MIT License | 5 votes |
def makemousehookevent(self, event): storewm = self.xwindowinfo() if event.detail == 1: MessageName = "mouse left " elif event.detail == 3: MessageName = "mouse right " elif event.detail == 2: MessageName = "mouse middle " elif event.detail == 5: MessageName = "mouse wheel down " elif event.detail == 4: MessageName = "mouse wheel up " else: MessageName = "mouse {} ".format(event.detail) if event.type == X.ButtonPress: MessageName = "{} down".format(MessageName) elif event.type == X.ButtonRelease: MessageName = "{} up".format(MessageName) else: MessageName = "mouse moved" return pyxhookmouseevent( storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName )
Example #28
Source File: _pyautogui_x11.py From pyautogui with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _mouseUp(x, y, button): _moveTo(x, y) assert button in BUTTON_NAME_MAPPING.keys(), "button argument not in ('left', 'middle', 'right', 4, 5, 6, 7)" button = BUTTON_NAME_MAPPING[button] fake_input(_display, X.ButtonRelease, button) _display.sync()
Example #29
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 #30
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)