]> git.sur5r.net Git - glabels/commitdiff
2007-04-25 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Wed, 25 Apr 2007 22:59:05 +0000 (22:59 +0000)
committerJim Evins <evins@snaught.com>
Wed, 25 Apr 2007 22:59:05 +0000 (22:59 +0000)
* src/view.h:
* src/view.c: (gl_view_update), (expose_cb),
(motion_notify_event_cb), (button_press_event_cb),
(button_release_event_cb):
- Try not to let updates get backed up.
- Grab pointer when doing any drag operations.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@652 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/src/view.c
glabels2/src/view.h

index c3fab5cd7c7f3e04fcd50c4f8f64549ab4fe3f85..b2747c50a0bac64051d4b6e3b92a37fad2e15d59 100644 (file)
@@ -1,3 +1,12 @@
+2007-04-25  Jim Evins  <evins@snaught.com>
+
+       * src/view.h:
+       * src/view.c: (gl_view_update), (expose_cb),
+       (motion_notify_event_cb), (button_press_event_cb),
+       (button_release_event_cb):
+               - Try not to let updates get backed up.
+               - Grab pointer when doing any drag operations.
+
 2007-04-11  Jim Evins  <evins@snaught.com>
 
        * src/cairo-label-path.c: (gl_cairo_label_path),
index 9cc6243c53d4cce34f27140969db20ede07ef693..79e768f556a7ff08e0fc45be51854637cfbea3c1 100644 (file)
@@ -553,11 +553,15 @@ gl_view_update (glView  *view)
 
        if (!widget->window) return;
 
-       region = gdk_drawable_get_clip_region (widget->window);
-       /* redraw the cairo canvas completely by exposing it */
-       gdk_window_invalidate_region (widget->window, region, TRUE);
+        if ( !view->update_scheduled_flag )
+        {
+                view->update_scheduled_flag = TRUE;
 
-       gdk_region_destroy (region);
+                region = gdk_drawable_get_clip_region (widget->window);
+                /* redraw the cairo canvas completely by exposing it */
+                gdk_window_invalidate_region (widget->window, region, TRUE);
+                gdk_region_destroy (region);
+        }
 
        gl_debug (DEBUG_VIEW, "END");
 }
@@ -573,6 +577,8 @@ expose_cb (glView         *view,
 
        gl_debug (DEBUG_VIEW, "START");
 
+        view->update_scheduled_flag = FALSE;
+
        /* get a cairo_t */
        cr = gdk_cairo_create (GTK_LAYOUT (view->canvas)->bin_window);
 
@@ -3213,6 +3219,21 @@ motion_notify_event_cb (glView            *view,
 
        cairo_destroy (cr);
 
+        /*
+         * FIXME: we re-establish grabs here if the grab has been lost.  We seem to be
+         *        losing grabs when we emit signals that lead to the manipulation of
+         *        the GtkUIManager.  Needs more investigation
+         */
+        if (view->grabbed_flag && !gdk_pointer_is_grabbed ())
+        {
+                gdk_pointer_grab (GTK_LAYOUT (view->canvas)->bin_window,
+                                  FALSE,
+                                  (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK),
+                                  NULL,
+                                  NULL,
+                                  event->time);
+        }
+
         return return_value;
 }
 
@@ -3341,6 +3362,14 @@ button_press_event_cb (glView            *view,
                 default:
                         g_message ("Invalid view mode.");      /*Should not happen!*/
                 }
+
+                view->grabbed_flag = TRUE;
+                gdk_pointer_grab (GTK_LAYOUT (view->canvas)->bin_window,
+                                  FALSE,
+                                  (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK),
+                                  NULL,
+                                  NULL,
+                                  event->time);
                 break;
 
         case 3:
@@ -3387,6 +3416,8 @@ button_release_event_cb (glView            *view,
         {
 
         case 1:
+                view->grabbed_flag = FALSE;
+                gdk_pointer_ungrab (event->time);
                 /*
                  * Handle event as appropriate for mode
                  */
index 6d927aac39db2e5652e42ccb110cb7b4aaa65b39..67a344c899f4100e501846f5de6ab2727886959f 100644 (file)
@@ -66,6 +66,7 @@ struct _glView {
         gdouble            x0, y0;
         gdouble            w, h;
 
+        gboolean           update_scheduled_flag;
         gboolean           grid_visible;
        gdouble            grid_spacing;
 
@@ -74,6 +75,7 @@ struct _glView {
        glViewMode         mode;
        glLabelObjectType  create_type;
         glViewState        state;
+        gboolean           grabbed_flag;
 
         /* GL_VIEW_ARROW_MOVE state */
         gdouble            move_last_x;