libwnck r1556 - in trunk: . libwnck



Author: vuntz
Date: Mon Jan 21 16:49:27 2008
New Revision: 1556
URL: http://svn.gnome.org/viewvc/libwnck?rev=1556&view=rev

Log:
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


Modified:
   trunk/ChangeLog
   trunk/libwnck/pager.c

Modified: trunk/libwnck/pager.c
==============================================================================
--- trunk/libwnck/pager.c	(original)
+++ trunk/libwnck/pager.c	Mon Jan 21 16:49:27 2008
@@ -289,6 +289,9 @@
 {
   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 @@
   /* 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 @@
  * 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 @@
  * 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.
  */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]