Merge lp:~alan-griffiths/miral/more-kiosk-options into lp:miral

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
Approved revision: 440
Merged at revision: 440
Proposed branch: lp:~alan-griffiths/miral/more-kiosk-options
Merge into: lp:miral
Diff against target: 128 lines (+51/-3)
3 files modified
miral-kiosk/kiosk_main.cpp (+22/-3)
miral-kiosk/kiosk_window_manager.cpp (+23/-0)
miral-kiosk/kiosk_window_manager.h (+6/-0)
To merge this branch: bzr merge lp:~alan-griffiths/miral/more-kiosk-options
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Review via email: mp+310270@code.launchpad.net

Commit message

Provide configuration options for kiosk: --keymap --kiosk-maximize-root-windows & --kiosk-startup-apps-only

To post a comment you must log in.
440. By Alan Griffiths

Only apply maximize_root_windows to restored windows

Revision history for this message
Gerry Boland (gerboland) wrote :

Why would a kiosk not have a fullscreen root client window? It's how I understood the "kiosk" idea - has a single fullscreen client window

review: Needs Information
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> Why would a kiosk not have a fullscreen root client window? It's how I
> understood the "kiosk" idea - has a single fullscreen client window

We don't have a real "usecase" for kiosk yet. So, pending feedback from kg I'm allowing the current behaviour (but changing the default).

Revision history for this message
Gerry Boland (gerboland) wrote :

Ok, looks fine to me

+ // We do this here, not in place_new_surface() so that clients get a resize event.
+ // This shouldn't be necessary, but works better with the gtk-mir backend.
You consider this a gtk-mir bug? It smells like one to me

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> + // This shouldn't be necessary, but works better with the gtk-mir backend.
> You consider this a gtk-mir bug? It smells like one to me

I do, but the workaround gets immediate results.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'miral-kiosk/kiosk_main.cpp'
2--- miral-kiosk/kiosk_main.cpp 2016-06-10 19:23:40 +0000
3+++ miral-kiosk/kiosk_main.cpp 2016-11-08 11:18:13 +0000
4@@ -20,16 +20,16 @@
5
6 #include <miral/runner.h>
7 #include <miral/application_authorizer.h>
8+#include <miral/command_line_option.h>
9+#include <miral/keymap.h>
10 #include <miral/set_window_managment_policy.h>
11 #include <miral/internal_client.h>
12
13 #include <unistd.h>
14-#include <cstdlib>
15+#include <atomic>
16
17 namespace
18 {
19-bool const startup_only = getenv("MIRAL_KIOSK_STARTUP_ONLY");
20-
21 struct KioskAuthorizer : miral::ApplicationAuthorizer
22 {
23 KioskAuthorizer(SwSplash const& splash) : splash{splash}{}
24@@ -61,8 +61,12 @@
25 return false;
26 }
27
28+ static std::atomic<bool> startup_only;
29+
30 SwSplash splash;
31 };
32+
33+std::atomic<bool> KioskAuthorizer::startup_only{false};
34 }
35
36 int main(int argc, char const* argv[])
37@@ -71,10 +75,25 @@
38
39 SwSplash splash;
40
41+ CommandLineOption maximise_roots{
42+ [&](bool maximize_root_windows) {KioskWindowManagerPolicy::maximize_root_windows = maximize_root_windows; },
43+ "kiosk-maximize-root-windows",
44+ "Force root windows to maximized",
45+ KioskWindowManagerPolicy::maximize_root_windows};
46+
47+ CommandLineOption startup_only{
48+ [&](bool startup_only) {KioskAuthorizer::startup_only = startup_only; },
49+ "kiosk-startup-apps-only",
50+ "Only allow applications to connect during startup",
51+ KioskAuthorizer::startup_only};
52+
53 return MirRunner{argc, argv}.run_with(
54 {
55 set_window_managment_policy<KioskWindowManagerPolicy>(splash),
56 SetApplicationAuthorizer<KioskAuthorizer>{splash},
57+ Keymap{},
58+ maximise_roots,
59+ startup_only,
60 StartupInternalClient{"Intro", splash}
61 });
62 }
63
64=== modified file 'miral-kiosk/kiosk_window_manager.cpp'
65--- miral-kiosk/kiosk_window_manager.cpp 2016-08-04 16:05:00 +0000
66+++ miral-kiosk/kiosk_window_manager.cpp 2016-11-08 11:18:13 +0000
67@@ -27,6 +27,9 @@
68 namespace ms = mir::scene;
69 using namespace miral;
70
71+std::atomic<bool> KioskWindowManagerPolicy::maximize_root_windows{true};
72+
73+
74 KioskWindowManagerPolicy::KioskWindowManagerPolicy(WindowManagerTools const& tools, SwSplash const& splash) :
75 CanonicalWindowManagerPolicy{tools},
76 splash{splash}
77@@ -119,3 +122,23 @@
78 tools.raise_tree(s);
79 }
80 }
81+
82+void KioskWindowManagerPolicy::advise_new_window(WindowInfo const& window_info)
83+{
84+ // We do this here, not in place_new_surface() so that clients get a resize event.
85+ // This shouldn't be necessary, but works better with the gtk-mir backend.
86+ if (maximize_root_windows &&
87+ window_info.type() == mir_surface_type_normal &&
88+ !window_info.parent() &&
89+ window_info.state() == mir_surface_state_restored)
90+ {
91+ WindowSpecification specification;
92+
93+ specification.state() = mir_surface_state_maximized;
94+
95+ tools.place_and_size_for_state(specification, window_info);
96+ tools.modify_window(window_info.window(), specification);
97+ }
98+
99+ CanonicalWindowManagerPolicy::advise_new_window(window_info);
100+}
101
102=== modified file 'miral-kiosk/kiosk_window_manager.h'
103--- miral-kiosk/kiosk_window_manager.h 2016-07-27 15:43:19 +0000
104+++ miral-kiosk/kiosk_window_manager.h 2016-11-08 11:18:13 +0000
105@@ -23,6 +23,8 @@
106
107 #include <miral/canonical_window_manager.h>
108
109+#include <atomic>
110+
111 using namespace mir::geometry;
112
113 class KioskWindowManagerPolicy : public miral::CanonicalWindowManagerPolicy
114@@ -32,10 +34,14 @@
115
116 void advise_focus_gained(miral::WindowInfo const& info) override;
117
118+ virtual void advise_new_window(miral::WindowInfo const& window_info) override;
119+
120 bool handle_keyboard_event(MirKeyboardEvent const* event) override;
121 bool handle_touch_event(MirTouchEvent const* event) override;
122 bool handle_pointer_event(MirPointerEvent const* event) override;
123
124+ static std::atomic<bool> maximize_root_windows;
125+
126 private:
127 static const int modifier_mask =
128 mir_input_event_modifier_alt |

Subscribers

People subscribed via source and target branches