diff options
author | 2018-04-02 19:19:38 -0400 | |
---|---|---|
committer | 2018-04-02 19:19:38 -0400 | |
commit | 64b9b4b1556c1c45273bfbe0ae1c92245414cfed (patch) | |
tree | 380408259cba4ea6a536f64f9726d37e65c59032 /include | |
parent | Merge pull request #1701 from emersion/remove-xdg-shell-xml (diff) | |
parent | Merge branch 'wlroots' into view-redesign (diff) | |
download | sway-64b9b4b1556c1c45273bfbe0ae1c92245414cfed.tar.gz sway-64b9b4b1556c1c45273bfbe0ae1c92245414cfed.tar.zst sway-64b9b4b1556c1c45273bfbe0ae1c92245414cfed.zip |
Merge pull request #1691 from emersion/view-redesign
Views redesign
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/output.h | 1 | ||||
-rw-r--r-- | include/sway/tree/container.h | 5 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 2 | ||||
-rw-r--r-- | include/sway/tree/view.h | 59 |
4 files changed, 45 insertions, 22 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index b343ecff..98d0f83f 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -24,6 +24,7 @@ struct sway_output { | |||
24 | struct wl_listener destroy; | 24 | struct wl_listener destroy; |
25 | struct wl_listener mode; | 25 | struct wl_listener mode; |
26 | struct wl_listener transform; | 26 | struct wl_listener transform; |
27 | struct wl_listener scale; | ||
27 | 28 | ||
28 | struct wl_listener damage_destroy; | 29 | struct wl_listener damage_destroy; |
29 | struct wl_listener damage_frame; | 30 | struct wl_listener damage_frame; |
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index aff2e58e..bd02197c 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -70,9 +70,10 @@ struct sway_container { | |||
70 | enum sway_container_layout prev_layout; | 70 | enum sway_container_layout prev_layout; |
71 | enum sway_container_layout workspace_layout; | 71 | enum sway_container_layout workspace_layout; |
72 | 72 | ||
73 | // TODO convert to layout coordinates | 73 | // For C_ROOT, this has no meaning |
74 | // For C_OUTPUT, this is the output position in layout coordinates | ||
75 | // For other types, this is the position in output-local coordinates | ||
74 | double x, y; | 76 | double x, y; |
75 | |||
76 | // does not include borders or gaps. | 77 | // does not include borders or gaps. |
77 | double width, height; | 78 | double width, height; |
78 | 79 | ||
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index e1034657..a14152e8 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -20,7 +20,7 @@ struct sway_root { | |||
20 | 20 | ||
21 | struct wl_listener output_layout_change; | 21 | struct wl_listener output_layout_change; |
22 | 22 | ||
23 | struct wl_list unmanaged_views; // sway_view::unmanaged_view_link | 23 | struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link |
24 | 24 | ||
25 | struct { | 25 | struct { |
26 | struct wl_signal new_container; | 26 | struct wl_signal new_container; |
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 3965d2b7..4b84205e 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <wlr/types/wlr_surface.h> | 4 | #include <wlr/types/wlr_surface.h> |
5 | #include <wlr/types/wlr_xdg_shell_v6.h> | 5 | #include <wlr/types/wlr_xdg_shell_v6.h> |
6 | #include <wlr/xwayland.h> | 6 | #include <wlr/xwayland.h> |
7 | #include "sway/input/input-manager.h" | ||
8 | #include "sway/input/seat.h" | ||
7 | 9 | ||
8 | struct sway_container; | 10 | struct sway_container; |
9 | struct sway_view; | 11 | struct sway_view; |
@@ -37,6 +39,13 @@ struct sway_xwayland_surface { | |||
37 | int pending_width, pending_height; | 39 | int pending_width, pending_height; |
38 | }; | 40 | }; |
39 | 41 | ||
42 | struct sway_xwayland_unmanaged { | ||
43 | struct wlr_xwayland_surface *wlr_xwayland_surface; | ||
44 | struct wl_list link; | ||
45 | |||
46 | struct wl_listener destroy; | ||
47 | }; | ||
48 | |||
40 | struct sway_wl_shell_surface { | 49 | struct sway_wl_shell_surface { |
41 | struct sway_view *view; | 50 | struct sway_view *view; |
42 | 51 | ||
@@ -64,10 +73,21 @@ enum sway_view_prop { | |||
64 | VIEW_PROP_INSTANCE, | 73 | VIEW_PROP_INSTANCE, |
65 | }; | 74 | }; |
66 | 75 | ||
76 | struct sway_view_impl { | ||
77 | const char *(*get_prop)(struct sway_view *view, | ||
78 | enum sway_view_prop prop); | ||
79 | void (*configure)(struct sway_view *view, double ox, double oy, int width, | ||
80 | int height); | ||
81 | void (*set_activated)(struct sway_view *view, bool activated); | ||
82 | void (*close)(struct sway_view *view); | ||
83 | }; | ||
84 | |||
67 | struct sway_view { | 85 | struct sway_view { |
68 | enum sway_view_type type; | 86 | enum sway_view_type type; |
69 | struct sway_container *swayc; | 87 | const struct sway_view_impl *impl; |
70 | struct wlr_surface *surface; | 88 | |
89 | struct sway_container *swayc; // NULL for unmanaged views | ||
90 | struct wlr_surface *surface; // NULL for unmapped views | ||
71 | int width, height; | 91 | int width, height; |
72 | 92 | ||
73 | union { | 93 | union { |
@@ -82,21 +102,15 @@ struct sway_view { | |||
82 | struct sway_wl_shell_surface *sway_wl_shell_surface; | 102 | struct sway_wl_shell_surface *sway_wl_shell_surface; |
83 | }; | 103 | }; |
84 | 104 | ||
85 | struct { | ||
86 | const char *(*get_prop)(struct sway_view *view, | ||
87 | enum sway_view_prop prop); | ||
88 | void (*set_size)(struct sway_view *view, | ||
89 | int width, int height); | ||
90 | void (*set_position)(struct sway_view *view, | ||
91 | double ox, double oy); | ||
92 | void (*set_activated)(struct sway_view *view, bool activated); | ||
93 | void (*close)(struct sway_view *view); | ||
94 | } iface; | ||
95 | |||
96 | // only used for unmanaged views (shell specific) | 105 | // only used for unmanaged views (shell specific) |
97 | struct wl_list unmanaged_view_link; // sway_root::unmanaged views | 106 | struct wl_list unmanaged_view_link; // sway_root::unmanaged_views |
98 | }; | 107 | }; |
99 | 108 | ||
109 | struct sway_view *view_create(enum sway_view_type type, | ||
110 | const struct sway_view_impl *impl); | ||
111 | |||
112 | void view_destroy(struct sway_view *view); | ||
113 | |||
100 | const char *view_get_title(struct sway_view *view); | 114 | const char *view_get_title(struct sway_view *view); |
101 | 115 | ||
102 | const char *view_get_app_id(struct sway_view *view); | 116 | const char *view_get_app_id(struct sway_view *view); |
@@ -105,18 +119,25 @@ const char *view_get_class(struct sway_view *view); | |||
105 | 119 | ||
106 | const char *view_get_instance(struct sway_view *view); | 120 | const char *view_get_instance(struct sway_view *view); |
107 | 121 | ||
108 | void view_set_size(struct sway_view *view, int width, int height); | 122 | void view_configure(struct sway_view *view, double ox, double oy, int width, |
109 | 123 | int height); | |
110 | void view_set_position(struct sway_view *view, double ox, double oy); | ||
111 | 124 | ||
112 | void view_set_activated(struct sway_view *view, bool activated); | 125 | void view_set_activated(struct sway_view *view, bool activated); |
113 | 126 | ||
114 | void view_close(struct sway_view *view); | 127 | void view_close(struct sway_view *view); |
115 | 128 | ||
116 | void view_update_outputs(struct sway_view *view, const struct wlr_box *before); | ||
117 | |||
118 | void view_damage_whole(struct sway_view *view); | 129 | void view_damage_whole(struct sway_view *view); |
119 | 130 | ||
120 | void view_damage_from(struct sway_view *view); | 131 | void view_damage_from(struct sway_view *view); |
121 | 132 | ||
133 | // view implementation | ||
134 | |||
135 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface); | ||
136 | |||
137 | void view_unmap(struct sway_view *view); | ||
138 | |||
139 | void view_update_position(struct sway_view *view, double ox, double oy); | ||
140 | |||
141 | void view_update_size(struct sway_view *view, int width, int height); | ||
142 | |||
122 | #endif | 143 | #endif |