summaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-17 09:31:34 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-04-17 09:31:34 +1000
commitc685ef081f090d1e15428f55426e02f2274312d0 (patch)
treee4997c84099e962a0c00a8fea22be30964cecda3 /sway
parentFeedback for fullscreen. (diff)
downloadsway-c685ef081f090d1e15428f55426e02f2274312d0.tar.gz
sway-c685ef081f090d1e15428f55426e02f2274312d0.tar.zst
sway-c685ef081f090d1e15428f55426e02f2274312d0.zip
Create sway_workspace struct.
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/output.c5
-rw-r--r--sway/input/seat.c4
-rw-r--r--sway/tree/container.c1
-rw-r--r--sway/tree/layout.c18
-rw-r--r--sway/tree/view.c7
-rw-r--r--sway/tree/workspace.c7
6 files changed, 19 insertions, 23 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index dc2f6380..74919ccd 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -22,6 +22,7 @@
22#include "sway/tree/container.h" 22#include "sway/tree/container.h"
23#include "sway/tree/layout.h" 23#include "sway/tree/layout.h"
24#include "sway/tree/view.h" 24#include "sway/tree/view.h"
25#include "sway/tree/workspace.h"
25 26
26struct sway_container *output_by_name(const char *name) { 27struct sway_container *output_by_name(const char *name) {
27 for (int i = 0; i < root_container.children->length; ++i) { 28 for (int i = 0; i < root_container.children->length; ++i) {
@@ -275,9 +276,9 @@ static void render_output(struct sway_output *output, struct timespec *when,
275 276
276 struct sway_container *workspace = output_get_active_workspace(output); 277 struct sway_container *workspace = output_get_active_workspace(output);
277 278
278 if (workspace->fullscreen) { 279 if (workspace->sway_workspace->fullscreen) {
279 wlr_output_set_fullscreen_surface(wlr_output, 280 wlr_output_set_fullscreen_surface(wlr_output,
280 workspace->fullscreen->surface); 281 workspace->sway_workspace->fullscreen->surface);
281 } else { 282 } else {
282 wlr_output_set_fullscreen_surface(wlr_output, NULL); 283 wlr_output_set_fullscreen_surface(wlr_output, NULL);
283 render_layer(output, 284 render_layer(output,
diff --git a/sway/input/seat.c b/sway/input/seat.c
index f60c43b5..23b7ef76 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -18,6 +18,7 @@
18#include "sway/output.h" 18#include "sway/output.h"
19#include "sway/tree/container.h" 19#include "sway/tree/container.h"
20#include "sway/tree/view.h" 20#include "sway/tree/view.h"
21#include "sway/tree/workspace.h"
21#include "log.h" 22#include "log.h"
22 23
23static void seat_device_destroy(struct sway_seat_device *seat_device) { 24static void seat_device_destroy(struct sway_seat_device *seat_device) {
@@ -457,7 +458,8 @@ void seat_set_focus_warp(struct sway_seat *seat,
457 new_workspace = container_parent(new_workspace, C_WORKSPACE); 458 new_workspace = container_parent(new_workspace, C_WORKSPACE);
458 } 459 }
459 460
460 if (last_workspace == new_workspace && last_workspace->fullscreen 461 if (last_workspace == new_workspace
462 && last_workspace->sway_workspace->fullscreen
461 && !container->sway_view->is_fullscreen) { 463 && !container->sway_view->is_fullscreen) {
462 return; 464 return;
463 } 465 }
diff --git a/sway/tree/container.c b/sway/tree/container.c
index c0067493..f14e9b9a 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -197,6 +197,7 @@ static struct sway_container *container_workspace_destroy(
197 } 197 }
198 } 198 }
199 199
200 free(workspace->sway_workspace);
200 _container_destroy(workspace); 201 _container_destroy(workspace);
201 202
202 output_damage_whole(output->sway_output); 203 output_damage_whole(output->sway_output);
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index ad097f2e..62219bb1 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -572,7 +572,7 @@ void arrange_windows(struct sway_container *container,
572 return; 572 return;
573 case C_WORKSPACE: 573 case C_WORKSPACE:
574 { 574 {
575 if (container->fullscreen) { 575 if (container->sway_workspace->fullscreen) {
576 return; 576 return;
577 } 577 }
578 struct sway_container *output = 578 struct sway_container *output =
@@ -847,22 +847,6 @@ struct sway_container *container_get_in_direction(
847 } 847 }
848 } 848 }
849 849
850 // TODO WLR fullscreen
851 /*
852 if (container->type == C_VIEW && swayc_is_fullscreen(container)) {
853 wlr_log(L_DEBUG, "Moving from fullscreen view, skipping to output");
854 container = container_parent(container, C_OUTPUT);
855 get_layout_center_position(container, &abs_pos);
856 struct sway_container *output =
857 swayc_adjacent_output(container, dir, &abs_pos, true);
858 return get_swayc_in_output_direction(output, dir);
859 }
860 if (container->type == C_WORKSPACE && container->fullscreen) {
861 sway_log(L_DEBUG, "Moving to fullscreen view");
862 return container->fullscreen;
863 }
864 */
865
866 struct sway_container *wrap_candidate = NULL; 850 struct sway_container *wrap_candidate = NULL;
867 while (true) { 851 while (true) {
868 bool can_move = false; 852 bool can_move = false;
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 10285ad0..e7a267ec 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -7,6 +7,7 @@
7#include "sway/tree/container.h" 7#include "sway/tree/container.h"
8#include "sway/tree/layout.h" 8#include "sway/tree/layout.h"
9#include "sway/tree/view.h" 9#include "sway/tree/view.h"
10#include "sway/tree/workspace.h"
10 11
11void view_init(struct sway_view *view, enum sway_view_type type, 12void view_init(struct sway_view *view, enum sway_view_type type,
12 const struct sway_view_impl *impl) { 13 const struct sway_view_impl *impl) {
@@ -90,10 +91,10 @@ void view_set_fullscreen(struct sway_view *view, bool fullscreen) {
90 view->is_fullscreen = fullscreen; 91 view->is_fullscreen = fullscreen;
91 92
92 if (fullscreen) { 93 if (fullscreen) {
93 workspace->fullscreen = view; 94 workspace->sway_workspace->fullscreen = view;
94 view_configure(view, 0, 0, output->wlr_output->width, output->wlr_output->height); 95 view_configure(view, 0, 0, output->wlr_output->width, output->wlr_output->height);
95 } else { 96 } else {
96 workspace->fullscreen = NULL; 97 workspace->sway_workspace->fullscreen = NULL;
97 arrange_windows(workspace, -1, -1); 98 arrange_windows(workspace, -1, -1);
98 } 99 }
99 100
@@ -105,7 +106,7 @@ void view_set_fullscreen(struct sway_view *view, bool fullscreen) {
105void view_close(struct sway_view *view) { 106void view_close(struct sway_view *view) {
106 if (view->is_fullscreen) { 107 if (view->is_fullscreen) {
107 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); 108 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
108 ws->fullscreen = NULL; 109 ws->sway_workspace->fullscreen = NULL;
109 } 110 }
110 111
111 if (view->impl->close) { 112 if (view->impl->close) {
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 316f01e4..7f3c1903 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -59,6 +59,13 @@ struct sway_container *workspace_create(struct sway_container *output,
59 workspace->layout = container_get_default_layout(output); 59 workspace->layout = container_get_default_layout(output);
60 workspace->workspace_layout = workspace->layout; 60 workspace->workspace_layout = workspace->layout;
61 61
62 struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace));
63 if (!swayws) {
64 return NULL;
65 }
66 swayws->swayc = workspace;
67 workspace->sway_workspace = swayws;
68
62 container_add_child(output, workspace); 69 container_add_child(output, workspace);
63 container_sort_workspaces(output); 70 container_sort_workspaces(output);
64 container_create_notify(workspace); 71 container_create_notify(workspace);