diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-06 07:34:33 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-12-06 07:34:33 -0500 |
commit | 47f268d8fa83a08cd5c07f2ce50c2ce8b93126de (patch) | |
tree | 2864dc44c17250428831a00471a8ee3e96b956a2 /sway/desktop | |
parent | Merge pull request #1498 from emersion/config (diff) | |
download | sway-47f268d8fa83a08cd5c07f2ce50c2ce8b93126de.tar.gz sway-47f268d8fa83a08cd5c07f2ce50c2ce8b93126de.tar.zst sway-47f268d8fa83a08cd5c07f2ce50c2ce8b93126de.zip |
view activate
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/wl_shell.c | 5 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 11 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 9 |
3 files changed, 25 insertions, 0 deletions
diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index b2e026ef..3f5a358a 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c | |||
@@ -45,6 +45,10 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
45 | view->swayc->y = oy; | 45 | view->swayc->y = oy; |
46 | } | 46 | } |
47 | 47 | ||
48 | static void set_activated(struct sway_view *view, bool activated) { | ||
49 | // no way to activate wl_shell | ||
50 | } | ||
51 | |||
48 | static void handle_commit(struct wl_listener *listener, void *data) { | 52 | static void handle_commit(struct wl_listener *listener, void *data) { |
49 | struct sway_wl_shell_surface *sway_surface = | 53 | struct sway_wl_shell_surface *sway_surface = |
50 | wl_container_of(listener, sway_surface, commit); | 54 | wl_container_of(listener, sway_surface, commit); |
@@ -96,6 +100,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { | |||
96 | sway_view->iface.get_prop = get_prop; | 100 | sway_view->iface.get_prop = get_prop; |
97 | sway_view->iface.set_size = set_size; | 101 | sway_view->iface.set_size = set_size; |
98 | sway_view->iface.set_position = set_position; | 102 | sway_view->iface.set_position = set_position; |
103 | sway_view->iface.set_activated = set_activated; | ||
99 | sway_view->wlr_wl_shell_surface = shell_surface; | 104 | sway_view->wlr_wl_shell_surface = shell_surface; |
100 | sway_view->sway_wl_shell_surface = sway_surface; | 105 | sway_view->sway_wl_shell_surface = sway_surface; |
101 | sway_view->surface = shell_surface->surface; | 106 | sway_view->surface = shell_surface->surface; |
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 37e39f37..2435c256 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -45,6 +45,16 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
45 | view->swayc->y = oy; | 45 | view->swayc->y = oy; |
46 | } | 46 | } |
47 | 47 | ||
48 | static void set_activated(struct sway_view *view, bool activated) { | ||
49 | if (!assert_xdg(view)) { | ||
50 | return; | ||
51 | } | ||
52 | struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6; | ||
53 | if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) { | ||
54 | wlr_xdg_toplevel_v6_set_activated(surface, activated); | ||
55 | } | ||
56 | } | ||
57 | |||
48 | static void handle_commit(struct wl_listener *listener, void *data) { | 58 | static void handle_commit(struct wl_listener *listener, void *data) { |
49 | struct sway_xdg_surface_v6 *sway_surface = | 59 | struct sway_xdg_surface_v6 *sway_surface = |
50 | wl_container_of(listener, sway_surface, commit); | 60 | wl_container_of(listener, sway_surface, commit); |
@@ -96,6 +106,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { | |||
96 | sway_view->iface.get_prop = get_prop; | 106 | sway_view->iface.get_prop = get_prop; |
97 | sway_view->iface.set_size = set_size; | 107 | sway_view->iface.set_size = set_size; |
98 | sway_view->iface.set_position = set_position; | 108 | sway_view->iface.set_position = set_position; |
109 | sway_view->iface.set_activated = set_activated; | ||
99 | sway_view->wlr_xdg_surface_v6 = xdg_surface; | 110 | sway_view->wlr_xdg_surface_v6 = xdg_surface; |
100 | sway_view->sway_xdg_surface_v6 = sway_surface; | 111 | sway_view->sway_xdg_surface_v6 = sway_surface; |
101 | sway_view->surface = xdg_surface->surface; | 112 | sway_view->surface = xdg_surface->surface; |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 266a5869..65c7e1ec 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -70,6 +70,14 @@ static void set_position(struct sway_view *view, double ox, double oy) { | |||
70 | view->width, view->height); | 70 | view->width, view->height); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void set_activated(struct sway_view *view, bool activated) { | ||
74 | if (!assert_xwayland(view)) { | ||
75 | return; | ||
76 | } | ||
77 | struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; | ||
78 | wlr_xwayland_surface_activate(surface, activated); | ||
79 | } | ||
80 | |||
73 | static void handle_commit(struct wl_listener *listener, void *data) { | 81 | static void handle_commit(struct wl_listener *listener, void *data) { |
74 | struct sway_xwayland_surface *sway_surface = | 82 | struct sway_xwayland_surface *sway_surface = |
75 | wl_container_of(listener, sway_surface, commit); | 83 | wl_container_of(listener, sway_surface, commit); |
@@ -133,6 +141,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { | |||
133 | sway_view->iface.get_prop = get_prop; | 141 | sway_view->iface.get_prop = get_prop; |
134 | sway_view->iface.set_size = set_size; | 142 | sway_view->iface.set_size = set_size; |
135 | sway_view->iface.set_position = set_position; | 143 | sway_view->iface.set_position = set_position; |
144 | sway_view->iface.set_activated = set_activated; | ||
136 | sway_view->wlr_xwayland_surface = xsurface; | 145 | sway_view->wlr_xwayland_surface = xsurface; |
137 | sway_view->sway_xwayland_surface = sway_surface; | 146 | sway_view->sway_xwayland_surface = sway_surface; |
138 | // TODO remove from the tree when the surface goes away (unmapped) | 147 | // TODO remove from the tree when the surface goes away (unmapped) |