[mousetrap/gnome3-wip] BUG 710802 - This is a partial fix to Bug 710802 - Implement Cursor Movement. New warp functions hav



commit 466472819c6f995ca7005a5bffa82af4d688b2b7
Author: Logan Hotchkiss <lhotchkiss17 gmail com>
Date:   Wed Dec 4 23:31:06 2013 -0500

    BUG 710802 - This is a partial fix to Bug 710802 - Implement Cursor Movement. New warp functions have 
replaced depricated GDK functions for moving the cursor. Depricated code still exists in click function.

 src/mousetrap/app/lib/mouse.py |   38 +++++++-------------------------------
 1 files changed, 7 insertions(+), 31 deletions(-)
---
diff --git a/src/mousetrap/app/lib/mouse.py b/src/mousetrap/app/lib/mouse.py
index 4e02bc8..a8992d5 100644
--- a/src/mousetrap/app/lib/mouse.py
+++ b/src/mousetrap/app/lib/mouse.py
@@ -45,6 +45,11 @@ clickType = { 'p' : [ X.ButtonPress ],
               'd' : [ X.ButtonPress, X.ButtonRelease,
                       X.ButtonPress, X.ButtonRelease ] }
 
+# Gets GDK Screen and Pointer - LMH 11/13/13
+gdkDisplay = Gdk.Display.get_default()
+manager = gdkDisplay.get_device_manager()
+pointer = manager.get_client_pointer()
+screen = gdkDisplay.get_default_screen()
 
 ## GTK Display for any user
 #FIXME: Swap these
@@ -72,7 +77,7 @@ def position( *arg ):
 
     Returns A list with the X and Y coordinates.
     """
-    return list(gtkDisplay.get_pointer()[1:3])
+    return list(pointer.get_position()[1:3])
 
 def click( x = None, y = None, button = "bc1" ):
     """
@@ -151,7 +156,7 @@ def move( x=0, y=0, point=None ):
 
         if isGnome:
             try:
-                reg.generateMouseEvent( x, y, 'abs' )
+                pointer.warp(screen,x,y)
             except:
                 isGnome = False
         else:
@@ -160,32 +165,3 @@ def move( x=0, y=0, point=None ):
             xDisplay.flush()
 
     return True
-
-###########################################
-#               DEPRECATED
-# Dictionary Dispatcher
-# dsp = { "move"      : move,
-#         "click"     : click,
-#         "position"  : position }
-#
-# def handler( func ):
-#     """
-#     Mouse functions decorator.
-#
-#     Arguments:
-#     - func: The function called to access the decorator.
-#
-#     Return The wrapper
-#     """
-#
-#     def wrapper( *arg, **kw ):
-#         """
-#         Wrapper function.
-#
-#         This functions will execute the required function passing the arguments to it.
-#
-#         Return the function executed
-#         """
-#         return dsp[arg[0]]( *arg[1:], **kw )
-#
-#     return wrapper


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]