static gboolean manager_maybe_grab_window (GSManager *manager, GSWindow *window) { GdkDisplay *display; GdkScreen *screen; int monitor; int x, y; gboolean grabbed; display = gdk_display_get_default (); gdk_display_get_pointer (display, &screen, &x, &y, NULL); monitor = gdk_screen_get_monitor_at_point (screen, x, y); gdk_flush (); grabbed = FALSE; if (gs_window_get_screen (window) == screen && gs_window_get_monitor (window) == monitor) { gs_debug ("Moving grab to %p", window); gs_grab_move_to_window (manager->priv->grab, gs_window_get_gdk_window (window), gs_window_get_screen (window), FALSE); grabbed = TRUE; } return grabbed; }
static gboolean manager_maybe_grab_window (GSManager *manager, GSWindow *window) { GdkDisplay *display; GdkScreen *screen; int monitor; int x, y; gboolean grabbed; display = gdk_display_get_default (); #if GTK_CHECK_VERSION(3, 0, 0) GdkDeviceManager *device_manager = gdk_display_get_device_manager (display); GdkDevice *pointer = gdk_device_manager_get_client_pointer (device_manager); gdk_device_get_position (pointer, &screen, &x, &y); #else gdk_display_get_pointer (display, &screen, &x, &y, NULL); #endif monitor = gdk_screen_get_monitor_at_point (screen, x, y); gdk_flush (); grabbed = FALSE; if (gs_window_get_screen (window) == screen && gs_window_get_monitor (window) == monitor) { gs_debug ("Moving grab to %p", window); gs_grab_move_to_window (manager->priv->grab, gs_window_get_gdk_window (window), gs_window_get_screen (window), TRUE); grabbed = TRUE; } return grabbed; }
static void handle_window_dialog_down (GSManager *manager, GSWindow *window) { GSList *l; g_return_if_fail (manager != NULL); g_return_if_fail (GS_IS_MANAGER (manager)); gs_debug ("Handling dialog down"); /* Regrab the mouse */ gs_grab_move_to_window (manager->priv->grab, gs_window_get_gdk_window (window), gs_window_get_screen (window), FALSE); /* Make all windows sensitive so we get events */ for (l = manager->priv->windows; l; l = l->next) { gtk_widget_set_sensitive (GTK_WIDGET (l->data), TRUE); } manager->priv->dialog_up = FALSE; if (! manager->priv->throttled) { manager_resume_jobs (manager); } g_signal_emit (manager, signals [AUTH_REQUEST_END], 0); }
static void handle_window_dialog_up (GSManager *manager, GSWindow *window) { GSList *l; g_return_if_fail (manager != NULL); g_return_if_fail (GS_IS_MANAGER (manager)); gs_debug ("Handling dialog up"); g_signal_emit (manager, signals [AUTH_REQUEST_BEGIN], 0); manager->priv->dialog_up = TRUE; /* Make all other windows insensitive so we don't get events */ for (l = manager->priv->windows; l; l = l->next) { if (l->data != window) { gtk_widget_set_sensitive (GTK_WIDGET (l->data), FALSE); } } /* Move keyboard and mouse grabs so dialog can be used */ gs_grab_move_to_window (manager->priv->grab, gs_window_get_gdk_window (window), gs_window_get_screen (window), FALSE); /* Release the pointer grab while dialog is up so that the dialog can be used. We'll regrab it when the dialog goes down. */ gs_grab_release_mouse (manager->priv->grab); }
static gboolean manager_maybe_grab_window (GSManager *manager, GSWindow *window) { GdkDisplay *display; GdkDevice *device; GdkMonitor *monitor; int x, y; gboolean grabbed; display = gdk_display_get_default (); device = gdk_seat_get_pointer (gdk_display_get_default_seat (display)); gdk_device_get_position (device, NULL, &x, &y); monitor = gdk_display_get_monitor_at_point (display, x, y); gdk_display_flush (display); grabbed = FALSE; if (gs_window_get_display (window) == display && gs_window_get_monitor (window) == monitor) { gs_debug ("Initiate grab move to %p", window); gs_grab_move_to_window (manager->priv->grab, gs_window_get_gdk_window (window), gs_window_get_display (window), FALSE, FALSE); grabbed = TRUE; } return grabbed; }
static void show_cb (GtkWindow* container, gpointer data) { gs_grab_move_to_window (grab, gtk_widget_get_window (GTK_WIDGET(container)), gtk_window_get_screen (container), FALSE); }
static void window_show_cb (GSWindow *window, gpointer data) { /* move devices grab so that dialog can be used */ gs_grab_move_to_window (grab, gs_window_get_gdk_window (window), gs_window_get_display (window), TRUE, FALSE); }
static void window_show_cb (GSWindow *window, gpointer data) { /* Grab keyboard so dialog can be used */ gs_grab_move_to_window (grab, gs_window_get_gdk_window (window), gs_window_get_screen (window), FALSE); }
static void handle_window_dialog_up (GSManager *manager, GSWindow *window) { GSList *l; g_return_if_fail (manager != NULL); g_return_if_fail (GS_IS_MANAGER (manager)); gs_debug ("Handling dialog up"); g_signal_emit (manager, signals [AUTH_REQUEST_BEGIN], 0); manager->priv->dialog_up = TRUE; /* make all other windows insensitive to not get events */ for (l = manager->priv->windows; l; l = l->next) { if (l->data != window) { gtk_widget_set_sensitive (GTK_WIDGET (l->data), FALSE); } } /* move devices grab so that dialog can be used; release the pointer grab while dialog is up so that the dialog can be used. We'll regrab it when the dialog goes down */ gs_debug ("Initiate pointer-less grab move to %p", window); gs_grab_move_to_window (manager->priv->grab, gs_window_get_gdk_window (window), gs_window_get_display (window), TRUE, FALSE); if (! manager->priv->throttled) { gs_debug ("Suspending jobs"); manager_suspend_jobs (manager); } }