--- xfce4-panel-4.14.0-orig/plugins/pager/pager.c 2019-09-05 17:11:16.690993341 +0200 +++ xfce4-panel-4.14.0/plugins/pager/pager.c 2019-09-05 17:09:02.205850264 +0200 @@ -77,6 +77,7 @@ static void pager_plugin_configure_workspace_settings (GtkWidget *button); static void pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin); static void pager_plugin_screen_layout_changed (PagerPlugin *plugin); +static void pager_plugin_get_ratio (PagerPlugin *plugin); static void pager_plugin_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width); @@ -527,9 +528,6 @@ g_message ("Setting the pager rows returned false. Maybe the setting is not applied."); wnck_pager_set_orientation (WNCK_PAGER (plugin->pager), orientation); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - plugin->ratio = (gfloat) gdk_screen_width () / (gfloat) gdk_screen_height (); -G_GNUC_END_IGNORE_DEPRECATIONS g_signal_connect_after (G_OBJECT (plugin->pager), "drag-begin", G_CALLBACK (pager_plugin_drag_begin_event), plugin); g_signal_connect_after (G_OBJECT (plugin->pager), "drag-end", @@ -825,6 +823,26 @@ static void +pager_plugin_get_ratio (PagerPlugin *plugin) +{ + WnckWorkspace *active_ws; + + panel_return_if_fail (XFCE_IS_PAGER_PLUGIN (plugin)); + panel_return_if_fail (WNCK_IS_SCREEN (plugin->wnck_screen)); + + active_ws = wnck_screen_get_active_workspace (plugin->wnck_screen); + if (wnck_workspace_is_virtual (active_ws)) + { + plugin->ratio = (gfloat) wnck_workspace_get_width (active_ws) / (gfloat) wnck_workspace_get_height (active_ws); + } + else + { + plugin->ratio = (gfloat) gdk_screen_width () / (gfloat) gdk_screen_height (); + } +} + + +static void pager_plugin_get_preferred_width (GtkWidget *widget, gint *minimum_width, gint *natural_width) @@ -846,6 +864,9 @@ { n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen); n_cols = MAX (1, (n_workspaces + plugin->rows - 1) / plugin->rows); + + pager_plugin_get_ratio(plugin); + min_width = nat_width = (gint) (xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)) / plugin->rows * plugin->ratio * n_cols); } @@ -877,6 +898,9 @@ { n_workspaces = wnck_screen_get_workspace_count (plugin->wnck_screen); n_cols = MAX (1, (n_workspaces + plugin->rows - 1) / plugin->rows); + + pager_plugin_get_ratio(plugin); + if (mode == XFCE_PANEL_PLUGIN_MODE_VERTICAL) min_height = nat_height = (gint) (xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)) / plugin->rows / plugin->ratio * n_cols); else /* (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR) */