changeset 4399:ce8d35b435de

[gaim-migrate @ 4668] Fixes the problem where doing a gesture and then clicking the right mouse button causes it to stay in gesture mode forever. It's hacky, though.. hope it doesn't cause other issues. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 23 Jan 2003 00:19:57 +0000
parents a8249a5250b6
children 6c38239ff612
files plugins/gestures/stroke-draw.c
diffstat 1 files changed, 26 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/gestures/stroke-draw.c	Wed Jan 22 23:46:59 2003 +0000
+++ b/plugins/gestures/stroke-draw.c	Thu Jan 23 00:19:57 2003 +0000
@@ -107,6 +107,7 @@
   static GtkWidget *original_widget = NULL;
   switch (event->type) {
     case GDK_BUTTON_PRESS:
+		debug_printf("Button press: %d\n", event->button.button);
       if (event->button.button != gstroke_get_mouse_button())
 	break;
 
@@ -126,9 +127,28 @@
 
     case GDK_BUTTON_RELEASE:
       if ((event->button.button != gstroke_get_mouse_button())
-	  || (original_widget == NULL))
-        /* the stroke probably did not start here... */
-	break;
+	  || (original_widget == NULL)) {
+
+		  /* Nice bug when you hold down one button and press another. */
+		  /* We'll just cancel the gesture instead. */
+		  last_mouse_position.invalid = TRUE;
+		  original_widget = NULL;
+
+		  if (timer_id > 0)
+			  gtk_timeout_remove (timer_id);
+
+		  gdk_pointer_ungrab (event->button.time);
+		  timer_id = 0;
+
+		  if (gstroke_draw_strokes()) {
+			  /* get rid of the invisible stroke window */
+			  XUnmapWindow (gstroke_disp, gstroke_window);
+			  XFlush (gstroke_disp);
+		  }
+
+		  break;
+	  
+	  }
 
       last_mouse_position.invalid = TRUE;
       original_widget = NULL;
@@ -314,11 +334,11 @@
   col_background = WhitePixel (gstroke_disp, screen);
 
   /* no border for the window */
-#ifdef DEBUG
+#if 0
   border_width = 5;
-#else
+#endif
   border_width = 0;
-#endif
+
   col_border = BlackPixel (gstroke_disp, screen);
 
   gstroke_window = XCreateSimpleWindow (gstroke_disp, wind,