summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2015-12-04 15:52:25 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2015-12-05 11:59:16 -0500
commit925468fbe92e440f293e223026af1ed7dd8dc1ea (patch)
tree831b4fb7534596e3a8b0368013087dcb30c49bc8
parenta6ded999a95b0673fb4162df80674fd03d9812db (diff)
-rw-r--r--src/bin/e_comp_wl.h2
-rw-r--r--src/modules/Makefile_wl_desktop_shell.mk4
-rw-r--r--src/modules/wl_desktop_shell/draw-mode.c21
-rw-r--r--src/modules/wl_desktop_shell/draw-mode.h60
-rw-r--r--src/modules/wl_desktop_shell/e_mod_main.c54
5 files changed, 140 insertions, 1 deletions
diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index a061c5a24..35e14ac60 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -140,6 +140,7 @@ struct _E_Comp_Wl_Data
140 { 140 {
141 struct wl_resource *shell; 141 struct wl_resource *shell;
142 struct wl_resource *xdg_shell; 142 struct wl_resource *xdg_shell;
143 struct wl_resource *draw_modes;
143 } shell_interface; 144 } shell_interface;
144 145
145 struct 146 struct
@@ -272,6 +273,7 @@ struct _E_Comp_Wl_Client_Data
272 void (*map)(struct wl_resource *resource); 273 void (*map)(struct wl_resource *resource);
273 void (*unmap)(struct wl_resource *resource); 274 void (*unmap)(struct wl_resource *resource);
274 Eina_Rectangle window; 275 Eina_Rectangle window;
276 Eina_Bool draw_mode_noshadow;
275 } shell; 277 } shell;
276 278
277 E_Comp_Wl_Buffer_Ref buffer_ref; 279 E_Comp_Wl_Buffer_Ref buffer_ref;
diff --git a/src/modules/Makefile_wl_desktop_shell.mk b/src/modules/Makefile_wl_desktop_shell.mk
index 51f5c8014..77bc745f3 100644
--- a/src/modules/Makefile_wl_desktop_shell.mk
+++ b/src/modules/Makefile_wl_desktop_shell.mk
@@ -25,7 +25,9 @@ src_modules_wl_desktop_shell_module_la_SOURCES = \
25 src/modules/wl_desktop_shell/e_input_method_protocol.c \ 25 src/modules/wl_desktop_shell/e_input_method_protocol.c \
26 src/modules/wl_desktop_shell/e_input_method_protocol.h \ 26 src/modules/wl_desktop_shell/e_input_method_protocol.h \
27 src/modules/wl_desktop_shell/e_desktop_shell_protocol.c \ 27 src/modules/wl_desktop_shell/e_desktop_shell_protocol.c \
28 src/modules/wl_desktop_shell/e_desktop_shell_protocol.h 28 src/modules/wl_desktop_shell/e_desktop_shell_protocol.h \
29src/modules/wl_desktop_shell/draw-mode.c \
30src/modules/wl_desktop_shell/draw-mode.h
29 31
30PHONIES += wl_desktop_shell install-wl_desktop_shell 32PHONIES += wl_desktop_shell install-wl_desktop_shell
31wl_desktop_shell: $(wl_desktop_shellpkg_LTLIBRARIES) $(wl_desktop_shell_DATA) 33wl_desktop_shell: $(wl_desktop_shellpkg_LTLIBRARIES) $(wl_desktop_shell_DATA)
diff --git a/src/modules/wl_desktop_shell/draw-mode.c b/src/modules/wl_desktop_shell/draw-mode.c
new file mode 100644
index 000000000..3b84597bb
--- /dev/null
+++ b/src/modules/wl_desktop_shell/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/modules/wl_desktop_shell/draw-mode.h b/src/modules/wl_desktop_shell/draw-mode.h
new file mode 100644
index 000000000..6028c5e95
--- /dev/null
+++ b/src/modules/wl_desktop_shell/draw-mode.h
@@ -0,0 +1,60 @@
1#ifndef ZWP_DRAW_MODES_SERVER_PROTOCOL_H
2#define ZWP_DRAW_MODES_SERVER_PROTOCOL_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdint.h>
9#include <stddef.h>
10#include "wayland-server.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
32struct draw_modes_interface {
33 /**
34 * set_available_draw_modes - advertise optional draw modes for
35 * the window
36 * @surface: (none)
37 * @states: (none)
38 *
39 * Inform the compositor of optional draw modes which are
40 * available for the window.
41 *
42 * Calling this after an xdg_surface's first commit is a client
43 * error.
44 *
45 * Required modes are implemented by all clients and are not
46 * present in this array. If set_available_draw_modes is not
47 * called, only required modes are available.
48 */
49 void (*set_available_draw_modes)(struct wl_client *client,
50 struct wl_resource *resource,
51 struct wl_resource *surface,
52 struct wl_array *states);
53};
54
55
56#ifdef __cplusplus
57}
58#endif
59
60#endif
diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c
index c18abad48..7899d0b0d 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.c
+++ b/src/modules/wl_desktop_shell/e_mod_main.c
@@ -2,6 +2,7 @@
2#include "e.h" 2#include "e.h"
3#include "e_mod_main.h" 3#include "e_mod_main.h"
4#include "e_desktop_shell_protocol.h" 4#include "e_desktop_shell_protocol.h"
5#include "draw-mode.h"
5 6
6#define XDG_SERVER_VERSION 5 7#define XDG_SERVER_VERSION 5
7 8
@@ -623,6 +624,8 @@ _e_xdg_shell_surface_configure_send(struct wl_resource *resource, uint32_t edges
623 _e_xdg_surface_state_add(resource, &states, XDG_SURFACE_STATE_RESIZING); 624 _e_xdg_surface_state_add(resource, &states, XDG_SURFACE_STATE_RESIZING);
624 if (ec->focused) 625 if (ec->focused)
625 _e_xdg_surface_state_add(resource, &states, XDG_SURFACE_STATE_ACTIVATED); 626 _e_xdg_surface_state_add(resource, &states, XDG_SURFACE_STATE_ACTIVATED);
627 if (ec->comp_data->shell.draw_mode_noshadow)
628 _e_xdg_surface_state_add(resource, &states, DRAW_MODES_STATE_DRAW_NOSHADOW);
626 629
627 if (ec->netwm.type != E_WINDOW_TYPE_POPUP_MENU) 630 if (ec->netwm.type != E_WINDOW_TYPE_POPUP_MENU)
628 { 631 {
@@ -1262,6 +1265,23 @@ _e_xdg_shell_cb_pong(struct wl_client *client EINA_UNUSED, struct wl_resource *r
1262 } 1265 }
1263} 1266}
1264 1267
1268static void
1269_e_draw_modes_cb_set_available_draw_modes(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource *surface, struct wl_array *modes)
1270{
1271 E_Client *ec;
1272 uint32_t *m;
1273
1274 ec = wl_resource_get_user_data(surface);
1275
1276 wl_array_for_each(m, modes)
1277 switch (*m)
1278 {
1279 case DRAW_MODES_STATE_DRAW_NOSHADOW:
1280 ec->comp_data->shell.draw_mode_noshadow = 1;
1281 break;
1282 }
1283}
1284
1265static const struct wl_shell_interface _e_shell_interface = 1285static const struct wl_shell_interface _e_shell_interface =
1266{ 1286{
1267 _e_shell_cb_shell_surface_get 1287 _e_shell_cb_shell_surface_get
@@ -1276,12 +1296,23 @@ static const struct xdg_shell_interface _e_xdg_shell_interface =
1276 _e_xdg_shell_cb_pong 1296 _e_xdg_shell_cb_pong
1277}; 1297};
1278 1298
1299static const struct draw_modes_interface _e_draw_modes_interface =
1300{
1301 _e_draw_modes_cb_set_available_draw_modes,
1302};
1303
1279static void 1304static void
1280_e_xdg_shell_cb_unbind(struct wl_resource *resource EINA_UNUSED) 1305_e_xdg_shell_cb_unbind(struct wl_resource *resource EINA_UNUSED)
1281{ 1306{
1282 e_comp_wl->shell_interface.xdg_shell = NULL; 1307 e_comp_wl->shell_interface.xdg_shell = NULL;
1283} 1308}
1284 1309
1310static void
1311_e_draw_modes_cb_unbind(struct wl_resource *resource EINA_UNUSED)
1312{
1313 e_comp_wl->shell_interface.draw_modes = NULL;
1314}
1315
1285static int 1316static int
1286_e_xdg_shell_cb_dispatch(const void *implementation EINA_UNUSED, void *target, uint32_t opcode, const struct wl_message *message EINA_UNUSED, union wl_argument *args) 1317_e_xdg_shell_cb_dispatch(const void *implementation EINA_UNUSED, void *target, uint32_t opcode, const struct wl_message *message EINA_UNUSED, union wl_argument *args)
1287{ 1318{
@@ -1351,6 +1382,23 @@ _e_xdg_shell_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t
1351 e_comp->wl_comp_data, NULL); 1382 e_comp->wl_comp_data, NULL);
1352} 1383}
1353 1384
1385static void
1386_e_draw_modes_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t version, uint32_t id)
1387{
1388 struct wl_resource *res;
1389
1390 if (!(res = wl_resource_create(client, &draw_modes_interface, version, id)))
1391 {
1392 wl_client_post_no_memory(client);
1393 return;
1394 }
1395
1396 e_comp_wl->shell_interface.draw_modes = res;
1397 wl_resource_set_implementation(res, &_e_draw_modes_interface,
1398 e_comp->wl_comp_data,
1399 _e_draw_modes_cb_unbind);
1400}
1401
1354E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" }; 1402E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" };
1355 1403
1356E_API void * 1404E_API void *
@@ -1380,6 +1428,12 @@ e_modapi_init(E_Module *m)
1380 ERR("Could not create xdg_shell global: %m"); 1428 ERR("Could not create xdg_shell global: %m");
1381 return NULL; 1429 return NULL;
1382 } 1430 }
1431 if (!wl_global_create(e_comp_wl->wl.disp, &draw_modes_interface, 1,
1432 e_comp->wl_comp_data, _e_draw_modes_cb_bind))
1433 {
1434 ERR("Could not create draw_modes global: %m");
1435 return NULL;
1436 }
1383 1437
1384#ifdef HAVE_WL_TEXT_INPUT 1438#ifdef HAVE_WL_TEXT_INPUT
1385 if (!e_input_panel_init()) 1439 if (!e_input_panel_init())