diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-04-05 20:14:44 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-04-05 20:14:44 +0000 |
| commit | bcd804c6c383e2964b072257da282d9a91db7d16 (patch) | |
| tree | aa9617b1045a4dda778ac86c7fc5c4ef22eef535 /src/event-context.cpp | |
| parent | add test code for bug #967416 (diff) | |
| download | inkscape-bcd804c6c383e2964b072257da282d9a91db7d16.tar.gz inkscape-bcd804c6c383e2964b072257da282d9a91db7d16.zip | |
C++ify context menu:
- c++ified context-menu.cpp (and included in interface.cpp)
- removed dozens of pointer conversions (of which some were erroneous)
- fixed a memory leak
- added some null pointer checks to prevent crashes
(bzr r11160)
Diffstat (limited to 'src/event-context.cpp')
| -rw-r--r-- | src/event-context.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/event-context.cpp b/src/event-context.cpp index 0cfa18f57..4ea4068fe 100644 --- a/src/event-context.cpp +++ b/src/event-context.cpp @@ -6,8 +6,9 @@ * Frank Felfe <innerspace@iname.com> * bulia byak <buliabyak@users.sf.net> * Jon A. Cruz <jon@joncruz.org> + * Kris De Gussem <Kris.DeGussem@gmail.com> * - * Copyright (C) 1999-2010 authors + * Copyright (C) 1999-2012 authors * Copyright (C) 2001-2002 Ximian, Inc. * * Released under GNU GPL, read the file 'COPYING' for more information @@ -1034,22 +1035,19 @@ static void set_event_location(SPDesktop *desktop, GdkEvent *event) { * Create popup menu and tell Gtk to show it. */ void sp_event_root_menu_popup(SPDesktop *desktop, SPItem *item, GdkEvent *event) { - GtkWidget *menu; - /* fixme: This is not what I want but works for now (Lauris) */ if (event->type == GDK_KEY_PRESS) { item = sp_desktop_selection(desktop)->singleItem(); } - menu = sp_ui_context_menu(desktop, item); - gtk_widget_show(menu); + ContextMenu* CM = new ContextMenu(desktop, item); + CM->show(); switch (event->type) { case GDK_BUTTON_PRESS: - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, 0, NULL, - event->button.button, event->button.time); + CM->popup(event->button.button, event->button.time); break; case GDK_KEY_PRESS: - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, 0, NULL, 0, event->key.time); + CM->popup(0, event->key.time); break; default: break; |
