Avoiding grabs whilst debugging




Hi all,

I've introduced a --no-grab runtime option for gdk (similar to --sync,
etc) which asks gdk to ignore gdk_pointer_grab. This is so that you
can use gdb and not have your display freeze up if you hit a
breakpoint or whatever whilst the pointer is grabbed by your program.

I've included my diffs (first time I've done this, I hope the format
is ok) if anyone else would find this useful.

Rupert.
(ps how can you tell diff not to bother checking if non-text files
differ?)
___________________________________________________________________
Rupert Littlewood                      "When I grow up, I'm going to 
rupert@maths.usyd.edu.au              Bovine University" -- R.Wiggum
http://www.maths.usyd.edu.au:8000/u/rupert/



diff -u gtk+-0.99.4/gdk/gdk.c gtk+-0.99.4a/gdk/gdk.c
--- gtk+-0.99.4/gdk/gdk.c       Wed Mar  4 09:52:30 1998
+++ gtk+-0.99.4a/gdk/gdk.c      Wed Mar  4 10:36:35 1998
@@ -361,6 +361,11 @@
              (*argv)[i] = NULL;
              synchronize = TRUE;
            }
+         else if (strcmp ("--no-grab", (*argv)[i]) == 0)
+           {
+             (*argv)[i] = NULL;
+             gdk_no_grab = TRUE;
+           }   
          else if (strcmp ("--no-xshm", (*argv)[i]) == 0)
            {
              (*argv)[i] = NULL;
@@ -1255,6 +1260,9 @@
   int i;
 
   g_return_val_if_fail (window != NULL, 0);
+  
+  if (gdk_no_grab)
+    return Success ;
 
   window_private = (GdkWindowPrivate*) window;
   confine_to_private = (GdkWindowPrivate*) confine_to;


diff -u gtk+-0.99.4/gdk/gdkprivate.h gtk+-0.99.4a/gdk/gdkprivate.h
--- gtk+-0.99.4/gdk/gdkprivate.h        Wed Mar  4 09:52:33 1998
+++ gtk+-0.99.4a/gdk/gdkprivate.h       Wed Mar  4 10:40:27 1998
@@ -232,6 +232,7 @@
 extern gint             gdk_debug_level;
 extern gint             gdk_show_events;
 extern gint             gdk_use_xshm;
+extern gint             gdk_no_grab;
 extern gint             gdk_stack_trace;
 extern gchar           *gdk_display_name;
 extern Display         *gdk_display;

diff -u gtk+-0.99.4/gdk/gdkglobals.c gtk+-0.99.4a/gdk/gdkglobals.c
--- gtk+-0.99.4/gdk/gdkglobals.c        Wed Mar  4 09:52:30 1998
+++ gtk+-0.99.4a/gdk/gdkglobals.c       Wed Mar  4 10:36:48 1998
@@ -22,6 +22,7 @@
 
 guint             gdk_debug_flags = 0;
 gint              gdk_use_xshm = TRUE;
+gint              gdk_no_grab = FALSE;
 gchar            *gdk_display_name = NULL;
 Display          *gdk_display = NULL;
 gint              gdk_screen;

-- 
___________________________________________________________________
Rupert Littlewood                      "When I grow up, I'm going to 
rupert@maths.usyd.edu.au              Bovine University" -- R.Wiggum
http://www.maths.usyd.edu.au:8000/u/rupert/



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