Merge lp:~3v1n0/unity-2d/secondary-activate-support into lp:unity-2d/3.0

Proposed by Marco Trevisan (Treviño) on 2011-07-19
Status: Rejected
Rejected by: Florian Boucault on 2011-07-27
Proposed branch: lp:~3v1n0/unity-2d/secondary-activate-support
Merge into: lp:unity-2d/3.0
Prerequisite: lp:~3v1n0/unity-2d/scroll-api-merge
Diff against target: 123 lines (+44/-11)
3 files modified
libunity-2d-private/Unity2d/CMakeLists.txt (+1/-1)
panel/applets/CMakeLists.txt (+3/-3)
panel/applets/indicator/indicator.c (+40/-7)
To merge this branch: bzr merge lp:~3v1n0/unity-2d/secondary-activate-support
Reviewer Review Type Date Requested Status
Aurélien Gâteau (community) 2011-07-19 Disapprove on 2011-07-25
Review via email: mp+68395@code.launchpad.net

Description of the change

Add support to "secondary-activate" event on middle-click, needed both by bug #609860 and bug #812933. See the second for more informations.

This needs the merge of lp:~3v1n0/libindicator/secondary-activate-support

To post a comment you must log in.
621. By Marco Trevisan (Treviño) on 2011-07-19

Merging with upstream...

622. By Marco Trevisan (Treviño) on 2011-07-21

libindicator doesn't support x,y mouse position anymore.

Dropping them from signal.

Aurélien Gâteau (agateau) wrote :

