diff options
-rw-r--r-- | applets/notification_area/na-tray.c | 4 | ||||
-rw-r--r-- | libmate-panel-applet/mate-panel-applet.c | 8 | ||||
-rw-r--r-- | libmate-panel-applet/mate-panel-applet.h | 3 | ||||
-rw-r--r-- | mate-panel/applet.c | 9 | ||||
-rw-r--r-- | mate-panel/mate-panel-applet-frame.c | 15 | ||||
-rw-r--r-- | mate-panel/panel-toplevel.c | 124 |
6 files changed, 121 insertions, 42 deletions
diff --git a/applets/notification_area/na-tray.c b/applets/notification_area/na-tray.c index 83f502e1..d2bcad3b 100644 --- a/applets/notification_area/na-tray.c +++ b/applets/notification_area/na-tray.c @@ -247,13 +247,17 @@ tray_removed (NaTrayManager *manager, TraysScreen *trays_screen) { NaTray *tray; + NaTrayPrivate *priv; tray = g_hash_table_lookup (trays_screen->icon_table, icon); if (tray == NULL) return; + priv = tray->priv; g_assert (tray->priv->trays_screen == trays_screen); + gtk_container_remove (GTK_CONTAINER (priv->box), icon); + g_hash_table_remove (trays_screen->icon_table, icon); /* this will also destroy the tip associated to this icon */ g_hash_table_remove (trays_screen->tip_table, icon); diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index ac00bafa..788cd964 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -2211,7 +2211,9 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass) g_param_spec_uint ("orient", "Orient", "Panel Applet Orientation", - 0, G_MAXUINT, 0, /* FIXME */ + MATE_PANEL_APPLET_ORIENT_FIRST, + MATE_PANEL_APPLET_ORIENT_LAST, + MATE_PANEL_APPLET_ORIENT_UP, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_SIZE, @@ -2232,7 +2234,9 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass) g_param_spec_uint ("flags", "Flags", "Panel Applet flags", - 0, G_MAXUINT, 0, /* FIXME */ + MATE_PANEL_APPLET_FLAGS_NONE, + MATE_PANEL_APPLET_FLAGS_ALL, + MATE_PANEL_APPLET_FLAGS_NONE, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, PROP_SIZE_HINTS, diff --git a/libmate-panel-applet/mate-panel-applet.h b/libmate-panel-applet/mate-panel-applet.h index 1190b4bb..1eb84a14 100644 --- a/libmate-panel-applet/mate-panel-applet.h +++ b/libmate-panel-applet/mate-panel-applet.h @@ -42,6 +42,8 @@ typedef enum { MATE_PANEL_APPLET_ORIENT_DOWN, MATE_PANEL_APPLET_ORIENT_LEFT, MATE_PANEL_APPLET_ORIENT_RIGHT +#define MATE_PANEL_APPLET_ORIENT_FIRST MATE_PANEL_APPLET_ORIENT_UP +#define MATE_PANEL_APPLET_ORIENT_LAST MATE_PANEL_APPLET_ORIENT_RIGHT } MatePanelAppletOrient; #define PANEL_TYPE_APPLET (mate_panel_applet_get_type ()) @@ -62,6 +64,7 @@ typedef enum { MATE_PANEL_APPLET_EXPAND_MAJOR = 1 << 0, MATE_PANEL_APPLET_EXPAND_MINOR = 1 << 1, MATE_PANEL_APPLET_HAS_HANDLE = 1 << 2 +#define MATE_PANEL_APPLET_FLAGS_ALL (MATE_PANEL_APPLET_EXPAND_MAJOR|MATE_PANEL_APPLET_EXPAND_MINOR|MATE_PANEL_APPLET_HAS_HANDLE) } MatePanelAppletFlags; typedef struct _MatePanelApplet MatePanelApplet; diff --git a/mate-panel/applet.c b/mate-panel/applet.c index 3d81eab4..fa668e89 100644 --- a/mate-panel/applet.c +++ b/mate-panel/applet.c @@ -598,6 +598,9 @@ mate_panel_applet_position_menu (GtkMenu *menu, { GtkAllocation allocation; GtkRequisition requisition; +#if GTK_CHECK_VERSION(3, 0, 0) + GdkDevice *device; +#endif GdkScreen *screen; GtkWidget *parent; int menu_x = 0; @@ -618,8 +621,12 @@ mate_panel_applet_position_menu (GtkMenu *menu, #endif gdk_window_get_origin (gtk_widget_get_window (applet), &menu_x, &menu_y); +#if GTK_CHECK_VERSION (3, 0, 0) + device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (applet))); + gdk_window_get_device_position(gtk_widget_get_window (applet), device, &pointer_x, &pointer_y, NULL); +#else gtk_widget_get_pointer (applet, &pointer_x, &pointer_y); - +#endif gtk_widget_get_allocation (applet, &allocation); if (!gtk_widget_get_has_window (applet)) { diff --git a/mate-panel/mate-panel-applet-frame.c b/mate-panel/mate-panel-applet-frame.c index ba68c083..b628727f 100644 --- a/mate-panel/mate-panel-applet-frame.c +++ b/mate-panel/mate-panel-applet-frame.c @@ -135,11 +135,16 @@ mate_panel_applet_frame_draw (GtkWidget *widget, cairo_pattern_destroy (bg_pattern); } + cairo_rectangle (cr, + frame->priv->handle_rect.x, + frame->priv->handle_rect.y, + frame->priv->handle_rect.width, + frame->priv->handle_rect.height); + cairo_clip (cr); gtk_render_handle (context, cr, - frame->priv->handle_rect.x, - frame->priv->handle_rect.y, - frame->priv->handle_rect.width, - frame->priv->handle_rect.height); + 0, 0, + gtk_widget_get_allocated_width (widget), + gtk_widget_get_allocated_height (widget)); cairo_restore (cr); @@ -951,7 +956,7 @@ mate_panel_applet_frame_activating_free (MatePanelAppletFrameActivating *frame_a GdkScreen * panel_applet_frame_activating_get_screen (MatePanelAppletFrameActivating *frame_act) { - return gtk_widget_get_screen (frame_act->panel); + return gtk_widget_get_screen (GTK_WIDGET(frame_act->panel)); } PanelOrientation diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index 9f23d1e9..00659e5d 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -1475,8 +1475,11 @@ void panel_toplevel_update_edges(PanelToplevel* toplevel) background = &toplevel->priv->panel_widget->background; + /* We don't want any bevels with a color/image background */ +#if !GTK_CHECK_VERSION(3, 0, 0) if (panel_background_effective_type (background) == PANEL_BACK_NONE) { +#endif if (toplevel->priv->geometry.y > 0) edges |= PANEL_EDGE_TOP; @@ -1515,7 +1518,9 @@ void panel_toplevel_update_edges(PanelToplevel* toplevel) inner_frame = TRUE; edges |= PANEL_EDGE_TOP | PANEL_EDGE_BOTTOM; } +#if !GTK_CHECK_VERSION(3, 0, 0) } +#endif if (!inner_frame) { inner_edges = PANEL_EDGE_NONE; @@ -2973,7 +2978,9 @@ static void panel_toplevel_check_resize (GtkContainer *container) { GtkAllocation allocation; +#if !GTK_CHECK_VERSION(3, 0, 0) GtkAllocation widget_allocation; +#endif GtkRequisition requisition; GtkWidget *widget; @@ -2990,13 +2997,11 @@ panel_toplevel_check_resize (GtkContainer *container) #else gtk_widget_size_request (widget, &requisition); #endif - gtk_widget_get_allocation (widget, &widget_allocation); + gtk_widget_get_allocation (widget, &allocation); - if (widget_allocation.width != requisition.width || - widget_allocation.height != requisition.height) - return; + allocation.width = requisition.width; + allocation.height = requisition.height; - allocation = widget_allocation; gtk_widget_size_allocate (widget, &allocation); } @@ -3148,13 +3153,16 @@ static gboolean panel_toplevel_expose(GtkWidget* widget, GdkEventExpose* event) PanelToplevel* toplevel = (PanelToplevel*) widget; PanelFrameEdge edges; gboolean retval = FALSE; - GdkWindow *window; - GtkStyle *style; - GtkStateType state; #if GTK_CHECK_VERSION (3, 0, 0) int awidth; int aheight; + GtkStyleContext *context; + GtkStateFlags state; + GtkBorder padding; #else + GdkWindow *window; + GtkStyle *style; + GtkStateType state; GtkAllocation allocation; #endif @@ -3181,57 +3189,77 @@ static gboolean panel_toplevel_expose(GtkWidget* widget, GdkEventExpose* event) toplevel->priv->attached) return retval; - window = gtk_widget_get_window (widget); - style = gtk_widget_get_style (widget); - state = gtk_widget_get_state (widget); #if GTK_CHECK_VERSION (3, 0, 0) + state = gtk_widget_get_state_flags (widget); awidth = gtk_widget_get_allocated_width (widget); aheight = gtk_widget_get_allocated_height (widget); + context = gtk_widget_get_style_context (widget); + gtk_style_context_get_padding (context, state, &padding); + gtk_style_context_save (context); + gtk_style_context_set_state (context, state); #else + window = gtk_widget_get_window (widget); + style = gtk_widget_get_style (widget); + state = gtk_widget_get_state (widget); gtk_widget_get_allocation (widget, &allocation); #endif if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK) { int x, y, width, height; - int xthickness, ythickness; #if GTK_CHECK_VERSION (3, 0, 0) x = 0; y = 0; height = height; #else + int xthickness, ythickness; x = allocation.x; y = allocation.y; height = allocation.height; #endif width = HANDLE_SIZE; +#if !GTK_CHECK_VERSION(3, 0, 0) xthickness = style->xthickness; ythickness = style->ythickness; +#endif if (edges & PANEL_EDGE_TOP) { +#if GTK_CHECK_VERSION (3, 0, 0) + y += padding.top; + height -= padding.top; +#else y += ythickness; height -= ythickness; +#endif } if (edges & PANEL_EDGE_BOTTOM) +#if GTK_CHECK_VERSION (3, 0, 0) + height -= padding.bottom; +#else height -= ythickness; +#endif if (edges & PANEL_EDGE_LEFT) +#if GTK_CHECK_VERSION (3, 0, 0) + x += padding.left; +#else x += xthickness; +#endif - gtk_paint_handle (style, #if GTK_CHECK_VERSION (3, 0, 0) - cr, + cairo_save (cr); + gtk_render_handle (context, cr, x, y, width, height); + cairo_restore (cr); #else + gtk_paint_handle (style, window, -#endif state, GTK_SHADOW_OUT, -#if !GTK_CHECK_VERSION (3, 0, 0) &event->area, -#endif widget, "handlebox", x, y, width, height, GTK_ORIENTATION_VERTICAL); +#endif #if GTK_CHECK_VERSION (3, 0, 0) x = awidth - HANDLE_SIZE; @@ -3239,63 +3267,83 @@ static gboolean panel_toplevel_expose(GtkWidget* widget, GdkEventExpose* event) x = allocation.width - HANDLE_SIZE; #endif if (edges & PANEL_EDGE_RIGHT) +#if GTK_CHECK_VERSION (3, 0, 0) + x -= padding.right; +#else x -= xthickness; +#endif - gtk_paint_handle (style, -#if GTK_CHECK_VERSION (3, 0, 0) - cr, +#if GTK_CHECK_VERSION(3, 0, 0) + cairo_save (cr); + gtk_render_handle (context, cr, x, y, width, height); + cairo_restore (cr); #else + gtk_paint_handle (style, window, -#endif state, GTK_SHADOW_OUT, -#if !GTK_CHECK_VERSION (3, 0, 0) &event->area, -#endif widget, "handlebox", x, y, width, height, GTK_ORIENTATION_VERTICAL); +#endif } else { int x, y, width, height; - int xthickness, ythickness; #if GTK_CHECK_VERSION (3, 0, 0) x = 0; y = 0; width = awidth; #else + int xthickness, ythickness; + x = allocation.x; y = allocation.y; width = allocation.width; #endif height = HANDLE_SIZE; +#if !GTK_CHECK_VERSION (3, 0, 0) xthickness = style->xthickness; ythickness = style->ythickness; +#endif if (edges & PANEL_EDGE_LEFT) { +#if GTK_CHECK_VERSION (3, 0, 0) + x += padding.left; + width -= padding.left; +#else x += xthickness; width -= xthickness; +#endif } if (edges & PANEL_EDGE_RIGHT) +#if GTK_CHECK_VERSION (3, 0, 0) + width -= padding.right; +#else width -= xthickness; +#endif if (edges & PANEL_EDGE_TOP) +#if GTK_CHECK_VERSION (3, 0, 0) + y += padding.top; +#else y += ythickness; +#endif - gtk_paint_handle (style, #if GTK_CHECK_VERSION (3, 0, 0) - cr, + cairo_save (cr); + gtk_render_handle (context, cr, x, y, width, height); + cairo_restore (cr); #else + gtk_paint_handle (style, window, -#endif state, GTK_SHADOW_OUT, -#if !GTK_CHECK_VERSION (3, 0, 0) &event->area, -#endif widget, "handlebox", x, y, width, height, GTK_ORIENTATION_HORIZONTAL); +#endif #if GTK_CHECK_VERSION (3, 0, 0) y = aheight - HANDLE_SIZE; @@ -3303,24 +3351,32 @@ static gboolean panel_toplevel_expose(GtkWidget* widget, GdkEventExpose* event) y = allocation.height - HANDLE_SIZE; #endif if (edges & PANEL_EDGE_BOTTOM) +#if GTK_CHECK_VERSION (3, 0, 0) + y -= padding.bottom; +#else y -= ythickness; +#endif - gtk_paint_handle (style, #if GTK_CHECK_VERSION (3, 0, 0) - cr, + cairo_save (cr); + gtk_render_handle (context, cr, x, y, width, height); + cairo_restore (cr); #else + gtk_paint_handle (style, window, -#endif state, GTK_SHADOW_OUT, -#if !GTK_CHECK_VERSION (3, 0, 0) &event->area, -#endif widget, "handlebox", x, y, width, height, GTK_ORIENTATION_HORIZONTAL); +#endif } +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_style_context_restore (context); +#endif + return retval; } |