aboutsummaryrefslogtreecommitdiff
path: root/rootston/wl_shell.c
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2017-12-08 09:22:44 -0500
committerTony Crisci <tony@dubstepdish.com>2017-12-08 09:22:44 -0500
commit35188834db182db43b407b58db167950fab05477 (patch)
tree4ce63cc7f7f01f1e7cf7fb0f6994c4306ae4cad2 /rootston/wl_shell.c
parente3542d879d50d6239ad4ca24b4d30520fef40a87 (diff)
parent381a646d2fbcb1b488e1551438444ac267f39138 (diff)
Merge branch 'master' into feature/xwm-selection
Diffstat (limited to 'rootston/wl_shell.c')
-rw-r--r--rootston/wl_shell.c54
1 files changed, 44 insertions, 10 deletions
diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c
index d0f5989b..d0aad407 100644
--- a/rootston/wl_shell.c
+++ b/rootston/wl_shell.c
@@ -50,15 +50,24 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
roots_seat_begin_resize(seat, view, e->edges);
}
-static void handle_request_set_maximized(struct wl_listener *listener,
+static void handle_request_maximize(struct wl_listener *listener,
void *data) {
struct roots_wl_shell_surface *roots_surface =
- wl_container_of(listener, roots_surface, request_set_maximized);
+ wl_container_of(listener, roots_surface, request_maximize);
struct roots_view *view = roots_surface->view;
- //struct wlr_wl_shell_surface_set_maximized_event *e = data;
+ //struct wlr_wl_shell_surface_maximize_event *e = data;
view_maximize(view, true);
}
+static void handle_request_fullscreen(struct wl_listener *listener,
+ void *data) {
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, request_fullscreen);
+ struct roots_view *view = roots_surface->view;
+ struct wlr_wl_shell_surface_set_fullscreen_event *e = data;
+ view_set_fullscreen(view, true, e->output);
+}
+
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);
@@ -68,10 +77,31 @@ static void handle_set_state(struct wl_listener *listener, void *data) {
surface->state != WLR_WL_SHELL_SURFACE_STATE_MAXIMIZED) {
view_maximize(view, false);
}
+ if (view->fullscreen_output != NULL &&
+ surface->state != WLR_WL_SHELL_SURFACE_STATE_FULLSCREEN) {
+ view_set_fullscreen(view, false, NULL);
+ }
}
static void handle_surface_commit(struct wl_listener *listener, void *data) {
- // TODO do we need to do anything here?
+ struct roots_wl_shell_surface *roots_surface =
+ wl_container_of(listener, roots_surface, surface_commit);
+ struct roots_view *view = roots_surface->view;
+ struct wlr_surface *wlr_surface = view->wlr_surface;
+
+ int width = wlr_surface->current->width;
+ int height = wlr_surface->current->height;
+
+ if (view->pending_move_resize.update_x) {
+ view->x = view->pending_move_resize.x +
+ view->pending_move_resize.width - width;
+ view->pending_move_resize.update_x = false;
+ }
+ if (view->pending_move_resize.update_y) {
+ view->y = view->pending_move_resize.y +
+ view->pending_move_resize.height - height;
+ view->pending_move_resize.update_y = false;
+ }
}
static void handle_destroy(struct wl_listener *listener, void *data) {
@@ -80,7 +110,8 @@ 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->request_maximize.link);
+ wl_list_remove(&roots_surface->request_fullscreen.link);
wl_list_remove(&roots_surface->set_state.link);
wl_list_remove(&roots_surface->surface_commit.link);
wl_list_remove(&roots_surface->view->link);
@@ -109,14 +140,17 @@ 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->request_maximize.notify = handle_request_maximize;
+ wl_signal_add(&surface->events.request_maximize,
+ &roots_surface->request_maximize);
+ roots_surface->request_fullscreen.notify =
+ handle_request_fullscreen;
+ wl_signal_add(&surface->events.request_fullscreen,
+ &roots_surface->request_fullscreen);
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);
+ wl_signal_add(&surface->events.commit, &roots_surface->surface_commit);
struct roots_view *view = calloc(1, sizeof(struct roots_view));
if (!view) {