Пример #1
0
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;
}
Пример #2
0
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);
}
Пример #3
0
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;
}
Пример #4
0
static void
apply_background_to_window (GSManager *manager,
                            GSWindow  *window)
{
        cairo_surface_t *surface = NULL;
        GdkScreen       *screen;
        GdkWindow       *gdk_window;
        gint             monitor;
        GdkRectangle     monitor_geometry;
        int              width;
        int              height;

        // if (manager->priv->bg == NULL) {
        //        gs_debug ("No background available");
                gs_window_set_background_surface (window, NULL);
        //} 

        screen = gs_window_get_screen (window);
        gdk_window = gs_window_get_gdk_window (window);
        monitor = gdk_screen_get_monitor_at_window (screen, gdk_window);
        gdk_screen_get_monitor_geometry (screen, monitor, &monitor_geometry);
        width = monitor_geometry.width;
        height = monitor_geometry.height;
        gs_debug ("Creating background w:%d h:%d", width, height);
        /*surface = gnome_bg_create_surface (manager->priv->bg,
                                           gdk_window,
                                           width,
                                           height,
                                           FALSE);*/
        gs_window_set_background_surface (window, surface);
        cairo_surface_destroy (surface);
}
Пример #5
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);
}
Пример #6
0
static void
apply_background_to_window (GSManager *manager,
                            GSWindow  *window)
{
	cairo_surface_t *surface;
	int              width;
	int              height;

        mate_bg_load_from_preferences (manager->priv->bg);

	if (manager->priv->bg == NULL)
	{
		gs_debug ("No background available");
		gs_window_set_background_surface (window, NULL);
	}

	gtk_widget_get_preferred_width (GTK_WIDGET (window), &width, NULL);
	gtk_widget_get_preferred_height (GTK_WIDGET (window), &height, NULL);
	gs_debug ("Creating background w:%d h:%d", width, height);
	surface = mate_bg_create_surface (manager->priv->bg,
	                                  gs_window_get_gdk_window (window),
	                                  width,
	                                  height,
	                                  FALSE);
	gs_window_set_background_surface (window, surface);
	cairo_surface_destroy (surface);
}
Пример #7
0
static void
window_grab_broken_cb (GSWindow           *window,
                       GdkEventGrabBroken *event,
                       GSManager          *manager)
{
	GdkDisplay *display;
	GdkSeat    *seat;
	GdkDevice  *device;

	display = gdk_window_get_display (gs_window_get_gdk_window (window));
	seat = gdk_display_get_default_seat (display);

	if (event->keyboard)
	{
		gs_debug ("KEYBOARD GRAB BROKEN!");
		device = gdk_seat_get_pointer (seat);
		if (!gdk_display_device_is_grabbed (display, device))
			gs_grab_reset (manager->priv->grab);
	}
	else
	{
		gs_debug ("POINTER GRAB BROKEN!");
		device = gdk_seat_get_keyboard (seat);
		if (!gdk_display_device_is_grabbed (display, device))
			gs_grab_reset (manager->priv->grab);
	}
}
Пример #8
0
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;
}
Пример #9
0
static void
apply_background_to_window (GSManager *manager,
                            GSWindow  *window)
{
#if GTK_CHECK_VERSION (3, 0, 0)
	cairo_surface_t *surface;
#else
	GdkPixmap       *pixmap;
#endif
	GdkScreen       *screen;
	int              width;
	int              height;

	if (manager->priv->bg == NULL)
	{
		gs_debug ("No background available");
#if GTK_CHECK_VERSION (3, 0, 0)
		gs_window_set_background_surface (window, NULL);
#else
		gs_window_set_background_pixmap (window, NULL);
#endif
	}

	screen = gs_window_get_screen (window);
	width = gdk_screen_get_width (screen);
	height = gdk_screen_get_height (screen);
	gs_debug ("Creating background w:%d h:%d", width, height);
#if GTK_CHECK_VERSION (3, 0, 0)
	surface = mate_bg_create_surface (manager->priv->bg,
	                                  gs_window_get_gdk_window (window),
	                                  width,
	                                  height,
	                                  FALSE);
	gs_window_set_background_surface (window, surface);
	cairo_surface_destroy (surface);
#else
	pixmap = mate_bg_create_pixmap (manager->priv->bg,
	                                gs_window_get_gdk_window (window),
	                                width,
	                                height,
	                                FALSE);
	gs_window_set_background_pixmap (window, pixmap);
	g_object_unref (pixmap);
#endif
}
Пример #10
0
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);
}
Пример #11
0
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);

}
Пример #12
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 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);
	}
}