summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-01 02:40:51 +0200
committerraveit65 <[email protected]>2017-08-09 22:07:03 +0200
commitdaa0acc2088b8501c3c55134f8f21f3e853ca83d (patch)
treea2ee25376922bafd9614e4f58bb56f01a77b995b /plugins
parent9568139c78f5d5621f87faee2db423fd9e1aa619 (diff)
downloadmate-settings-daemon-daa0acc2088b8501c3c55134f8f21f3e853ca83d.tar.bz2
mate-settings-daemon-daa0acc2088b8501c3c55134f8f21f3e853ca83d.tar.xz
avoid deprecated gdk_display_get_screen and gdk_display_get_n_screens
Diffstat (limited to 'plugins')
-rw-r--r--plugins/background/msd-background-manager.c36
-rw-r--r--plugins/keybindings/msd-keybindings-manager.c53
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c12
-rw-r--r--plugins/xsettings/msd-xsettings-manager.c30
4 files changed, 45 insertions, 86 deletions
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c
index b3cbdc4..de1ff34 100644
--- a/plugins/background/msd-background-manager.c
+++ b/plugins/background/msd-background-manager.c
@@ -216,18 +216,14 @@ draw_background (MsdBackgroundManager *manager,
mate_settings_profile_start (NULL);
GdkDisplay *display = gdk_display_get_default ();
- int n_screens = gdk_display_get_n_screens (display);
- int scr;
p->draw_in_progress = TRUE;
p->do_fade = may_fade && can_fade_bg (manager);
free_scr_sizes (manager);
- for (scr = 0; scr < n_screens; scr++)
- {
- g_debug ("Drawing background on Screen%d", scr);
- real_draw_bg (manager, gdk_display_get_screen (display, scr));
- }
+ g_debug ("Drawing background on Screen");
+ real_draw_bg (manager, gdk_display_get_default_screen (display));
+
p->scr_sizes = g_list_reverse (p->scr_sizes);
p->draw_in_progress = FALSE;
@@ -277,33 +273,23 @@ static void
disconnect_screen_signals (MsdBackgroundManager *manager)
{
GdkDisplay *display = gdk_display_get_default();
- int n_screens = gdk_display_get_n_screens (display);
- int i;
- for (i = 0; i < n_screens; i++)
- {
- g_signal_handlers_disconnect_by_func
- (gdk_display_get_screen (display, i),
- G_CALLBACK (on_screen_size_changed), manager);
- }
+ g_signal_handlers_disconnect_by_func
+ (gdk_display_get_default_screen (display),
+ G_CALLBACK (on_screen_size_changed), manager);
}
static void
connect_screen_signals (MsdBackgroundManager *manager)
{
GdkDisplay *display = gdk_display_get_default();
- int n_screens = gdk_display_get_n_screens (display);
- int i;
- for (i = 0; i < n_screens; i++)
- {
- GdkScreen *screen = gdk_display_get_screen (display, i);
+ GdkScreen *screen = gdk_display_get_default_screen (display);
- g_signal_connect (screen, "monitors-changed",
- G_CALLBACK (on_screen_size_changed), manager);
- g_signal_connect (screen, "size-changed",
- G_CALLBACK (on_screen_size_changed), manager);
- }
+ g_signal_connect (screen, "monitors-changed",
+ G_CALLBACK (on_screen_size_changed), manager);
+ g_signal_connect (screen, "size-changed",
+ G_CALLBACK (on_screen_size_changed), manager);
}
static gboolean
diff --git a/plugins/keybindings/msd-keybindings-manager.c b/plugins/keybindings/msd-keybindings-manager.c
index 0927927..f04ac54 100644
--- a/plugins/keybindings/msd-keybindings-manager.c
+++ b/plugins/keybindings/msd-keybindings-manager.c
@@ -77,26 +77,9 @@ static gpointer manager_object = NULL;
static GSList *
get_screens_list (void)
{
- GdkDisplay *display = gdk_display_get_default();
- int n_screens;
GSList *list = NULL;
- int i;
- n_screens = gdk_display_get_n_screens (display);
-
- if (n_screens == 1) {
- list = g_slist_append (list, gdk_screen_get_default ());
- } else {
- for (i = 0; i < n_screens; i++) {
- GdkScreen *screen;
-
- screen = gdk_display_get_screen (display, i);
- if (screen != NULL) {
- list = g_slist_prepend (list, screen);
- }
- }
- list = g_slist_reverse (list);
- }
+ list = g_slist_append (list, gdk_screen_get_default ());
return list;
}
@@ -539,8 +522,6 @@ msd_keybindings_manager_start (MsdKeybindingsManager *manager,
GdkDisplay *dpy;
GdkScreen *screen;
GdkWindow *window;
- int screen_num;
- int i;
Display *xdpy;
Window xwindow;
XWindowAttributes atts;
@@ -550,23 +531,21 @@ msd_keybindings_manager_start (MsdKeybindingsManager *manager,
dpy = gdk_display_get_default ();
xdpy = GDK_DISPLAY_XDISPLAY (dpy);
- screen_num = gdk_display_get_n_screens (dpy);
-
- for (i = 0; i < screen_num; i++) {
- screen = gdk_display_get_screen (dpy, i);
- window = gdk_screen_get_root_window (screen);
- xwindow = GDK_WINDOW_XID (window);
-
- gdk_window_add_filter (window,
- (GdkFilterFunc) keybindings_filter,
- manager);
-
- gdk_error_trap_push ();
- /* Add KeyPressMask to the currently reportable event masks */
- XGetWindowAttributes (xdpy, xwindow, &atts);
- XSelectInput (xdpy, xwindow, atts.your_event_mask | KeyPressMask);
- gdk_error_trap_pop_ignored ();
- }
+
+ screen = gdk_display_get_default_screen (dpy);
+ window = gdk_screen_get_root_window (screen);
+ xwindow = GDK_WINDOW_XID (window);
+
+ gdk_window_add_filter (window,
+ (GdkFilterFunc) keybindings_filter,
+ manager);
+
+ gdk_error_trap_push ();
+ /* Add KeyPressMask to the currently reportable event masks */
+ XGetWindowAttributes (xdpy, xwindow, &atts);
+ XSelectInput (xdpy, xwindow, atts.your_event_mask | KeyPressMask);
+ gdk_error_trap_pop_ignored ();
+
manager->priv->screens = get_screens_list ();
manager->priv->binding_list = NULL;
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 1a8d291..9533968 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -107,16 +107,14 @@ static void
init_screens (MsdMediaKeysManager *manager)
{
GdkDisplay *display;
- int i;
display = gdk_display_get_default ();
- for (i = 0; i < gdk_display_get_n_screens (display); i++) {
- GdkScreen *screen;
- screen = gdk_display_get_screen (display, i);
- if (screen == NULL) {
- continue;
- }
+ GdkScreen *screen;
+
+ screen = gdk_display_get_default_screen (display);
+
+ if (screen != NULL) {
manager->priv->screens = g_slist_append (manager->priv->screens, screen);
}
diff --git a/plugins/xsettings/msd-xsettings-manager.c b/plugins/xsettings/msd-xsettings-manager.c
index b88e71f..e7849ec 100644
--- a/plugins/xsettings/msd-xsettings-manager.c
+++ b/plugins/xsettings/msd-xsettings-manager.c
@@ -643,13 +643,10 @@ static gboolean
setup_xsettings_managers (MateXSettingsManager *manager)
{
GdkDisplay *display;
- int i;
- int n_screens;
gboolean res;
gboolean terminated;
display = gdk_display_get_default ();
- n_screens = gdk_display_get_n_screens (display);
res = xsettings_manager_check_running (gdk_x11_display_get_xdisplay (display),
gdk_x11_screen_get_screen_number (gdk_screen_get_default ()));
@@ -658,22 +655,21 @@ setup_xsettings_managers (MateXSettingsManager *manager)
return FALSE;
}
- manager->priv->managers = g_new0 (XSettingsManager *, n_screens + 1);
+ manager->priv->managers = g_new0 (XSettingsManager *, 2);
terminated = FALSE;
- for (i = 0; i < n_screens; i++) {
- GdkScreen *screen;
-
- screen = gdk_display_get_screen (display, i);
-
- manager->priv->managers [i] = xsettings_manager_new (gdk_x11_display_get_xdisplay (display),
- gdk_x11_screen_get_screen_number (screen),
- terminate_cb,
- &terminated);
- if (! manager->priv->managers [i]) {
- g_warning ("Could not create xsettings manager for screen %d!", i);
- return FALSE;
- }
+
+ GdkScreen *screen;
+
+ screen = gdk_display_get_default_screen (display);
+
+ manager->priv->managers [0] = xsettings_manager_new (gdk_x11_display_get_xdisplay (display),
+ gdk_x11_screen_get_screen_number (screen),
+ terminate_cb,
+ &terminated);
+ if (! manager->priv->managers [0]) {
+ g_warning ("Could not create xsettings manager for screen!");
+ return FALSE;
}
return TRUE;