Unfortunately this branch cannot be merged in for the same reason lp:~3v1n0/unity-2d/scroll-api-merge cannot be (cf. https://code.launchpad.net/~3v1n0/unity-2d/scroll-api-merge/+merge/66680 )

review: Disapprove

Unmerged revisions

622. By Marco Trevisan (Treviño) on 2011-07-21

libindicator doesn't support x,y mouse position anymore.

Dropping them from signal.

621. By Marco Trevisan (Treviño) on 2011-07-19

Merging with upstream...

620. By Marco Trevisan (Treviño) on 2011-07-18

Use gtk_widget_get_allocation for better future Gtk3 support

619. By Marco Trevisan (Treviño) on 2011-07-09

Emit secondary_activate signal on Middle-Click over indicators

When a middle-click is performed (press and release over the same indicator)
emit the "secondary-activate" signal to the hit indicator entry.

This can be used by indicators to perform particular actions.

618. By Marco Trevisan (Treviño) on 2011-07-08

Compile with libindicator-0.4

617. By Marco Trevisan (Treviño) on 2011-07-02

Use the "entry-scrolled" signal instead of the old ones

It follows the API change of libindicator

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/Unity2d/CMakeLists.txt'
2--- libunity-2d-private/Unity2d/CMakeLists.txt 2011-06-22 08:54:52 +0000
3+++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-07-21 16:44:34 +0000
4@@ -8,7 +8,7 @@
5 pkg_check_modules(GDK REQUIRED gdk-2.0)
6 pkg_check_modules(GIO REQUIRED gio-2.0)
7 pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0)
8-pkg_check_modules(INDICATOR REQUIRED indicator)
9+pkg_check_modules(INDICATOR REQUIRED indicator-0.4)
10
11 find_package(X11 REQUIRED)
12
13
14=== modified file 'panel/applets/CMakeLists.txt'
15--- panel/applets/CMakeLists.txt 2011-06-22 08:22:14 +0000
16+++ panel/applets/CMakeLists.txt 2011-07-21 16:44:34 +0000
17@@ -15,14 +15,14 @@
18 pkg_check_modules(QTBAMF REQUIRED libqtbamf)
19 pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)
20 pkg_check_modules(GTK REQUIRED gtk+-2.0)
21-pkg_check_modules(INDICATOR REQUIRED indicator)
22+pkg_check_modules(INDICATOR REQUIRED indicator-0.4)
23 pkg_check_modules(WNCK REQUIRED libwnck-1.0)
24
25 find_package(X11 REQUIRED)
26
27 # Get indicator dirs from pkgconfig
28-read_pkg_variable(INDICATOR_DIR indicator indicatordir)
29-read_pkg_variable(INDICATOR_ICONS_DIR indicator iconsdir)
30+read_pkg_variable(INDICATOR_DIR indicator-0.4 indicatordir)
31+read_pkg_variable(INDICATOR_ICONS_DIR indicator-0.4 iconsdir)
32 configure_file(indicator-config.h.in indicator-config.h)
33
34 # Sources
35
36=== modified file 'panel/applets/indicator/indicator.c'
37--- panel/applets/indicator/indicator.c 2011-07-21 16:44:33 +0000
38+++ panel/applets/indicator/indicator.c 2011-07-21 16:44:34 +0000
39@@ -165,6 +165,40 @@
40 return FALSE;
41 }
42
43+static gboolean
44+on_menuitem_press (GtkWidget *menuitem, GdkEventButton *event, gpointer data)
45+{
46+ IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
47+ IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
48+
49+ g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
50+ g_return_val_if_fail(entry, FALSE);
51+
52+ static GtkWidget *clicked_item = NULL;
53+
54+ if (event->button == 2) {
55+ if (event->type == GDK_BUTTON_PRESS) {
56+ clicked_item = menuitem;
57+ } else if (event->type == GDK_BUTTON_RELEASE && clicked_item == menuitem) {
58+ GtkAllocation alloc;
59+ gint px = event->x;
60+ gint py = event->y;
61+ gtk_widget_get_allocation (menuitem, &alloc);
62+
63+ if (px >= 0 && px < alloc.width && py >= 0 && py < alloc.height) {
64+ g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE,
65+ entry, event->time);
66+ }
67+ } else if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
68+ clicked_item = NULL;
69+ }
70+
71+ return TRUE;
72+ }
73+
74+ return FALSE;
75+}
76+
77 static void
78 entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
79 {
80@@ -247,6 +281,8 @@
81 g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY, entry);
82 g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);
83 g_signal_connect(G_OBJECT (menuitem), "scroll-event", G_CALLBACK(entry_scrolled), NULL);
84+ g_signal_connect(G_OBJECT(menuitem), "button-press-event", G_CALLBACK(on_menuitem_press), NULL);
85+ g_signal_connect(G_OBJECT(menuitem), "button-release-event", G_CALLBACK(on_menuitem_press), NULL);
86
87 return;
88 }
89@@ -441,6 +477,7 @@
90 GTK_WIDGET_SET_FLAGS (indicator->menu, GTK_WIDGET_FLAGS(indicator->menu) | GTK_CAN_FOCUS);
91 gtk_widget_set_name(GTK_WIDGET (indicator->menu), "indicator-applet-menubar");
92 g_signal_connect(indicator->menu, "button-press-event", G_CALLBACK(on_menu_press), NULL);
93+ g_signal_connect(indicator->menu, "button-release-event", G_CALLBACK(on_menu_press), NULL);
94 //g_signal_connect_after(indicator->menu, "expose-event", G_CALLBACK(menu_on_expose), menu);
95 gtk_container_set_border_width(GTK_CONTAINER(indicator->menu), 0);
96
97@@ -487,7 +524,6 @@
98 g_free(indicator);
99 }
100
101-
102 #if 0
103 static gboolean
104 indicator_size_changed (XfcePanelPlugin *plugin,
105@@ -510,15 +546,12 @@
106 }
107 #endif
108
109-
110 static gboolean
111 on_menu_press (GtkWidget *widget, GdkEventButton *event, IndicatorPlugin *indicator)
112 {
113- if (indicator != NULL && event->button == 1) /* left click only */
114- {
115- /* gtk_menu_popup (GTK_MENU(indicator->menu), NULL, NULL, NULL, NULL, 0,
116- event->time);*/
117+ /* Don't open the menubar item on middle-click, it must be used to send events! */
118+ if (event->button == 2)
119 return TRUE;
120- }
121+
122 return FALSE ;
123 }

Subscribers

People subscribed via source and target branches