From 7bee2f870bcf850f68fdf8d8db4bd2e914ece143 Mon Sep 17 00:00:00 2001 From: ZenWalker Date: Sun, 16 Jul 2017 04:18:38 +0200 Subject: avoid deprecated gdk_screen_get_number --- .../system-tray/na-tray-manager.c | 4 +-- applets/notification_area/system-tray/na-tray.c | 12 ++++---- applets/notification_area/testtray.c | 6 ++-- applets/wncklet/showdesktop.c | 2 +- applets/wncklet/wncklet.c | 3 +- mate-panel/libegg/eggdesktopfile.c | 8 ++--- .../panel-applet-container.c | 2 +- mate-panel/panel-layout.c | 35 +++++++++++----------- mate-panel/panel-multiscreen.c | 14 ++++----- mate-panel/panel-profile.c | 17 ++++++----- mate-panel/panel-struts.c | 12 ++++---- mate-panel/xstuff.c | 14 ++++----- 12 files changed, 66 insertions(+), 63 deletions(-) diff --git a/applets/notification_area/system-tray/na-tray-manager.c b/applets/notification_area/system-tray/na-tray-manager.c index 94d3003d..3886a10d 100644 --- a/applets/notification_area/system-tray/na-tray-manager.c +++ b/applets/notification_area/system-tray/na-tray-manager.c @@ -780,7 +780,7 @@ na_tray_manager_manage_screen_x11 (NaTrayManager *manager, GDK_PROPERTY_CHANGE_MASK | GDK_STRUCTURE_MASK); selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d", - gdk_screen_get_number (screen)); + gdk_x11_screen_get_screen_number (screen)); manager->selection_atom = gdk_atom_intern (selection_atom_name, FALSE); g_free (selection_atom_name); @@ -886,7 +886,7 @@ na_tray_manager_check_running_screen_x11 (GdkScreen *screen) display = gdk_screen_get_display (screen); selection_atom_name = g_strdup_printf ("_NET_SYSTEM_TRAY_S%d", - gdk_screen_get_number (screen)); + gdk_x11_screen_get_screen_number (screen)); selection_atom = gdk_x11_get_xatom_by_name_for_display (display, selection_atom_name); g_free (selection_atom_name); diff --git a/applets/notification_area/system-tray/na-tray.c b/applets/notification_area/system-tray/na-tray.c index c2488ecf..94fe6911 100644 --- a/applets/notification_area/system-tray/na-tray.c +++ b/applets/notification_area/system-tray/na-tray.c @@ -13,7 +13,7 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA @@ -103,7 +103,7 @@ get_tray (TraysScreen *trays_screen) { if (trays_screen->all_trays == NULL) return NULL; - + return trays_screen->all_trays->data; } @@ -282,7 +282,7 @@ message_sent (NaTrayManager *manager, icontip = g_hash_table_lookup (trays_screen->tip_table, icon); find_buffer.id = id; - if (icontip && + if (icontip && (icontip->id == id || g_slist_find_custom (icontip->buffer, &find_buffer, icon_tip_buffer_compare) != NULL)) @@ -437,7 +437,7 @@ na_tray_constructor (GType type, initialized = TRUE; } - screen_number = gdk_screen_get_number (priv->screen); + screen_number = gdk_x11_screen_get_screen_number (priv->screen); if (trays_screens [screen_number].tray_manager == NULL) { @@ -477,7 +477,7 @@ na_tray_constructor (GType type, g_object_unref (tray_manager); } } - + priv->trays_screen = &trays_screens [screen_number]; trays_screens [screen_number].all_trays = g_slist_append (trays_screens [screen_number].all_trays, tray); @@ -711,7 +711,7 @@ idle_redraw_cb (NaTray *tray) g_hash_table_foreach (priv->trays_screen->icon_table, (GHFunc) na_tray_child_force_redraw, NULL); - + priv->idle_redraw_id = 0; return FALSE; diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c index b2ce0fa2..cc36c02f 100644 --- a/applets/notification_area/testtray.c +++ b/applets/notification_area/testtray.c @@ -139,7 +139,7 @@ create_tray_on_screen (GdkScreen *screen, "Override tray manager?"); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "There is already a tray manager running on screen %d.", - gdk_screen_get_number (screen)); + gdk_x11_screen_get_screen_number (screen)); gtk_window_set_screen (GTK_WINDOW (dialog), screen); g_signal_connect (dialog, "response", G_CALLBACK (warning_dialog_response_cb), screen); gtk_window_present (GTK_WINDOW (dialog)); @@ -149,7 +149,7 @@ create_tray_on_screen (GdkScreen *screen, data = g_new0 (TrayData, 1); data->screen = screen; - data->screen_num = gdk_screen_get_number (screen); + data->screen_num = gdk_x11_screen_get_screen_number (screen); data->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_object_weak_ref (G_OBJECT (window), (GWeakNotify) maybe_quit, NULL); @@ -274,7 +274,7 @@ main (int argc, char *argv[]) screen = gdk_display_get_default_screen (display); create_tray_on_screen (screen, FALSE); - + gtk_main (); #ifdef PROVIDE_WATCHER_SERVICE diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c index a9aebb10..59d537cf 100644 --- a/applets/wncklet/showdesktop.c +++ b/applets/wncklet/showdesktop.c @@ -361,7 +361,7 @@ static void show_desktop_applet_realized(MatePanelApplet* applet, gpointer data) g_signal_handlers_disconnect_by_func(sdd->icon_theme, theme_changed_callback, sdd); screen = gtk_widget_get_screen(sdd->applet); - sdd->wnck_screen = wnck_screen_get(gdk_screen_get_number (screen)); + sdd->wnck_screen = wnck_screen_get(gdk_x11_screen_get_screen_number (screen)); if (sdd->wnck_screen != NULL) wncklet_connect_while_alive(sdd->wnck_screen, "showing_desktop_changed", G_CALLBACK(show_desktop_changed_callback), sdd, sdd->applet); diff --git a/applets/wncklet/wncklet.c b/applets/wncklet/wncklet.c index d9b9fd47..7ad3c0a1 100644 --- a/applets/wncklet/wncklet.c +++ b/applets/wncklet/wncklet.c @@ -30,6 +30,7 @@ #include #include +#include #define WNCK_I_KNOW_THIS_IS_UNSTABLE #include @@ -99,7 +100,7 @@ WnckScreen* wncklet_get_screen(GtkWidget* applet) if (!gtk_widget_has_screen(applet)) return wnck_screen_get_default(); - screen_num = gdk_screen_get_number(gtk_widget_get_screen(applet)); + screen_num = gdk_x11_screen_get_screen_number(gtk_widget_get_screen(applet)); return wnck_screen_get(screen_num); } diff --git a/mate-panel/libegg/eggdesktopfile.c b/mate-panel/libegg/eggdesktopfile.c index 384fd475..f7c231a8 100644 --- a/mate-panel/libegg/eggdesktopfile.c +++ b/mate-panel/libegg/eggdesktopfile.c @@ -1185,7 +1185,7 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file, display = gdk_display_get_default (); screen = gdk_display_get_default_screen (display); } - screen_num = gdk_screen_get_number (screen); + screen_num = gdk_x11_screen_get_screen_number (screen); translated_documents = translate_document_list (desktop_file, documents); docs = translated_documents; @@ -1364,7 +1364,7 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file, EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE, _("Can't pass document URIs to a 'Type=Link' desktop entry")); return FALSE; - } + } if (!parse_link (desktop_file, &app_desktop_file, &documents, error)) return FALSE; @@ -1483,10 +1483,10 @@ egg_set_desktop_file_without_defaults (const char *desktop_file_path) /** * egg_get_desktop_file: - * + * * Gets the application's #EggDesktopFile, as set by * egg_set_desktop_file(). - * + * * Return value: the #EggDesktopFile, or %NULL if it hasn't been set. **/ EggDesktopFile * diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-container.c b/mate-panel/libmate-panel-applet-private/panel-applet-container.c index 95fca64b..e4232fcb 100644 --- a/mate-panel/libmate-panel-applet-private/panel-applet-container.c +++ b/mate-panel/libmate-panel-applet-private/panel-applet-container.c @@ -479,7 +479,7 @@ mate_panel_applet_container_get_applet (MatePanelAppletContainer *container, /* we can't use the screen of the container widget since it's not in a * widget hierarchy yet */ - screen_number = gdk_screen_get_number (screen); + screen_number = gdk_x11_screen_get_screen_number (screen); data = g_new (AppletFactoryData, 1); data->result = result; diff --git a/mate-panel/panel-layout.c b/mate-panel/panel-layout.c index 9275dfaf..11d616ec 100644 --- a/mate-panel/panel-layout.c +++ b/mate-panel/panel-layout.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -180,7 +181,7 @@ panel_layout_append_group_helper (GKeyFile *keyfile, } g_strfreev (existing_ids); g_free (dconf_path); - + if (existing_id || !id) unique_id = panel_profile_find_new_id (type); else @@ -285,10 +286,10 @@ panel_layout_apply_default_from_gkeyfile (GdkScreen *screen) gchar **groups = NULL; GError *error = NULL; int i; - - screen_n = gdk_screen_get_number (screen); + + screen_n = gdk_x11_screen_get_screen_number (screen); layout_file = panel_layout_filename(); - + if (layout_file) { keyfile = g_key_file_new (); @@ -298,12 +299,12 @@ panel_layout_apply_default_from_gkeyfile (GdkScreen *screen) &error)) { groups = g_key_file_get_groups (keyfile, NULL); - + for (i = 0; groups[i] != NULL; i++) { - + if (g_strcmp0 (groups[i], "Toplevel") == 0 || g_str_has_prefix (groups[i], "Toplevel ")) - + panel_layout_append_group_helper ( keyfile, groups[i], screen_n, @@ -315,10 +316,10 @@ panel_layout_apply_default_from_gkeyfile (GdkScreen *screen) panel_layout_toplevel_keys, G_N_ELEMENTS (panel_layout_toplevel_keys), "toplevel"); - + else if (g_strcmp0 (groups[i], "Object") == 0 || g_str_has_prefix (groups[i], "Object ")) - + panel_layout_append_group_helper ( keyfile, groups[i], -1, @@ -330,14 +331,14 @@ panel_layout_apply_default_from_gkeyfile (GdkScreen *screen) panel_layout_object_keys, G_N_ELEMENTS (panel_layout_object_keys), "object"); - + else - + g_warning ("Unknown group in default layout: '%s'", groups[i]); - + } - + } else { @@ -345,19 +346,19 @@ panel_layout_apply_default_from_gkeyfile (GdkScreen *screen) layout_file, error->message); g_error_free (error); } - + } else { g_warning ("Cant find the layout file!"); /* FIXME implement a fallback panel */ } - + if (groups) g_strfreev (groups); - + if (keyfile) g_key_file_free (keyfile); - + if (layout_file) g_free (layout_file); } diff --git a/mate-panel/panel-multiscreen.c b/mate-panel/panel-multiscreen.c index 64dda92e..7c6df59f 100644 --- a/mate-panel/panel-multiscreen.c +++ b/mate-panel/panel-multiscreen.c @@ -481,7 +481,7 @@ panel_multiscreen_monitors (GdkScreen *screen) { int n_screen; - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); g_return_val_if_fail (n_screen >= 0 && n_screen < screens, 1); @@ -494,7 +494,7 @@ panel_multiscreen_x (GdkScreen *screen, { int n_screen; - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); g_return_val_if_fail (n_screen >= 0 && n_screen < screens, 0); g_return_val_if_fail (monitor >= 0 && monitor < monitors [n_screen], 0); @@ -508,7 +508,7 @@ panel_multiscreen_y (GdkScreen *screen, { int n_screen; - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); g_return_val_if_fail (n_screen >= 0 && n_screen < screens, 0); g_return_val_if_fail (monitor >= 0 && monitor < monitors [n_screen], 0); @@ -522,7 +522,7 @@ panel_multiscreen_width (GdkScreen *screen, { int n_screen; - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); g_return_val_if_fail (n_screen >= 0 && n_screen < screens, 0); g_return_val_if_fail (monitor >= 0 && monitor < monitors [n_screen], 0); @@ -536,7 +536,7 @@ panel_multiscreen_height (GdkScreen *screen, { int n_screen; - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); g_return_val_if_fail (n_screen >= 0 && n_screen < screens, 0); g_return_val_if_fail (monitor >= 0 && monitor < monitors [n_screen], 0); @@ -588,7 +588,7 @@ panel_multiscreen_get_monitor_at_point (GdkScreen *screen, /* not -1 as callers expect a real monitor */ g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); n_monitors = monitors[n_screen]; geoms = geometries[n_screen]; @@ -653,7 +653,7 @@ panel_multiscreen_is_at_visible_extreme (GdkScreen *screen, MonitorBounds monitor; int n_screen, i; - n_screen = gdk_screen_get_number (screen); + n_screen = gdk_x11_screen_get_screen_number (screen); *leftmost = TRUE; *rightmost = TRUE; diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index 2b7784d4..7f5aea06 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -577,7 +578,7 @@ panel_profile_queue_toplevel_location_change (PanelToplevel *toplevel, if (change->screen_changed) g_settings_set_int (toplevel->queued_settings, "screen", - gdk_screen_get_number (change->screen)); + gdk_x11_screen_get_screen_number (change->screen)); if (change->monitor_changed) g_settings_set_int (toplevel->queued_settings, @@ -775,7 +776,7 @@ panel_profile_toplevel_change_notify (GSettings *settings, if (!strcmp (key, "screen")) { GdkScreen *screen; screen = gdk_display_get_screen ( - gdk_display_get_default (), + gdk_display_get_default (), g_settings_get_int (settings, key)); if (screen) gtk_window_set_screen (GTK_WINDOW (toplevel), screen); @@ -980,13 +981,13 @@ panel_profile_create_toplevel (GdkScreen *screen) settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA, path); g_free (path); - g_settings_set_int (settings, PANEL_TOPLEVEL_SCREEN_KEY, gdk_screen_get_number (screen)); + g_settings_set_int (settings, PANEL_TOPLEVEL_SCREEN_KEY, gdk_x11_screen_get_screen_number (screen)); if (panel_profile_find_empty_spot (screen, &orientation, &monitor)) { g_settings_set_int (settings, PANEL_TOPLEVEL_MONITOR_KEY, monitor); g_settings_set_enum (settings, PANEL_TOPLEVEL_ORIENTATION_KEY, orientation); } - + panel_profile_add_to_list (PANEL_GSETTINGS_TOPLEVELS, id); g_object_unref (settings); @@ -1182,7 +1183,7 @@ panel_profile_load_and_show_toplevel (char *toplevel_id) GSettings *panel_settings; panel_settings = g_settings_new (PANEL_SCHEMA); objects = g_settings_get_strv (panel_settings, PANEL_OBJECT_ID_LIST_KEY); - + if (objects) { panel_profile_object_id_list_update (objects); loading_queued_applets = TRUE; @@ -1190,7 +1191,7 @@ panel_profile_load_and_show_toplevel (char *toplevel_id) if (!loading_queued_applets) mate_panel_applet_load_queued_applets (FALSE); - + g_strfreev (objects); g_object_unref (panel_settings); } @@ -1561,7 +1562,7 @@ panel_profile_load_list (GSettings *settings, gint i; changed_signal = g_strdup_printf ("changed::%s", key); - g_signal_connect (settings, changed_signal, G_CALLBACK (notify_handler), NULL); + g_signal_connect (settings, changed_signal, G_CALLBACK (notify_handler), NULL); g_free (changed_signal); list = g_settings_get_strv (settings, key); @@ -1678,7 +1679,7 @@ panel_profile_can_be_moved_freely (PanelToplevel *toplevel) if (!g_settings_is_writable (toplevel->settings, PANEL_TOPLEVEL_MONITOR_KEY)) return FALSE; - /* For expanded panels we don't really have to check + /* For expanded panels we don't really have to check x and y */ if (panel_toplevel_get_expand (toplevel)) return TRUE; diff --git a/mate-panel/panel-struts.c b/mate-panel/panel-struts.c index 4b3bd936..e83ede10 100644 --- a/mate-panel/panel-struts.c +++ b/mate-panel/panel-struts.c @@ -34,7 +34,7 @@ typedef struct { GdkScreen *screen; int monitor; - + PanelOrientation orientation; GdkRectangle geometry; int strut_size; @@ -221,7 +221,7 @@ panel_struts_allocate_struts (PanelToplevel *toplevel, geometry.height = geometry.y + geometry.height - monitor_y; geometry.y = monitor_y; } - + if (geometry.y + geometry.height > monitor_y + monitor_height) geometry.height = monitor_y + monitor_height - geometry.y; } @@ -372,8 +372,8 @@ panel_struts_compare (const PanelStrut *s1, int s2_depth; if (s1->screen != s2->screen) - return gdk_screen_get_number (s1->screen) - - gdk_screen_get_number (s2->screen); + return gdk_x11_screen_get_screen_number (s1->screen) - + gdk_x11_screen_get_screen_number (s2->screen); if (s1->monitor != s2->monitor) return s1->monitor - s2->monitor; @@ -429,7 +429,7 @@ panel_struts_register_strut (PanelToplevel *toplevel, strut->strut_size = strut_size; strut->strut_start = strut_start; strut->strut_end = strut_end; - + panel_struts_get_monitor_geometry (screen, monitor, &monitor_x, &monitor_y, &monitor_width, &monitor_height); @@ -500,7 +500,7 @@ panel_struts_update_toplevel_geometry (PanelToplevel *toplevel, g_return_val_if_fail (x != NULL, FALSE); g_return_val_if_fail (y != NULL, FALSE); - + if (!(strut = panel_struts_find_strut (toplevel))) return FALSE; diff --git a/mate-panel/xstuff.c b/mate-panel/xstuff.c index f9156c31..931b8255 100644 --- a/mate-panel/xstuff.c +++ b/mate-panel/xstuff.c @@ -137,7 +137,7 @@ zoom_draw (GtkWidget *widget, return FALSE; } -static void +static void draw_zoom_animation_composited (GdkScreen *gscreen, int x, int y, int w, int h, GdkPixbuf *pixbuf, @@ -208,10 +208,10 @@ draw_zoom_animation_composited (GdkScreen *gscreen, win); } -static void +static void draw_zoom_animation (GdkScreen *gscreen, int x, int y, int w, int h, - int fx, int fy, int fw, int fh, + int fx, int fy, int fw, int fh, int steps) { #define FRAMES (MINIATURIZE_ANIMATION_FRAMES_Z) @@ -229,7 +229,7 @@ draw_zoom_animation (GdkScreen *gscreen, dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen)); root_win = GDK_WINDOW_XID (gdk_screen_get_root_window (gscreen)); - screen = gdk_screen_get_number (gscreen); + screen = gdk_x11_screen_get_screen_number (gscreen); depth = DefaultDepth(dpy,screen); /* frame GC */ @@ -279,7 +279,7 @@ draw_zoom_animation (GdkScreen *gscreen, usleep(10); #endif for (j=0; j