aboutsummaryrefslogtreecommitdiff
path: root/include/sway/tree
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-04-02 19:22:10 -0400
committerTony Crisci <tony@dubstepdish.com>2018-04-02 19:22:10 -0400
commita89096278b3dee599d75b7e91810a354b90a0ecb (patch)
tree69bb7208e42acab112048192f3a93557c6658186 /include/sway/tree
parentd434da563239c43c5fe417ce83b23b417f2ab635 (diff)
parent64b9b4b1556c1c45273bfbe0ae1c92245414cfed (diff)
Merge branch 'wlroots' into split-containers
Diffstat (limited to 'include/sway/tree')
-rw-r--r--include/sway/tree/container.h5
-rw-r--r--include/sway/tree/layout.h2
-rw-r--r--include/sway/tree/view.h59
3 files changed, 44 insertions, 22 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index fa22ea75..464f80c4 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -70,9 +70,10 @@ struct sway_container {
enum sway_container_layout prev_layout;
enum sway_container_layout workspace_layout;
- // TODO convert to layout coordinates
+ // For C_ROOT, this has no meaning
+ // For C_OUTPUT, this is the output position in layout coordinates
+ // For other types, this is the position in output-local coordinates
double x, y;
-
// does not include borders or gaps.
double width, height;
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h
index fbc3d6af..8badb244 100644
--- a/include/sway/tree/layout.h
+++ b/include/sway/tree/layout.h
@@ -20,7 +20,7 @@ struct sway_root {
struct wl_listener output_layout_change;
- struct wl_list unmanaged_views; // sway_view::unmanaged_view_link
+ struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
struct {
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 @@
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/xwayland.h>
+#include "sway/input/input-manager.h"
+#include "sway/input/seat.h"
struct sway_container;
struct sway_view;
@@ -37,6 +39,13 @@ struct sway_xwayland_surface {
int pending_width, pending_height;
};
+struct sway_xwayland_unmanaged {
+ struct wlr_xwayland_surface *wlr_xwayland_surface;
+ struct wl_list link;
+
+ struct wl_listener destroy;
+};
+
struct sway_wl_shell_surface {
struct sway_view *view;
@@ -64,10 +73,21 @@ enum sway_view_prop {
VIEW_PROP_INSTANCE,
};
+struct sway_view_impl {
+ const char *(*get_prop)(struct sway_view *view,
+ enum sway_view_prop prop);
+ void (*configure)(struct sway_view *view, double ox, double oy, int width,
+ int height);
+ void (*set_activated)(struct sway_view *view, bool activated);
+ void (*close)(struct sway_view *view);
+};
+
struct sway_view {
enum sway_view_type type;
- struct sway_container *swayc;
- struct wlr_surface *surface;
+ const struct sway_view_impl *impl;
+
+ struct sway_container *swayc; // NULL for unmanaged views
+ struct wlr_surface *surface; // NULL for unmapped views
int width, height;
union {
@@ -82,21 +102,15 @@ struct sway_view {
struct sway_wl_shell_surface *sway_wl_shell_surface;
};
- struct {
- const char *(*get_prop)(struct sway_view *view,
- enum sway_view_prop prop);
- void (*set_size)(struct sway_view *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);
- void (*close)(struct sway_view *view);
- } iface;
-
// only used for unmanaged views (shell specific)
- struct wl_list unmanaged_view_link; // sway_root::unmanaged views
+ struct wl_list unmanaged_view_link; // sway_root::unmanaged_views
};
+struct sway_view *view_create(enum sway_view_type type,
+ const struct sway_view_impl *impl);
+
+void view_destroy(struct sway_view *view);
+
const char *view_get_title(struct sway_view *view);
const char *view_get_app_id(struct sway_view *view);
@@ -105,18 +119,25 @@ const char *view_get_class(struct sway_view *view);
const char *view_get_instance(struct sway_view *view);
-void view_set_size(struct sway_view *view, int width, int height);
-
-void view_set_position(struct sway_view *view, double ox, double oy);
+void view_configure(struct sway_view *view, double ox, double oy, int width,
+ int height);
void view_set_activated(struct sway_view *view, bool activated);
void view_close(struct sway_view *view);
-void view_update_outputs(struct sway_view *view, const struct wlr_box *before);
-
void view_damage_whole(struct sway_view *view);
void view_damage_from(struct sway_view *view);
+// view implementation
+
+void view_map(struct sway_view *view, struct wlr_surface *wlr_surface);
+
+void view_unmap(struct sway_view *view);
+
+void view_update_position(struct sway_view *view, double ox, double oy);
+
+void view_update_size(struct sway_view *view, int width, int height);
+
#endif