diff options
author | monsta <[email protected]> | 2018-01-31 09:46:08 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2018-01-31 09:46:08 +0300 |
commit | ab7987701bcea97e4326fecd161c3137080f6077 (patch) | |
tree | 3e49c11405cc69fab4b8a10ba4342cf70078d22a /applets/notification_area/status-notifier | |
parent | f553591e0562fd7b4bba0fe6a6182bc0b3747a34 (diff) | |
download | mate-panel-ab7987701bcea97e4326fecd161c3137080f6077.tar.bz2 mate-panel-ab7987701bcea97e4326fecd161c3137080f6077.tar.xz |
require GTK+ 3.22 and GLib 2.50
Diffstat (limited to 'applets/notification_area/status-notifier')
-rw-r--r-- | applets/notification_area/status-notifier/sn-dbus-menu.c | 4 | ||||
-rw-r--r-- | applets/notification_area/status-notifier/sn-item-v0.c | 2 | ||||
-rw-r--r-- | applets/notification_area/status-notifier/sn-item.c | 77 |
3 files changed, 2 insertions, 81 deletions
diff --git a/applets/notification_area/status-notifier/sn-dbus-menu.c b/applets/notification_area/status-notifier/sn-dbus-menu.c index 28633990..5b73db00 100644 --- a/applets/notification_area/status-notifier/sn-dbus-menu.c +++ b/applets/notification_area/status-notifier/sn-dbus-menu.c @@ -187,11 +187,11 @@ get_layout_cb (GObject *source_object, g_hash_table_remove_all (menu->items); layout_parse (menu, layout, GTK_MENU (menu)); -#if GTK_CHECK_VERSION (3, 22, 0) + /* Reposition menu to accomodate any size changes */ /* Menu size never changes with GTK 3.20 or earlier */ gtk_menu_reposition(GTK_MENU(menu)); -#endif + g_variant_unref (layout); } diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c index dec9bdf1..46a4c064 100644 --- a/applets/notification_area/status-notifier/sn-item-v0.c +++ b/applets/notification_area/status-notifier/sn-item-v0.c @@ -1372,9 +1372,7 @@ sn_item_v0_class_init (SnItemV0Class *v0_class) widget_class->size_allocate = sn_item_v0_size_allocate; -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "sn-item"); -#endif install_properties (object_class); } diff --git a/applets/notification_area/status-notifier/sn-item.c b/applets/notification_area/status-notifier/sn-item.c index d2d86ec0..a7fa6fea 100644 --- a/applets/notification_area/status-notifier/sn-item.c +++ b/applets/notification_area/status-notifier/sn-item.c @@ -182,49 +182,6 @@ sn_item_get_action_coordinates (SnItem *item, *x += width; } -#if ! GTK_CHECK_VERSION (3, 22, 0) -static void -sn_item_popup_menu_position_func (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer widget) -{ - GtkAllocation widget_alloc; - GtkRequisition menu_req; - GdkWindow *window; - GdkScreen *screen; - gint monitor_num; - GdkRectangle monitor; - - gtk_widget_get_allocation (widget, &widget_alloc); - gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL); - - window = gtk_widget_get_window (widget); - gdk_window_get_origin (window, x, y); - - *x += widget_alloc.x; - *y += widget_alloc.y; - - screen = gtk_widget_get_screen (widget); - monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - - /* put the menu on the left if we can't put it on the right */ - if (*x + menu_req.width > monitor.x + monitor.width) - *x -= menu_req.width - widget_alloc.width; - /* and push it back in if all else failed */ - if (*x < monitor.x) - *x = monitor.x; - - /* put the menu above if we can't put it below */ - if (*y + widget_alloc.height + menu_req.height > monitor.y + monitor.height) - *y -= menu_req.height; - else - *y += widget_alloc.height; -} -#endif - static gboolean sn_item_button_press_event (GtkWidget *widget, GdkEventButton *event) @@ -244,39 +201,23 @@ sn_item_button_press_event (GtkWidget *widget, if (event->button == 2) { -#if GTK_CHECK_VERSION (3, 20, 0) gdk_seat_ungrab (gdk_device_get_seat (event->device)); -#else - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif SN_ITEM_GET_CLASS (item)->secondary_activate (item, x, y); } else if (event->button == 3) { if (priv->menu != NULL) { -#if GTK_CHECK_VERSION (3, 22, 0) gtk_menu_popup_at_widget (priv->menu, widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *) event); /*Fix positioning if size changed since last shown*/ gtk_menu_reposition(priv->menu); -#else - gtk_menu_popup (priv->menu, NULL, NULL, - sn_item_popup_menu_position_func, widget, - event->button, event->time); - /*Fix positioning if size changed since last shown*/ - gtk_menu_reposition(priv->menu); -#endif } else { -#if GTK_CHECK_VERSION (3, 20, 0) gdk_seat_ungrab (gdk_device_get_seat (event->device)); -#else - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif SN_ITEM_GET_CLASS (item)->context_menu (item, x, y); } } @@ -299,30 +240,12 @@ sn_item_popup_menu (GtkWidget *widget) if (priv->menu != NULL) { -#if GTK_CHECK_VERSION (3, 22, 0) gtk_menu_popup_at_widget (priv->menu, widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); /*Fix positioning if size changed since last shown*/ gtk_menu_reposition(priv->menu); -#else - guint button = 0; - guint32 active_time = GDK_CURRENT_TIME; - GdkEvent *event = gtk_get_current_event (); - - if (event) - { - gdk_event_get_button (event, &button); - active_time = gdk_event_get_time (event); - } - - gtk_menu_popup (priv->menu, NULL, NULL, - sn_item_popup_menu_position_func, widget, - button, active_time); - /*Fix positioning if size changed since last shown*/ - gtk_menu_reposition(priv->menu); -#endif } else { |