summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-02-07 03:25:34 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-02-07 03:25:34 +0000
commit84c3050a7cb24c672c58bdbdf586c88f163dcd71 (patch)
treebd18d1db04cc42e4b3747053b9bc1e00dd8c4dc5 /src
parent8ae714eeaef03db0a55c11fc31834c8d65e2ea03 (diff)
downloadmetacity-84c3050a7cb24c672c58bdbdf586c88f163dcd71.tar.gz
metacity-84c3050a7cb24c672c58bdbdf586c88f163dcd71.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/display.c37
-rw-r--r--src/display.h3
-rw-r--r--src/main.c1
-rw-r--r--src/theme-parser.c16
4 files changed, 45 insertions, 12 deletions
diff --git a/src/display.c b/src/display.c
index 073232d..354055a 100644
--- a/src/display.c
+++ b/src/display.c
@@ -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
diff --git a/src/display.h b/src/display.h
index f1ef424..e9642bd 100644
--- a/src/display.h
+++ b/src/display.h
@@ -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
diff --git a/src/main.c b/src/main.c
index 4e30b1c..3b4def1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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:
diff --git a/src/theme-parser.c b/src/theme-parser.c
index dfeed94..bc7805c 100644
--- a/src/theme-parser.c
+++ b/src/theme-parser.c
@@ -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;
}