redo window sizes/appearance when the theme changes

2002-02-06  Havoc Pennington  <hp@pobox.com>

	* src/main.c (prefs_changed_callback): redo window
	sizes/appearance when the theme changes

	* src/display.c (meta_display_retheme_all): new function

	* src/theme-parser.c (locate_attributes): remove error handling
	for MAX_ATTRS reached, add an assert instead, the way this code
	ended up the attrs in the array depend on the code not the theme
	file.
This commit is contained in:
Havoc Pennington 2002-02-07 03:25:34 +00:00 committed by Havoc Pennington
parent 8ae714eeae
commit 84c3050a7c
5 changed files with 57 additions and 12 deletions

View File

@ -1,3 +1,15 @@
2002-02-06 Havoc Pennington <hp@pobox.com>
* src/main.c (prefs_changed_callback): redo window
sizes/appearance when the theme changes
* src/display.c (meta_display_retheme_all): new function
* src/theme-parser.c (locate_attributes): remove error handling
for MAX_ATTRS reached, add an assert instead, the way this code
ended up the attrs in the array depend on the code not the theme
file.
2002-02-06 Havoc Pennington <hp@pobox.com>
* src/main.c (main): disable custom log handler and fatal mask for

View File

@ -1112,6 +1112,7 @@ event_callback (XEvent *event,
meta_verbose ("Received reload theme request\n");
meta_ui_set_current_theme (meta_prefs_get_theme (),
TRUE);
meta_display_retheme_all ();
}
}
}
@ -2067,6 +2068,42 @@ meta_display_unshow_desktop (MetaDisplay *display)
queue_windows_showing (display);
}
void
meta_display_queue_retheme_all_windows (MetaDisplay *display)
{
GSList* windows;
GSList *tmp;
windows = meta_display_list_windows (display);
tmp = windows;
while (tmp != NULL)
{
MetaWindow *window = tmp->data;
meta_window_queue_move_resize (window);
if (window->frame)
meta_frame_queue_draw (window->frame);
tmp = tmp->next;
}
g_slist_free (windows);
}
void
meta_display_retheme_all (void)
{
GSList *tmp;
tmp = meta_displays_list ();
while (tmp != NULL)
{
MetaDisplay *display = tmp->data;
meta_display_queue_retheme_all_windows (display);
tmp = tmp->next;
}
}
static gboolean is_syncing = FALSE;
gboolean

View File

@ -228,4 +228,7 @@ guint32 meta_display_get_current_time (MetaDisplay *display);
const char* meta_focus_mode_to_string (int m);
const char* meta_focus_detail_to_string (int d);
void meta_display_queue_retheme_all_windows (MetaDisplay *display);
void meta_display_retheme_all (void);
#endif

View File

@ -310,6 +310,7 @@ prefs_changed_callback (MetaPreference pref,
{
case META_PREF_THEME:
meta_ui_set_current_theme (meta_prefs_get_theme (), FALSE);
meta_display_retheme_all ();
break;
default:

View File

@ -356,14 +356,7 @@ locate_attributes (GMarkupParseContext *context,
{
g_return_val_if_fail (retloc != NULL, FALSE);
if (n_attrs == MAX_ATTRS)
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
_("Element <%s> has more than %d attributes, can't possibly be valid"),
element_name, MAX_ATTRS);
retval = FALSE;
goto out;
}
g_assert (n_attrs < MAX_ATTRS);
attrs[n_attrs].name = name;
attrs[n_attrs].retloc = retloc;
@ -374,7 +367,6 @@ locate_attributes (GMarkupParseContext *context,
retloc = va_arg (args, const char**);
}
out:
va_end (args);
if (!retval)
@ -402,7 +394,7 @@ locate_attributes (GMarkupParseContext *context,
_("Attribute \"%s\" repeated twice on the same <%s> element"),
attrs[j].name, element_name);
retval = FALSE;
goto out2;
goto out;
}
*retloc = attribute_values[i];
@ -420,13 +412,13 @@ locate_attributes (GMarkupParseContext *context,
_("Attribute \"%s\" is invalid on <%s> element in this context"),
attribute_names[i], element_name);
retval = FALSE;
goto out2;
goto out;
}
++i;
}
out2:
out:
return retval;
}