[Xfce4-commits] <xfce4-panel:devel> Force a pager rebuild on screen changes (bug #3328).
Nick Schermer
noreply at xfce.org
Tue Feb 2 20:44:02 CET 2010
Updating branch refs/heads/devel
to 0cdd86a4e1db680e766e7b6e1a387a4553e8b5c4 (commit)
from fa6bf45b08be59f1d0acc97676aa9f86a5ced2e8 (commit)
commit 0cdd86a4e1db680e766e7b6e1a387a4553e8b5c4
Author: Nick Schermer <nick at xfce.org>
Date: Tue Feb 2 20:13:13 2010 +0100
Force a pager rebuild on screen changes (bug #3328).
plugins/pager/pager.c | 53 +++++++++++++++++++++++++++++++++++-------------
1 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/plugins/pager/pager.c b/plugins/pager/pager.c
index c3c6f59..d3d7af4 100644
--- a/plugins/pager/pager.c
+++ b/plugins/pager/pager.c
@@ -266,6 +266,36 @@ pager_plugin_scroll_event (GtkWidget *widget,
static void
+pager_plugin_screen_layout_changed (PagerPlugin *plugin)
+{
+ panel_return_if_fail (XFCE_IS_PAGER_PLUGIN (plugin));
+ panel_return_if_fail (WNCK_IS_SCREEN (plugin->wnck_screen));
+
+ if (G_UNLIKELY (plugin->wnck_pager != NULL))
+ {
+ /* destroy the existing pager */
+ gtk_widget_destroy (GTK_WIDGET (plugin->wnck_pager));
+
+ /* force a screen update */
+ wnck_screen_force_update (plugin->wnck_screen);
+ }
+
+ /* create the wnck pager */
+ plugin->wnck_pager = wnck_pager_new (plugin->wnck_screen);
+ gtk_container_add (GTK_CONTAINER (plugin), plugin->wnck_pager);
+ gtk_widget_show (plugin->wnck_pager);
+
+ /* set the pager properties */
+ wnck_pager_set_display_mode (WNCK_PAGER (plugin->wnck_pager),
+ plugin->show_names ?
+ WNCK_PAGER_DISPLAY_NAME :
+ WNCK_PAGER_DISPLAY_CONTENT);
+ wnck_pager_set_n_rows (WNCK_PAGER (plugin->wnck_pager), plugin->rows);
+}
+
+
+
+static void
pager_plugin_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
{
@@ -280,24 +310,17 @@ pager_plugin_screen_changed (GtkWidget *widget,
/* only update if the screen changed */
if (plugin->wnck_screen != wnck_screen)
{
- /* destroy the existing pager */
- if (G_UNLIKELY (plugin->wnck_pager != NULL))
- gtk_widget_destroy (GTK_WIDGET (plugin->wnck_pager));
-
/* set the new screen */
plugin->wnck_screen = wnck_screen;
- /* create the wnck pager */
- plugin->wnck_pager = wnck_pager_new (wnck_screen);
- gtk_container_add (GTK_CONTAINER (widget), plugin->wnck_pager);
- gtk_widget_show (plugin->wnck_pager);
-
- /* set the pager properties */
- wnck_pager_set_display_mode (WNCK_PAGER (plugin->wnck_pager),
- plugin->show_names ?
- WNCK_PAGER_DISPLAY_NAME :
- WNCK_PAGER_DISPLAY_CONTENT);
- wnck_pager_set_n_rows (WNCK_PAGER (plugin->wnck_pager), plugin->rows);
+ /* rebuild the pager */
+ pager_plugin_screen_layout_changed (plugin);
+
+ /* watch the screen for changes */
+ g_signal_connect_swapped (G_OBJECT (screen), "monitors-changed",
+ G_CALLBACK (pager_plugin_screen_layout_changed), plugin);
+ g_signal_connect_swapped (G_OBJECT (screen), "size-changed",
+ G_CALLBACK (pager_plugin_screen_layout_changed), plugin);
}
}
More information about the Xfce4-commits
mailing list