[dia/dia-next: 39/59] Update popup logic
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/dia-next: 39/59] Update popup logic
- Date: Wed, 9 Jan 2019 18:37:34 +0000 (UTC)
commit 4023a980b6b3d169c40f180de86dc53247765c6a
Author: Zander Brown <zbrown gnome org>
Date: Sat Dec 29 18:00:57 2018 +0000
Update popup logic
app/disp_callbacks.c | 26 +++++++++++++++++++-------
app/toolbox.c | 3 ---
2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 2ef37476..1271acd6 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -445,14 +445,26 @@ popup_object_menu(DDisplay *ddisp, GdkEvent *event)
menu = GTK_MENU(dia_menu->app_data);
/* add the properties menu item to raise the properties from the contextual menu */
-
- if (event->type == GDK_BUTTON_PRESS)
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL,
- ((GdkEventButton *)event)->button, ((GdkEventButton *)event)->time);
- else if (event->type == GDK_KEY_PRESS)
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, ((GdkEventKey *)event)->time);
- else /* warn about unexpected usage of this function */
+ if (event->type == GDK_BUTTON_PRESS) {
+ gtk_menu_popup_at_pointer (menu, event);
+ } else if (event->type == GDK_KEY_PRESS) {
+ Rectangle *bounds = dia_object_get_bounding_box (obj);
+ GdkRectangle rect = {
+ bounds->left,
+ bounds->top,
+ bounds->right - bounds->left,
+ bounds->bottom - bounds->top
+ };
+ gtk_menu_popup_at_rect (menu,
+ ((GdkEventAny *)event)->window,
+ &rect,
+ GDK_GRAVITY_SOUTH_WEST,
+ GDK_GRAVITY_NORTH_WEST,
+ event);
+ } else {
+ /* warn about unexpected usage of this function */
g_warning ("Unhandled GdkEvent type=%d", event->type);
+ }
}
gint
diff --git a/app/toolbox.c b/app/toolbox.c
index 17f7e5be..4306d699 100644
--- a/app/toolbox.c
+++ b/app/toolbox.c
@@ -684,9 +684,6 @@ create_tools (DiaToolbox *self)
static void
dia_toolbox_class_init (DiaToolboxClass *class)
{
- GtkWidgetClass *widget_class;
-
- widget_class = GTK_WIDGET_CLASS (class);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]