Windows: on a handset, apps open maximized and dialogs float above
- Apps open maximized on a touchscreen whose short side is under 720px. Restore gives a floating window that fits the screen. - Maximized windows can't be dragged or resized. - Dialogs (xdg_toplevel.set_parent) open floating and centered, and stay above their app when it is activated. - Under tiling, the last used app is drawn on top. - Add transient_for to WmState and make inner_work_area and fit_rect public for the compositor. - Tests cover maximized opening, dialog stacking, drag suppression and restore. - Document the handset window behavior in docs/handset.md.
This commit is contained in:
1 parent
7029c92e6e
commit
5c83cdaa22
5 files changed
+148
-10
No files matched your search
@@ -780,6 +780,12 @@ fn ChandraCompositor::configure_window(self : ChandraCompositor, win : HostWindo
|
||||
)
|
||||
}
|
||||
|
||||
///| A phone's screen: a touchscreen, and the short side (whichever way it is turned) too narrow
|
||||
/// for windows side by side.
|
||||
fn ChandraCompositor::is_handset(self : ChandraCompositor) -> Bool {
|
||||
self.server.touch && self.output_w.min(self.output_h) < 720
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
self.flush_configures()
|
||||
@@ -811,8 +817,17 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
geo_y: 0,
|
||||
}
|
||||
self.windows.set(wid, win)
|
||||
// On a handset apps open maximized, and float so the last used one is on top. Dialogs
|
||||
// float above their app.
|
||||
let handset = self.is_handset()
|
||||
let dialog = self.server.toplevel_has_parent(wid)
|
||||
match self.server.toplevel_parent(wid) {
|
||||
Some(p) => self.wm.transient_for.set(wid, p)
|
||||
None => ()
|
||||
}
|
||||
win.maximized = handset && !dialog
|
||||
// An app whose window was last left somewhere reopens there, floating, kept on screen.
|
||||
let saved = self.shell.saved_window(app_id)
|
||||
let saved = if handset && dialog { None } else { self.shell.saved_window(app_id) }
|
||||
let g : @wm.Rect = match saved {
|
||||
Some((sx, sy, sw, sh)) => {
|
||||
let w = if sw > self.output_w { self.output_w } else { sw }
|
||||
@@ -823,6 +838,14 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
}
|
||||
None => { x: 100, y: 100, w: 640, h: 480 }
|
||||
}
|
||||
// (Maximized, this is the size Restore goes back to.)
|
||||
let g = if handset {
|
||||
let a = self.wm.inner_work_area(self.work_area)
|
||||
let r = @wm.fit_rect(g, a)
|
||||
if dialog { { ..r, x: a.x + (a.w - r.w) / 2, y: a.y + (a.h - r.h) / 2 } } else { r }
|
||||
} else {
|
||||
g
|
||||
}
|
||||
win.geometry = @scene.Rect::new(g.x, g.y, g.w, g.h)
|
||||
let rec : @wm.WindowRecord = {
|
||||
id: wid,
|
||||
@@ -833,10 +856,10 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
min_size: { w: min_w, h: min_h },
|
||||
max_size: None,
|
||||
focused: true,
|
||||
maximized: false,
|
||||
maximized: win.maximized,
|
||||
fullscreen: false,
|
||||
minimized: false,
|
||||
is_floating: saved is Some(_),
|
||||
is_floating: handset || saved is Some(_),
|
||||
workspace: 0U,
|
||||
can_move: true,
|
||||
can_resize: true,
|
||||
|
||||
Reference in new issue
Block a user