summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorTim Janik <timj@src.gnome.org>1998-01-21 08:35:37 +0000
committerTim Janik <timj@src.gnome.org>1998-01-21 08:35:37 +0000
commit5e517e426c744d2dff04a3eeaf5fa55df8bad3a1 (patch)
tree2be6ba4c21bcf6fea072dcff8fce04d4a68860c3 /gdk
parent325dc92ad470909fba60584f844498bcb40dd9ae (diff)
downloadgtk+-5e517e426c744d2dff04a3eeaf5fa55df8bad3a1.tar.gz
new function gdk_pointer_is_grabbed(). extremely simple ;)
-timj
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdk.c32
-rw-r--r--gdk/gdk.h2
-rw-r--r--gdk/x11/gdkmain-x11.c32
3 files changed, 62 insertions, 4 deletions
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 6ab60dc600..5e1351ebf1 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -204,6 +204,9 @@ static GdkWindow *button_window[2]; /* The last 2 windows to rec
*/
static guint button_number[2]; /* The last 2 buttons to be pressed.
*/
+static gboolean pointer_is_grabbed = FALSE; /* Boolean value of wether the there is
+ * an active x pointer grab in effect
+ */
#ifdef USE_XIM
static gint xim_using; /* using XIM Protocol if TRUE */
@@ -1272,7 +1275,7 @@ gdk_pointer_grab (GdkWindow * window,
time);
else
return_val = Success;;
-
+
if (return_val == Success)
return_val = XGrabPointer (window_private->xdisplay,
xwindow,
@@ -1282,7 +1285,10 @@ gdk_pointer_grab (GdkWindow * window,
xconfine_to,
xcursor,
time);
-
+
+ if (return_val == GrabSuccess)
+ pointer_is_grabbed = TRUE;
+
return return_val;
}
@@ -1308,6 +1314,28 @@ gdk_pointer_ungrab (guint32 time)
gdk_input_vtable.ungrab_pointer (time);
XUngrabPointer (gdk_display, time);
+ pointer_is_grabbed = FALSE;
+}
+
+/*
+ *--------------------------------------------------------------
+ * gdk_pointer_is_grabbed
+ *
+ * Tell wether there is an active x pointer grab in effect
+ *
+ * Arguments:
+ *
+ * Results:
+ *
+ * Side effects:
+ *
+ *--------------------------------------------------------------
+ */
+
+gint
+gdk_pointer_is_grabbed (void)
+{
+ return pointer_is_grabbed;
}
/*
diff --git a/gdk/gdk.h b/gdk/gdk.h
index a00da138e4..88beda6238 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -81,6 +81,8 @@ gint gdk_keyboard_grab (GdkWindow * window,
guint32 time);
void gdk_keyboard_ungrab (guint32 time);
+gint gdk_pointer_is_grabbed (void);
+
gint gdk_screen_width (void);
gint gdk_screen_height (void);
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
index 6ab60dc600..5e1351ebf1 100644
--- a/gdk/x11/gdkmain-x11.c
+++ b/gdk/x11/gdkmain-x11.c
@@ -204,6 +204,9 @@ static GdkWindow *button_window[2]; /* The last 2 windows to rec
*/
static guint button_number[2]; /* The last 2 buttons to be pressed.
*/
+static gboolean pointer_is_grabbed = FALSE; /* Boolean value of wether the there is
+ * an active x pointer grab in effect
+ */
#ifdef USE_XIM
static gint xim_using; /* using XIM Protocol if TRUE */
@@ -1272,7 +1275,7 @@ gdk_pointer_grab (GdkWindow * window,
time);
else
return_val = Success;;
-
+
if (return_val == Success)
return_val = XGrabPointer (window_private->xdisplay,
xwindow,
@@ -1282,7 +1285,10 @@ gdk_pointer_grab (GdkWindow * window,
xconfine_to,
xcursor,
time);
-
+
+ if (return_val == GrabSuccess)
+ pointer_is_grabbed = TRUE;
+
return return_val;
}
@@ -1308,6 +1314,28 @@ gdk_pointer_ungrab (guint32 time)
gdk_input_vtable.ungrab_pointer (time);
XUngrabPointer (gdk_display, time);
+ pointer_is_grabbed = FALSE;
+}
+
+/*
+ *--------------------------------------------------------------
+ * gdk_pointer_is_grabbed
+ *
+ * Tell wether there is an active x pointer grab in effect
+ *
+ * Arguments:
+ *
+ * Results:
+ *
+ * Side effects:
+ *
+ *--------------------------------------------------------------
+ */
+
+gint
+gdk_pointer_is_grabbed (void)
+{
+ return pointer_is_grabbed;
}
/*