[eog] EogSidebar: Replace custom menu positioning function with built-in
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] EogSidebar: Replace custom menu positioning function with built-in
- Date: Wed, 16 Nov 2016 19:07:38 +0000 (UTC)
commit d9240e1caee66946556fafb46a4709b543993072
Author: Felix Riemann <friemann gnome org>
Date: Wed Nov 16 18:12:55 2016 +0100
EogSidebar: Replace custom menu positioning function with built-in
Gtk 3.22 has improved positioning functions for GtkMenu which
make it possible to drop our own positioning function.
This also works correctly in RTL locales now.
configure.ac | 2 +-
src/eog-sidebar.c | 39 +++++++++------------------------------
2 files changed, 10 insertions(+), 31 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f013217..546a3b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,7 +85,7 @@ YELP_HELP_INIT
# GNOME Libs
# **********
-GTK_REQUIRED=3.19.11
+GTK_REQUIRED=3.22.0
GLIB_REQUIRED=2.42.0
GNOME_DESKTOP_REQUIRED=2.91.2
GDKPIXBUF_REQUIRED=2.30.0
diff --git a/src/eog-sidebar.c b/src/eog-sidebar.c
index 43dd3e4..e07ddca 100644
--- a/src/eog-sidebar.c
+++ b/src/eog-sidebar.c
@@ -28,6 +28,7 @@
#endif
#include <string.h>
+#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -218,30 +219,6 @@ eog_sidebar_class_init (EogSidebarClass *eog_sidebar_class)
GTK_TYPE_WIDGET);
}
-static void
-eog_sidebar_menu_position_under (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data)
-{
- GtkWidget *widget;
- GtkAllocation allocation;
-
- g_return_if_fail (GTK_IS_BUTTON (user_data));
- g_return_if_fail (!gtk_widget_get_has_window (user_data));
-
- widget = GTK_WIDGET (user_data);
- gtk_widget_get_allocation (widget, &allocation);
-
- gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
-
- *x += allocation.x;
- *y += allocation.y + allocation.height;
-
- *push_in = FALSE;
-}
-
static gboolean
eog_sidebar_select_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
@@ -265,9 +242,10 @@ eog_sidebar_select_button_press_cb (GtkWidget *widget,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_menu_popup (GTK_MENU (eog_sidebar->priv->menu),
- NULL, NULL, eog_sidebar_menu_position_under, widget,
- event->button, event->time);
+ gtk_menu_popup_at_widget (GTK_MENU (eog_sidebar->priv->menu),
+ widget, GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ (const GdkEvent*) event);
return TRUE;
}
@@ -288,9 +266,10 @@ eog_sidebar_select_button_key_press_cb (GtkWidget *widget,
event->keyval == GDK_KEY_KP_Enter) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
- gtk_menu_popup (GTK_MENU (eog_sidebar->priv->menu),
- NULL, NULL, eog_sidebar_menu_position_under, widget,
- 1, event->time);
+ gtk_menu_popup_at_widget (GTK_MENU (eog_sidebar->priv->menu),
+ widget, GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ (const GdkEvent*) event);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]