Mercurial > pidgin
comparison plugins/gestures/stroke-draw.c @ 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 | 16540914c963 |
| children | 25c2119deab3 |
comparison
equal
deleted
inserted
replaced
| 4398:a8249a5250b6 | 4399:ce8d35b435de |
|---|---|
| 105 process_event (GtkWidget *widget, GdkEvent *event, gpointer data G_GNUC_UNUSED) | 105 process_event (GtkWidget *widget, GdkEvent *event, gpointer data G_GNUC_UNUSED) |
| 106 { | 106 { |
| 107 static GtkWidget *original_widget = NULL; | 107 static GtkWidget *original_widget = NULL; |
| 108 switch (event->type) { | 108 switch (event->type) { |
| 109 case GDK_BUTTON_PRESS: | 109 case GDK_BUTTON_PRESS: |
| 110 debug_printf("Button press: %d\n", event->button.button); | |
| 110 if (event->button.button != gstroke_get_mouse_button()) | 111 if (event->button.button != gstroke_get_mouse_button()) |
| 111 break; | 112 break; |
| 112 | 113 |
| 113 original_widget = widget; /* remeber the widget where | 114 original_widget = widget; /* remeber the widget where |
| 114 the stroke started */ | 115 the stroke started */ |
| 124 gstroke_timeout, widget); | 125 gstroke_timeout, widget); |
| 125 return TRUE; | 126 return TRUE; |
| 126 | 127 |
| 127 case GDK_BUTTON_RELEASE: | 128 case GDK_BUTTON_RELEASE: |
| 128 if ((event->button.button != gstroke_get_mouse_button()) | 129 if ((event->button.button != gstroke_get_mouse_button()) |
| 129 || (original_widget == NULL)) | 130 || (original_widget == NULL)) { |
| 130 /* the stroke probably did not start here... */ | 131 |
| 131 break; | 132 /* Nice bug when you hold down one button and press another. */ |
| 133 /* We'll just cancel the gesture instead. */ | |
| 134 last_mouse_position.invalid = TRUE; | |
| 135 original_widget = NULL; | |
| 136 | |
| 137 if (timer_id > 0) | |
| 138 gtk_timeout_remove (timer_id); | |
| 139 | |
| 140 gdk_pointer_ungrab (event->button.time); | |
| 141 timer_id = 0; | |
| 142 | |
| 143 if (gstroke_draw_strokes()) { | |
| 144 /* get rid of the invisible stroke window */ | |
| 145 XUnmapWindow (gstroke_disp, gstroke_window); | |
| 146 XFlush (gstroke_disp); | |
| 147 } | |
| 148 | |
| 149 break; | |
| 150 | |
| 151 } | |
| 132 | 152 |
| 133 last_mouse_position.invalid = TRUE; | 153 last_mouse_position.invalid = TRUE; |
| 134 original_widget = NULL; | 154 original_widget = NULL; |
| 135 gtk_timeout_remove (timer_id); | 155 gtk_timeout_remove (timer_id); |
| 136 gdk_pointer_ungrab (event->button.time); | 156 gdk_pointer_ungrab (event->button.time); |
| 312 | 332 |
| 313 /* Default input window look */ | 333 /* Default input window look */ |
| 314 col_background = WhitePixel (gstroke_disp, screen); | 334 col_background = WhitePixel (gstroke_disp, screen); |
| 315 | 335 |
| 316 /* no border for the window */ | 336 /* no border for the window */ |
| 317 #ifdef DEBUG | 337 #if 0 |
| 318 border_width = 5; | 338 border_width = 5; |
| 319 #else | 339 #endif |
| 320 border_width = 0; | 340 border_width = 0; |
| 321 #endif | 341 |
| 322 col_border = BlackPixel (gstroke_disp, screen); | 342 col_border = BlackPixel (gstroke_disp, screen); |
| 323 | 343 |
| 324 gstroke_window = XCreateSimpleWindow (gstroke_disp, wind, | 344 gstroke_window = XCreateSimpleWindow (gstroke_disp, wind, |
| 325 0, 0, | 345 0, 0, |
| 326 hints.width - 2 * border_width, | 346 hints.width - 2 * border_width, |
