summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2013-09-11 14:32:00 +0100
committerMike Blumenkrantz <zmike@samsung.com>2013-12-23 18:36:33 -0500
commit87b16dad61fd137b537f8639671d095faf69821f (patch)
tree59a894b7743ca82717da4bc7b381c9d5bdf8722a
parentf714dbf7e439868a45c8f2edbd95a10584d77673 (diff)
downloadenlightenment-87b16dad61fd137b537f8639671d095faf69821f.tar.gz
feature: add wl_x11 output module
this is the first of the wayland output modules, and it is extremely simple as a result of the compositor rewrite. for any other wayland output modules, it should be enough to simply create an ecore_evas canvas and do startup in this way.
-rw-r--r--configure.ac93
-rw-r--r--src/bin/e_module.c12
-rw-r--r--src/modules/Makefile.mk4
-rw-r--r--src/modules/Makefile_wl_x11.mk15
-rw-r--r--src/modules/wl_x11/e_mod_main.c72
5 files changed, 159 insertions, 37 deletions
diff --git a/configure.ac b/configure.ac
index 995291abc5..f4626cfa0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -761,39 +761,47 @@ define([CHECK_MODULE_BLUEZ4],
AC_SUBST([EBLUEZ4_CFLAGS])
AC_SUBST([EBLUEZ4_LIBS])
+have_wayland_only=no
+AC_ARG_ENABLE([wayland-only],
+ AS_HELP_STRING([--enable-wayland-only],[enable wayland-only version of enlightenment @<:@default=disabled@:>@]),
+ [e_cv_want_wayland_only=$enableval],
+ [e_cv_want_wayland_only=no])
+AC_MSG_CHECKING([whether wayland-only version is enabled])
+AC_MSG_RESULT([${e_cv_want_wayland_only}])
+
have_wayland_clients=no
AC_ARG_ENABLE([wayland-clients],
AS_HELP_STRING([--enable-wayland-clients],[enable wayland clients in composite module @<:@default=disabled@:>@]),
[e_cv_want_wayland_clients=$enableval],
[e_cv_want_wayland_clients=no])
-
AC_MSG_CHECKING([whether wayland client support is enabled])
AC_MSG_RESULT([${e_cv_want_wayland_clients}])
-if test "x$e_cv_want_wayland_clients" != "xno";then
- PKG_CHECK_MODULES([WAYLAND], [wayland-server >= 1.2.90 pixman-1 >= 0.3 xkbcommon >= 0.3.0],
+have_wayland_egl=no
+AC_ARG_ENABLE([wayland-egl],
+ AS_HELP_STRING([--enable-wayland-egl],[enable wayland to render using EGL @<:@default=disabled@:>@]),
+ [e_cv_want_wayland_egl=$enableval],
+ [e_cv_want_wayland_egl=no])
+AC_MSG_CHECKING([whether wayland EGL support is enabled])
+AC_MSG_RESULT([${e_cv_want_wayland_egl}])
+
+if test "x${e_cv_want_wayland_only}" != "xno" || test "x${e_cv_want_wayland_clients}" != "xno";then
+ PKG_CHECK_MODULES([WAYLAND], [ecore-wayland wayland-server pixman-1 xkbcommon],
[
- have_wayland_clients=yes
- AC_DEFINE_UNQUOTED([HAVE_WAYLAND_CLIENTS],[1],[enable wayland client support])
+ have_wayland=yes
+ AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[enable wayland support])
],
- [have_wayland_clients=no])
+ [have_wayland=no])
else
- have_wayland_clients=no
+ have_wayland=no
fi
-AM_CONDITIONAL([HAVE_WAYLAND_CLIENTS], [test "x${have_wayland_clients}" = "xyes"])
-
-have_wayland_egl=no
-if test "x${have_wayland_clients}" = "xyes"; then
- AC_ARG_ENABLE([wayland-egl],
- AS_HELP_STRING([--enable-wayland-egl],[enable wayland clients to render using EGL @<:@default=disabled@:>@]),
- [e_cv_want_wayland_egl=$enableval],
- [e_cv_want_wayland_egl=no])
-
- AC_MSG_CHECKING([whether wayland client EGL support is enabled])
- AC_MSG_RESULT([${e_cv_want_wayland_egl}])
-
- if test "x$e_cv_want_wayland_egl" != "xno";then
+if test "x${have_wayland}" = "xyes"; then
+ if test "x${e_cv_want_wayland_clients}" != "xno"; then
+ have_wayland_clients=yes
+ AC_DEFINE_UNQUOTED([HAVE_WAYLAND_CLIENTS],[1],[enable wayland clients in composite module])
+ fi
+ if test "x${e_cv_want_wayland_egl}" != "xno";then
PKG_CHECK_MODULES([WAYLAND_EGL], [egl >= 7.10],
[
have_wayland_egl=yes
@@ -805,8 +813,30 @@ if test "x${have_wayland_clients}" = "xyes"; then
fi
fi
+AM_CONDITIONAL([HAVE_WAYLAND], [test "x${have_wayland}" = "xyes"])
+AM_CONDITIONAL([HAVE_WAYLAND_ONLY], [test "x${have_wayland_only}" = "xyes"])
+AM_CONDITIONAL([HAVE_WAYLAND_CLIENTS], [test "x${have_wayland_clients}" = "xyes"])
AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "x${have_wayland_egl}" = "xyes"])
+PKG_CHECK_MODULES([ECORE_X], [ecore-x >= ${efl_version}])
+if test -n "$ECORE_X_CFLAGS" ; then
+ ecore_x=true
+else
+ ecore_x=false
+fi
+
+if test "x${have_wayland}" = "xyes" ; then
+ allow_wl_x11=true
+else
+ allow_wl_x11=false
+fi
+
+if test "x${ecore_x}" = "xtrue" && test -n "$WAYLAND_CFLAGS" ; then
+ wl_x11=true
+else
+ wl_x11=false
+fi
+
define([CHECK_MODULE_WL_DESKTOP_SHELL],
[
if test "x${have_wayland_clients}" = "xyes"; then
@@ -817,16 +847,6 @@ define([CHECK_MODULE_WL_DESKTOP_SHELL],
])
AM_CONDITIONAL([HAVE_WL_DESKTOP_SHELL], [test "x${WL_DESKTOP_SHELL}" = "xtrue"])
-define([CHECK_MODULE_WL_SCREENSHOT],
-[
- if test "x${have_wayland_clients}" = "xyes"; then
- AC_E_CHECK_PKG(WL_SCREENSHOT, [ ecore >= $efl_version ecore-wayland >= $efl_version eina >= $efl_version ], [WL_SCREENSHOT=true], [WL_SCREENSHOT=false])
- else
- WL_SCREENSHOT=false
- fi
-])
-AM_CONDITIONAL([HAVE_WL_SCREENSHOT], [test "x${WL_SCREENSHOT}" = "xtrue"])
-
AC_E_OPTIONAL_MODULE([ibar], true)
AC_E_OPTIONAL_MODULE([clock], true)
AC_E_OPTIONAL_MODULE([pager], true)
@@ -867,17 +887,18 @@ AC_E_OPTIONAL_MODULE([systray], true)
AC_E_OPTIONAL_MODULE([appmenu], true)
AC_E_OPTIONAL_MODULE([quickaccess], true)
AC_E_OPTIONAL_MODULE([teamwork], true)
-AC_E_OPTIONAL_MODULE([shot], true)
+AC_E_OPTIONAL_MODULE([shot], true, $ecore_x)
AC_E_OPTIONAL_MODULE([backlight], true)
AC_E_OPTIONAL_MODULE([tasks], true)
-AC_E_OPTIONAL_MODULE([conf_randr], true)
-AC_E_OPTIONAL_MODULE([xkbswitch], true)
+AC_E_OPTIONAL_MODULE([conf_randr], true, $ecore_x)
+AC_E_OPTIONAL_MODULE([xkbswitch], true, $ecore_x)
AC_E_OPTIONAL_MODULE([tiling], true)
-AC_E_OPTIONAL_MODULE([access], true)
+AC_E_OPTIONAL_MODULE([access], false, $ecore_x)
AC_E_OPTIONAL_MODULE([music_control], true, [CHECK_MODULE_MUSIC_CONTROL])
-AC_E_OPTIONAL_MODULE([contact], true)
+AC_E_OPTIONAL_MODULE([contact], false)
AC_E_OPTIONAL_MODULE([wl_desktop_shell], true, [CHECK_MODULE_WL_DESKTOP_SHELL])
-AC_E_OPTIONAL_MODULE([wl_screenshot], true, [CHECK_MODULE_WL_SCREENSHOT])
+AC_E_OPTIONAL_MODULE([wl_x11], $allow_wl_x11, $wl_x11)
+#AC_E_OPTIONAL_MODULE([wl_screenshot], true, [CHECK_MODULE_WL_SCREENSHOT])
HALT="/sbin/shutdown -h now"
REBOOT="/sbin/shutdown -r now"
diff --git a/src/bin/e_module.c b/src/bin/e_module.c
index 0b7cb27c37..0bfce52463 100644
--- a/src/bin/e_module.c
+++ b/src/bin/e_module.c
@@ -238,7 +238,9 @@ e_module_all_load(void)
{
if (!em) continue;
- if ((!e_util_strcmp(em->name, "comp")) || (!e_util_strcmp(em->name, "conf_comp")))
+ if ((!e_util_strcmp(em->name, "comp")) || (!e_util_strcmp(em->name, "conf_comp")) ||
+ (e_comp_get(NULL) && (!strcmp(em->name, "wl_x11"))) //block wl_x11 if we've already created a compositor
+ )
{
eina_stringshare_del(em->name);
e_config->modules = eina_list_remove_list(e_config->modules, l);
@@ -399,6 +401,12 @@ e_module_new(const char *name)
init_done:
_e_modules = eina_list_append(_e_modules, m);
+ if (!_e_modules_hash)
+ {
+ /* wayland module preloading */
+ if (!e_module_init())
+ CRI("WTFFFFF");
+ }
eina_hash_add(_e_modules_hash, name, m);
m->name = eina_stringshare_add(name);
if (modpath)
@@ -912,6 +920,8 @@ _e_module_whitelist_check(void)
"tiling",
"winlist",
"wizard",
+ "wl_desktop_shell",
+ "wl_x11",
"wl_drm",
"wl_screenshot",
"wl_shell",
diff --git a/src/modules/Makefile.mk b/src/modules/Makefile.mk
index f37f0a169b..43cb505c08 100644
--- a/src/modules/Makefile.mk
+++ b/src/modules/Makefile.mk
@@ -222,6 +222,10 @@ if USE_MODULE_WL_DESKTOP_SHELL
include src/modules/Makefile_wl_desktop_shell.mk
endif
+if USE_MODULE_WL_X11
+include src/modules/Makefile_wl_x11.mk
+endif
+
#if HAVE_WAYLAND_SCREENSHOT
#include src/modules/Makefile_wl_screenshot.mk
#endif
diff --git a/src/modules/Makefile_wl_x11.mk b/src/modules/Makefile_wl_x11.mk
new file mode 100644
index 0000000000..88259f0d93
--- /dev/null
+++ b/src/modules/Makefile_wl_x11.mk
@@ -0,0 +1,15 @@
+wl_x11dir = $(MDIR)/wl_x11
+
+wl_x11pkgdir = $(MDIR)/wl_x11/$(MODULE_ARCH)
+wl_x11pkg_LTLIBRARIES = src/modules/wl_x11/module.la
+
+src_modules_wl_x11_module_la_DEPENDENCIES = $(MDEPENDENCIES)
+src_modules_wl_x11_module_la_CPPFLAGS = $(MOD_CPPFLAGS) @ECORE_X_CFLAGS@ @WAYLAND_CFLAGS@ -DNEED_X=1
+src_modules_wl_x11_module_la_LIBADD = $(LIBS) @ECORE_X_LIBS@ @WAYLAND_LIBS@
+src_modules_wl_x11_module_la_LDFLAGS = $(MOD_LDFLAGS)
+src_modules_wl_x11_module_la_SOURCES = src/modules/wl_x11/e_mod_main.c
+
+# TODO: incomplete
+#.PHONY: wl_x11 install-wl_x11
+#wl_x11: $(wl_x11pkg_LTLIBRARIES) $(wl_x11_DATA)
+#install-wl_x11: install-wl_x11DATA install-wl_x11pkgLTLIBRARIES
diff --git a/src/modules/wl_x11/e_mod_main.c b/src/modules/wl_x11/e_mod_main.c
new file mode 100644
index 0000000000..3545dc7105
--- /dev/null
+++ b/src/modules/wl_x11/e_mod_main.c
@@ -0,0 +1,72 @@
+#include "e.h"
+#include "e_comp_wl.h"
+#include <Ecore_Wayland.h>
+
+EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_X11" };
+
+#define SCREEN_W 1024
+#define SCREEN_H 768
+
+static void
+_cb_delete_request(Ecore_Evas *ee EINA_UNUSED)
+{
+ ecore_main_loop_quit();
+}
+
+EAPI void *
+e_modapi_init(E_Module *m)
+{
+ Ecore_Evas *ee;
+ E_Screen *screen;
+ E_Comp *comp;
+
+ printf("LOAD WL_X11 MODULE\n");
+
+ /* try to init ecore_x */
+ if (!ecore_x_init(NULL))
+ {
+ fprintf(stderr, "Could not initialize ecore_x\n");
+ return NULL;
+ }
+
+ ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, SCREEN_W, SCREEN_H);
+ comp = e_comp_new();
+ comp->comp_type = E_PIXMAP_TYPE_WL;
+ comp->ee = ee;
+ if (!e_xinerama_fake_screens_exist())
+ {
+ screen = E_NEW(E_Screen, 1);
+ screen->escreen = screen->screen = 0;
+ screen->x = 0;
+ screen->y = 0;
+ screen->w = SCREEN_W;
+ screen->h = SCREEN_H;
+ e_xinerama_screens_set(eina_list_append(NULL, screen));
+ }
+ comp->man = e_manager_new(0, comp, SCREEN_W, SCREEN_H);
+ comp->pointer = e_pointer_window_new(comp->man->root, 1);
+ e_comp_wl_init();
+ e_comp_canvas_init(comp);
+ e_comp_canvas_fake_layers_init(comp);
+
+ ecore_evas_callback_delete_request_set(ee, _cb_delete_request);
+
+ /* setup keymap_change event handler */
+ if (!_e_wl_comp->kbd_handler)
+ _e_wl_comp->kbd_handler =
+ ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY,
+ e_comp_wl_cb_keymap_changed, NULL);
+
+ ecore_wl_init(NULL);
+ ecore_wl_server_mode_set(1);
+ return m;
+}
+
+EAPI int
+e_modapi_shutdown(E_Module *m EINA_UNUSED)
+{
+ /* shutdown ecore_x */
+ ecore_x_shutdown();
+
+ return 1;
+}