aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-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
7 files changed, 163 insertions, 0 deletions
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
{
unsigned int win, event_win, edges;
int x, y, w, h;
+ Eina_Bool no_shadow;
} Ecore_Wl2_Event_Window_Configure;
typedef enum _Ecore_Wl2_Window_Type
@@ -1006,6 +1007,8 @@ EAPI void ecore_wl2_keyboard_repeat_info_set(Ecore_Wl2_Keyboard *kbd, double rat
/* } */
/* # endif */
+EAPI Eina_Bool ecore_wl2_window_shadow_get(const Ecore_Wl2_Window *win);
+
# undef EAPI
# define EAPI
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 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface xdg_surface_interface;
+
+static const struct wl_interface *types[] = {
+ &xdg_surface_interface,
+ NULL,
+};
+
+static const struct wl_message draw_modes_requests[] = {
+ { "set_available_draw_modes", "oa", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface draw_modes_interface = {
+ "draw_modes", 1,
+ 1, draw_modes_requests,
+ 0, NULL,
+};
+
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 @@
+#ifndef ZWP_DRAW_MODES_CLIENT_PROTOCOL_H
+#define ZWP_DRAW_MODES_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct draw_modes;
+
+extern const struct wl_interface draw_modes_interface;
+
+#ifndef DRAW_MODES_STATE_ENUM
+#define DRAW_MODES_STATE_ENUM
+/**
+ * draw_modes_state - the surface has CSD without dropshadow
+ * @DRAW_MODES_STATE_DRAW_NOSHADOW: CSD with no dropshadow
+ *
+ * The surface contains a CSD region which does not include a dropshadow.
+ */
+enum draw_modes_state {
+ DRAW_MODES_STATE_DRAW_NOSHADOW = 0x2000,
+};
+#endif /* DRAW_MODES_STATE_ENUM */
+
+#define DRAW_MODES_SET_AVAILABLE_DRAW_MODES 0
+
+static inline void
+draw_modes_set_user_data(struct draw_modes *draw_modes, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) draw_modes, user_data);
+}
+
+static inline void *
+draw_modes_get_user_data(struct draw_modes *draw_modes)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) draw_modes);
+}
+
+static inline void
+draw_modes_destroy(struct draw_modes *draw_modes)
+{
+ wl_proxy_destroy((struct wl_proxy *) draw_modes);
+}
+
+static inline void
+draw_modes_set_available_draw_modes(struct draw_modes *draw_modes, struct xdg_surface *surface, struct wl_array *states)
+{
+ wl_proxy_marshal((struct wl_proxy *) draw_modes,
+ DRAW_MODES_SET_AVAILABLE_DRAW_MODES, surface, states);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#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 @@
+<protocol name="zwp_draw_modes">
+ <interface name="draw_modes" version="1">
+ <request name="set_available_draw_modes">
+ <description summary="advertise optional draw modes for the window">
+ Inform the compositor of optional draw modes which are available
+ for the window.
+
+ Calling this after an xdg_surface's first commit is a client error.
+
+ Required modes are implemented by all clients and are not present in
+ this array. If set_available_draw_modes is not called, only required
+ modes are available.
+ </description>
+ <arg name="surface" type="object" interface="xdg_surface"/>
+ <arg name="states" type="array"/>
+ </request>
+ <enum name="state">
+ <description summary="types of state on the surface">
+ The different state values used on the surface. This is designed for
+ state values like maximized, fullscreen. It is paired with the
+ configure event to ensure that both the client and the compositor
+ setting the state can be synchronized.
+
+ States set in this way are double-buffered. They will get applied on
+ the next commit.
+
+ Compositors will pass a draw mode in every states array when the mode is
+ not "CSD with optional dropshadow".
+ </description>
+ <entry name="draw_noshadow" value="0x2000" summary="CSD with no dropshadow">
+ <description summary="the surface has CSD without dropshadow">
+ The surface contains a CSD region which does not include a dropshadow.
+ </description>
+ </entry>
+ </enum>
+ </interface>
+</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 @@
#endif
#include "ecore_wl2_private.h"
+#include "draw-mode.h"
static Eina_Bool _fatal_error = EINA_FALSE;
static Eina_Hash *_server_displays = NULL;
@@ -49,6 +50,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
ewd = data;
+fprintf(stderr, "wl_global disp %p interface %s\n", ewd, interface);
/* test to see if we have already added this global to our hash */
if (!eina_hash_find(ewd->globals, &id))
{
@@ -74,6 +76,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
if (!strcmp(interface, "wl_compositor"))
{
+ fprintf(stderr, "wl_compositor.bind disp %p\n", ewd);
ewd->wl.compositor =
wl_registry_bind(registry, id, &wl_compositor_interface, 3);
}
@@ -113,6 +116,10 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
_ecore_wl2_output_add(ewd, id);
else if (!strcmp(interface, "wl_seat"))
_ecore_wl2_input_add(ewd, id, version);
+ else if (!strcmp(interface, "draw_modes"))
+ {
+ ewd->wl.draw_modes = wl_registry_bind(registry, id, &draw_modes_interface, 1);
+ }
event:
/* 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
struct wl_shm *shm;
struct wl_shell *wl_shell;
struct xdg_shell *xdg_shell;
+ struct draw_modes *draw_modes;
} wl;
uint32_t serial;
@@ -137,6 +138,7 @@ struct _Ecore_Wl2_Window
Eina_Bool resizing : 1;
Eina_Bool alpha : 1;
Eina_Bool transparent : 1;
+ Eina_Bool no_shadow : 1;
};
struct _Ecore_Wl2_Output
@@ -404,4 +406,5 @@ void _ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source);
void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window);
+void _ecore_wl2_window_draw_modes_init(Ecore_Wl2_Window *window);
#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 @@
#endif
#include "ecore_wl2_private.h"
+#include "draw-mode.h"
static void
_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
ev->w = w;
ev->h = h;
ev->edges = edges;
+ ev->no_shadow = window->no_shadow;
ecore_event_add(ECORE_WL2_EVENT_WINDOW_CONFIGURE, ev, NULL, NULL);
}
@@ -90,11 +92,15 @@ _xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSE
win->fullscreen = EINA_FALSE;
win->focused = EINA_FALSE;
win->resizing = EINA_FALSE;
+ win->no_shadow = 0;
wl_array_for_each(s, states)
{
switch (*s)
{
+ case DRAW_MODES_STATE_DRAW_NOSHADOW:
+ win->no_shadow = 1;
+ break;
case XDG_SURFACE_STATE_MAXIMIZED:
win->maximized = EINA_TRUE;
break;
@@ -215,6 +221,19 @@ _ecore_wl2_window_type_set(Ecore_Wl2_Window *win)
}
void
+_ecore_wl2_window_draw_modes_init(Ecore_Wl2_Window *window)
+{
+ struct wl_array modes;
+ uint32_t *m;
+
+ wl_array_init(&modes);
+ m = wl_array_add(&modes, sizeof(uint32_t));
+ *m = DRAW_MODES_STATE_DRAW_NOSHADOW;
+ draw_modes_set_available_draw_modes(window->display->wl.draw_modes, window->xdg_surface, &modes);
+ wl_array_release(&modes);
+}
+
+void
_ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
{
if (!window->surface) return;
@@ -229,6 +248,8 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
if (window->class)
xdg_surface_set_app_id(window->xdg_surface, window->class);
+ if (window->display->wl.draw_modes)
+ _ecore_wl2_window_draw_modes_init(window);
xdg_surface_set_user_data(window->xdg_surface, window);
xdg_surface_add_listener(window->xdg_surface,
@@ -305,6 +326,7 @@ ecore_wl2_window_surface_get(Ecore_Wl2_Window *window)
if (!window->surface)
{
+ fprintf(stderr, "ecore_wl2_window_surface_get() disp %p\n", window->display);
EINA_SAFETY_ON_NULL_RETURN_VAL(window->display->wl.compositor, NULL);
window->surface =
@@ -874,3 +896,10 @@ ecore_wl2_window_input_get(Ecore_Wl2_Window *window)
return NULL;
}
+
+EAPI Eina_Bool
+ecore_wl2_window_shadow_get(const Ecore_Wl2_Window *win)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
+ return !win->no_shadow;
+}