Browse Source

Check if the size actually changes before setting struts. Also check for incorrect intermediate values (bug #2598 again).

(Old svn revision: 24051)
upstream/xfce4-panel-4.10.1
Jasper Huijsmans 17 years ago
parent
commit
ea64ccc8db
  1. 5
      panel/panel-app.c
  2. 45
      panel/panel-config.c
  3. 23
      panel/panel-properties.c

5
panel/panel-app.c

@ -345,7 +345,7 @@ session_die (gpointer client_data)
}
/* screen layout */
static void
static void
monitor_size_changed (GdkScreen *screen)
{
int i;
@ -930,6 +930,9 @@ panel_app_about (GtkWidget *panel)
xfce_about_info_add_credit (info, "Jasper Huijsmans", "jasper@xfce.org",
_("Developer"));
xfce_about_info_add_credit (info, "Nick Schermer", "nick@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),

45
panel/panel-config.c

@ -97,16 +97,18 @@ create_panel_array_from_config (const char *file)
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 @@ panel_config_create_panels (void)
}
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 @@ panel_config_save_panels (GPtrArray * panels)
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)

23
panel/panel-properties.c

@ -397,13 +397,16 @@ panel_resize_function (XfcePanelWindow *window, Panel *panel,
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;
priv = panel->priv;
xmon = panel_app_get_monitor (priv->monitor);
_calculate_coordinates (priv->screen_position, &(xmon->geometry),
@ -412,8 +415,18 @@ panel_resize_function (XfcePanelWindow *window, Panel *panel,
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);
}

Loading…
Cancel
Save