summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-03-31 18:07:44 -0400
committerLibravatar emersion <contact@emersion.fr>2018-03-31 18:07:44 -0400
commit1d68f9ecca8870f2f2a6823072c77657436b123a (patch)
treed66fbfa54f5c20f77c640bb695e43c02f2364bc3 /include
parentIntroduce common functions to create, map, unmap, destroy views (diff)
downloadsway-1d68f9ecca8870f2f2a6823072c77657436b123a.tar.gz
sway-1d68f9ecca8870f2f2a6823072c77657436b123a.tar.zst
sway-1d68f9ecca8870f2f2a6823072c77657436b123a.zip
Add sway_view_impl
Diffstat (limited to 'include')
-rw-r--r--include/sway/tree/view.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h
index 82a5541b..c68739d6 100644
--- a/include/sway/tree/view.h
+++ b/include/sway/tree/view.h
@@ -66,10 +66,23 @@ enum sway_view_prop {
66 VIEW_PROP_INSTANCE, 66 VIEW_PROP_INSTANCE,
67}; 67};
68 68
69struct sway_view_impl {
70 const char *(*get_prop)(struct sway_view *view,
71 enum sway_view_prop prop);
72 void (*set_size)(struct sway_view *view,
73 int width, int height);
74 void (*set_position)(struct sway_view *view,
75 double ox, double oy);
76 void (*set_activated)(struct sway_view *view, bool activated);
77 void (*close)(struct sway_view *view);
78};
79
69struct sway_view { 80struct sway_view {
70 enum sway_view_type type; 81 enum sway_view_type type;
71 struct sway_container *swayc; 82 const struct sway_view_impl *impl;
72 struct wlr_surface *surface; 83
84 struct sway_container *swayc; // NULL for unmanaged views
85 struct wlr_surface *surface; // NULL for unmapped views
73 int width, height; 86 int width, height;
74 87
75 union { 88 union {
@@ -84,22 +97,12 @@ struct sway_view {
84 struct sway_wl_shell_surface *sway_wl_shell_surface; 97 struct sway_wl_shell_surface *sway_wl_shell_surface;
85 }; 98 };
86 99
87 struct {
88 const char *(*get_prop)(struct sway_view *view,
89 enum sway_view_prop prop);
90 void (*set_size)(struct sway_view *view,
91 int width, int height);
92 void (*set_position)(struct sway_view *view,
93 double ox, double oy);
94 void (*set_activated)(struct sway_view *view, bool activated);
95 void (*close)(struct sway_view *view);
96 } iface;
97
98 // only used for unmanaged views (shell specific) 100 // only used for unmanaged views (shell specific)
99 struct wl_list unmanaged_view_link; // sway_root::unmanaged_views 101 struct wl_list unmanaged_view_link; // sway_root::unmanaged_views
100}; 102};
101 103
102struct sway_view *view_create(enum sway_view_type type); 104struct sway_view *view_create(enum sway_view_type type,
105 const struct sway_view_impl *impl);
103 106
104void view_destroy(struct sway_view *view); 107void view_destroy(struct sway_view *view);
105 108