aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-10-09 00:02:36 +0200
committerGitHub <noreply@github.com>2018-10-09 00:02:36 +0200
commit4bebee620f1160d6531d9aaa9b528029f75cecf4 (patch)
tree14fb50168c3ba60446b11b786ea69b8fa07b767f /sway/desktop
parenta999269e1cf8eeb423547a0c8ab3420f27628168 (diff)
parentcaed15af8210abffe2dff7c9e0fffc36ab0fbdb5 (diff)
Merge pull request #2772 from RyanDwyer/improve-popup-damage
Only damage popups when popups have damage
Diffstat (limited to 'sway/desktop')
-rw-r--r--sway/desktop/xdg_shell.c15
-rw-r--r--sway/desktop/xdg_shell_v6.c15
2 files changed, 30 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 4690a3c5..46582204 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -20,6 +20,17 @@
static const struct sway_view_child_impl popup_impl;
+static void popup_get_root_coords(struct sway_view_child *child,
+ int *root_sx, int *root_sy) {
+ struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child;
+ struct wlr_xdg_surface *surface = popup->wlr_xdg_surface;
+
+ wlr_xdg_popup_get_toplevel_coords(surface->popup,
+ -surface->geometry.x + surface->popup->geometry.x,
+ -surface->geometry.y + surface->popup->geometry.y,
+ root_sx, root_sy);
+}
+
static void popup_destroy(struct sway_view_child *child) {
if (!sway_assert(child->impl == &popup_impl,
"Expected an xdg_shell popup")) {
@@ -32,6 +43,7 @@ static void popup_destroy(struct sway_view_child *child) {
}
static const struct sway_view_child_impl popup_impl = {
+ .get_root_coords = popup_get_root_coords,
.destroy = popup_destroy,
};
@@ -85,6 +97,9 @@ static struct sway_xdg_popup *popup_create(
wl_signal_add(&xdg_surface->events.destroy, &popup->destroy);
popup->destroy.notify = popup_handle_destroy;
+ wl_signal_add(&xdg_surface->events.map, &popup->child.surface_map);
+ wl_signal_add(&xdg_surface->events.unmap, &popup->child.surface_unmap);
+
popup_unconstrain(popup);
return popup;
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c
index ff950c70..165cc7eb 100644
--- a/sway/desktop/xdg_shell_v6.c
+++ b/sway/desktop/xdg_shell_v6.c
@@ -19,6 +19,17 @@
static const struct sway_view_child_impl popup_impl;
+static void popup_get_root_coords(struct sway_view_child *child,
+ int *root_sx, int *root_sy) {
+ struct sway_xdg_popup_v6 *popup = (struct sway_xdg_popup_v6 *)child;
+ struct wlr_xdg_surface_v6 *surface = popup->wlr_xdg_surface_v6;
+
+ wlr_xdg_popup_v6_get_toplevel_coords(surface->popup,
+ -surface->geometry.x + surface->popup->geometry.x,
+ -surface->geometry.y + surface->popup->geometry.y,
+ root_sx, root_sy);
+}
+
static void popup_destroy(struct sway_view_child *child) {
if (!sway_assert(child->impl == &popup_impl,
"Expected an xdg_shell_v6 popup")) {
@@ -31,6 +42,7 @@ static void popup_destroy(struct sway_view_child *child) {
}
static const struct sway_view_child_impl popup_impl = {
+ .get_root_coords = popup_get_root_coords,
.destroy = popup_destroy,
};
@@ -84,6 +96,9 @@ static struct sway_xdg_popup_v6 *popup_create(
wl_signal_add(&xdg_surface->events.destroy, &popup->destroy);
popup->destroy.notify = popup_handle_destroy;
+ wl_signal_add(&xdg_surface->events.map, &popup->child.surface_map);
+ wl_signal_add(&xdg_surface->events.unmap, &popup->child.surface_unmap);
+
popup_unconstrain(popup);
return popup;