summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-06-26 11:59:06 +0900
committerLibravatar Dominique Martinet <asmadeus@codewreck.org>2018-06-26 12:02:50 +0900
commitc9be0145576433e71f8b7732f7ff5ddee0d36076 (patch)
tree8636e5de53e26f990b3c9d8bebea993446aaeb36
parentMerge pull request #2159 from acrisci/focus-dont-follow-keyboard-grab (diff)
downloadsway-c9be0145576433e71f8b7732f7ff5ddee0d36076.tar.gz
sway-c9be0145576433e71f8b7732f7ff5ddee0d36076.tar.zst
sway-c9be0145576433e71f8b7732f7ff5ddee0d36076.zip
xdg_shell: make view floating if a parent has been set
Prompts e.g. authentication request from firefox-wayland ought to be floating. This is a bit coarse but just fixed size is not enough, here is what firefox does: [1285461.363] -> xdg_wm_base@18.get_xdg_surface(new id xdg_surface@68, wl_surface@71) [1285461.508] -> xdg_surface@68.get_toplevel(new id xdg_toplevel@67) [1285461.571] -> xdg_toplevel@67.set_parent(xdg_toplevel@37) [1285461.630] -> xdg_toplevel@67.set_title("Authentication Required") [1285461.736] -> xdg_toplevel@67.set_app_id("firefox") ... [1285476.549] xdg_toplevel@67.configure(0, 0, array) ... [1285502.080] -> xdg_toplevel@67.set_min_size(299, 187) [1285502.140] -> xdg_toplevel@67.set_max_size(1920, 32767) This can also be observed with e.g. the open window of gedit (gedit->open->other documents)
-rw-r--r--sway/desktop/xdg_shell.c9
-rw-r--r--sway/desktop/xdg_shell_v6.c10
2 files changed, 11 insertions, 8 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index d2b8822c..8457c06b 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -120,11 +120,12 @@ static void set_fullscreen(struct sway_view *view, bool fullscreen) {
120} 120}
121 121
122static bool wants_floating(struct sway_view *view) { 122static bool wants_floating(struct sway_view *view) {
123 struct wlr_xdg_toplevel_state *state = 123 struct wlr_xdg_toplevel *toplevel = view->wlr_xdg_surface->toplevel;
124 &view->wlr_xdg_surface->toplevel->current; 124 struct wlr_xdg_toplevel_state *state = &toplevel->current;
125 return state->min_width != 0 && state->min_height != 0 125 return (state->min_width != 0 && state->min_height != 0
126 && state->min_width == state->max_width 126 && state->min_width == state->max_width
127 && state->min_height == state->max_height; 127 && state->min_height == state->max_height)
128 || toplevel->parent;
128} 129}
129 130
130static void for_each_surface(struct sway_view *view, 131static void for_each_surface(struct sway_view *view,
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index 6ffe334a..eb1cef26 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -119,11 +119,13 @@ static void set_fullscreen(struct sway_view *view, bool fullscreen) {
119} 119}
120 120
121static bool wants_floating(struct sway_view *view) { 121static bool wants_floating(struct sway_view *view) {
122 struct wlr_xdg_toplevel_v6_state *state = 122 struct wlr_xdg_toplevel_v6 *toplevel =
123 &view->wlr_xdg_surface_v6->toplevel->current; 123 view->wlr_xdg_surface_v6->toplevel;
124 return state->min_width != 0 && state->min_height != 0 124 struct wlr_xdg_toplevel_v6_state *state = &toplevel->current;
125 return (state->min_width != 0 && state->min_height != 0
125 && state->min_width == state->max_width 126 && state->min_width == state->max_width
126 && state->min_height == state->max_height; 127 && state->min_height == state->max_height)
128 || toplevel->parent;
127} 129}
128 130
129static void for_each_surface(struct sway_view *view, 131static void for_each_surface(struct sway_view *view,