diff options
author | Havoc Pennington <hp@pobox.com> | 2002-02-07 03:07:56 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-02-07 03:07:56 +0000 |
commit | 8ae714eeaef03db0a55c11fc31834c8d65e2ea03 (patch) | |
tree | e3bc1027754f8e70bfc06266f798f682802c4342 /src/menu.c | |
parent | 2be2d8ccbe196193d383841e1c990843a35d4f1b (diff) | |
download | metacity-8ae714eeaef03db0a55c11fc31834c8d65e2ea03.tar.gz |
disable custom log handler and fatal mask for now
2002-02-06 Havoc Pennington <hp@pobox.com>
* src/main.c (main): disable custom log handler and fatal mask for
now
* src/theme.c (meta_draw_op_list_draw):
Add META_DRAW_CLIP
* src/main.c: load theme, monitor current theme setting
* src/prefs.c: add "current theme" setting
* src/stack.c (meta_stack_free): don't try to free
last_root_children_stacked if it doesn't exist
* src/themewidget.c: pluggable GtkMisc subclass to use
for menu icons
* src/screen.c (meta_screen_manage_all_windows): fix
signed/unsigned warning
* src/frames.c: port to theme system
(meta_frames_style_set): chain up
* theme-format.txt: new file
* configure.in: add more compiler warnings
* src/theme.c: add various stuff needed to get theme parser
working. Remove the "spacer" concept from FrameLayout object.
Add draw op that references a draw op list.
* configure.in: require GTK 1.3.13
* src/Makefile.am: add theme-parser.[hc], implement loading a
theme
* src/theme.c: add "draw title" and "draw window icon" operations
(meta_draw_op_draw): put object_width/object_height in expression
environment before computing x/y. Handle out-of-memory when
creating pixbufs. Assorted other cleanups.
Diffstat (limited to 'src/menu.c')
-rw-r--r-- | src/menu.c | 85 |
1 files changed, 61 insertions, 24 deletions
@@ -24,6 +24,7 @@ #include "main.h" #include "util.h" #include "core.h" +#include "themewidget.h" typedef struct _MenuItem MenuItem; typedef struct _MenuData MenuData; @@ -117,6 +118,41 @@ activate_cb (GtkWidget *menuitem, gpointer data) /* menu may now be freed */ } +static void +menu_icon_size_func (MetaArea *area, + int *width, + int *height, + void *user_data) +{ + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, + width, height); +} + +static void +menu_icon_expose_func (MetaArea *area, + GdkEventExpose *event, + int x_offset, + int y_offset, + void *user_data) +{ + int width, height; + MetaMenuIconType type; + + type = GPOINTER_TO_INT (user_data); + + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, + &width, &height); + + meta_theme_draw_menu_icon (meta_theme_get_current (), + GTK_WIDGET (area), + GTK_WIDGET (area)->window, + &event->area, + x_offset, y_offset, + width, height, + type); +} + + MetaWindowMenu* meta_window_menu_new (MetaFrames *frames, MetaMenuOp ops, @@ -141,7 +177,7 @@ meta_window_menu_new (MetaFrames *frames, menu->menu = gtk_menu_new (); i = 0; - while (i < G_N_ELEMENTS (menuitems)) + while (i < (int) G_N_ELEMENTS (menuitems)) { if (ops & menuitems[i].op || menuitems[i].op == 0) { @@ -155,48 +191,49 @@ meta_window_menu_new (MetaFrames *frames, else { GtkWidget *image; - GdkPixmap *pix; - GdkBitmap *mask; image = NULL; - pix = NULL; - mask = NULL; switch (menuitems[i].op) { case META_MENU_OP_MAXIMIZE: - meta_frames_get_pixmap_for_control (frames, - META_FRAME_CONTROL_MAXIMIZE, - &pix, &mask); + image = meta_area_new (); + meta_area_setup (META_AREA (image), + menu_icon_size_func, + menu_icon_expose_func, + GINT_TO_POINTER (META_MENU_ICON_TYPE_MAXIMIZE), + NULL); break; case META_MENU_OP_UNMAXIMIZE: - meta_frames_get_pixmap_for_control (frames, - META_FRAME_CONTROL_UNMAXIMIZE, - &pix, &mask); + image = meta_area_new (); + meta_area_setup (META_AREA (image), + menu_icon_size_func, + menu_icon_expose_func, + GINT_TO_POINTER (META_MENU_ICON_TYPE_UNMAXIMIZE), + NULL); break; case META_MENU_OP_MINIMIZE: - meta_frames_get_pixmap_for_control (frames, - META_FRAME_CONTROL_MINIMIZE, - &pix, &mask); + image = meta_area_new (); + meta_area_setup (META_AREA (image), + menu_icon_size_func, + menu_icon_expose_func, + GINT_TO_POINTER (META_MENU_ICON_TYPE_MINIMIZE), + NULL); break; case META_MENU_OP_DELETE: - meta_frames_get_pixmap_for_control (frames, - META_FRAME_CONTROL_DELETE, - &pix, &mask); + image = meta_area_new (); + meta_area_setup (META_AREA (image), + menu_icon_size_func, + menu_icon_expose_func, + GINT_TO_POINTER (META_MENU_ICON_TYPE_CLOSE), + NULL); break; default: break; } - - if (pix) - { - image = gtk_image_new_from_pixmap (pix, mask); - g_object_unref (G_OBJECT (pix)); - g_object_unref (G_OBJECT (mask)); - } if (image == NULL && menuitems[i].stock_id) |