mousetweaks r261 - in trunk: . src



Author: gerdk
Date: Thu Aug 28 17:46:30 2008
New Revision: 261
URL: http://svn.gnome.org/viewvc/mousetweaks?rev=261&view=rev

Log:
2008-08-28  Gerd Kohlberger  <gerdk svn gnome org>

	* src/mt-main.c: Fix regression with drag clicks.



Modified:
   trunk/ChangeLog
   trunk/src/mt-main.c

Modified: trunk/src/mt-main.c
==============================================================================
--- trunk/src/mt-main.c	(original)
+++ trunk/src/mt-main.c	Thu Aug 28 17:46:30 2008
@@ -133,12 +133,15 @@
 }
 
 static void
-dwell_do_pointer_click (MTClosure *mt, gint x, gint y)
+mt_main_do_dwell_click (MTClosure *mt)
 {
     guint clicktype;
 
     clicktype = mt_service_get_clicktype (mt->service);
-    mt_main_generate_motion_event (mt_main_current_screen (mt), x, y);
+
+    if (mt->dwell_mode == DWELL_MODE_GESTURE)
+	mt_main_generate_motion_event (mt_main_current_screen (mt),
+				       mt->pointer_x, mt->pointer_y);
 
     switch (clicktype) {
 	case DWELL_CLICK_TYPE_SINGLE:
@@ -183,16 +186,20 @@
 }
 
 static gboolean
-analyze_direction (MTClosure *mt, gint x, gint y)
+mt_main_analyze_gesture (MTClosure *mt)
 {
-    gint gd, i, dx, dy;
+    gint x, y, gd, i, dx, dy;
 
-    dx = ABS (x - mt->pointer_x);
-    dy = ABS (y - mt->pointer_y);
+    if (mt_service_get_clicktype (mt->service) == DWELL_CLICK_TYPE_DRAG)
+	return TRUE;
 
+    gdk_display_get_pointer (gdk_display_get_default (), NULL, &x, &y, NULL);
     if (below_threshold (mt, x, y))
 	return FALSE;
 
+    dx = ABS (x - mt->pointer_x);
+    dy = ABS (y - mt->pointer_y);
+
     /* find direction */
     if (x < mt->pointer_x)
 	if (y < mt->pointer_y)
@@ -218,12 +225,12 @@
 		gd = DIRECTION_RIGHT;
 
     /* get click type for direction */
-    for (i = 0; i < N_CLICK_TYPES; i++)
+    for (i = 0; i < N_CLICK_TYPES; i++) {
 	if (mt->dwell_dirs[i] == gd) {
 	    mt_service_set_clicktype (mt->service, i, NULL);
 	    return TRUE;
 	}
-
+    }
     return FALSE;
 }
 
@@ -255,8 +262,10 @@
     if (mt->override_cursor) {
 	cursor = gdk_cursor_new (GDK_CROSS);
 	root = gdk_screen_get_root_window (mt_main_current_screen (mt));
-	gdk_pointer_grab (root, FALSE, GDK_POINTER_MOTION_MASK, 
-			  NULL, cursor, GDK_CURRENT_TIME);
+	gdk_pointer_grab (root, FALSE,
+			  GDK_POINTER_MOTION_MASK, 
+			  NULL, cursor,
+			  gtk_get_current_event_time ());
 	gdk_cursor_unref (cursor);
     }
     else {
@@ -271,7 +280,7 @@
 dwell_stop_gesture (MTClosure *mt)
 {
     if (mt->override_cursor)
-	gdk_pointer_ungrab (GDK_CURRENT_TIME);
+	gdk_pointer_ungrab (gtk_get_current_event_time ());
     else
 	mt_main_set_cursor (mt, GDK_LEFT_PTR);
 
@@ -291,19 +300,18 @@
 dwell_timer_finished (MtTimer *timer, gpointer data)
 {
     MTClosure *mt = data;
-    gint x, y;
 
-    gdk_display_get_pointer (gdk_display_get_default (), NULL, &x, &y, NULL);
     mt_cursor_manager_restore_all (mt_cursor_manager_get_default ());
 
     if (mt->dwell_mode == DWELL_MODE_CTW) {
-	dwell_do_pointer_click (mt, x, y);
+	mt_main_do_dwell_click (mt);
     }
     else {
 	if (mt->dwell_gesture_started) {
 	    dwell_stop_gesture (mt);
-	    if (analyze_direction (mt, x, y))
-		dwell_do_pointer_click (mt, mt->pointer_x, mt->pointer_y);
+
+	    if (mt_main_analyze_gesture (mt))
+		mt_main_do_dwell_click (mt);
 	}
 	else
 	    dwell_start_gesture (mt);



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