Merge lp:~davidmhewitt/wingpanel/fix-focus into lp:~wingpanel-devs/wingpanel/trunk

Proposed by David Hewitt
Status: Merged
Approved by: Danielle Foré
Approved revision: 175
Merged at revision: 176
Proposed branch: lp:~davidmhewitt/wingpanel/fix-focus
Merge into: lp:~wingpanel-devs/wingpanel/trunk
Diff against target: 40 lines (+1/-11)
2 files modified
src/Services/PopoverManager.vala (+0/-10)
src/Widgets/IndicatorEntry.vala (+1/-1)
To merge this branch: bzr merge lp:~davidmhewitt/wingpanel/fix-focus
Reviewer Review Type Date Requested Status
Danielle Foré Approve
Review via email: mp+320544@code.launchpad.net

Commit message

IndicatorEntry.vala:
* Prevent middle click events on indicators from being propagated to anywhere but the indicator itself.
PopoverManager.vala:
* Don't call set_expanded when mousing in/out of wingpanel, only necessary when opening/closing the popover

Description of the change

There were two problems here that prevented a dialog opened by middle-clicking an indicator from getting focus.

The first was that the set_expanded method was called when the mouse moved in and out of the bound of wingpanel. As far as I can tell, this should only be called when a popover is opened as it looks like it expands/contracts the area that the popover should fit into. Calling it when the mouse left wingpanel was causing wingpanel to activate the window that was activated when the mouse entered wingpanel.

Because the middle click happened between these two events, the wrong window was being focused.

The second issue was that middle click events were also being propagated elsewhere instead of just to the indicator, I believe this was causing gala to give focus to the indicator itself rather than the dialog, meaning you had to click once in the dialog to focus it and then again to perform your action.

I've tested this quite comprehensively and haven't noticed any difference in the way anything works, so I think it is safe to merge this code. However, it would be good to know the reasoning for why it was developed this way in the first place.

A branch of the session indicator that spawns a dialog on middle-clicking the indicator can be found here for testing: https://github.com/elementary/wingpanel-indicator-session/tree/middle-click-shortcut

To post a comment you must log in.
Revision history for this message
Djax (parnold-x) wrote :

Hi, the expand on enter was necessary because of some timing thing inside gtk. Often when a popover expanded right after the window expand, it opened to the top and the popover could not be seen right. Maybe they changed the timing stuff, dunno I have not monitored the development lately.

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Thanks, do you have any hints as to where I should look to see if this has changed?

Revision history for this message
Djax (parnold-x) wrote :

Not really. If it doesn't appear if you open/close a popover fast many times it should be fine. If I remember right it happend quite often in this case.

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Can open/close popovers really fast with the enter/leave code removed, so I'm definitely not seeing that issue. It would be nice if a few more people could test it in case it's related to hardware speed or something strange like that.

lp:~davidmhewitt/wingpanel/fix-focus updated
175. By David Hewitt

Merged trunk

Revision history for this message
Danielle Foré (danrabbit) wrote :

Been running the branch the past couple days and haven't experienced any issues yet :)

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Tested in a virtual machine to emulate much slower hardware and works fine too!

Revision history for this message
Danielle Foré (danrabbit) wrote :

Going to merge since nobody has had any issues with this yet. Will get wider testing in Daily

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Services/PopoverManager.vala'
2--- src/Services/PopoverManager.vala 2017-02-04 20:54:27 +0000
3+++ src/Services/PopoverManager.vala 2017-03-26 16:03:34 +0000
4@@ -171,8 +171,6 @@
5 registered_indicators.set (widg.base_indicator.code_name, widg);
6
7 widg.enter_notify_event.connect ((w, e) => {
8- owner.set_expanded (true);
9-
10 if (mousing) {
11 return Gdk.EVENT_PROPAGATE;
12 }
13@@ -190,14 +188,6 @@
14 return Gdk.EVENT_PROPAGATE;
15 });
16
17- widg.leave_notify_event.connect (() => {
18- if (this.current_indicator == null) {
19- owner.set_expanded (false);
20- }
21-
22- return Gdk.EVENT_PROPAGATE;
23- });
24-
25 widg.notify["visible"].connect (() => {
26 if (mousing || grabbed) {
27 return;
28
29=== modified file 'src/Widgets/IndicatorEntry.vala'
30--- src/Widgets/IndicatorEntry.vala 2017-01-02 21:30:08 +0000
31+++ src/Widgets/IndicatorEntry.vala 2017-03-26 16:03:34 +0000
32@@ -128,7 +128,7 @@
33 /* Call button press on the indicator display widget */
34 display_widget.button_press_event (e);
35
36- return Gdk.EVENT_PROPAGATE;
37+ return Gdk.EVENT_STOP;
38 });
39
40 set_reveal (base_indicator.visible);

Subscribers

People subscribed via source and target branches

to all changes: