aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/rootston/view.h3
-rw-r--r--include/wlr/types/wlr_wl_shell.h2
-rw-r--r--rootston/wl_shell.c28
-rw-r--r--types/wlr_wl_shell.c11
-rw-r--r--xwayland/xwm.c2
5 files changed, 36 insertions, 10 deletions
diff --git a/include/rootston/view.h b/include/rootston/view.h
index f6ac0d23..1b0fb831 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -11,9 +11,10 @@ struct roots_wl_shell_surface {
// TODO: Maybe destroy listener should go in roots_view
struct wl_listener destroy;
- struct wl_listener ping_timeout;
struct wl_listener request_move;
struct wl_listener request_resize;
+ struct wl_listener request_set_maximized;
+ struct wl_listener set_state;
struct wl_listener surface_commit;
};
diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h
index 4e814817..1f0630f2 100644
--- a/include/wlr/types/wlr_wl_shell.h
+++ b/include/wlr/types/wlr_wl_shell.h
@@ -42,6 +42,8 @@ struct wlr_wl_shell_popup_grab {
enum wlr_wl_shell_surface_state {
WLR_WL_SHELL_SURFACE_STATE_NONE,
WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL,
+ WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED,
+ WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN,
WLR_WL_SHELL_SURFACE_STATE_TRANSIENT,
WLR_WL_SHELL_SURFACE_STATE_POPUP,
};
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index e38eb697..3ac8fe61 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -49,6 +49,26 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
view_begin_resize(input, event->cursor, view, e->edges);
}
+static void handle_request_set_maximized(struct wl_listener *listener,
+ void *data) {
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, request_set_maximized);
+ struct roots_view *view = roots_surface->view;
+ //struct wlr_wl_shell_surface_set_maximized_event *e = data;
+ view_maximize(view, true);
+}
+
+static void handle_set_state(struct wl_listener *listener, void *data) {
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, set_state);
+ struct roots_view *view = roots_surface->view;
+ struct wlr_wl_shell_surface *surface = view->wl_shell_surface;
+ if (view->maximized &&
+ surface->state != WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED) {
+ view_maximize(view, false);
+ }
+}
+
static void handle_surface_commit(struct wl_listener *listener, void *data) {
// TODO do we need to do anything here?
}
@@ -60,6 +80,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
wl_list_remove(&roots_surface->destroy.link);
wl_list_remove(&roots_surface->request_move.link);
wl_list_remove(&roots_surface->request_resize.link);
+ wl_list_remove(&roots_surface->request_set_maximized.link);
+ wl_list_remove(&roots_surface->set_state.link);
+ wl_list_remove(&roots_surface->surface_commit.link);
view_destroy(roots_surface->view);
free(roots_surface);
}
@@ -93,6 +116,11 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
roots_surface->request_resize.notify = handle_request_resize;
wl_signal_add(&surface->events.request_resize,
&roots_surface->request_resize);
+ roots_surface->request_set_maximized.notify = handle_request_set_maximized;
+ wl_signal_add(&surface->events.request_set_maximized,
+ &roots_surface->request_set_maximized);
+ roots_surface->set_state.notify = handle_set_state;
+ wl_signal_add(&surface->events.set_state, &roots_surface->set_state);
roots_surface->surface_commit.notify = handle_surface_commit;
wl_signal_add(&surface->surface->events.commit,
&roots_surface->surface_commit);
diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c
index fe61075e..f0287ba9 100644
--- a/types/wlr_wl_shell.c
+++ b/types/wlr_wl_shell.c
@@ -171,7 +171,6 @@ static void shell_surface_destroy_popup_state(
}
}
-
static void shell_surface_protocol_resize(struct wl_client *client,
struct wl_resource *resource, struct wl_resource *seat_resource,
uint32_t serial, enum wl_shell_surface_resize edges) {
@@ -287,9 +286,8 @@ static void shell_surface_protocol_set_fullscreen(struct wl_client *client,
output = wl_resource_get_user_data(output_resource);
}
- if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
- return;
- }
+ shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN,
+ NULL, NULL);
struct wlr_wl_shell_surface_set_fullscreen_event *event =
calloc(1, sizeof(struct wlr_wl_shell_surface_set_fullscreen_event));
@@ -377,9 +375,8 @@ static void shell_surface_protocol_set_maximized(struct wl_client *client,
output = wl_resource_get_user_data(output_resource);
}
- if (surface->state == WLR_WL_SHELL_SURFACE_STATE_TOPLEVEL) {
- return;
- }
+ shell_surface_set_state(surface, WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED,
+ NULL, NULL);
struct wlr_wl_shell_surface_set_maximized_event *event =
calloc(1, sizeof(struct wlr_wl_shell_surface_set_maximized_event));
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index e5806d5b..dff9fac2 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -839,11 +839,9 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
xsurface_set_net_wm_state(xsurface);
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_VERT] &&
update_state(action, &xsurface->maximized_vert)) {
- wlr_log(L_DEBUG, "cc sava");
xsurface_set_net_wm_state(xsurface);
} else if (property == xwm->atoms[_NET_WM_STATE_MAXIMIZED_HORZ] &&
update_state(action, &xsurface->maximized_horz)) {
- wlr_log(L_DEBUG, "mwa sava");
xsurface_set_net_wm_state(xsurface);
}
}