diff options
author | Guido Günther <agx@sigxcpu.org> | 2018-04-23 16:16:47 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-04-26 14:08:30 +0200 |
commit | b1bd0e2557ad7b151fa10a6735f9f14ca3b3a368 (patch) | |
tree | b6717cdb8c13415ab635f85817b41c1ff3790450 /rootston | |
parent | a6790d45b2b25f38754403fe692ee9304aefc5fc (diff) |
layer-shell: Fix crash when cursor is intially outside any output
On the X11 backend the cursor position might be outside the output
window so no output is returned leading to the assert to trigger. Use
sane fallback instead of crashing.
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/layer_shell.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index 836deb42..db0aeb59 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -395,8 +395,18 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { wlr_output_layout_output_at(desktop->layout, seat->cursor->cursor->x, seat->cursor->cursor->y); - assert(output); // And this one - layer_surface->output = output; + if (!output) { + wlr_log(L_ERROR, "Couldn't find output at (%.0f,%.0f)", + seat->cursor->cursor->x, + seat->cursor->cursor->y); + output = wlr_output_layout_get_center_output(desktop->layout); + } + if (output) { + layer_surface->output = output; + } else { + wlr_layer_surface_close(layer_surface); + return; + } } roots_surface->surface_commit.notify = handle_surface_commit; |