Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.1:Update
mate-screensaver
mate-screensaver-gtk-3.20.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File mate-screensaver-gtk-3.20.patch of Package mate-screensaver
--- a/configure.ac +++ b/configure.ac @@ -44,8 +44,8 @@ GLIB_GSETTINGS # Dependencies DBUS_REQUIRED_VERSION=0.30 -GLIB_REQUIRED_VERSION=2.50.0 -GTK_REQUIRED_VERSION=3.22.0 +GLIB_REQUIRED_VERSION=2.48.0 +GTK_REQUIRED_VERSION=3.20.0 X11_REQUIRED_VERSION=1.0 LIBMATE_MENU_REQUIRED_VERSION=1.10.0 MATE_DESKTOP_REQUIRED_VERSION=1.17.0 --- a/src/gs-manager.c +++ b/src/gs-manager.c @@ -1103,7 +1103,12 @@ find_window_at_pointer (GSManager *manag { GdkDisplay *display; GdkDevice *device; +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor; +#else + GdkScreen *screen; + int monitor; +#endif int x, y; GSWindow *window; GSList *l; @@ -1111,8 +1116,13 @@ find_window_at_pointer (GSManager *manag display = gdk_display_get_default (); device = gdk_seat_get_pointer (gdk_display_get_default_seat (display)); +#if GTK_CHECK_VERSION (3, 22, 0) gdk_device_get_position (device, NULL, &x, &y); monitor = gdk_display_get_monitor_at_point (display, x, y); +#else + gdk_device_get_position (device, &screen, &x, &y); + monitor = gdk_screen_get_monitor_at_point (screen, x, y); +#endif /* Find the gs-window that is on that monitor */ window = NULL; @@ -1165,14 +1175,24 @@ manager_maybe_grab_window (GSManager *ma { GdkDisplay *display; GdkDevice *device; +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor; +#else + GdkScreen *screen; + int monitor; +#endif int x, y; gboolean grabbed; display = gdk_display_get_default (); device = gdk_seat_get_pointer (gdk_display_get_default_seat (display)); +#if GTK_CHECK_VERSION (3, 22, 0) gdk_device_get_position (device, NULL, &x, &y); monitor = gdk_display_get_monitor_at_point (display, x, y); +#else + gdk_device_get_position (device, &screen, &x, &y); + monitor = gdk_screen_get_monitor_at_point (screen, x, y); +#endif gdk_flush (); grabbed = FALSE; @@ -1524,14 +1544,26 @@ connect_window_signals (GSManager *manag static void gs_manager_create_window_for_monitor (GSManager *manager, +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor) +#else + GdkDisplay *display, + int monitor) +#endif { GSWindow *window; +#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; +#endif GdkRectangle rect; +#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_monitor_get_display (monitor); gdk_monitor_get_geometry (monitor, &rect); +#else + gdk_screen_get_monitor_geometry (gdk_display_get_default_screen (display), + monitor, &rect); +#endif gs_debug ("Creating a window for the monitor [%d,%d] (%dx%d)", monitor, rect.x, rect.y, rect.width, rect.height); @@ -1556,6 +1588,7 @@ gs_manager_create_window_for_monitor (GS } } +#if GTK_CHECK_VERSION (3, 22, 0) static void on_display_monitor_added (GdkDisplay *display, GdkMonitor *monitor, @@ -1625,6 +1658,85 @@ on_display_monitor_removed (GdkDisplay * gdk_display_flush (display); gdk_x11_ungrab_server (); } +#else +static void +on_screen_monitors_changed (GdkScreen *screen, + GSManager *manager) +{ + GSList *l; + GdkDisplay *display; + int n_monitors; + int n_windows; + int i; + + display = gdk_screen_get_display (screen); + n_monitors = gdk_screen_get_n_monitors (screen); + n_windows = g_slist_length (manager->priv->windows); + + gs_debug ("Monitors changed for display %s: num=%d", + gdk_display_get_name (display), + n_monitors); + + if (n_monitors > n_windows) + { + /* Tear down unlock dialog in case we want to move it + * to a new monitor + */ + l = manager->priv->windows; + while (l != NULL) + { + gs_window_cancel_unlock_request (GS_WINDOW (l->data)); + l = l->next; + } + + /* Add more windows */ + for (i = n_windows; i < n_monitors; ++i) + { + gs_manager_create_window_for_monitor (manager, + display, i); + } + + /* And put unlock dialog up where ever it's supposed to be */ + gs_manager_request_unlock (manager); + } + else + { + gdk_x11_grab_server (); + + /* Remove the extra windows */ + l = manager->priv->windows; + while (l != NULL) + { + GdkDisplay *this_display; + int this_monitor; + GSList *next = l->next; + + this_display = gs_window_get_display (GS_WINDOW (l->data)); + this_monitor = gs_window_get_monitor (GS_WINDOW (l->data)); + if (this_display == display && this_monitor >= n_monitors) + { + manager_maybe_stop_job_for_window (manager, GS_WINDOW (l->data)); + g_hash_table_remove (manager->priv->jobs, l->data); + gs_window_destroy (GS_WINDOW (l->data)); + manager->priv->windows = g_slist_delete_link (manager->priv->windows, l); + } + l = next; + } + + /* Make sure there is a lock dialog on a connected monitor, + * and that the keyboard is still properly grabbed after all + * the windows above got destroyed + */ + if (n_windows > n_monitors) + { + gs_manager_request_unlock (manager); + } + + gdk_display_flush (display); + gdk_x11_ungrab_server (); + } +} +#endif static void gs_manager_destroy_windows (GSManager *manager) @@ -1642,12 +1756,18 @@ gs_manager_destroy_windows (GSManager *m display = gdk_display_get_default (); +#if GTK_CHECK_VERSION (3, 22, 0) g_signal_handlers_disconnect_by_func (display, on_display_monitor_removed, manager); g_signal_handlers_disconnect_by_func (display, on_display_monitor_added, manager); +#else + g_signal_handlers_disconnect_by_func (gdk_display_get_default_screen (display), + on_screen_monitors_changed, + manager); +#endif for (l = manager->priv->windows; l; l = l->next) { @@ -1703,6 +1823,9 @@ static void gs_manager_create_windows_for_display (GSManager *manager, GdkDisplay *display) { +#if !GTK_CHECK_VERSION (3, 22, 0) + GdkScreen *screen; +#endif int n_monitors; int i; @@ -1713,15 +1836,25 @@ gs_manager_create_windows_for_display (G g_object_ref (manager); g_object_ref (display); +#if GTK_CHECK_VERSION (3, 22, 0) n_monitors = gdk_display_get_n_monitors (display); +#else + screen = gdk_display_get_default_screen (display); + n_monitors = gdk_screen_get_n_monitors (screen); +#endif gs_debug ("Creating %d windows for display %s", n_monitors, gdk_display_get_name (display)); for (i = 0; i < n_monitors; i++) { +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *mon = gdk_display_get_monitor (display, i); gs_manager_create_window_for_monitor (manager, mon); +#else + gs_manager_create_window_for_monitor (manager, + display, i); +#endif } g_object_unref (display); @@ -1739,12 +1872,19 @@ gs_manager_create_windows (GSManager *ma g_assert (manager->priv->windows == NULL); display = gdk_display_get_default (); +#if GTK_CHECK_VERSION (3, 22, 0) g_signal_connect (display, "monitor-added", G_CALLBACK (on_display_monitor_added), manager); g_signal_connect (display, "monitor-removed", G_CALLBACK (on_display_monitor_removed), manager); +#else + g_signal_connect (gdk_display_get_default_screen (display), + "monitors-changed", + G_CALLBACK (on_screen_monitors_changed), + manager); +#endif gs_manager_create_windows_for_display (manager, display); } --- a/src/gs-window.h +++ b/src/gs-window.h @@ -62,8 +62,13 @@ gboolean gs_window_is_dialog_up GdkDisplay * gs_window_get_display (GSWindow *window); void gs_window_set_monitor (GSWindow *window, +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor); GdkMonitor * gs_window_get_monitor (GSWindow *window); +#else + int monitor); +int gs_window_get_monitor (GSWindow *window); +#endif void gs_window_set_background_surface (GSWindow *window, cairo_surface_t *surface); @@ -92,7 +97,11 @@ void gs_window_request_unlock void gs_window_cancel_unlock_request (GSWindow *window); GSWindow * gs_window_new (GdkDisplay *display, +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor, +#else + int monitor, +#endif gboolean lock_enabled); void gs_window_show (GSWindow *window); void gs_window_destroy (GSWindow *window); --- a/src/gs-window-x11.c +++ b/src/gs-window-x11.c @@ -62,7 +62,11 @@ enum struct GSWindowPrivate { +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor; +#else + int monitor; +#endif GdkRectangle geometry; guint obscured : 1; @@ -292,35 +296,56 @@ static cairo_region_t * get_outside_region (GSWindow *window) { GdkDisplay *display; +#if GTK_CHECK_VERSION (3, 22, 0) int i; int num_monitors; +#else + GdkScreen *screen; + int mon; +#endif cairo_region_t *region; display = gtk_widget_get_display (GTK_WIDGET (window)); +#if !GTK_CHECK_VERSION (3, 22, 0) + screen = gdk_display_get_default_screen (display); +#endif region = cairo_region_create (); +#if GTK_CHECK_VERSION (3, 22, 0) num_monitors = gdk_display_get_n_monitors (display); for (i = 0; i < num_monitors; i++) +#else + for (mon = 0; mon < window->priv->monitor; mon++) +#endif { +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *mon = gdk_display_get_monitor (display, i); if (mon != window->priv->monitor) { +#endif GdkRectangle geometry; cairo_rectangle_int_t rectangle; +#if GTK_CHECK_VERSION (3, 22, 0) gdk_monitor_get_geometry (mon, &geometry); +#else + gdk_screen_get_monitor_geometry (screen, mon, + &geometry); +#endif rectangle.x = geometry.x; rectangle.y = geometry.y; rectangle.width = geometry.width; rectangle.height = geometry.height; cairo_region_union_rectangle (region, &rectangle); +#if GTK_CHECK_VERSION (3, 22, 0) } else { break; } +#endif } return region; @@ -335,7 +360,13 @@ update_geometry (GSWindow *window) outside_region = get_outside_region (window); +#if GTK_CHECK_VERSION (3, 22, 0) gdk_monitor_get_geometry (window->priv->monitor, &geometry); +#else + gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (window)), + window->priv->monitor, + &geometry); +#endif gs_debug ("got geometry for monitor: x=%d y=%d w=%d h=%d", geometry.x, geometry.y, @@ -1911,7 +1942,11 @@ gs_window_set_status_message (GSWindow void gs_window_set_monitor (GSWindow *window, +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor) +#else + int monitor) +#endif { g_return_if_fail (GS_IS_WINDOW (window)); @@ -1927,10 +1962,18 @@ gs_window_set_monitor (GSWindow *windo g_object_notify (G_OBJECT (window), "monitor"); } +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor * +#else +int +#endif gs_window_get_monitor (GSWindow *window) { +#if GTK_CHECK_VERSION (3, 22, 0) g_return_val_if_fail (GS_IS_WINDOW (window), NULL); +#else + g_return_val_if_fail (GS_IS_WINDOW (window), -1); +#endif return window->priv->monitor; } @@ -1969,7 +2012,11 @@ gs_window_set_property (GObject gs_window_set_logout_timeout (self, g_value_get_long (value)); break; case PROP_MONITOR: +#if GTK_CHECK_VERSION (3, 22, 0) gs_window_set_monitor (self, g_value_get_pointer (value)); +#else + gs_window_set_monitor (self, g_value_get_int (value)); +#endif break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -2011,7 +2058,11 @@ gs_window_get_property (GObject *obje g_value_set_long (value, self->priv->logout_timeout); break; case PROP_MONITOR: +#if GTK_CHECK_VERSION (3, 22, 0) g_value_set_pointer (value, (gpointer) self->priv->monitor); +#else + g_value_set_int (value, self->priv->monitor); +#endif break; case PROP_OBSCURED: g_value_set_boolean (value, self->priv->obscured); @@ -2412,10 +2463,19 @@ gs_window_class_init (GSWindowClass *kla g_object_class_install_property (object_class, PROP_MONITOR, +#if GTK_CHECK_VERSION (3, 22, 0) g_param_spec_pointer ("monitor", "Gdk monitor", "The monitor (in terms of Gdk) which the window is on", G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); +#else + g_param_spec_int ("monitor", + "RandR monitor", + "The monitor (in terms of RandR) which the window is on", + 0, G_MAXINT, 0, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); +#endif + } static void @@ -2548,7 +2608,11 @@ gs_window_finalize (GObject *object) GSWindow * gs_window_new (GdkDisplay *display, +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor, +#else + int monitor, +#endif gboolean lock_enabled) { GObject *result; --- a/src/mate-screensaver-preferences.c +++ b/src/mate-screensaver-preferences.c @@ -387,10 +387,17 @@ help_display (void) GError *error; error = NULL; +#if GTK_CHECK_VERSION (3, 22, 0) gtk_show_uri_on_window (NULL, "help:mate-user-guide/prefs-screensaver", GDK_CURRENT_TIME, &error); +#else + gtk_show_uri (NULL, + "help:mate-user-guide/prefs-screensaver", + GDK_CURRENT_TIME, + &error); +#endif if (error != NULL) { --- a/src/test-window.c +++ b/src/test-window.c @@ -123,12 +123,22 @@ test_window (void) gboolean lock_active; gboolean user_switch_enabled; GdkDisplay *display; +#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor; +#else + GdkScreen *screen; + int monitor; +#endif lock_active = TRUE; user_switch_enabled = TRUE; display = gdk_display_get_default (); +#if GTK_CHECK_VERSION (3, 22, 0) monitor = gdk_display_get_primary_monitor (display); +#else + screen = gdk_display_get_default_screen (display); + monitor = gdk_screen_get_primary_monitor (screen); +#endif window = gs_window_new (display, monitor, lock_active);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor