aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorRyan Dwyer <RyanDwyer@users.noreply.github.com>2018-07-18 09:32:03 +1000
committerGitHub <noreply@github.com>2018-07-18 09:32:03 +1000
commit8ce7e3b44eea0a270ecc35a9da2ae801aaf6bce1 (patch)
tree6badffb0c6ee33b4e23e914c4c9f9b39a625b5f3 /sway/desktop/xdg_shell.c
parent621d2666b1ac214c63628bbe0ac8f5d6485cb501 (diff)
parent48b911a4596f50b585a1073d32413236d9defb60 (diff)
Merge branch 'master' into destroy-output-destroy-empty-workspaces
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r--sway/desktop/xdg_shell.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index ac35a8d1..98c16faf 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -45,6 +45,24 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) {
view_child_destroy(&popup->child);
}
+static void popup_unconstrain(struct sway_xdg_popup *popup) {
+ struct sway_view *view = popup->child.view;
+ struct wlr_xdg_popup *wlr_popup = popup->wlr_xdg_surface->popup;
+
+ struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
+
+ // the output box expressed in the coordinate system of the toplevel parent
+ // of the popup
+ struct wlr_box output_toplevel_sx_box = {
+ .x = output->x - view->x,
+ .y = output->y - view->y,
+ .width = output->width,
+ .height = output->height,
+ };
+
+ wlr_xdg_popup_unconstrain_from_box(wlr_popup, &output_toplevel_sx_box);
+}
+
static struct sway_xdg_popup *popup_create(
struct wlr_xdg_popup *wlr_popup, struct sway_view *view) {
struct wlr_xdg_surface *xdg_surface = wlr_popup->base;
@@ -55,12 +73,15 @@ static struct sway_xdg_popup *popup_create(
return NULL;
}
view_child_init(&popup->child, &popup_impl, view, xdg_surface->surface);
+ popup->wlr_xdg_surface = xdg_surface;
wl_signal_add(&xdg_surface->events.new_popup, &popup->new_popup);
popup->new_popup.notify = popup_handle_new_popup;
wl_signal_add(&xdg_surface->events.destroy, &popup->destroy);
popup->destroy.notify = popup_handle_destroy;
+ popup_unconstrain(popup);
+
return popup;
}
@@ -223,7 +244,8 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
view_set_fullscreen(view, e->fullscreen);
struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
- arrange_and_commit(output);
+ arrange_windows(output);
+ transaction_commit_dirty();
}
static void handle_unmap(struct wl_listener *listener, void *data) {
@@ -260,10 +282,11 @@ static void handle_map(struct wl_listener *listener, void *data) {
if (xdg_surface->toplevel->client_pending.fullscreen) {
view_set_fullscreen(view, true);
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
- arrange_and_commit(ws);
+ arrange_windows(ws);
} else {
- arrange_and_commit(view->swayc->parent);
+ arrange_windows(view->swayc->parent);
}
+ transaction_commit_dirty();
xdg_shell_view->commit.notify = handle_commit;
wl_signal_add(&xdg_surface->surface->events.commit,
@@ -304,11 +327,11 @@ void handle_xdg_shell_surface(struct wl_listener *listener, void *data) {
struct wlr_xdg_surface *xdg_surface = data;
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
- wlr_log(L_DEBUG, "New xdg_shell popup");
+ wlr_log(WLR_DEBUG, "New xdg_shell popup");
return;
}
- wlr_log(L_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'",
+ wlr_log(WLR_DEBUG, "New xdg_shell toplevel title='%s' app_id='%s'",
xdg_surface->toplevel->title, xdg_surface->toplevel->app_id);
wlr_xdg_surface_ping(xdg_surface);