def click_button(button): xcoord, ycoord = get_mouse_position() XWINDOW.warp_pointer(xcoord - 20, ycoord) #XWINDOW.warp_pointer(xcoord, ycoord) WINDOW.set_keep_above(False) WINDOW.set_keep_below(True) ddisplay = display.Display() # press button 1, for middle mouse button use 2, for opposite button use 3 try: WINDOW.destroy() print "destroyed" except: print "not destroyed" ext.xtest.fake_input(ddisplay, X.ButtonPress, button) ddisplay.sync() # to make click we need to release the same button ext.xtest.fake_input(ddisplay, X.ButtonRelease, button) ddisplay.sync() ext.xtest.fake_input(ddisplay, X.ButtonPress, button) ddisplay.sync() ext.xtest.fake_input(ddisplay, X.ButtonRelease, button) ddisplay.sync()
def get_screen_resolution(): ddisplay = display.Display() resolution = ddisplay.screen().root.get_geometry() return resolution.width, resolution.height
def release_button(button): ddisplay = display.Display() # to make click we need to release the same button ext.xtest.fake_input(ddisplay, X.ButtonRelease, button) ddisplay.sync()
def press_button(button): ddisplay = display.Display() # press button 1, for middle mouse button use 2, for opposite button use 3 ext.xtest.fake_input(ddisplay, X.ButtonPress, button) ddisplay.sync()
def button_release(button): ddisplay = display.Display() ext.xtest.fake_input(ddisplay, X.ButtonRelease, button) ddisplay.sync()
def button_press(button): ddisplay = display.Display() ext.xtest.fake_input(ddisplay, X.ButtonPress, button) ddisplay.sync()
def get_mouse_position(): ddisplay = display.Display() data = ddisplay.screen().root.query_pointer()._data return data['root_x'], data['root_y']
def create_relative_mouse_event(deltax, deltay): ddisplay = display.Display() # move pointer to set relative location ddisplay.warp_pointer(deltax, deltay) ddisplay.sync()
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from plugins.Xevents.Xlib import X from plugins.Xevents.Xlib import display from plugins.Xevents.Xlib import ext from plugins.Xevents.Xlib.ext import record from plugins.Xevents.Xlib.ext import xtest from plugins.Xevents.Xlib.ext import shape from plugins.Xevents.Xlib.ext import xinerama import gtk DISPLAY = display.Display() SCREEN = DISPLAY.screen() XWINDOW = SCREEN.root XB, YB = False, False WINDOW = gtk.Window(gtk.WINDOW_POPUP) WINDOW.set_keep_above(True) WINDOW.set_opacity(1) COLOR = gtk.gdk.color_parse("#234fdb") WINDOW.modify_bg(gtk.STATE_NORMAL, COLOR) WINDOW.set_decorated(False) WINDOW.add_events(gtk.gdk.KEY_PRESS_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.SCROLL_MASK) def get_screen_resolution(): ddisplay = display.Display()