[Xfce4-commits] r24051 - xfce4-panel/trunk/panel
Jasper Huijsmans
jasper at xfce.org
Wed Dec 6 21:10:26 CET 2006
Author: jasper
Date: 2006-12-06 20:10:25 +0000 (Wed, 06 Dec 2006)
New Revision: 24051
Modified:
xfce4-panel/trunk/panel/panel-app.c
xfce4-panel/trunk/panel/panel-config.c
xfce4-panel/trunk/panel/panel-properties.c
Log:
Check if the size actually changes before setting struts. Also check for incorrect intermediate values (bug #2598 again).
Modified: xfce4-panel/trunk/panel/panel-app.c
===================================================================
--- xfce4-panel/trunk/panel/panel-app.c 2006-12-06 06:47:50 UTC (rev 24050)
+++ xfce4-panel/trunk/panel/panel-app.c 2006-12-06 20:10:25 UTC (rev 24051)
@@ -345,7 +345,7 @@
}
/* screen layout */
- static void
+static void
monitor_size_changed (GdkScreen *screen)
{
int i;
@@ -930,6 +930,9 @@
xfce_about_info_add_credit (info, "Jasper Huijsmans", "jasper at xfce.org",
_("Developer"));
+ xfce_about_info_add_credit (info, "Nick Schermer", "nick at xfce.org",
+ _("Developer"));
+
pb = xfce_themed_icon_load ("xfce4-panel", 48);
dlg = xfce_about_dialog_new_with_values (NULL, info, pb);
gtk_window_set_screen (GTK_WINDOW (dlg),
Modified: xfce4-panel/trunk/panel/panel-config.c
===================================================================
--- xfce4-panel/trunk/panel/panel-config.c 2006-12-06 06:47:50 UTC (rev 24050)
+++ xfce4-panel/trunk/panel/panel-config.c 2006-12-06 20:10:25 UTC (rev 24051)
@@ -97,16 +97,18 @@
GPtrArray *
panel_config_create_panels (void)
{
- char *file = NULL;
- GPtrArray *array = NULL;
- gboolean use_user_config;
+ gboolean use_user_config;
+ char *file = NULL;
+ GPtrArray *array = NULL;
+ char *path = "xfce4" G_DIR_SEPARATOR_S
+ "panel" G_DIR_SEPARATOR_S
+ "panels.xml";
use_user_config = xfce_allow_panel_customization ();
if (G_UNLIKELY (!use_user_config))
{
- file = g_build_filename (SYSCONFDIR, "xdg", "xfce4", "panel",
- "panels.xml", NULL);
+ file = g_build_filename (SYSCONFDIR, "xdg", path, NULL);
if (!g_file_test (file, G_FILE_TEST_IS_REGULAR))
{
@@ -117,26 +119,21 @@
}
else
{
- char *path = g_build_filename ("xfce4", "panel", "panels.xml", NULL);
-
file = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, path);
- g_free (path);
- }
-
- if (G_UNLIKELY (!file && use_user_config))
- {
- file = g_build_filename (SYSCONFDIR, "xdg", "xfce4", "panel",
- "panels.xml", NULL);
-
- if (!g_file_test (file, G_FILE_TEST_IS_REGULAR))
+ if (G_UNLIKELY (!file))
{
- g_free (file);
+ file = g_build_filename (SYSCONFDIR, path, NULL);
- file = NULL;
+ if (!g_file_test (file, G_FILE_TEST_IS_REGULAR))
+ {
+ g_free (file);
+
+ file = NULL;
+ }
}
}
-
+
if (file)
array = create_panel_array_from_config (file);
else
@@ -158,15 +155,13 @@
if (use_user_config)
{
- int i;
- char *path;
-
- path = g_build_filename ("xfce4", "panel", "panels.xml", NULL);
+ int i;
+ char *path = "xfce4" G_DIR_SEPARATOR_S
+ "panel" G_DIR_SEPARATOR_S
+ "panels.xml";
file = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, path, TRUE);
- g_free (path);
-
failed = !config_save_to_file (panels, file);
for (i = 0; i < panels->len; ++i)
Modified: xfce4-panel/trunk/panel/panel-properties.c
===================================================================
--- xfce4-panel/trunk/panel/panel-properties.c 2006-12-06 06:47:50 UTC (rev 24050)
+++ xfce4-panel/trunk/panel/panel-properties.c 2006-12-06 20:10:25 UTC (rev 24051)
@@ -397,13 +397,16 @@
GtkAllocation *old, GtkAllocation *new, int *x, int *y)
{
PanelPrivate *priv;
- XfceMonitor *xmon;
+ XfceMonitor *xmon;
+ DBG ("old: %dx%d\tnew: %dx%d",
+ old ? old->width : 0, old ? old->height : 0,
+ new->width, new->height );
+
if (!GTK_WIDGET_VISIBLE (panel))
return;
-
+
priv = panel->priv;
-
xmon = panel_app_get_monitor (priv->monitor);
_calculate_coordinates (priv->screen_position, &(xmon->geometry),
@@ -412,9 +415,19 @@
priv->xoffset = *x - xmon->geometry.x;
priv->yoffset = *y - xmon->geometry.y;
- DBG ("\n + Position: %d\n + Offset: (%d, %d)",
- priv->screen_position, priv->xoffset, priv->yoffset);
+ /* No change. We do need to calculate the position above, but we only need
+ * to update the struts when the size actually changes. */
+ if (old && new->width == old->width && new->height == old->height)
+ return;
+ /* Catch incorrect intermediate values when changing orientation:
+ * check if both height and width are larger than half the screen. */
+ if (new->width * 2 > xmon->geometry.width &&
+ new->height * 2 > xmon->geometry.height)
+ {
+ return;
+ }
+
_set_struts (panel, xmon, *x, *y, new->width, new->height);
}
More information about the Xfce4-commits
mailing list