1 diff -urN aa/gnome-panel-2.5.92/gnome-panel/Makefile.am gnome-panel-2.5.92/gnome-panel/Makefile.am
2 --- aa/gnome-panel-2.5.92/gnome-panel/Makefile.am 2004-02-06 17:04:50.000000000 +0100
3 +++ gnome-panel-2.5.92/gnome-panel/Makefile.am 2004-03-12 14:24:21.791325944 +0100
13 diff -urN aa/gnome-panel-2.5.92/gnome-panel/menu.c gnome-panel-2.5.92/gnome-panel/menu.c
14 --- aa/gnome-panel-2.5.92/gnome-panel/menu.c 2004-03-09 11:08:47.000000000 +0100
15 +++ gnome-panel-2.5.92/gnome-panel/menu.c 2004-03-12 14:24:21.795325336 +0100
17 #include "menu-fentry.h"
18 #include "menu-util.h"
19 #include "menu-ditem.h"
20 +#include "panel-menu.h"
21 #include "panel-util.h"
22 #include "panel-gconf.h"
25 #include "panel-lockdown.h"
28 +#define MENU_SNAP_LENGTH 10
30 static char *gnome_folder = NULL;
33 if (repo->orig_func != NULL) {
34 repo->orig_func (menu, x, y, push_in, repo->orig_data);
36 + if (*x < MENU_SNAP_LENGTH)
39 if (menu->parent_menu_item != NULL) {
40 /* This is a submenu so behave submenuish */
41 if (*x < monitor_basex ||
43 reload_image_menu_items ();
47 -panel_create_menu (void)
49 +panel_create_menu_of_type (GType menu_type)
52 static gboolean registered_icon_theme_changer = FALSE;
54 G_CALLBACK (icon_theme_changed), NULL);
57 - retval = gtk_menu_new ();
59 + retval = g_object_new (menu_type, NULL);
60 panel_gconf_notify_add_while_alive ("/desktop/gnome/interface/menus_have_icons",
61 (GConfClientNotifyFunc) menus_have_icons_changed,
68 +panel_create_menu (void)
70 + return panel_create_menu_of_type (gtk_menu_get_type());
75 +menu_new_of_type (GType menu_type)
79 - retval = panel_create_menu ();
80 + retval = panel_create_menu_of_type (menu_type);
83 retval, "show", G_CALLBACK (setup_menu_panel), NULL);
91 + return menu_new_of_type (gtk_menu_get_type ());
96 icon_to_load_free (IconToLoad *icon)
102 - root_menu = menu_new ();
103 + root_menu = menu_new_of_type (panel_menu_get_type ());
105 g_object_set_data (G_OBJECT (root_menu), "menu_panel", panel);
107 diff -urN aa/gnome-panel-2.5.92/gnome-panel/panel-config-global.c gnome-panel-2.5.92/gnome-panel/panel-config-global.c
108 --- aa/gnome-panel-2.5.92/gnome-panel/panel-config-global.c 2004-01-18 15:35:47.000000000 +0100
109 +++ gnome-panel-2.5.92/gnome-panel/panel-config-global.c 2004-03-12 14:24:21.795325336 +0100
111 guint drawer_auto_close : 1;
112 guint confirm_panel_remove : 1;
113 guint highlight_when_over : 1;
114 + guint menu_stripe : 1;
117 static GlobalConfig global_config = { 0, };
120 return global_config.confirm_panel_remove;
123 +panel_global_config_get_menu_stripe (void)
125 + g_assert (global_config_initialised == TRUE);
127 + return global_config.menu_stripe;
131 panel_global_config_set_entry (GConfEntry *entry)
133 else if (strcmp (key, "highlight_launchers_on_mouseover") == 0)
134 global_config.highlight_when_over =
135 gconf_value_get_bool (value);
137 + else if (strcmp (key, "show_menu_stripe") == 0)
138 + global_config.menu_stripe =
139 + gconf_value_get_bool (value);
144 diff -urN aa/gnome-panel-2.5.92/gnome-panel/panel-config-global.h gnome-panel-2.5.92/gnome-panel/panel-config-global.h
145 --- aa/gnome-panel-2.5.92/gnome-panel/panel-config-global.h 2004-01-18 15:32:28.000000000 +0100
146 +++ gnome-panel-2.5.92/gnome-panel/panel-config-global.h 2004-03-12 14:24:21.796325184 +0100
148 gboolean panel_global_config_get_drawer_auto_close (void);
149 gboolean panel_global_config_get_tooltips_enabled (void);
150 gboolean panel_global_config_get_confirm_panel_remove (void);
151 +gboolean panel_global_config_get_menu_stripe (void);
155 diff -urN aa/gnome-panel-2.5.92/gnome-panel/panel-global.schemas.in gnome-panel-2.5.92/gnome-panel/panel-global.schemas.in
156 --- aa/gnome-panel-2.5.92/gnome-panel/panel-global.schemas.in 2004-01-18 16:10:23.000000000 +0100
157 +++ gnome-panel-2.5.92/gnome-panel/panel-global.schemas.in 2004-03-12 14:24:21.797325032 +0100
162 + <key>/schemas/apps/panel/global/show_menu_stripe</key>
163 + <applyto>/apps/panel/global/show_menu_stripe</applyto>
164 + <owner>panel</owner>
166 + <default>true</default>
174 <key>/schemas/apps/panel/global/enable_key_bindings</key>
175 <applyto>/apps/panel/global/enable_key_bindings</applyto>
177 diff -urN aa/gnome-panel-2.5.92/gnome-panel/panel-menu.c gnome-panel-2.5.92/gnome-panel/panel-menu.c
178 --- aa/gnome-panel-2.5.92/gnome-panel/panel-menu.c 1970-01-01 01:00:00.000000000 +0100
179 +++ gnome-panel-2.5.92/gnome-panel/panel-menu.c 2004-03-12 14:39:15.063527928 +0100
182 + * To set this up insert something like this in your ~/.gtkrc-2.0
184 + * Copyright (C) 2002 Ximian, Inc.
185 + * Copyright (C) 2001 Havoc Pennington
186 + * Copyright (C) 1997-2000 Dan Pascu and Alfredo Kojima
187 + * Copyright (C) 2003 Marcin Krzy¿anowski
191 + * PanelMenu::default_side_image = "/tmp/stripelogo.png"
192 + * PanelMenu::gradient_bg = true
194 + * class "PanelMenu" style "default"
197 + * Thomas, Michael Meeks
198 + * GtkMenu code by the GTK+ team
199 + * Gradient code from WindowMaker by Dan Pascu and Alfredo Kojima,
200 + * by way of metacity by Havoc Pennington.
201 + * Marcin Krzy¿anowski
205 +#include <libgnome/gnome-macros.h>
206 +#include <libgnome/gnome-program.h>
207 +#include <libgnome/gnome-i18n.h>
208 +#include <gtk/gtkgc.h>
209 +#include <gtk/gtkimagemenuitem.h>
210 +#include <gtk/gtkseparatormenuitem.h>
211 +#include <gtk/gtkmenu.h>
212 +#include <gtk/gtkwidget.h>
213 +#include <gtk/gtkwindow.h>
214 +#include <gtk/gtkmain.h>
215 +#include <gdk/gdkwindow.h>
216 +#include <panel-menu.h>
218 +#include "panel-config-global.h"
220 +#define dprintf(a) g_warning a
221 +/*#define dprintf(a) G_STMT_START { (void) 0; } G_STMT_END*/
223 +GNOME_CLASS_BOILERPLATE (PanelMenu, panel_menu,
224 + GtkMenu, GTK_TYPE_MENU)
229 +panel_menu_size_request (GtkWidget *widget,
230 + GtkRequisition *requisition)
232 + PanelMenu *pm = PANEL_MENU (widget);
234 + GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
236 + if (panel_global_config_get_menu_stripe () && pm->side_image != NULL)
237 + requisition->width += gdk_pixbuf_get_width (pm->side_image)
238 + + gtk_widget_get_style (widget)->xthickness;
242 +get_light_stripe_color (PanelMenu *pm)
246 + gtk_widget_style_get (GTK_WIDGET (pm),
247 + "stripe-color-light", &color,
251 + color = gdk_color_copy (>K_WIDGET (pm)->style->bg[GTK_STATE_NORMAL]);
258 +get_stripe_color (PanelMenu *pm)
262 + gtk_widget_style_get (GTK_WIDGET (pm),
263 + "stripe-color", &color,
267 + color = gdk_color_copy (>K_WIDGET (pm)->style->bg[GTK_STATE_SELECTED]);
274 +get_stripe_gc (PanelMenu *pm)
276 + GdkGCValues gc_values;
277 + GdkGCValuesMask gc_values_mask;
280 + color = get_stripe_color (pm);
281 + gc_values.foreground = *color;
282 + gdk_color_free (color);
283 + gc_values_mask = GDK_GC_FOREGROUND;
285 + gdk_rgb_find_color (GTK_WIDGET (pm)->style->colormap, &gc_values.foreground);
287 + return gtk_gc_get (GTK_WIDGET (pm)->style->depth,
288 + GTK_WIDGET (pm)->style->colormap,
289 + &gc_values, gc_values_mask);
293 +panel_menu_expose_event (GtkWidget *widget,
294 + GdkEventExpose *event)
296 + GdkRectangle exposed;
297 + GdkRectangle position;
301 + PanelMenu *pm = PANEL_MENU (widget);
303 + GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
305 + if (!panel_global_config_get_menu_stripe () || !pm->side_image) {
308 + window = GTK_MENU (widget)->bin_window;
310 + stripe_gc = get_stripe_gc (pm);
312 + gdk_gc_set_clip_rectangle (stripe_gc, &event->area);
313 + gdk_draw_rectangle (window,
316 + widget->allocation.x,
317 + widget->allocation.y,
318 + gdk_pixbuf_get_width (pm->side_image),
319 + widget->allocation.height);
320 + gdk_gc_set_clip_rectangle (stripe_gc, NULL);
322 + bin_height = widget->allocation.height - 2 * (GTK_CONTAINER (widget)->border_width + widget->style->ythickness);
324 + position = widget->allocation;
325 + position.y += bin_height - gdk_pixbuf_get_height (pm->side_image);
326 + position.width = gdk_pixbuf_get_width (pm->side_image);
327 + position.height = gdk_pixbuf_get_height (pm->side_image);
329 + if (widget->allocation.height >= gdk_pixbuf_get_height (pm->side_image)) {
330 + if (gdk_rectangle_intersect (&event->area,
333 + gdk_pixbuf_render_to_drawable (
334 + pm->side_image, window,
335 + widget->style->black_gc,
336 + exposed.x - position.x,
337 + exposed.y - position.y,
338 + exposed.x, exposed.y,
339 + exposed.width, exposed.height,
340 + GDK_RGB_DITHER_NORMAL,
341 + exposed.x, exposed.y);
345 + position = widget->allocation;
346 + if (position.height != gdk_pixbuf_get_height (pm->side_image)) {
347 + position.width = gdk_pixbuf_get_width (pm->side_image);
348 + if (position.height > gdk_pixbuf_get_height (pm->side_image)) {
349 + position.height = bin_height - gdk_pixbuf_get_height (pm->side_image);
351 + position.height = bin_height;
354 + if (pm->scaled_image && gdk_rectangle_intersect (&event->area,
358 + gdk_pixbuf_render_to_drawable (
359 + pm->scaled_image, window,
360 + widget->style->black_gc,
361 + exposed.x - position.x,
362 + exposed.y - position.y,
363 + exposed.x, exposed.y,
364 + exposed.width, exposed.height,
365 + GDK_RGB_DITHER_NORMAL,
366 + exposed.x, exposed.y);
373 +/* begin metacity cut and paste */
375 +free_buffer (guchar *pixels, gpointer data)
381 +blank_pixbuf (int width, int height, gboolean no_padding)
386 + g_return_val_if_fail (width > 0, NULL);
387 + g_return_val_if_fail (height > 0, NULL);
390 + rowstride = width * 3;
392 + /* Always align rows to 32-bit boundaries */
393 + rowstride = 4 * ((3 * width + 3) / 4);
395 + buf = g_try_malloc (height * rowstride);
399 + return gdk_pixbuf_new_from_data (buf, GDK_COLORSPACE_RGB,
401 + width, height, rowstride,
402 + free_buffer, NULL);
406 +meta_gradient_create_vertical (int width, int height,
407 + const GdkColor *from,
408 + const GdkColor *to)
411 + long r, g, b, dr, dg, db;
413 + unsigned char *ptr;
414 + unsigned char rr, gg, bb;
418 + unsigned char *pixels;
420 + pixbuf = blank_pixbuf (width, height, FALSE);
421 + if (pixbuf == NULL)
424 + pixels = gdk_pixbuf_get_pixels (pixbuf);
425 + rowstride = gdk_pixbuf_get_rowstride (pixbuf);
427 + r0 = (guchar) (from->red / 256.0);
428 + g0 = (guchar) (from->green / 256.0);
429 + b0 = (guchar) (from->blue / 256.0);
430 + rf = (guchar) (to->red / 256.0);
431 + gf = (guchar) (to->green / 256.0);
432 + bf = (guchar) (to->blue / 256.0);
438 + dr = ((rf-r0)<<16)/(int)height;
439 + dg = ((gf-g0)<<16)/(int)height;
440 + db = ((bf-b0)<<16)/(int)height;
442 + for (i=0; i<height; i++)
444 + ptr = pixels + i * rowstride;
449 + for (j=0; j<width/8; j++)
451 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
452 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
453 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
454 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
455 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
456 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
457 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
458 + *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
462 + case 7: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
463 + case 6: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
464 + case 5: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
465 + case 4: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
466 + case 3: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
467 + case 2: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
468 + case 1: *(ptr++) = rr; *(ptr++) = gg; *(ptr++) = bb;
477 +/* end metacity cut and paste */
479 +/* begin gtkmenu.c cut and paste */
481 +#define MENU_SCROLL_ARROW_HEIGHT 16
483 +typedef struct _GtkMenuPrivate GtkMenuPrivate;
484 +struct _GtkMenuPrivate
486 + gboolean have_position;
490 + /* info used for the table */
495 + gint heights_length;
501 +gtk_menu_free_private (gpointer data)
503 + GtkMenuPrivate *priv = (GtkMenuPrivate *)data;
505 + g_free (priv->heights);
510 +static GtkMenuPrivate *
511 +gtk_menu_get_private (GtkMenu *menu)
513 + GtkMenuPrivate *private;
514 + static GQuark private_quark = 0;
516 + if (!private_quark)
517 + private_quark = g_quark_from_static_string ("gtk-menu-private");
519 + private = g_object_get_qdata (G_OBJECT (menu), private_quark);
523 + private = g_new0 (GtkMenuPrivate, 1);
524 + private->have_position = FALSE;
526 + g_object_set_qdata_full (G_OBJECT (menu), private_quark,
527 + private, gtk_menu_free_private);
534 +gtk_menu_remove_scroll_timeout (GtkMenu *menu)
536 + if (menu->timeout_id)
538 + g_source_remove (menu->timeout_id);
539 + menu->timeout_id = 0;
544 +gtk_menu_stop_scrolling (GtkMenu *menu)
546 + gtk_menu_remove_scroll_timeout (menu);
548 + menu->upper_arrow_prelight = FALSE;
549 + menu->lower_arrow_prelight = FALSE;
553 +gtk_menu_scroll_to (GtkMenu *menu,
558 + gint view_width, view_height;
560 + gboolean last_visible;
562 + guint vertical_padding;
564 + widget = GTK_WIDGET (menu);
566 + if (menu->tearoff_active &&
567 + menu->tearoff_adjustment &&
568 + (menu->tearoff_adjustment->value != offset))
570 + menu->tearoff_adjustment->value =
572 + 0, menu->tearoff_adjustment->upper - menu->tearoff_adjustment->page_size);
573 + gtk_adjustment_value_changed (menu->tearoff_adjustment);
576 + /* Move/resize the viewport according to arrows: */
577 + view_width = widget->allocation.width;
578 + view_height = widget->allocation.height;
580 + gtk_widget_style_get (GTK_WIDGET (menu),
581 + "vertical-padding", &vertical_padding,
584 + border_width = GTK_CONTAINER (menu)->border_width;
585 + view_width -= (border_width + widget->style->xthickness) * 2;
586 + view_height -= (border_width + widget->style->ythickness + vertical_padding) * 2;
587 + menu_height = widget->requisition.height -
588 + (border_width + widget->style->ythickness + vertical_padding) * 2;
590 + x = border_width + widget->style->xthickness;
591 + y = border_width + widget->style->ythickness + vertical_padding;
593 + if (!menu->tearoff_active)
595 + last_visible = menu->upper_arrow_visible;
596 + menu->upper_arrow_visible = offset > 0;
598 + if (menu->upper_arrow_visible)
599 + view_height -= MENU_SCROLL_ARROW_HEIGHT;
601 + if ( (last_visible != menu->upper_arrow_visible) &&
602 + !menu->upper_arrow_visible)
604 + menu->upper_arrow_prelight = FALSE;
606 + /* If we hid the upper arrow, possibly remove timeout */
607 + if (menu->scroll_step < 0)
609 + gtk_menu_stop_scrolling (menu);
610 + gtk_widget_queue_draw (GTK_WIDGET (menu));
614 + last_visible = menu->lower_arrow_visible;
615 + menu->lower_arrow_visible = offset < menu_height - view_height;
617 + if (menu->lower_arrow_visible)
618 + view_height -= MENU_SCROLL_ARROW_HEIGHT;
620 + if ( (last_visible != menu->lower_arrow_visible) &&
621 + !menu->lower_arrow_visible)
623 + menu->lower_arrow_prelight = FALSE;
625 + /* If we hid the lower arrow, possibly remove timeout */
626 + if (menu->scroll_step > 0)
628 + gtk_menu_stop_scrolling (menu);
629 + gtk_widget_queue_draw (GTK_WIDGET (menu));
633 + if (menu->upper_arrow_visible)
634 + y += MENU_SCROLL_ARROW_HEIGHT;
637 + /* Scroll the menu: */
638 + if (GTK_WIDGET_REALIZED (menu))
639 + gdk_window_move (menu->bin_window, 0, -offset);
641 + if (GTK_WIDGET_REALIZED (menu))
642 + gdk_window_move_resize (menu->view_window,
648 + menu->scroll_offset = offset;
652 +gtk_menu_set_tearoff_hints (GtkMenu *menu,
655 + GdkGeometry geometry_hints;
657 + if (!menu->tearoff_window)
660 + if (GTK_WIDGET_VISIBLE (menu->tearoff_scrollbar))
662 + gtk_widget_size_request (menu->tearoff_scrollbar, NULL);
663 + width += menu->tearoff_scrollbar->requisition.width;
666 + geometry_hints.min_width = width;
667 + geometry_hints.max_width = width;
669 + geometry_hints.min_height = 0;
670 + geometry_hints.max_height = GTK_WIDGET (menu)->requisition.height;
672 + gtk_window_set_geometry_hints (GTK_WINDOW (menu->tearoff_window),
675 + GDK_HINT_MAX_SIZE|GDK_HINT_MIN_SIZE);
679 +get_child_attach (GtkWidget *child,
685 + gtk_container_child_get (GTK_CONTAINER (child->parent), child,
689 + "bottom_attach", b,
694 +gtk_menu_size_allocate (GtkWidget *widget,
695 + GtkAllocation *allocation)
698 + GtkMenuShell *menu_shell;
700 + GtkAllocation child_allocation;
701 + GtkRequisition child_requisition;
702 + GtkMenuPrivate *priv;
705 + gint width, height;
706 + guint vertical_padding;
707 + guint menu_stripe_width;
709 + g_return_if_fail (GTK_IS_MENU (widget));
710 + g_return_if_fail (allocation != NULL);
712 + menu = GTK_MENU (widget);
713 + menu_shell = GTK_MENU_SHELL (widget);
714 + priv = gtk_menu_get_private (menu);
716 + widget->allocation = *allocation;
717 + gtk_widget_get_child_requisition (GTK_WIDGET (menu), &child_requisition);
719 + gtk_widget_style_get (GTK_WIDGET (menu),
720 + "vertical-padding", &vertical_padding,
723 + x = GTK_CONTAINER (menu)->border_width + widget->style->xthickness;
724 + y = GTK_CONTAINER (menu)->border_width + widget->style->ythickness + vertical_padding;
726 + width = MAX (1, allocation->width - x * 2);
727 + height = MAX (1, allocation->height - y * 2);
729 + child_requisition.width -= x * 2;
730 + child_requisition.height -= y * 2;
732 + if (menu_shell->active)
733 + gtk_menu_scroll_to (menu, menu->scroll_offset);
735 + if (menu->upper_arrow_visible && !menu->tearoff_active)
737 + y += MENU_SCROLL_ARROW_HEIGHT;
738 + height -= MENU_SCROLL_ARROW_HEIGHT;
741 + if (menu->lower_arrow_visible && !menu->tearoff_active)
742 + height -= MENU_SCROLL_ARROW_HEIGHT;
744 + if (GTK_WIDGET_REALIZED (widget))
746 + gdk_window_move_resize (widget->window,
747 + allocation->x, allocation->y,
748 + allocation->width, allocation->height);
750 + gdk_window_move_resize (menu->view_window,
757 +/* inserted for panel-menu.c */
758 + if (panel_global_config_get_menu_stripe () && PANEL_MENU (widget)->side_image) {
759 + menu_stripe_width = gdk_pixbuf_get_width (PANEL_MENU (widget)->side_image) + gtk_widget_get_style (widget)->xthickness;
761 + menu_stripe_width = 0;
763 +/* end panel-menu.c */
765 + if (menu_shell->children)
767 +/* inserted for panel-menu.c */
769 + gint base_width = width / priv->columns;
771 + gint base_width = (width - menu_stripe_width) / priv->columns;
773 +/* end panel-menu.c */
775 + children = menu_shell->children;
778 + child = children->data;
779 + children = children->next;
781 + if (GTK_WIDGET_VISIBLE (child))
786 + get_child_attach (child, &l, &r, &t, &b);
788 + if (gtk_widget_get_direction (GTK_WIDGET (menu)) == GTK_TEXT_DIR_RTL)
791 + tmp = priv->columns - l;
792 + l = priv->columns - r;
796 + child_allocation.width = (r - l) * base_width;
797 + child_allocation.height = 0;
798 +/* inserted for panel-menu.c */
800 + child_allocation.x = l * base_width;
802 + child_allocation.x = l * base_width + menu_stripe_width;
804 + child_allocation.y = 0;
806 + for (i = 0; i < b; i++)
809 + child_allocation.y += priv->heights[i];
811 + child_allocation.height += priv->heights[i];
815 + gtk_menu_item_toggle_size_allocate (GTK_MENU_ITEM (child),
816 + menu->toggle_size);
818 + gtk_widget_size_allocate (child, &child_allocation);
822 +/* inserted for panel-menu.c */
823 + if (use_menu_stripe && g_type_is_a (G_OBJECT_TYPE (child), GTK_TYPE_SEPARATOR_MENU_ITEM))
825 + /* this is dumb, gtkmenuitem.c uses allocation.width as an absolute point */
826 + child_allocation.width += gdk_pixbuf_get_width (PANEL_MENU (widget)->side_image);
829 + gtk_widget_size_allocate (child, &child_allocation);
831 + if (use_menu_stripe && g_type_is_a (G_OBJECT_TYPE (child), GTK_TYPE_SEPARATOR_MENU_ITEM))
833 + child_allocation.width -= gdk_pixbuf_get_width (PANEL_MENU (widget)->side_image);
837 + /* Hack to handle events on the stripe area */
838 + if (GTK_WIDGET_REALIZED (child) && l == 0)
840 + gdk_window_move_resize (GTK_MENU_ITEM (child)->event_window,
841 + 0, child_allocation.y,
842 + child_allocation.width + child_allocation.x,
843 + child_allocation.height);
845 +/* end panel-menu.c */
847 + gtk_widget_queue_draw (child);
851 + /* Resize the item window */
852 + if (GTK_WIDGET_REALIZED (widget))
855 + gint width, height;
858 + for (i = 0; i < priv->rows; i++)
859 + height += priv->heights[i];
861 +/* inserted for panel-menu.c */
863 + width = priv->columns * base_width;
865 + width = priv->columns * base_width + menu_stripe_width;
867 +/* end panel-menu.c */
869 + gdk_window_resize (menu->bin_window, width, height);
872 + if (menu->tearoff_active)
874 + if (allocation->height >= widget->requisition.height)
876 + if (GTK_WIDGET_VISIBLE (menu->tearoff_scrollbar))
878 + gtk_widget_hide (menu->tearoff_scrollbar);
879 + gtk_menu_set_tearoff_hints (menu, allocation->width);
881 + gtk_menu_scroll_to (menu, 0);
886 + menu->tearoff_adjustment->upper = widget->requisition.height;
887 + menu->tearoff_adjustment->page_size = allocation->height;
889 + if (menu->tearoff_adjustment->value + menu->tearoff_adjustment->page_size >
890 + menu->tearoff_adjustment->upper)
893 + value = menu->tearoff_adjustment->upper - menu->tearoff_adjustment->page_size;
896 + gtk_menu_scroll_to (menu, value);
899 + gtk_adjustment_changed (menu->tearoff_adjustment);
901 + if (!GTK_WIDGET_VISIBLE (menu->tearoff_scrollbar))
903 + gtk_widget_show (menu->tearoff_scrollbar);
904 + gtk_menu_set_tearoff_hints (menu, allocation->width);
909 +/* inserted for panel-menu.c */
912 + PanelMenu *pm = PANEL_MENU (widget);
914 + gint scaled_height = height;
916 + if (pm->side_image && widget->allocation.height > gdk_pixbuf_get_height (pm->side_image))
918 + scaled_height -= gdk_pixbuf_get_height (pm->side_image);
921 + if (pm->side_image && widget->allocation.height < gdk_pixbuf_get_height (pm->side_image))
923 + gint scaled_width = ((scaled_height * gdk_pixbuf_get_width (pm->side_image)) / gdk_pixbuf_get_height (pm->side_image));
925 + if (pm->scaled_image)
926 + gdk_pixbuf_unref(pm->scaled_image);
928 + pm->scaled_image = gdk_pixbuf_scale_simple (pm->side_image,
931 + GDK_INTERP_BILINEAR); /* maybe HYPER ? */
932 + gdk_pixbuf_unref(pm->side_image);
933 + pm->side_image = pm->scaled_image;
937 + gboolean draw_gradient;
938 + gtk_widget_style_get (GTK_WIDGET (pm),
939 + "gradient_bg", &draw_gradient,
942 + if (pm->side_image && draw_gradient)
944 + GdkColor *stripe_color;
945 + GdkColor *light_color;
947 + stripe_color = get_stripe_color (pm);
948 + light_color = get_light_stripe_color (pm);
949 + pm->scaled_image = meta_gradient_create_vertical
950 + (gdk_pixbuf_get_width (pm->side_image),
954 + gdk_color_free (light_color);
955 + gdk_color_free (stripe_color);
959 +/* end panel-menu.c */
962 +/* end gtkmenu cut and paste */
965 +unload_images (PanelMenu *pm)
967 + if (pm->side_image) {
968 + g_object_unref (pm->side_image);
969 + pm->side_image = NULL;
972 + if (pm->scaled_image) {
973 + g_object_unref (pm->scaled_image);
974 + pm->scaled_image = NULL;
979 +get_stripe_image (PanelMenu *pm,
981 + const char *default_filename)
983 + GdkPixbuf *image = NULL;
986 + gtk_widget_style_get (GTK_WIDGET (pm), name, &file_src, NULL);
989 + file_src = gnome_program_locate_file (NULL,
990 + GNOME_FILE_DOMAIN_PIXMAP,
997 + image = gdk_pixbuf_new_from_file (file_src, NULL);
1005 +load_images (PanelMenu *pm)
1009 + unload_images (pm);
1011 + pm->side_image = get_stripe_image (pm, "default_side_image",
1012 + "pld-desktop-stripe.png");
1016 +panel_menu_style_set (GtkWidget *widget,
1017 + GtkStyle *old_style)
1019 + load_images (PANEL_MENU (widget));
1020 + GNOME_CALL_PARENT (GTK_WIDGET_CLASS, style_set, (widget, old_style));
1024 +panel_menu_destroy (GtkObject *object)
1026 + PanelMenu *pm = PANEL_MENU (object);
1028 + unload_images (pm);
1030 + GNOME_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
1034 +panel_menu_finalize (GObject *object)
1036 + GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
1040 +panel_menu_class_init (PanelMenuClass *klass)
1042 + GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
1043 + GtkObjectClass *gtk_object_class = (GtkObjectClass *)klass;
1044 + GObjectClass *object_class = (GObjectClass *) klass;
1046 + gtk_widget_class_install_style_property (
1048 + g_param_spec_string ("default_side_image",
1049 + _("Default Side Image"),
1050 + _("Filename of logo down the side of applications menu"),
1052 + G_PARAM_READWRITE));
1054 + gtk_widget_class_install_style_property (
1056 + g_param_spec_boolean ("gradient_bg",
1057 + _("Gradient Background"),
1058 + _("Draw a gradient in the menu stripe"),
1060 + G_PARAM_READWRITE));
1061 + gtk_widget_class_install_style_property (
1063 + g_param_spec_boxed ("stripe_color",
1064 + _("Stripe Color"),
1065 + _("Color of the panel menu stripe"),
1067 + G_PARAM_READABLE));
1069 + gtk_widget_class_install_style_property (
1071 + g_param_spec_boxed ("stripe_color_light",
1072 + _("Light Stripe Color"),
1073 + _("Light color of the panel menu stripe, for gradients"),
1075 + G_PARAM_READABLE));
1077 + object_class->finalize = panel_menu_finalize;
1078 + gtk_object_class->destroy = panel_menu_destroy;
1079 + widget_class->size_request = panel_menu_size_request;
1080 + widget_class->size_allocate = gtk_menu_size_allocate;
1081 + widget_class->expose_event = panel_menu_expose_event;
1082 + widget_class->style_set = panel_menu_style_set;
1086 +panel_menu_instance_init (PanelMenu *pm)
1088 + gtk_widget_ensure_style (GTK_WIDGET (pm));
1092 + gtk_widget_add_events (
1094 + GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
1095 + GDK_POINTER_MOTION_MASK);
1097 diff -urN aa/gnome-panel-2.5.92/gnome-panel/panel-menu.h gnome-panel-2.5.92/gnome-panel/panel-menu.h
1098 --- aa/gnome-panel-2.5.92/gnome-panel/panel-menu.h 1970-01-01 01:00:00.000000000 +0100
1099 +++ gnome-panel-2.5.92/gnome-panel/panel-menu.h 2004-03-12 14:41:46.122563464 +0100
1101 +#include <gtk/gtkmenu.h>
1102 +#include <gtk/gtkimage.h>
1104 +typedef struct _PanelMenu PanelMenu;
1105 +typedef struct _PanelMenuClass PanelMenuClass;
1107 +#define PANEL_MENU(obj) \
1108 + GTK_CHECK_CAST (obj, panel_menu_get_type (), PanelMenu)
1109 +#define PANEL_MENU_CLASS(k) \
1110 + GTK_CHECK_CLASS_CAST (k, panel_menu_get_type (), PanelMenuClass)
1111 +#define PANEL_IS_MENU(obj) \
1112 + GTK_CHECK_TYPE (obj, panel_menu_get_type ())
1119 + GdkPixbuf *side_image;
1120 + GdkPixbuf *scaled_image;
1122 + GdkRegion *navigation_region;
1125 +struct _PanelMenuClass
1127 + GtkMenuClass parent_class;
1130 +GType panel_menu_get_type (void);
1131 +GtkWidget *panel_menu_evolve (void);