Merge lp:~gerboland/unity-mir/app-visible-property into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Daniel d'Andrada
Approved revision: 181
Merged at revision: 181
Proposed branch: lp:~gerboland/unity-mir/app-visible-property
Merge into: lp:unity-mir
Diff against target: 92 lines (+28/-0)
2 files modified
src/modules/Unity/Application/application.cpp (+22/-0)
src/modules/Unity/Application/application.h (+6/-0)
To merge this branch: bzr merge lp:~gerboland/unity-mir/app-visible-property
Reviewer Review Type Date Requested Status
Daniel d'Andrada (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+207177@code.launchpad.net

Commit message

Add visible property to Application, so can show/hide all app surfaces

Description of the change

Add visible property to Application, so can show/hide all app surfaces

• Are there any related MPs required for this MP to build/function as expected?
No
• Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
• If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Unnecessary

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Works well! I need it!

review: Approve
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
 * Did CI run pass? If not, please explain why.
Yes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application.cpp'
2--- src/modules/Unity/Application/application.cpp 2014-01-27 11:29:44 +0000
3+++ src/modules/Unity/Application/application.cpp 2014-02-19 12:52:49 +0000
4@@ -40,6 +40,7 @@
5 , m_state(state)
6 , m_focused(false)
7 , m_fullscreen(false)
8+ , m_visible(false)
9 , m_arguments(arguments)
10 , m_suspendTimer(new QTimer(this))
11 {
12@@ -125,6 +126,11 @@
13 return m_session;
14 }
15
16+bool Application::visible() const
17+{
18+ return m_visible;
19+}
20+
21 pid_t Application::pid() const
22 {
23 return m_pid;
24@@ -141,6 +147,7 @@
25
26 // TODO(greyback) what if called with new surface?
27 m_session = session;
28+ m_visible = true; // bit of an assumption that, but no other way to deduce an actual Surface has been created
29 }
30
31 void Application::setSessionName(const QString& name)
32@@ -216,6 +223,21 @@
33 }
34 }
35
36+void Application::setVisible(const bool visible)
37+{
38+ DLOG("Application::setVisible (this=%p, visible=%s)", this, visible ? "yes" : "no");
39+ // FIXME: this is bad, as should a MirSurface of this app exist, it won't be notified of the visiblity change.
40+ if (visible != m_visible) {
41+ if (visible) {
42+ m_session->show();
43+ } else {
44+ m_session->hide();
45+ }
46+ m_visible = visible;
47+ Q_EMIT visibleChanged();
48+ }
49+}
50+
51 void Application::suspend()
52 {
53 DLOG("Application::suspend (this=%p)", this);
54
55=== modified file 'src/modules/Unity/Application/application.h'
56--- src/modules/Unity/Application/application.h 2014-01-27 11:29:44 +0000
57+++ src/modules/Unity/Application/application.h 2014-02-19 12:52:49 +0000
58@@ -38,6 +38,7 @@
59 Q_PROPERTY(QString desktopFile READ desktopFile CONSTANT)
60 Q_PROPERTY(QString exec READ exec CONSTANT)
61 Q_PROPERTY(bool fullscreen READ fullscreen NOTIFY fullscreenChanged)
62+ Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
63 Q_PROPERTY(Stage stage READ stage WRITE setStage NOTIFY stageChanged)
64
65 public:
66@@ -57,7 +58,10 @@
67 State state() const override;
68 bool focused() const override;
69
70+ bool visible() const;
71+
72 void setStage(Stage stage);
73+ void setVisible(const bool);
74
75 bool isValid() const;
76 QString desktopFile() const;
77@@ -74,6 +78,7 @@
78 Q_SIGNALS:
79 void fullscreenChanged();
80 void stageChanged(Stage stage);
81+ void visibleChanged();
82
83 private:
84 void setPid(pid_t pid);
85@@ -90,6 +95,7 @@
86 State m_state;
87 bool m_focused;
88 bool m_fullscreen;
89+ bool m_visible; // duplicating internal Mir data :(
90 std::shared_ptr<mir::shell::Session> m_session;
91 QString m_sessionName;
92 QStringList m_arguments;

Subscribers

People subscribed via source and target branches