summaryrefslogtreecommitdiff
path: root/plugins/keybindings
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/keybindings
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/keybindings')
-rw-r--r--plugins/keybindings/msd-keybindings-manager.c53
1 files changed, 16 insertions, 37 deletions
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;