summaryrefslogtreecommitdiff
path: root/libwnck
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2008-01-21 16:49:27 +0000
committerVincent Untz <vuntz@src.gnome.org>2008-01-21 16:49:27 +0000
commitbcbd0145991b7862eeb31d577925b57ef2aa249c (patch)
tree050aac69370d4b9be0df3751292e0b4862a56f24 /libwnck
parentbfae086040ffa679f1595156e2179b9669f8eedd (diff)
downloadlibwnck-bcbd0145991b7862eeb31d577925b57ef2aa249c.tar.gz
Make the pager always work in multiscreen environment. Fix bug #479959.
2008-01-21 Vincent Untz <vuntz@gnome.org> Make the pager always work in multiscreen environment. Fix bug #479959. Thanks go to David Sundqvist <bugzilla@dystopic.org> for the help in debugging this. * libwnck/pager.c: (_wnck_pager_set_screen): do nothing if the pager is not on a screen. Else, we might work on the default screen, which is bad in a multiscreen environment. (wnck_pager_set_layout_hint): do not assume that _wnck_pager_set_screen() worked. Someone can call this function before the pager has been added to a widget hierarchy, and so before we know the screen the pager will work on. (wnck_pager_set_orientation): document this specific case of failure (wnck_pager_set_n_rows): ditto svn path=/trunk/; revision=1556
Diffstat (limited to 'libwnck')
-rw-r--r--libwnck/pager.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libwnck/pager.c b/libwnck/pager.c
index 337808d..9a615b6 100644
--- a/libwnck/pager.c
+++ b/libwnck/pager.c
@@ -289,6 +289,9 @@ _wnck_pager_set_screen (WnckPager *pager)
{
GdkScreen *gdkscreen;
+ if (!gtk_widget_has_screen (GTK_WIDGET (pager)))
+ return;
+
gdkscreen = gtk_widget_get_screen (GTK_WIDGET (pager));
pager->priv->screen = wnck_screen_get (gdk_screen_get_number (gdkscreen));
@@ -1948,7 +1951,9 @@ wnck_pager_set_layout_hint (WnckPager *pager)
/* if we're not realized, we don't know about our screen yet */
if (pager->priv->screen == NULL)
_wnck_pager_set_screen (pager);
- g_assert (pager->priv->screen != NULL);
+ /* can still happen if the pager was not added to a widget hierarchy */
+ if (pager->priv->screen == NULL)
+ return FALSE;
/* The visual representation of the pager doesn't
* correspond to the layout of the workspaces
@@ -1998,6 +2003,9 @@ wnck_pager_set_layout_hint (WnckPager *pager)
* For example, if the layout contains one row, but the orientation of the
* layout is vertical, the #WnckPager will display a column of #WnckWorkspace.
*
+ * If @pager has not been added to a widget hierarchy, the call will fail
+ * because @pager can't know the screen on which to modify the orientation.
+ *
* Return value: %TRUE if the layout of #WnckWorkspace has been successfully
* changed or did not need to be changed, %FALSE otherwise.
*/
@@ -2042,6 +2050,9 @@ wnck_pager_set_orientation (WnckPager *pager,
* set this property of a #WnckScreen at a time, setting the layout is not
* guaranteed to work.
*
+ * If @pager has not been added to a widget hierarchy, the call will fail
+ * because @pager can't know the screen on which to modify the layout.
+ *
* Return value: %TRUE if the layout of #WnckWorkspace has been successfully
* changed or did not need to be changed, %FALSE otherwise.
*/