commit a89d1333f1de52e788ccab8899ce79ede5d3192e
parent 3fe64482bb269a3dcceeaf1107b9d59dc60eb8d0
Author: Drew DeVault <sir@cmpwn.com>
Date: Wed, 6 Dec 2017 12:06:42 -0500
Merge pull request #1504 from acrisci/feature/view-activate
view activate
Diffstat:
4 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/include/sway/view.h b/include/sway/view.h
@@ -89,6 +89,7 @@ struct sway_view {
int width, int height);
void (*set_position)(struct sway_view *view,
double ox, double oy);
+ void (*set_activated)(struct sway_view *view, bool activated);
} iface;
};
diff --git 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) {
view->swayc->y = oy;
}
+static void set_activated(struct sway_view *view, bool activated) {
+ // no way to activate wl_shell
+}
+
static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_wl_shell_surface *sway_surface =
wl_container_of(listener, sway_surface, commit);
@@ -96,6 +100,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
sway_view->iface.get_prop = get_prop;
sway_view->iface.set_size = set_size;
sway_view->iface.set_position = set_position;
+ sway_view->iface.set_activated = set_activated;
sway_view->wlr_wl_shell_surface = shell_surface;
sway_view->sway_wl_shell_surface = sway_surface;
sway_view->surface = shell_surface->surface;
diff --git 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) {
view->swayc->y = oy;
}
+static void set_activated(struct sway_view *view, bool activated) {
+ if (!assert_xdg(view)) {
+ return;
+ }
+ struct wlr_xdg_surface_v6 *surface = view->wlr_xdg_surface_v6;
+ if (surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL) {
+ wlr_xdg_toplevel_v6_set_activated(surface, activated);
+ }
+}
+
static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xdg_surface_v6 *sway_surface =
wl_container_of(listener, sway_surface, commit);
@@ -96,6 +106,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
sway_view->iface.get_prop = get_prop;
sway_view->iface.set_size = set_size;
sway_view->iface.set_position = set_position;
+ sway_view->iface.set_activated = set_activated;
sway_view->wlr_xdg_surface_v6 = xdg_surface;
sway_view->sway_xdg_surface_v6 = sway_surface;
sway_view->surface = xdg_surface->surface;
diff --git 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) {
view->width, view->height);
}
+static void set_activated(struct sway_view *view, bool activated) {
+ if (!assert_xwayland(view)) {
+ return;
+ }
+ struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface;
+ wlr_xwayland_surface_activate(surface, activated);
+}
+
static void handle_commit(struct wl_listener *listener, void *data) {
struct sway_xwayland_surface *sway_surface =
wl_container_of(listener, sway_surface, commit);
@@ -133,6 +141,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
sway_view->iface.get_prop = get_prop;
sway_view->iface.set_size = set_size;
sway_view->iface.set_position = set_position;
+ sway_view->iface.set_activated = set_activated;
sway_view->wlr_xwayland_surface = xsurface;
sway_view->sway_xwayland_surface = sway_surface;
// TODO remove from the tree when the surface goes away (unmapped)