[gnote] Do not use GdkEvent directly in utils
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Do not use GdkEvent directly in utils
- Date: Wed, 30 Dec 2020 21:00:02 +0000 (UTC)
commit e16ee025301d5900befd55bfc7da6174d0ecf106
Author: Aurimas Černius <aurisc4 gmail com>
Date: Wed Dec 30 22:52:02 2020 +0200
Do not use GdkEvent directly in utils
src/utils.cpp | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/utils.cpp b/src/utils.cpp
index d1673fbb..2b83dd72 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -99,14 +99,23 @@ namespace gnote {
}
- void popup_menu(Gtk::Menu &menu, const GdkEventButton * ev)
+ void popup_menu(Gtk::Menu &menu, const GdkEventButton *ev)
{
+ guint button = 0;
+ guint32 time;
+ auto event = (const GdkEvent*)ev;
+ if(event) {
+ gdk_event_get_button(event, &button);
+ time = gdk_event_get_time(event);
+ }
+ else {
+ time = gtk_get_current_event_time();
+ }
menu.signal_deactivate().connect(sigc::bind(&deactivate_menu, &menu));
menu.popup([&menu](int & x, int & y, bool & push_in) {
get_menu_position(&menu, x, y, push_in);
},
- (ev ? ev->button : 0),
- (ev ? ev->time : gtk_get_current_event_time()));
+ button, time);
if(menu.get_attach_widget()) {
menu.get_attach_widget()->set_state(Gtk::STATE_SELECTED);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]