summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-08-04 20:02:45 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-08-04 20:02:45 +0000
commit583596178ff110e80bfd41a7ed1c2fb5a062ad9f (patch)
treecfb2b2f7ced68fbd07f99ae174db57b7f420e46f /src
parentae148bc89f71b796f078a08228f095800c787e9f (diff)
downloadmetacity-583596178ff110e80bfd41a7ed1c2fb5a062ad9f.tar.gz
metacity-583596178ff110e80bfd41a7ed1c2fb5a062ad9f.tar.bz2
use MetaMenuIconType not button type for the size of the menu ops array
2002-08-04 Havoc Pennington <hp@redhat.com> * src/theme.c (free_menu_ops): use MetaMenuIconType not button type for the size of the menu ops array (meta_theme_define_int_constant): return TRUE on success (how the heck did this ever work?) (meta_theme_define_float_constant): return TRUE on success (meta_frame_style_validate): allow the "positional" buttons to be omitted for now. * src/testgradient.c (render_multi): don't define N_COLORS twice * src/theme-viewer.c (run_theme_benchmark): don't define ITERATIONS twice * src/theme.c (button_rect): handle new button types (meta_button_type_to_string): update (meta_button_type_from_string): update * src/theme.h (enum): add button types for the 6 possible button positions. No way to reposition buttons still but this will allow themes to go ahead and support doing so.
Diffstat (limited to 'src')
-rw-r--r--src/display.c5
-rw-r--r--src/testgradient.c1
-rw-r--r--src/theme-viewer.c2
-rw-r--r--src/theme.c74
-rw-r--r--src/theme.h7
5 files changed, 73 insertions, 16 deletions
diff --git a/src/display.c b/src/display.c
index 2d72b7d..15b96b9 100644
--- a/src/display.c
+++ b/src/display.c
@@ -1021,7 +1021,10 @@ event_callback (XEvent *event,
if (window &&
window->frame &&
modified == window->frame->xwindow)
- frame_was_receiver = TRUE;
+ {
+ frame_was_receiver = TRUE;
+ meta_topic (META_DEBUG_EVENTS, "Frame was receiver of event\n");
+ }
switch (event->type)
{
diff --git a/src/testgradient.c b/src/testgradient.c
index 7d16b42..ae7c125 100644
--- a/src/testgradient.c
+++ b/src/testgradient.c
@@ -201,6 +201,7 @@ render_multi (GdkDrawable *drawable,
0, 0);
g_object_unref (G_OBJECT (pixbuf));
+#undef N_COLORS
}
static void
diff --git a/src/theme-viewer.c b/src/theme-viewer.c
index 5687a00..1f7cc0f 100644
--- a/src/theme-viewer.c
+++ b/src/theme-viewer.c
@@ -744,6 +744,8 @@ run_theme_benchmark (int client_width,
g_object_unref (G_OBJECT (layout));
g_object_unref (G_OBJECT (pixmap));
gtk_widget_destroy (widget);
+
+#undef ITERATIONS
}
typedef struct
diff --git a/src/theme.c b/src/theme.c
index dd7d5b3..cc5e73d 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -3556,20 +3556,24 @@ meta_frame_style_validate (MetaFrameStyle *style,
i = 0;
while (i < META_BUTTON_TYPE_LAST)
{
- j = 0;
- while (j < META_BUTTON_STATE_LAST)
- {
- if (get_button (style, i, j) == NULL)
+ /* for now the "positional" buttons are optional */
+ if (i >= META_BUTTON_TYPE_CLOSE)
+ {
+ j = 0;
+ while (j < META_BUTTON_STATE_LAST)
{
- g_set_error (error, META_THEME_ERROR,
- META_THEME_ERROR_FAILED,
- _("<button function=\"%s\" state=\"%s\" draw_ops=\"whatever\"/> must be specified for this frame style"),
- meta_button_type_to_string (i),
- meta_button_state_to_string (j));
- return FALSE;
+ if (get_button (style, i, j) == NULL)
+ {
+ g_set_error (error, META_THEME_ERROR,
+ META_THEME_ERROR_FAILED,
+ _("<button function=\"%s\" state=\"%s\" draw_ops=\"whatever\"/> must be specified for this frame style"),
+ meta_button_type_to_string (i),
+ meta_button_state_to_string (j));
+ return FALSE;
+ }
+
+ ++j;
}
-
- ++j;
}
++i;
@@ -3585,22 +3589,34 @@ button_rect (MetaButtonType type,
{
switch (type)
{
+ case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
case META_BUTTON_TYPE_CLOSE:
*rect = fgeom->close_rect;
break;
+ case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
case META_BUTTON_TYPE_MAXIMIZE:
*rect = fgeom->max_rect;
break;
+ case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
case META_BUTTON_TYPE_MINIMIZE:
*rect = fgeom->min_rect;
break;
+ case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
case META_BUTTON_TYPE_MENU:
*rect = fgeom->menu_rect;
break;
+ case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
+ case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
+ rect->x = 0;
+ rect->y = 0;
+ rect->width = 0;
+ rect->height = 0;
+ break;
+
case META_BUTTON_TYPE_LAST:
g_assert_not_reached ();
break;
@@ -4113,12 +4129,12 @@ meta_theme_new (void)
static void
-free_menu_ops (MetaDrawOpList *op_lists[META_BUTTON_TYPE_LAST][N_GTK_STATES])
+free_menu_ops (MetaDrawOpList *op_lists[META_MENU_ICON_TYPE_LAST][N_GTK_STATES])
{
int i, j;
i = 0;
- while (i < META_BUTTON_TYPE_LAST)
+ while (i < META_MENU_ICON_TYPE_LAST)
{
j = 0;
while (j < N_GTK_STATES)
@@ -4662,6 +4678,8 @@ meta_theme_define_int_constant (MetaTheme *theme,
g_hash_table_insert (theme->integer_constants,
g_strdup (name),
GINT_TO_POINTER (value));
+
+ return TRUE;
}
gboolean
@@ -4723,7 +4741,9 @@ meta_theme_define_float_constant (MetaTheme *theme,
*d = value;
g_hash_table_insert (theme->float_constants,
- g_strdup (name), d);
+ g_strdup (name), d);
+
+ return TRUE;
}
gboolean
@@ -4883,6 +4903,18 @@ meta_button_type_from_string (const char *str)
return META_BUTTON_TYPE_MINIMIZE;
else if (strcmp ("menu", str) == 0)
return META_BUTTON_TYPE_MENU;
+ else if (strcmp ("left_left_background", str) == 0)
+ return META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND;
+ else if (strcmp ("left_middle_background", str) == 0)
+ return META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND;
+ else if (strcmp ("left_right_background", str) == 0)
+ return META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND;
+ else if (strcmp ("right_left_background", str) == 0)
+ return META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND;
+ else if (strcmp ("right_middle_background", str) == 0)
+ return META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND;
+ else if (strcmp ("right_right_background", str) == 0)
+ return META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND;
else
return META_BUTTON_TYPE_LAST;
}
@@ -4900,6 +4932,18 @@ meta_button_type_to_string (MetaButtonType type)
return "minimize";
case META_BUTTON_TYPE_MENU:
return "menu";
+ case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
+ return "left_left_background";
+ case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
+ return "left_middle_background";
+ case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
+ return "left_right_background";
+ case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
+ return "right_left_background";
+ case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
+ return "right_middle_background";
+ case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
+ return "right_right_background";
case META_BUTTON_TYPE_LAST:
break;
}
diff --git a/src/theme.h b/src/theme.h
index df946af..2e4151e 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -396,6 +396,13 @@ typedef enum
typedef enum
{
+ /* Ordered so that background is drawn first */
+ META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
+ META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
+ META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
+ META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
+ META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
+ META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
META_BUTTON_TYPE_CLOSE,
META_BUTTON_TYPE_MAXIMIZE,
META_BUTTON_TYPE_MINIMIZE,