summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-12-04 14:40:02 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-12-05 13:00:13 -0500
commit888870b1ba08d207de5d11448d9b43dfb17c31f1 (patch)
tree92cc68a3f0c9cfeedd8f373443b3a16ad5192930
parentf50a434bd1a6ec4a28d538c750b38da9619574f2 (diff)
poc for shadow togglingdevs/discomfitor/xdg-shedsmanship
https://www.enlightenment.org/ss/e-5663260720de00.68316445.png
-rw-r--r--src/Makefile_Ecore_Wl2.am2
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h3
-rw-r--r--src/lib/ecore_wl2/draw-mode.c21
-rw-r--r--src/lib/ecore_wl2/draw-mode.h63
-rw-r--r--src/lib/ecore_wl2/draw-mode.xml37
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c7
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h3
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c29
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c3
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h1
10 files changed, 168 insertions, 1 deletions
diff --git a/src/Makefile_Ecore_Wl2.am b/src/Makefile_Ecore_Wl2.am
index d08414bb6b..246cb302c0 100644
--- a/src/Makefile_Ecore_Wl2.am
+++ b/src/Makefile_Ecore_Wl2.am
@@ -20,6 +20,8 @@ lib/ecore_wl2/ecore_wl2_input.c \
20lib/ecore_wl2/ecore_wl2_output.c \ 20lib/ecore_wl2/ecore_wl2_output.c \
21lib/ecore_wl2/ecore_wl2_display.c \ 21lib/ecore_wl2/ecore_wl2_display.c \
22lib/ecore_wl2/ecore_wl2.c \ 22lib/ecore_wl2/ecore_wl2.c \
23lib/ecore_wl2/draw-mode.c \
24lib/ecore_wl2/draw-mode.h \
23lib/ecore_wl2/ecore_wl2_private.h 25lib/ecore_wl2/ecore_wl2_private.h
24 26
25lib_ecore_wl2_libecore_wl2_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_WL2_CFLAGS@ 27lib_ecore_wl2_libecore_wl2_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_WL2_CFLAGS@
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 6c7da2192c..b1ef50d542 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -124,6 +124,7 @@ typedef struct _Ecore_Wl2_Event_Window_Configure
124{ 124{
125 unsigned int win, event_win, edges; 125 unsigned int win, event_win, edges;
126 int x, y, w, h; 126 int x, y, w, h;
127 Eina_Bool no_shadow;
127} Ecore_Wl2_Event_Window_Configure; 128} Ecore_Wl2_Event_Window_Configure;
128 129
129typedef enum _Ecore_Wl2_Window_Type 130typedef enum _Ecore_Wl2_Window_Type
@@ -1006,6 +1007,8 @@ EAPI void ecore_wl2_keyboard_repeat_info_set(Ecore_Wl2_Keyboard *kbd, double rat
1006/* } */ 1007/* } */
1007/* # endif */ 1008/* # endif */
1008 1009
1010EAPI Eina_Bool ecore_wl2_window_shadow_get(const Ecore_Wl2_Window *win);
1011
1009# undef EAPI 1012# undef EAPI
1010# define EAPI 1013# define EAPI
1011 1014
diff --git a/src/lib/ecore_wl2/draw-mode.c b/src/lib/ecore_wl2/draw-mode.c
new file mode 100644
index 0000000000..3b84597bb0
--- /dev/null
+++ b/src/lib/ecore_wl2/draw-mode.c
@@ -0,0 +1,21 @@
1#include <stdlib.h>
2#include <stdint.h>
3#include "wayland-util.h"
4
5extern const struct wl_interface xdg_surface_interface;
6
7static const struct wl_interface *types[] = {
8 &xdg_surface_interface,
9 NULL,
10};
11
12static const struct wl_message draw_modes_requests[] = {
13 { "set_available_draw_modes", "oa", types + 0 },
14};
15
16WL_EXPORT const struct wl_interface draw_modes_interface = {
17 "draw_modes", 1,
18 1, draw_modes_requests,
19 0, NULL,
20};
21
diff --git a/src/lib/ecore_wl2/draw-mode.h b/src/lib/ecore_wl2/draw-mode.h
new file mode 100644
index 0000000000..1520e0d983
--- /dev/null
+++ b/src/lib/ecore_wl2/draw-mode.h
@@ -0,0 +1,63 @@
1#ifndef ZWP_DRAW_MODES_CLIENT_PROTOCOL_H
2#define ZWP_DRAW_MODES_CLIENT_PROTOCOL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <stddef.h>
10#include "wayland-client.h"
11
12struct wl_client;
13struct wl_resource;
14
15struct draw_modes;
16
17extern const struct wl_interface draw_modes_interface;
18
19#ifndef DRAW_MODES_STATE_ENUM
20#define DRAW_MODES_STATE_ENUM
21/**
22 * draw_modes_state - the surface has CSD without dropshadow
23 * @DRAW_MODES_STATE_DRAW_NOSHADOW: CSD with no dropshadow
24 *
25 * The surface contains a CSD region which does not include a dropshadow.
26 */
27enum draw_modes_state {
28 DRAW_MODES_STATE_DRAW_NOSHADOW = 0x2000,
29};
30#endif /* DRAW_MODES_STATE_ENUM */
31
32#define DRAW_MODES_SET_AVAILABLE_DRAW_MODES 0
33
34static inline void
35draw_modes_set_user_data(struct draw_modes *draw_modes, void *user_data)
36{
37 wl_proxy_set_user_data((struct wl_proxy *) draw_modes, user_data);
38}
39
40static inline void *
41draw_modes_get_user_data(struct draw_modes *draw_modes)
42{
43 return wl_proxy_get_user_data((struct wl_proxy *) draw_modes);
44}
45
46static inline void
47draw_modes_destroy(struct draw_modes *draw_modes)
48{
49 wl_proxy_destroy((struct wl_proxy *) draw_modes);
50}
51
52static inline void
53draw_modes_set_available_draw_modes(struct draw_modes *draw_modes, struct xdg_surface *surface, struct wl_array *states)
54{
55 wl_proxy_marshal((struct wl_proxy *) draw_modes,
56 DRAW_MODES_SET_AVAILABLE_DRAW_MODES, surface, states);
57}
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
diff --git a/src/lib/ecore_wl2/draw-mode.xml b/src/lib/ecore_wl2/draw-mode.xml
new file mode 100644
index 0000000000..3bb24a462d
--- /dev/null
+++ b/src/lib/ecore_wl2/draw-mode.xml
@@ -0,0 +1,37 @@
1<protocol name="zwp_draw_modes">
2 <interface name="draw_modes" version="1">
3 <request name="set_available_draw_modes">
4 <description summary="advertise optional draw modes for the window">
5 Inform the compositor of optional draw modes which are available
6 for the window.
7
8 Calling this after an xdg_surface's first commit is a client error.
9
10 Required modes are implemented by all clients and are not present in
11 this array. If set_available_draw_modes is not called, only required
12 modes are available.
13 </description>
14 <arg name="surface" type="object" interface="xdg_surface"/>
15 <arg name="states" type="array"/>
16 </request>
17 <enum name="state">
18 <description summary="types of state on the surface">
19 The different state values used on the surface. This is designed for
20 state values like maximized, fullscreen. It is paired with the
21 configure event to ensure that both the client and the compositor
22 setting the state can be synchronized.
23
24 States set in this way are double-buffered. They will get applied on
25 the next commit.
26
27 Compositors will pass a draw mode in every states array when the mode is
28 not "CSD with optional dropshadow".
29 </description>
30 <entry name="draw_noshadow" value="0x2000" summary="CSD with no dropshadow">
31 <description summary="the surface has CSD without dropshadow">
32 The surface contains a CSD region which does not include a dropshadow.
33 </description>
34 </entry>
35 </enum>
36 </interface>
37</protocol>
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 4f612b1d54..7dc28ebc5e 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#include "ecore_wl2_private.h" 5#include "ecore_wl2_private.h"
6#include "draw-mode.h"
6 7
7static Eina_Bool _fatal_error = EINA_FALSE; 8static Eina_Bool _fatal_error = EINA_FALSE;
8static Eina_Hash *_server_displays = NULL; 9static Eina_Hash *_server_displays = NULL;
@@ -49,6 +50,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
49 50
50 ewd = data; 51 ewd = data;
51 52
53fprintf(stderr, "wl_global disp %p interface %s\n", ewd, interface);
52 /* test to see if we have already added this global to our hash */ 54 /* test to see if we have already added this global to our hash */
53 if (!eina_hash_find(ewd->globals, &id)) 55 if (!eina_hash_find(ewd->globals, &id))
54 { 56 {
@@ -74,6 +76,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
74 76
75 if (!strcmp(interface, "wl_compositor")) 77 if (!strcmp(interface, "wl_compositor"))
76 { 78 {
79 fprintf(stderr, "wl_compositor.bind disp %p\n", ewd);
77 ewd->wl.compositor = 80 ewd->wl.compositor =
78 wl_registry_bind(registry, id, &wl_compositor_interface, 3); 81 wl_registry_bind(registry, id, &wl_compositor_interface, 3);
79 } 82 }
@@ -113,6 +116,10 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
113 _ecore_wl2_output_add(ewd, id); 116 _ecore_wl2_output_add(ewd, id);
114 else if (!strcmp(interface, "wl_seat")) 117 else if (!strcmp(interface, "wl_seat"))
115 _ecore_wl2_input_add(ewd, id, version); 118 _ecore_wl2_input_add(ewd, id, version);
119 else if (!strcmp(interface, "draw_modes"))
120 {
121 ewd->wl.draw_modes = wl_registry_bind(registry, id, &draw_modes_interface, 1);
122 }
116 123
117event: 124event:
118 /* allocate space for event structure */ 125 /* allocate space for event structure */
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index e33eaa2aac..5f681060b4 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -62,6 +62,7 @@ struct _Ecore_Wl2_Display
62 struct wl_shm *shm; 62 struct wl_shm *shm;
63 struct wl_shell *wl_shell; 63 struct wl_shell *wl_shell;
64 struct xdg_shell *xdg_shell; 64 struct xdg_shell *xdg_shell;
65 struct draw_modes *draw_modes;
65 } wl; 66 } wl;
66 67
67 uint32_t serial; 68 uint32_t serial;
@@ -137,6 +138,7 @@ struct _Ecore_Wl2_Window
137 Eina_Bool resizing : 1; 138 Eina_Bool resizing : 1;
138 Eina_Bool alpha : 1; 139 Eina_Bool alpha : 1;
139 Eina_Bool transparent : 1; 140 Eina_Bool transparent : 1;
141 Eina_Bool no_shadow : 1;
140}; 142};
141 143
142struct _Ecore_Wl2_Output 144struct _Ecore_Wl2_Output
@@ -404,4 +406,5 @@ void _ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source);
404void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf); 406void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
405 407
406void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window); 408void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window);
409void _ecore_wl2_window_draw_modes_init(Ecore_Wl2_Window *window);
407#endif 410#endif
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 3f6d0a314c..3901cc8ef9 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#include "ecore_wl2_private.h" 5#include "ecore_wl2_private.h"
6#include "draw-mode.h"
6 7
7static void 8static void
8_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges) 9_ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigned int edges)
@@ -19,6 +20,7 @@ _ecore_wl2_window_configure_send(Ecore_Wl2_Window *window, int w, int h, unsigne
19 ev->w = w; 20 ev->w = w;
20 ev->h = h; 21 ev->h = h;
21 ev->edges = edges; 22 ev->edges = edges;
23 ev->no_shadow = window->no_shadow;
22 24
23 ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL); 25 ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
24} 26}
@@ -90,11 +92,15 @@ _xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSE
90 win->fullscreen = EINA_FALSE; 92 win->fullscreen = EINA_FALSE;
91 win->focused = EINA_FALSE; 93 win->focused = EINA_FALSE;
92 win->resizing = EINA_FALSE; 94 win->resizing = EINA_FALSE;
95 win->no_shadow = 0;
93 96
94 wl_array_for_each(s, states) 97 wl_array_for_each(s, states)
95 { 98 {
96 switch (*s) 99 switch (*s)
97 { 100 {
101 case DRAW_MODES_STATE_DRAW_NOSHADOW:
102 win->no_shadow = 1;
103 break;
98 case XDG_SURFACE_STATE_MAXIMIZED: 104 case XDG_SURFACE_STATE_MAXIMIZED:
99 win->maximized = EINA_TRUE; 105 win->maximized = EINA_TRUE;
100 break; 106 break;
@@ -215,6 +221,19 @@ _ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
215} 221}
216 222
217void 223void
224_ecore_wl2_window_draw_modes_init(Ecore_Wl2_Window *window)
225{
226 struct wl_array modes;
227 uint32_t *m;
228
229 wl_array_init(&modes);
230 m = wl_array_add(&modes, sizeof(uint32_t));
231 *m = DRAW_MODES_STATE_DRAW_NOSHADOW;
232 draw_modes_set_available_draw_modes(window->display->wl.draw_modes, window->xdg_surface, &modes);
233 wl_array_release(&modes);
234}
235
236void
218_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window) 237_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
219{ 238{
220 if (!window->surface) return; 239 if (!window->surface) return;
@@ -229,6 +248,8 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
229 if (window->class) 248 if (window->class)
230 xdg_surface_set_app_id(window->xdg_surface, window->class); 249 xdg_surface_set_app_id(window->xdg_surface, window->class);
231 250
251 if (window->display->wl.draw_modes)
252 _ecore_wl2_window_draw_modes_init(window);
232 253
233 xdg_surface_set_user_data(window->xdg_surface, window); 254 xdg_surface_set_user_data(window->xdg_surface, window);
234 xdg_surface_add_listener(window->xdg_surface, 255 xdg_surface_add_listener(window->xdg_surface,
@@ -305,6 +326,7 @@ ecore_wl2_window_surface_get(Ecore_Wl2_Window *window)
305 326
306 if (!window->surface) 327 if (!window->surface)
307 { 328 {
329 fprintf(stderr, "ecore_wl2_window_surface_get() disp %p\n", window->display);
308 EINA_SAFETY_ON_NULL_RETURN_VAL(window->display->wl.compositor, NULL); 330 EINA_SAFETY_ON_NULL_RETURN_VAL(window->display->wl.compositor, NULL);
309 331
310 window->surface = 332 window->surface =
@@ -874,3 +896,10 @@ ecore_wl2_window_input_get(Ecore_Wl2_Window *window)
874 896
875 return NULL; 897 return NULL;
876} 898}
899
900EAPI Eina_Bool
901ecore_wl2_window_shadow_get(const Ecore_Wl2_Window *win)
902{
903 EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
904 return !win->no_shadow;
905}
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 0a36eec0f0..4331bd71e5 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -195,7 +195,8 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
195 _ecore_evas_wl_common_border_update(ee); 195 _ecore_evas_wl_common_border_update(ee);
196 196
197 if ((prev_max != ee->prop.maximized) || 197 if ((prev_max != ee->prop.maximized) ||
198 (prev_full != ee->prop.fullscreen)) 198 (prev_full != ee->prop.fullscreen) ||
199 (wdata->no_shadow != ev->no_shadow))
199 _ecore_evas_wl_common_state_update(ee); 200 _ecore_evas_wl_common_state_update(ee);
200 201
201 /* NB: We receive window configure sizes based on xdg surface 202 /* NB: We receive window configure sizes based on xdg surface
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
index 2551c0f830..e283846af0 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_private.h
@@ -39,6 +39,7 @@ struct _Ecore_Evas_Engine_Wl_Data
39 struct wl_egl_window *egl_win; 39 struct wl_egl_window *egl_win;
40#endif 40#endif
41 struct wl_callback *anim_callback; 41 struct wl_callback *anim_callback;
42 Eina_Bool no_shadow : 1;
42}; 43};
43 44
44Ecore_Evas_Interface_Wayland *_ecore_evas_wl_interface_new(void); 45Ecore_Evas_Interface_Wayland *_ecore_evas_wl_interface_new(void);