Merge lp:~osomon/unity-2d/panel-update-on-view-opened into lp:unity-2d/3.0

Proposed by Olivier Tilloy
Status: Merged
Approved by: Ugo Riboni
Approved revision: 533
Merged at revision: 532
Proposed branch: lp:~osomon/unity-2d/panel-update-on-view-opened
Merge into: lp:unity-2d/3.0
Diff against target: 63 lines (+24/-0)
3 files modified
panel/applets/appname/menubarwidget.cpp (+18/-0)
panel/applets/appname/menubarwidget.h (+1/-0)
panel/applets/appname/windowhelper.cpp (+5/-0)
To merge this branch: bzr merge lp:~osomon/unity-2d/panel-update-on-view-opened
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Approve
Review via email: mp+57598@code.launchpad.net

Commit message

[panel] Update the appname applet’s information (application name, window buttons, menu bar) also when a new view is opened.

This works around a bug in BAMF whereby the ActiveWindowChanged signal is not emitted for some windows that open maximized. This is for example the case of the LibreOffice startcenter..

To post a comment you must log in.
Revision history for this message
Ugo Riboni (uriboni) wrote :

I tested it functionally and it works fine with both libreoffice and other applications that are made to start maximized.
I also checked for regressions with other apps and window sizes and it all seems ok.

Looking at the code I don't see how it would cause regressions anyway. At worse what it might do is cause unnecessary updates.

I don't have comments about the code either, it seems good to go.
Well done.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/applets/appname/menubarwidget.cpp'
2--- panel/applets/appname/menubarwidget.cpp 2011-04-01 17:04:43 +0000
3+++ panel/applets/appname/menubarwidget.cpp 2011-04-13 21:29:45 +0000
4@@ -69,6 +69,11 @@
5
6 connect(&BamfMatcher::get_default(), SIGNAL(ActiveWindowChanged(BamfWindow*, BamfWindow*)),
7 SLOT(slotActiveWindowChanged(BamfWindow*, BamfWindow*)));
8+ /* Work around a bug in BAMF: the ActiveWindowChanged signal is not emitted
9+ for some windows that open maximized. This is for example the case of the
10+ LibreOffice startcenter. */
11+ connect(&BamfMatcher::get_default(), SIGNAL(ViewOpened(BamfView*)),
12+ SLOT(slotViewOpened()));
13 updateActiveWinId(BamfMatcher::get_default().active_window());
14 }
15
16@@ -121,6 +126,19 @@
17 }
18 }
19
20+void MenuBarWidget::slotViewOpened()
21+{
22+ BamfWindow* active = BamfMatcher::get_default().active_window();
23+ if (active != NULL) {
24+ if (active->xid() != m_activeWinId) {
25+ /* This shouldn’t be needed as BAMF should have emitted the
26+ ActiveWindowChanged signal, but it sometimes doesn’t (e.g. when
27+ LibreOffice startcenter starts automatically maximized). */
28+ updateActiveWinId(active);
29+ }
30+ }
31+}
32+
33 void MenuBarWidget::slotWindowRegistered(WId wid, const QString& service, const QDBusObjectPath& menuObjectPath)
34 {
35 MyDBusMenuImporter* importer = new MyDBusMenuImporter(service, menuObjectPath.path(), this);
36
37=== modified file 'panel/applets/appname/menubarwidget.h'
38--- panel/applets/appname/menubarwidget.h 2011-01-15 01:41:03 +0000
39+++ panel/applets/appname/menubarwidget.h 2011-04-13 21:29:45 +0000
40@@ -80,6 +80,7 @@
41
42 private Q_SLOTS:
43 void slotActiveWindowChanged(BamfWindow*, BamfWindow*);
44+ void slotViewOpened();
45 void slotWindowRegistered(WId, const QString& service, const QDBusObjectPath& menuObjectPath);
46 void slotWindowUnregistered(WId);
47 void slotMenuUpdated();
48
49=== modified file 'panel/applets/appname/windowhelper.cpp'
50--- panel/applets/appname/windowhelper.cpp 2011-03-30 16:21:18 +0000
51+++ panel/applets/appname/windowhelper.cpp 2011-04-13 21:29:45 +0000
52@@ -61,6 +61,11 @@
53
54 connect(&BamfMatcher::get_default(), SIGNAL(ActiveWindowChanged(BamfWindow*,BamfWindow*)),
55 SLOT(update()));
56+ /* Work around a bug in BAMF: the ActiveWindowChanged signal is not emitted
57+ for some windows that open maximized. This is for example the case of the
58+ LibreOffice startcenter. */
59+ connect(&BamfMatcher::get_default(), SIGNAL(ViewOpened(BamfView*)),
60+ SLOT(update()));
61 // Work around a BAMF bug: it does not emit ActiveWindowChanged when the
62 // last window is closed. Should be removed when this bug is fixed.
63 connect(&BamfMatcher::get_default(), SIGNAL(ViewClosed(BamfView*)),

Subscribers

People subscribed via source and target branches