mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
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.
This commit is contained in:
parent
ae148bc89f
commit
583596178f
31
ChangeLog
31
ChangeLog
@ -1,13 +1,36 @@
|
||||
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.
|
||||
|
||||
2002-08-03 Craig Black <blackc@speakeasy.net>
|
||||
|
||||
* src/keybindings.c: (meta_display_process_key_event),
|
||||
(process_tab_grab), (do_choose_window): change alt+tab
|
||||
to a windowless grab, fixes #83499
|
||||
(process_tab_grab), (do_choose_window): change alt+tab to a
|
||||
windowless grab, fixes #83499
|
||||
|
||||
2002-08-03 Craig Black <blackc@speakeasy.net>
|
||||
|
||||
* src/display.c: (event_callback): Have ButtonPress and UnmapNotify
|
||||
events account for a null grab window, fixes #87896
|
||||
* src/display.c: (event_callback): Have ButtonPress and
|
||||
UnmapNotify events account for a null grab window, fixes #87896
|
||||
|
||||
2002-08-03 Gaute Lindkvist <lindkvis@linpro.no>
|
||||
|
||||
|
18
autogen.sh
18
autogen.sh
@ -12,6 +12,14 @@ FILE=src/display.c
|
||||
|
||||
DIE=0
|
||||
|
||||
AUTOMAKE=automake-1.4
|
||||
ACLOCAL=aclocal-1.4
|
||||
|
||||
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
AUTOMAKE=automake
|
||||
ACLOCAL=aclocal
|
||||
}
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $PROJECT."
|
||||
@ -20,7 +28,7 @@ DIE=0
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile $PROJECT."
|
||||
echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz"
|
||||
@ -104,14 +112,14 @@ do
|
||||
echo "Running libtoolize..."
|
||||
libtoolize --force --copy
|
||||
fi
|
||||
echo "Running aclocal $aclocalinclude ..."
|
||||
aclocal $aclocalinclude
|
||||
echo "Running $ACLOCAL $aclocalinclude ..."
|
||||
$ACLOCAL $aclocalinclude
|
||||
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
|
||||
echo "Running autoheader..."
|
||||
autoheader
|
||||
fi
|
||||
echo "Running automake --gnu $am_opt ..."
|
||||
automake --add-missing --gnu $am_opt
|
||||
echo "Running $AUTOMAKE --gnu $am_opt ..."
|
||||
$AUTOMAKE --add-missing --gnu $am_opt
|
||||
echo "Running autoconf ..."
|
||||
autoconf
|
||||
)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -201,6 +201,7 @@ render_multi (GdkDrawable *drawable,
|
||||
0, 0);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
#undef N_COLORS
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -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
|
||||
|
74
src/theme.c
74
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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -173,9 +173,17 @@ Themes are in a simple XML-subset format.
|
||||
<!-- For buttons, drawing methods have to be provided for
|
||||
each of three states:
|
||||
normal, pressed, prelight
|
||||
and the button name must be provided:
|
||||
close, maximize, minimize, menu
|
||||
and the button function or position must be provided:
|
||||
close, maximize, minimize, menu,
|
||||
left_left_background, left_middle_background,
|
||||
left_right_background, right_left_background,
|
||||
right_middle_background, right_right_background
|
||||
So a working theme needs 3*4 = 12 button declarations
|
||||
and a theme may have up to 3*10 = 30 button declarations
|
||||
in order to handle button-rearrangement preferences.
|
||||
|
||||
(The name "function" for the attribute is from before the
|
||||
background values existed.)
|
||||
-->
|
||||
|
||||
<button function="close" state="normal" draw_ops="previously_named"/>
|
||||
|
Loading…
Reference in New Issue
Block a user