Use gdk_event_triggers_context_menu.

Fri, 08 Sep 2017 19:43:07 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Fri, 08 Sep 2017 19:43:07 -0400
changeset 38705
62a7a975251a
parent 38704
ba0c47533bb2
child 38706
4a3f253ea22c

Use gdk_event_triggers_context_menu.

pidgin/gtkblist.c file | annotate | diff | comparison | revisions
pidgin/gtkconv.c file | annotate | diff | comparison | revisions
pidgin/gtkdebug.c file | annotate | diff | comparison | revisions
pidgin/gtklog.c file | annotate | diff | comparison | revisions
pidgin/gtkroomlist.c file | annotate | diff | comparison | revisions
pidgin/gtkstatusbox.c file | annotate | diff | comparison | revisions
pidgin/gtkwebview.c file | annotate | diff | comparison | revisions
pidgin/gtkwebviewtoolbar.c file | annotate | diff | comparison | revisions
pidgin/plugins/disco/gtkdisco.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkblist.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkblist.c	Fri Sep 08 19:43:07 2017 -0400
@@ -1941,7 +1941,7 @@
 	gtknode = purple_blist_node_get_ui_data(node);
 
 	/* Right click draws a context menu */
-	if ((event->button == 3) && (event->type == GDK_BUTTON_PRESS)) {
+	if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
 		handled = pidgin_blist_show_context_menu(node, NULL, tv, 3, event->time);
 
 	/* CTRL+middle click expands or collapse a contact */
@@ -4627,21 +4627,20 @@
 {
 	GList *convs;
 
-	switch (event->button) {
-		case 1:
-			convs = pidgin_conversations_get_unseen_ims(PIDGIN_UNSEEN_TEXT, FALSE, 1);
-
-			if(!convs)
-				convs = pidgin_conversations_get_unseen_chats(PIDGIN_UNSEEN_NICK, FALSE, 1);
-			if (convs) {
-				pidgin_conv_present_conversation((PurpleConversation*)convs->data);
-				g_list_free(convs);
-			}
-			break;
-		case 3:
-			unseen_conv_menu();
-			break;
-	}
+	if (event->button == 1) {
+		convs = pidgin_conversations_get_unseen_ims(PIDGIN_UNSEEN_TEXT, FALSE, 1);
+
+		if(!convs)
+			convs = pidgin_conversations_get_unseen_chats(PIDGIN_UNSEEN_NICK, FALSE, 1);
+		if (convs) {
+			pidgin_conv_present_conversation((PurpleConversation*)convs->data);
+			g_list_free(convs);
+		}
+
+	} else if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
+		unseen_conv_menu();
+	}
+
 	return TRUE;
 }
 
--- a/pidgin/gtkconv.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkconv.c	Fri Sep 08 19:43:07 2017 -0400
@@ -1859,7 +1859,7 @@
 		if (node != NULL)
 			webkit_dom_element_scroll_into_view(WEBKIT_DOM_ELEMENT(node), TRUE);
 
-	} else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
+	} else if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
 		GtkWidget *menu = create_chat_menu (PURPLE_CHAT_CONVERSATION(conv), who, gc);
 		gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
 					   event->button, event->time);
@@ -2967,7 +2967,7 @@
 		return TRUE;
 	}
 
-	if (e->button != 3 || e->type != GDK_BUTTON_PRESS) {
+	if (!gdk_event_triggers_context_menu((GdkEvent *)e)) {
 		return FALSE;
 	}
 
@@ -6256,7 +6256,7 @@
 			g_free(name);
 
 			return TRUE;
-		} else if (btn_event->button == 3 && event->type == GDK_BUTTON_PRESS) {
+		} else if (gdk_event_triggers_context_menu(event)) {
 			GtkTextIter start, end;
 
 			/* we shouldn't display the popup
@@ -9391,7 +9391,7 @@
 		return FALSE;
 	}
 
-	if (e->button == 3) {
+	if (gdk_event_triggers_context_menu((GdkEvent *)e)) {
 		/* Right click was pressed. Popup the context menu. */
 		GtkWidget *menu = gtk_menu_new(), *sub;
 		gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE);
@@ -9804,7 +9804,7 @@
 	GtkWidget *menu;
 	PidginConversation *gtkconv;
 
-	if (event->type != GDK_BUTTON_PRESS || event->button != 3)
+	if (!gdk_event_triggers_context_menu((GdkEvent *)event))
 		return FALSE;
 
 	gtkconv = pidgin_conv_window_get_gtkconv_at_index(win,
--- a/pidgin/gtkdebug.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkdebug.c	Fri Sep 08 19:43:07 2017 -0400
@@ -396,7 +396,7 @@
 	GtkToolbarStyle value[3];
 	int i;
 
-	if (!(event->button == 3 && event->type == GDK_BUTTON_PRESS))
+	if (!gdk_event_triggers_context_menu((GdkEvent *)event))
 		return FALSE;
 
 	text[0] = _("_Icon Only");          value[0] = GTK_TOOLBAR_ICONS;
--- a/pidgin/gtklog.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtklog.c	Fri Sep 08 19:43:07 2017 -0400
@@ -349,8 +349,7 @@
 
 static gboolean log_button_press_cb(GtkWidget *treeview, GdkEventButton *event, PidginLogViewer *lv)
 {
-	if (event->type == GDK_BUTTON_PRESS && event->button == 3)
-	{
+	if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
 		GtkTreePath *path;
 		GtkTreeIter *iter;
 		GValue val;
--- a/pidgin/gtkroomlist.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkroomlist.c	Fri Sep 08 19:43:07 2017 -0400
@@ -298,7 +298,7 @@
 	GtkWidget *menu;
 	static struct _menu_cb_info info; /* XXX? */
 
-	if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
+	if (!gdk_event_triggers_context_menu((GdkEvent *)event))
 		return FALSE;
 
 	/* Here we figure out which room was clicked */
--- a/pidgin/gtkstatusbox.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkstatusbox.c	Fri Sep 08 19:43:07 2017 -0400
@@ -301,7 +301,7 @@
 static gboolean
 icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
 {
-	if (event->button == 3) {
+	if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
 		GtkWidget *menu_item;
 		const char *path;
 
--- a/pidgin/gtkwebview.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkwebview.c	Fri Sep 08 19:43:07 2017 -0400
@@ -969,7 +969,7 @@
 static gboolean
 webview_button_pressed(WebKitWebView *webview, GdkEventButton *event)
 {
-	if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
+	if (gdk_event_triggers_context_menu((GdkEvent *)event)) {
 		WebKitHitTestResult *hit;
 		int context;
 		WebKitDOMNode *node;
--- a/pidgin/gtkwebviewtoolbar.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/gtkwebviewtoolbar.c	Fri Sep 08 19:43:07 2017 -0400
@@ -1245,7 +1245,7 @@
 	GtkWidget *item;
 	gboolean wide;
 
-	if (event->button != 3)
+	if (!gdk_event_triggers_context_menu((GdkEvent *)event))
 		return FALSE;
 
 	wide = gtk_widget_get_visible(priv->wide_view);
--- a/pidgin/plugins/disco/gtkdisco.c	Fri Sep 08 00:55:18 2017 -0400
+++ b/pidgin/plugins/disco/gtkdisco.c	Fri Sep 08 19:43:07 2017 -0400
@@ -282,7 +282,7 @@
 	GtkTreeIter iter;
 	GValue val;
 
-	if (event->button != 3 || event->type != GDK_BUTTON_PRESS)
+	if (!gdk_event_triggers_context_menu((GdkEvent *)event))
 		return FALSE;
 
 	pdl = user_data;

mercurial