/** * gdk_pointer_is_grabbed: * * Returns %TRUE if the pointer on the default display is currently * grabbed by this application. * * Note that this does not take the inmplicit pointer grab on button * presses into account. * * Returns: %TRUE if the pointer is currently grabbed by this application. * * Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead. **/ gboolean gdk_pointer_is_grabbed (void) { return gdk_display_pointer_is_grabbed (gdk_display_get_default ()); }
static VALUE rg_pointer_grabbed_p(VALUE self) { return CBOOL2RVAL(gdk_display_pointer_is_grabbed(_SELF(self))); }
static gboolean maybe_redirect_mouse_event (XEvent *xevent) { GdkDisplay *gdisplay; MetaUI *ui; #if GTK_CHECK_VERSION (3, 0, 0) GdkDeviceManager *gmanager; GdkDevice *gdevice; GdkEvent *gevent; #else GdkEvent gevent; #endif GdkWindow *gdk_window; Window window; switch (xevent->type) { case ButtonPress: case ButtonRelease: window = xevent->xbutton.window; break; case MotionNotify: window = xevent->xmotion.window; break; case EnterNotify: case LeaveNotify: window = xevent->xcrossing.window; break; default: return FALSE; } gdisplay = gdk_x11_lookup_xdisplay (xevent->xany.display); ui = g_object_get_data (G_OBJECT (gdisplay), "meta-ui"); if (!ui) return FALSE; #if GTK_CHECK_VERSION (3, 0, 0) gdk_window = gdk_x11_window_lookup_for_display (gdisplay, window); #else gdk_window = gdk_window_lookup_for_display (gdisplay, window); #endif if (gdk_window == NULL) return FALSE; #if GTK_CHECK_VERSION (3, 0, 0) gmanager = gdk_display_get_device_manager (gdisplay); gdevice = gdk_device_manager_get_client_pointer (gmanager); #endif /* If GDK already thinks it has a grab, we better let it see events; this * is the menu-navigation case and events need to get sent to the appropriate * (client-side) subwindow for individual menu items. */ #if GTK_CHECK_VERSION (3, 0, 0) if (gdk_display_device_is_grabbed (gdisplay, gdevice)) #else if (gdk_display_pointer_is_grabbed (gdisplay)) #endif return FALSE; #if !GTK_CHECK_VERSION (3, 0, 0) memset (&gevent, 0, sizeof (gevent)); #endif switch (xevent->type) { case ButtonPress: case ButtonRelease: if (xevent->type == ButtonPress) { GtkSettings *settings = gtk_settings_get_default (); int double_click_time; int double_click_distance; g_object_get (settings, "gtk-double-click-time", &double_click_time, "gtk-double-click-distance", &double_click_distance, NULL); if (xevent->xbutton.button == ui->button_click_number && xevent->xbutton.window == ui->button_click_window && xevent->xbutton.time < ui->button_click_time + double_click_time && ABS (xevent->xbutton.x - ui->button_click_x) <= double_click_distance && ABS (xevent->xbutton.y - ui->button_click_y) <= double_click_distance) { #if GTK_CHECK_VERSION (3, 0, 0) gevent = gdk_event_new (GDK_2BUTTON_PRESS); #else gevent.button.type = GDK_2BUTTON_PRESS; #endif ui->button_click_number = 0; } else { #if GTK_CHECK_VERSION (3, 0, 0) gevent = gdk_event_new (GDK_BUTTON_PRESS); #else gevent.button.type = GDK_BUTTON_PRESS; #endif ui->button_click_number = xevent->xbutton.button; ui->button_click_window = xevent->xbutton.window; ui->button_click_time = xevent->xbutton.time; ui->button_click_x = xevent->xbutton.x; ui->button_click_y = xevent->xbutton.y; } } else { #if GTK_CHECK_VERSION (3, 0, 0) gevent = gdk_event_new (GDK_BUTTON_RELEASE); #else gevent.button.type = GDK_BUTTON_RELEASE; #endif } #if GTK_CHECK_VERSION (3, 0, 0) gevent->button.window = g_object_ref (gdk_window); gevent->button.button = xevent->xbutton.button; gevent->button.time = xevent->xbutton.time; gevent->button.x = xevent->xbutton.x; gevent->button.y = xevent->xbutton.y; gevent->button.x_root = xevent->xbutton.x_root; gevent->button.y_root = xevent->xbutton.y_root; #else gevent.button.window = gdk_window; gevent.button.button = xevent->xbutton.button; gevent.button.time = xevent->xbutton.time; gevent.button.x = xevent->xbutton.x; gevent.button.y = xevent->xbutton.y; gevent.button.x_root = xevent->xbutton.x_root; gevent.button.y_root = xevent->xbutton.y_root; #endif break; case MotionNotify: #if GTK_CHECK_VERSION (3, 0, 0) gevent = gdk_event_new (GDK_MOTION_NOTIFY); gevent->motion.type = GDK_MOTION_NOTIFY; gevent->motion.window = g_object_ref (gdk_window); #else gevent.motion.type = GDK_MOTION_NOTIFY; gevent.motion.window = gdk_window; #endif break; case EnterNotify: case LeaveNotify: #if GTK_CHECK_VERSION (3, 0, 0) gevent = gdk_event_new (xevent->type == EnterNotify ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY); gevent->crossing.window = g_object_ref (gdk_window); gevent->crossing.x = xevent->xcrossing.x; gevent->crossing.y = xevent->xcrossing.y; #else gevent.crossing.type = xevent->type == EnterNotify ? GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY; gevent.crossing.window = gdk_window; gevent.crossing.x = xevent->xcrossing.x; gevent.crossing.y = xevent->xcrossing.y; #endif break; default: g_assert_not_reached (); break; } /* If we've gotten here, we've filled in the gdk_event and should send it on */ #if GTK_CHECK_VERSION (3, 0, 0) gdk_event_set_device (gevent, gdevice); gtk_main_do_event (gevent); gdk_event_free (gevent); #else gtk_main_do_event (&gevent); #endif return TRUE; }
/*# @method pointer_is_grabbed GdkDisplay @brief Test if the pointer is grabbed. @return TRUE if an active X pointer grab is in effect Warning: gdk_display_pointer_is_grabbed has been deprecated since version 3.0 and should not be used in newly-written code. Use gdk_display_device_is_grabbed() instead. */ FALCON_FUNC Display::pointer_is_grabbed( VMARG ) { NO_ARGS vm->retval( (bool) gdk_display_pointer_is_grabbed( GET_DISPLAY( vm->self() ) ) ); }