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

Proposed by Marco Trevisan (Treviño)
Status: Rejected
Rejected by: Florian Boucault
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) Disapprove
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)

Merging with upstream...

622. By Marco Trevisan (Treviño)

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

Dropping them from signal.

Revision history for this message
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)

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

Dropping them from signal.

621. By Marco Trevisan (Treviño)

Merging with upstream...

620. By Marco Trevisan (Treviño)

Use gtk_widget_get_allocation for better future Gtk3 support

619. By Marco Trevisan (Treviño)

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)

Compile with libindicator-0.4

617. By Marco Trevisan (Treviño)

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
=== modified file 'libunity-2d-private/Unity2d/CMakeLists.txt'
--- libunity-2d-private/Unity2d/CMakeLists.txt 2011-06-22 08:54:52 +0000
+++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-07-21 16:44:34 +0000
@@ -8,7 +8,7 @@
8pkg_check_modules(GDK REQUIRED gdk-2.0)8pkg_check_modules(GDK REQUIRED gdk-2.0)
9pkg_check_modules(GIO REQUIRED gio-2.0)9pkg_check_modules(GIO REQUIRED gio-2.0)
10pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0)10pkg_check_modules(STARTUPNOTIFICATION REQUIRED libstartup-notification-1.0)
11pkg_check_modules(INDICATOR REQUIRED indicator)11pkg_check_modules(INDICATOR REQUIRED indicator-0.4)
1212
13find_package(X11 REQUIRED)13find_package(X11 REQUIRED)
1414
1515
=== modified file 'panel/applets/CMakeLists.txt'
--- panel/applets/CMakeLists.txt 2011-06-22 08:22:14 +0000
+++ panel/applets/CMakeLists.txt 2011-07-21 16:44:34 +0000
@@ -15,14 +15,14 @@
15pkg_check_modules(QTBAMF REQUIRED libqtbamf)15pkg_check_modules(QTBAMF REQUIRED libqtbamf)
16pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)16pkg_check_modules(DBUSMENUQT REQUIRED dbusmenu-qt)
17pkg_check_modules(GTK REQUIRED gtk+-2.0)17pkg_check_modules(GTK REQUIRED gtk+-2.0)
18pkg_check_modules(INDICATOR REQUIRED indicator)18pkg_check_modules(INDICATOR REQUIRED indicator-0.4)
19pkg_check_modules(WNCK REQUIRED libwnck-1.0)19pkg_check_modules(WNCK REQUIRED libwnck-1.0)
2020
21find_package(X11 REQUIRED)21find_package(X11 REQUIRED)
2222
23# Get indicator dirs from pkgconfig23# Get indicator dirs from pkgconfig
24read_pkg_variable(INDICATOR_DIR indicator indicatordir)24read_pkg_variable(INDICATOR_DIR indicator-0.4 indicatordir)
25read_pkg_variable(INDICATOR_ICONS_DIR indicator iconsdir)25read_pkg_variable(INDICATOR_ICONS_DIR indicator-0.4 iconsdir)
26configure_file(indicator-config.h.in indicator-config.h)26configure_file(indicator-config.h.in indicator-config.h)
2727
28# Sources28# Sources
2929
=== modified file 'panel/applets/indicator/indicator.c'
--- panel/applets/indicator/indicator.c 2011-07-21 16:44:33 +0000
+++ panel/applets/indicator/indicator.c 2011-07-21 16:44:34 +0000
@@ -165,6 +165,40 @@
165 return FALSE;165 return FALSE;
166}166}
167167
168static gboolean
169on_menuitem_press (GtkWidget *menuitem, GdkEventButton *event, gpointer data)
170{
171 IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT);
172 IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY);
173
174 g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE);
175 g_return_val_if_fail(entry, FALSE);
176
177 static GtkWidget *clicked_item = NULL;
178
179 if (event->button == 2) {
180 if (event->type == GDK_BUTTON_PRESS) {
181 clicked_item = menuitem;
182 } else if (event->type == GDK_BUTTON_RELEASE && clicked_item == menuitem) {
183 GtkAllocation alloc;
184 gint px = event->x;
185 gint py = event->y;
186 gtk_widget_get_allocation (menuitem, &alloc);
187
188 if (px >= 0 && px < alloc.width && py >= 0 && py < alloc.height) {
189 g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE,
190 entry, event->time);
191 }
192 } else if (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) {
193 clicked_item = NULL;
194 }
195
196 return TRUE;
197 }
198
199 return FALSE;
200}
201
168static void202static void
169entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)203entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar)
170{204{
@@ -247,6 +281,8 @@
247 g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY, entry);281 g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY, entry);
248 g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);282 g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io);
249 g_signal_connect(G_OBJECT (menuitem), "scroll-event", G_CALLBACK(entry_scrolled), NULL);283 g_signal_connect(G_OBJECT (menuitem), "scroll-event", G_CALLBACK(entry_scrolled), NULL);
284 g_signal_connect(G_OBJECT(menuitem), "button-press-event", G_CALLBACK(on_menuitem_press), NULL);
285 g_signal_connect(G_OBJECT(menuitem), "button-release-event", G_CALLBACK(on_menuitem_press), NULL);
250286
251 return;287 return;
252}288}
@@ -441,6 +477,7 @@
441 GTK_WIDGET_SET_FLAGS (indicator->menu, GTK_WIDGET_FLAGS(indicator->menu) | GTK_CAN_FOCUS);477 GTK_WIDGET_SET_FLAGS (indicator->menu, GTK_WIDGET_FLAGS(indicator->menu) | GTK_CAN_FOCUS);
442 gtk_widget_set_name(GTK_WIDGET (indicator->menu), "indicator-applet-menubar");478 gtk_widget_set_name(GTK_WIDGET (indicator->menu), "indicator-applet-menubar");
443 g_signal_connect(indicator->menu, "button-press-event", G_CALLBACK(on_menu_press), NULL);479 g_signal_connect(indicator->menu, "button-press-event", G_CALLBACK(on_menu_press), NULL);
480 g_signal_connect(indicator->menu, "button-release-event", G_CALLBACK(on_menu_press), NULL);
444 //g_signal_connect_after(indicator->menu, "expose-event", G_CALLBACK(menu_on_expose), menu);481 //g_signal_connect_after(indicator->menu, "expose-event", G_CALLBACK(menu_on_expose), menu);
445 gtk_container_set_border_width(GTK_CONTAINER(indicator->menu), 0);482 gtk_container_set_border_width(GTK_CONTAINER(indicator->menu), 0);
446483
@@ -487,7 +524,6 @@
487 g_free(indicator);524 g_free(indicator);
488}525}
489526
490
491#if 0527#if 0
492static gboolean528static gboolean
493indicator_size_changed (XfcePanelPlugin *plugin,529indicator_size_changed (XfcePanelPlugin *plugin,
@@ -510,15 +546,12 @@
510}546}
511#endif547#endif
512548
513
514static gboolean549static gboolean
515on_menu_press (GtkWidget *widget, GdkEventButton *event, IndicatorPlugin *indicator)550on_menu_press (GtkWidget *widget, GdkEventButton *event, IndicatorPlugin *indicator)
516{551{
517 if (indicator != NULL && event->button == 1) /* left click only */552 /* Don't open the menubar item on middle-click, it must be used to send events! */
518 {553 if (event->button == 2)
519 /* gtk_menu_popup (GTK_MENU(indicator->menu), NULL, NULL, NULL, NULL, 0,
520 event->time);*/
521 return TRUE;554 return TRUE;
522 }555
523 return FALSE ;556 return FALSE ;
524}557}

Subscribers

People subscribed via source and target branches