diff --git a/README.wayland b/README.wayland new file mode 100644 index 000000000..e383f2733 --- /dev/null +++ b/README.wayland @@ -0,0 +1,133 @@ +Wayland support in Enlightenment 0.19.0 + +Caution: Support for running Enlightenment in a Wayland-Only +configuration is considered Highly Experimental !! Use at your own +risk !! We are not responsible if it nukes your files, burns up your cpu, +kills your cat, sells your house, divorces you, or otherwise messes +Anything up ! + +Use at your own risk !! You have been warned !! + + +Requirements: +------------- + +Aside from the normal requirements that Enlightenment needs, there are +a few things to note in order to get Enlightenment to build without +X11 support. + +Firstly, you MUST have EFL built with the following options: + + --enable-drm + --enable-wayland + +This Readme does not address the dependencies needed to enable Wayland +in EFL. If you require any information for that, please see: + + https://phab.enlightenment.org/w/wayland/ + +If you would like support for EGL in Wayland, then also build EFL with: + + --enable-egl + --with-opengl=es + +The above options can be enabled for EFL without any adverse effects to +existing applications. + + +Next, you will need to adjust the options that you pass to +Enlightenment during the compile phase. + +Please note, we recommend installing This version of Enlightenment into it's +own separate prefix so that you can still safely fallback to the X11 version. + +This can be done by passing: + + --prefix= + +Now, on to the magic bits ;) + +In order for Enlightenment to be compiled without X11, using Wayland +only, you will need to pass a few more options to the configure stage +of Enlightenment: + + --enable-wayland-only + --enable-wayland-clients + --enable-wl-drm + +Since this is all still a work-in-progress, there are a few +Enlightenment modules that have not been "fixed" to work without X11 +yet. Those will need to be disabled: + + --disable-shot + --disable-xkbswitch + --disable-conf-randr + --disable-everything (don't worry, this is just the everything module) + + +At this stage, you should have EFL properly built, and Enlightenment +properly built. Let's move on to running it... + + +Usage: +------------- + +Hopefully at this stage you have successfully built EFL and +Enlightenment in preparation for a Wayland-only setup. Congratulations +!! Now, let's get it running... + +The following steps assume you are currently at a Virtual Terminal +without anything else running (ie: no other window managers, X11, etc). + +In order for Enlightenment to function without X11, we need to setup +the environment. In your current tty, do: + + export E_WL_FORCE=drm + export ELM_ENGINE=wayland_shm (or wayland_egl) + +This will make sure that Enlightenment renders using DRM, and any +Elementary applications use a Wayland engine. + +At this point, you should just be able 'cd' to the Enlightenment +prefix where you installed, and issue: + + ./enlightenment_start + +Please Note: It is suggested that you create a separate configuration +profile with only a Minimum of modules loaded. Due to the experimental +(and ongoing) status of Wayland-Only support in Enlightenment, Many +modules May Not Work. Very few have actually been tested yet !! + +If you have a separate configuration profile (as suggested) that you +would like to use, you can tell Enlightenment to use that when you +start it: + + ./enlightenment_start -profile + + +Notes: +------------- + +Please Note: There is currently NO support for running X11 +applications with this !! So basically, your web browsers won't work, +don't expect to be able to run Firefox, Thunderbird, or practically +Any Other X11 application yet. About the only things "known" to work +so far are EFL/Elementary applications. + + +Bugs: +------------- + +Yes, there are Lots of them !! +Yes, I am already aware of 99.9% of them. +No, you do not need to start reporting them yet !! + +When we feel that the work is reaching a "finalizing" stage, we will +put out a request for actual testers and bug reports ! + +You are here because you want to play...because you want to +experiment...because you want to be "cool" ;) You are not hear to nag +me with complaints & reports about things I am already well aware of +;) Save yourself some time, and me some stress !! ;) + + diff --git a/configure.ac b/configure.ac index 07babf5e3..6c27aa9ba 100644 --- a/configure.ac +++ b/configure.ac @@ -819,6 +819,10 @@ if test "x${have_wayland}" = "xyes"; then else have_wayland_egl=no fi + if test "x${e_cv_want_wayland_only}" != "xno"; then + have_wayland_only=yes + AC_DEFINE_UNQUOTED([HAVE_WAYLAND_ONLY],[1],[enable wayland-only version of enlightenment]) + fi fi AM_CONDITIONAL([HAVE_WAYLAND], [test "x${have_wayland}" = "xyes"]) @@ -841,7 +845,7 @@ fi define([CHECK_MODULE_WL_DESKTOP_SHELL], [ - if test "x${have_wayland_clients}" = "xyes"; then + if test "x${have_wayland_clients}" = "xyes" || test "x${e_cv_want_wayland_only}" = "xyes"; then AC_E_CHECK_PKG(WL_DESKTOP_SHELL, [ ecore >= $efl_version eina >= $efl_version ], [WL_DESKTOP_SHELL=true], [WL_DESKTOP_SHELL=false]) else WL_DESKTOP_SHELL=false @@ -859,6 +863,16 @@ define([CHECK_MODULE_WL_FB], ]) AM_CONDITIONAL([HAVE_WL_FB], [test "x${WL_FB}" = "xtrue"]) +define([CHECK_MODULE_WL_DRM], +[ + if test "x${have_wayland}" = "xyes" && test "x${e_cv_want_wayland_only}" = "xyes"; then + AC_E_CHECK_PKG(WL_DRM, [ ecore-drm >= $efl_version ecore >= $efl_version eina >= $efl_version ], [WL_DRM=true], [WL_DRM=false]) + else + WL_DRM=false + fi +]) +AM_CONDITIONAL([HAVE_WL_DRM], [test "x${WL_DRM}" = "xtrue"]) + AC_E_OPTIONAL_MODULE([ibar], true) AC_E_OPTIONAL_MODULE([clock], true) AC_E_OPTIONAL_MODULE([pager], true) @@ -914,6 +928,7 @@ AC_E_OPTIONAL_MODULE([contact], false) AC_E_OPTIONAL_MODULE([wl_desktop_shell], true, [CHECK_MODULE_WL_DESKTOP_SHELL]) AC_E_OPTIONAL_MODULE([wl_x11], $have_wayland, $wl_x11) AC_E_OPTIONAL_MODULE([wl_fb], $have_wayland, [CHECK_MODULE_WL_FB]) +AC_E_OPTIONAL_MODULE([wl_drm], $have_wayland, [CHECK_MODULE_WL_DRM]) #AC_E_OPTIONAL_MODULE([wl_screenshot], true, [CHECK_MODULE_WL_SCREENSHOT]) HALT="/sbin/shutdown -h now" diff --git a/src/bin/Makefile.mk b/src/bin/Makefile.mk index 5aa474bdd..683c98012 100644 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@ -212,6 +212,7 @@ enlightenment_src = \ src/bin/e_about.c \ src/bin/e_acpi.c \ src/bin/e_actions.c \ +src/bin/e_alert.c \ src/bin/e_atoms.c \ src/bin/e_auth.c \ src/bin/e_backlight.c \ @@ -239,9 +240,9 @@ src/bin/e_deskenv.c \ src/bin/e_desklock.c \ src/bin/e_deskmirror.c \ src/bin/e_dialog.c \ -src/bin/e_dnd.c \ src/bin/e_dpms.c \ src/bin/e_desktop_editor.c \ +src/bin/e_dnd.c \ src/bin/e_entry.c \ src/bin/e_entry_dialog.c \ src/bin/e_env.c \ @@ -360,6 +361,7 @@ src/bin/e_widget_textblock.c \ src/bin/e_widget_toolbar.c \ src/bin/e_widget_toolbook.c \ src/bin/e_win.c \ +src/bin/e_xkb.c \ src/bin/e_xinerama.c \ src/bin/e_zoomap.c \ src/bin/e_zone.c \ @@ -367,10 +369,8 @@ $(ENLIGHTENMENTHEADERS) if ! HAVE_WAYLAND_ONLY enlightenment_src += \ -src/bin/e_alert.c \ src/bin/e_comp_x.c \ src/bin/e_randr.c \ -src/bin/e_xkb.c \ src/bin/e_xsettings.c endif diff --git a/src/bin/e.h b/src/bin/e.h index aca58bc95..8eac2dbc1 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -122,6 +122,10 @@ void *alloca (size_t); # include # endif +# ifdef HAVE_WAYLAND +# include +# endif + # ifdef EAPI # undef EAPI # endif diff --git a/src/bin/e_actions.c b/src/bin/e_actions.c index 34431ad10..068bd6592 100644 --- a/src/bin/e_actions.c +++ b/src/bin/e_actions.c @@ -2837,17 +2837,23 @@ ACT_FN_GO(kbd_layout, ) errno = 0; x = strtoul(params, NULL, 10); if (errno || (x > eina_list_count(e_config->xkb.used_layouts) - 1)) return; +#ifndef HAVE_WAYLAND_ONLY e_xkb_layout_set(eina_list_nth(e_config->xkb.used_layouts, x)); +#endif } ACT_FN_GO(kbd_layout_next, __UNUSED__) { +#ifndef HAVE_WAYLAND_ONLY e_xkb_layout_next(); +#endif } ACT_FN_GO(kbd_layout_prev, __UNUSED__) { +#ifndef HAVE_WAYLAND_ONLY e_xkb_layout_prev(); +#endif } ACT_FN_GO(module_enable, ) diff --git a/src/bin/e_alert.c b/src/bin/e_alert.c index 330744ad1..8daa8d221 100644 --- a/src/bin/e_alert.c +++ b/src/bin/e_alert.c @@ -19,6 +19,7 @@ e_alert_shutdown(void) EAPI void e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window comp) { +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Atom composite_win; composite_win = ecore_x_atom_get("_E_COMP_WINDOW"); @@ -27,6 +28,7 @@ e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window comp) ecore_x_window_prop_property_del(root, composite_win); else ecore_x_window_prop_card32_set(root, composite_win, &comp, 1); +#endif } EAPI void diff --git a/src/bin/e_atoms.c b/src/bin/e_atoms.c index 436a772f8..a84c7591c 100644 --- a/src/bin/e_atoms.c +++ b/src/bin/e_atoms.c @@ -1,6 +1,7 @@ #include "e.h" /* Atoms */ +#ifndef HAVE_WAYLAND_ONLY EAPI Ecore_X_Atom E_ATOM_MANAGED = 0; EAPI Ecore_X_Atom E_ATOM_ZONE = 0; EAPI Ecore_X_Atom E_ATOM_DESK = 0; @@ -12,11 +13,13 @@ EAPI Ecore_X_Atom E_ATOM_WINDOW_STATE = 0; EAPI Ecore_X_Atom E_ATOM_WINDOW_STATE_CENTERED = 0; EAPI Ecore_X_Atom E_ATOM_DESKTOP_FILE = 0; EAPI Ecore_X_Atom E_ATOM_ZONE_GEOMETRY = 0; +#endif /* externally accessible functions */ EINTERN int e_atoms_init(void) { +#ifndef HAVE_WAYLAND_ONLY const char *atom_names[] = { "__E_WINDOW_MANAGED", "__E_WINDOW_ZONE", @@ -44,6 +47,7 @@ e_atoms_init(void) E_ATOM_WINDOW_STATE_CENTERED = atoms[8]; E_ATOM_DESKTOP_FILE = atoms[9]; E_ATOM_ZONE_GEOMETRY = atoms[10]; +#endif return 1; } diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c index f65127c82..cdf252194 100644 --- a/src/bin/e_backlight.c +++ b/src/bin/e_backlight.c @@ -21,7 +21,7 @@ static void _e_backlight_update(E_Zone *zone); static void _e_backlight_set(E_Zone *zone, double val); static Eina_Bool _bl_anim(void *data, double pos); static Eina_Bool bl_avail = EINA_TRUE; -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY static Eina_Bool xbl_avail = EINA_FALSE; #endif #ifdef HAVE_EEZE @@ -47,7 +47,7 @@ e_backlight_init(void) eeze_init(); #endif -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (e_comp_get(NULL)->man->root) xbl_avail = ecore_x_randr_output_backlight_available(); #endif @@ -197,7 +197,7 @@ static void _e_backlight_update(E_Zone *zone) { double x_bl = -1.0; -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Window root; Ecore_X_Randr_Output *out; int i, num = 0; @@ -254,8 +254,11 @@ _e_backlight_update(E_Zone *zone) static void _e_backlight_set(E_Zone *zone, double val) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY if (0) + { + return; + } #else if (sysmode == MODE_RANDR) { diff --git a/src/bin/e_bindings.c b/src/bin/e_bindings.c index cafb8eeb3..7c904b7ad 100644 --- a/src/bin/e_bindings.c +++ b/src/bin/e_bindings.c @@ -381,12 +381,14 @@ e_bindings_mouse_grab(E_Binding_Context ctxt, Ecore_X_Window win) { if (_e_bindings_context_match(binding->ctxt, ctxt)) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_button_grab(win, binding->button, ECORE_X_EVENT_MASK_MOUSE_DOWN | ECORE_X_EVENT_MASK_MOUSE_UP | ECORE_X_EVENT_MASK_MOUSE_MOVE, e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); +#endif } } } @@ -401,8 +403,10 @@ e_bindings_mouse_ungrab(E_Binding_Context ctxt, Ecore_X_Window win) { if (_e_bindings_context_match(binding->ctxt, ctxt)) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_button_ungrab(win, binding->button, e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); +#endif } } } @@ -589,8 +593,12 @@ e_bindings_key_grab(E_Binding_Context ctxt, Ecore_X_Window win) if (_e_bindings_context_match(binding->ctxt, ctxt)) { if (e_bindings_key_allowed(binding->key)) - ecore_x_window_key_grab(win, binding->key, - e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); + { +#ifndef HAVE_WAYLAND_ONLY + ecore_x_window_key_grab(win, binding->key, + e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); +#endif + } } } } @@ -606,8 +614,12 @@ e_bindings_key_ungrab(E_Binding_Context ctxt, Ecore_X_Window win) if (_e_bindings_context_match(binding->ctxt, ctxt)) { if (e_bindings_key_allowed(binding->key)) - ecore_x_window_key_ungrab(win, binding->key, - e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); + { +#ifndef HAVE_WAYLAND_ONLY + ecore_x_window_key_ungrab(win, binding->key, + e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); +#endif + } } } } @@ -1176,10 +1188,12 @@ e_bindings_wheel_grab(E_Binding_Context ctxt, Ecore_X_Window win) else if (binding->z > 0) button = 7; } +#ifndef HAVE_WAYLAND_ONLY if (button != 0) ecore_x_window_button_grab(win, button, ECORE_X_EVENT_MASK_MOUSE_DOWN, e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); +#endif } } } @@ -1208,9 +1222,11 @@ e_bindings_wheel_ungrab(E_Binding_Context ctxt, Ecore_X_Window win) else if (binding->z > 0) button = 7; } +#ifndef HAVE_WAYLAND_ONLY if (button != 0) ecore_x_window_button_ungrab(win, button, e_bindings_modifiers_to_ecore_convert(binding->mod), binding->any_mod); +#endif } } } diff --git a/src/bin/e_canvas.c b/src/bin/e_canvas.c index 03fc3a5d2..bb7b8c9b9 100644 --- a/src/bin/e_canvas.c +++ b/src/bin/e_canvas.c @@ -148,14 +148,6 @@ e_canvas_new(Ecore_Window win, int x, int y, int w, int h, { Ecore_Evas *ee = NULL; -#ifdef WAYLAND_ONLY - ee = ecore_evas_wayland_shm_new(NULL, win, x, y, w, h, 0); - if (ee) - { - ecore_evas_override_set(ee, override); - if (win_ret) *win_ret = ecore_evas_wayland_window_get(ee); - } -#else switch (e_comp_get(NULL)->comp_type) { case E_PIXMAP_TYPE_X: @@ -167,19 +159,22 @@ e_canvas_new(Ecore_Window win, int x, int y, int w, int h, if (win_ret) *win_ret = ecore_evas_software_x11_window_get(ee); } break; -# ifdef HAVE_WAYLAND_CLIENTS +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) case E_PIXMAP_TYPE_WL: ee = ecore_evas_wayland_shm_new(NULL, win, x, y, w, h, 0); if (ee) { ecore_evas_override_set(ee, override); - if (win_ret) *win_ret = (Ecore_Window)ecore_evas_wayland_window_get(ee); + if (win_ret) + { + *win_ret = + ecore_wl_window_id_get(ecore_evas_wayland_window_get(ee)); + } } break; -# endif +#endif default: break; } -#endif if (!ee) EINA_LOG_ERR("Impossible to build any Ecore_Evas window !!"); return ee; diff --git a/src/bin/e_client.c b/src/bin/e_client.c index d40c0bb00..579a4eb3b 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -2676,12 +2676,14 @@ e_client_mouse_move(E_Client *ec, Evas_Point *output) e_object_ref(E_OBJECT(ec)); e_comp_object_frame_icon_geometry_get(ec->frame, &x, &y, &w, &h); +#ifndef HAVE_WAYLAND_ONLY client_drag = e_drag_new(ec->zone->comp, output->x, output->y, drag_types, 1, ec, -1, NULL, _e_client_cb_drag_finished); e_drag_resize(client_drag, w, h); +#endif o = e_client_icon_add(ec, client_drag->evas); if (!o) { @@ -2689,10 +2691,12 @@ e_client_mouse_move(E_Client *ec, Evas_Point *output) o = evas_object_rectangle_add(client_drag->evas); evas_object_color_set(o, 255, 255, 255, 255); } +#ifndef HAVE_WAYLAND_ONLY e_drag_object_set(client_drag, o); e_drag_start(client_drag, output->x + (ec->drag.x - x), output->y + (ec->drag.y - y)); +#endif } ec->drag.start = 0; } @@ -3574,8 +3578,13 @@ e_client_fullscreen(E_Client *ec, E_Fullscreen policy) else if (e_config->mode.presentation) evas_object_layer_set(ec->frame, E_LAYER_CLIENT_TOP); +#ifndef HAVE_WAYLAND_ONLY if ((eina_list_count(ec->comp->zones) > 1) || (policy == E_FULLSCREEN_RESIZE) || (!ecore_x_randr_query())) +#else + if ((eina_list_count(ec->comp->zones) > 1) || + (policy == E_FULLSCREEN_RESIZE)) +#endif { evas_object_geometry_set(ec->frame, ec->zone->x, ec->zone->y, ec->zone->w, ec->zone->h); } diff --git a/src/bin/e_client.h b/src/bin/e_client.h index f73d2c5da..aacb5932b 100644 --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@ -290,7 +290,7 @@ struct E_Client unsigned char changed : 1; unsigned char user_selected : 1; Eina_Stringshare *name; - } border; + } border; struct { @@ -389,9 +389,9 @@ struct E_Client unsigned int desktop; Eina_Stringshare *name; Eina_Stringshare *icon_name; -#ifdef E_COMP_X_H + Ecore_X_Icon *icons; -#endif + int num_icons; unsigned int user_time; unsigned char opacity; diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c index afb80c33f..0667e4f9c 100644 --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@ -726,7 +726,11 @@ _e_comp_shapes_update_job(E_Comp *c) } #endif } + +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_shape_input_rectangles_set(c->win, (Ecore_X_Rectangle*)exr, i); +#endif + #ifdef SHAPE_DEBUG E_FREE_LIST(rl, free); printf("\n"); @@ -1111,8 +1115,7 @@ e_comp_init(void) actions = eina_list_append(actions, act); } - -#ifdef HAVE_WAYLAND_CLIENTS +#ifdef HAVE_WAYLAND_ONLY { const char *eng; @@ -1127,11 +1130,12 @@ e_comp_init(void) } } #endif -#ifndef WAYLAND_ONLY + +#ifndef HAVE_WAYLAND_ONLY if (!e_comp_x_init()) return EINA_FALSE; #endif -#ifdef HAVE_WAYLAND_CLIENTS - e_comp_wl_init(); +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if (!e_comp_wl_init()) return EINA_FALSE; #endif E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_screensaver_on, NULL); diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c index 4536f1ddf..1571a77b9 100644 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@ -224,7 +224,10 @@ _e_comp_object_cb_signal_bind(void *data, Evas_Object *obj EINA_UNUSED, const ch { E_Comp_Object *cw = data; - if (e_dnd_active() || (!cw->ec)) return; + if (!cw->ec) return; +#ifndef HAVE_WAYLAND_ONLY + if (e_dnd_active()) return; +#endif e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(cw->ec), emission, source); } diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c index 298846bd0..aefb315e1 100644 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@ -314,12 +314,13 @@ e_comp_wl_init(void) goto err; } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY /* setup keymap_change event handler */ _e_wl_comp->kbd_handler = ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, e_comp_wl_cb_keymap_changed, NULL); #endif + /* get the displays event loop */ _e_wl_comp->wl.loop = wl_display_get_event_loop(_e_wl_comp->wl.display); @@ -344,10 +345,10 @@ e_comp_wl_init(void) } wl_event_loop_dispatch(_e_wl_comp->wl.loop, 0); -#ifndef WAYLAND_ONLY + /* add an idler for deferred shell module loading */ _module_idler = ecore_idler_add(_e_comp_wl_cb_module_idle, NULL); -#endif + /* return success */ return EINA_TRUE; @@ -355,10 +356,9 @@ err: /* remove kbd handler */ if (_e_wl_comp->kbd_handler) ecore_event_handler_del(_e_wl_comp->kbd_handler); -#ifndef WAYLAND_ONLY + /* remove the module idler */ if (_module_idler) ecore_idler_del(_module_idler); -#endif #ifdef HAVE_WAYLAND_EGL /* unbind wayland display */ @@ -423,13 +423,13 @@ e_comp_wl_shutdown(void) e_module_disable(mod); } -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY EAPI int e_comp_wl_input_read(int fd EINA_UNUSED, unsigned int mask EINA_UNUSED, void *data) { E_Wayland_Compositor *wl_comp = data; - wl_event_loop_dispatch(wl_comp->wl.input_loop, 0); + wl_event_loop_dispatch(wl_comp->wl.loop, 0); return 1; } #endif @@ -1975,7 +1975,7 @@ _e_comp_wl_input_keymap_get(void) names.layout = strdup(kbd_layout->name); } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY /* if we are running under X11, try to get the xkb rule names atom */ if (getenv("DISPLAY")) { diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 927b1723a..f3bc3c5b6 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -6,7 +6,12 @@ # define WL_HIDE_DEPRECATED # include + +/* NB: Turn off shadow warnings for Wayland includes */ +# pragma GCC diagnostic ignored "-Wshadow" # include +# pragma GCC diagnostic pop + # include /* headers for terminal support */ @@ -473,7 +478,7 @@ struct _E_Wayland_Compositor E_Wayland_Shell_Interface shell_interface; -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY Eina_Bool focus : 1; unsigned int output_pool; @@ -592,7 +597,7 @@ extern EAPI E_Wayland_Compositor *_e_wl_comp; EAPI Eina_Bool e_comp_wl_init(void); EINTERN void e_comp_wl_shutdown(void); -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY EAPI int e_comp_wl_input_read(int fd EINA_UNUSED, unsigned int mask EINA_UNUSED, void *data); #endif diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c index 28604c1da..111ba6300 100644 --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@ -892,9 +892,11 @@ _e_desk_hide_begin(E_Desk *desk, int dx, int dy) static void _e_desk_window_profile_change_protocol_set(void) { +#ifndef HAVE_WAYLAND_ONLY Eina_List *l = NULL; E_Manager *man; EINA_LIST_FOREACH(e_manager_list(), l, man) ecore_x_e_window_profile_supported_set(man->root, e_config->use_desktop_window_profile); +#endif } diff --git a/src/bin/e_desklock.c b/src/bin/e_desklock.c index b98aa2ae4..889a8f86e 100644 --- a/src/bin/e_desklock.c +++ b/src/bin/e_desklock.c @@ -420,12 +420,14 @@ _e_desklock_cb_idle_poller(void *data __UNUSED__) { if ((e_config->desklock_autolock_idle) && (!e_config->mode.presentation)) { - double idle, max; + double idle = 0.0, max; /* If a desklock is already up, bail */ if ((_e_custom_desklock_exe) || (_e_desklock_state)) return ECORE_CALLBACK_RENEW; +#ifndef HAVE_WAYLAND_ONLY idle = ecore_x_screensaver_idle_time_get(); +#endif max = e_config->desklock_autolock_idle_timeout; if (_e_desklock_ask_presentation_count > 0) max *= (1 + _e_desklock_ask_presentation_count); @@ -491,7 +493,9 @@ _e_desklock_ask_presentation_no_increase(void *data __UNUSED__, E_Dialog *dia) blanking = e_config->screensaver_blanking; expose = e_config->screensaver_expose; +#ifndef HAVE_WAYLAND_ONLY ecore_x_screensaver_set(timeout, interval, blanking, expose); +#endif e_object_del(E_OBJECT(dia)); } diff --git a/src/bin/e_dialog.c b/src/bin/e_dialog.c index 91f4abe95..cb29f1046 100644 --- a/src/bin/e_dialog.c +++ b/src/bin/e_dialog.c @@ -222,10 +222,12 @@ EAPI void e_dialog_parent_set(E_Dialog *dia, E_Win *win) { if (!dia) return; +#ifndef HAVE_WAYLAND_ONLY if (win) ecore_x_icccm_transient_for_set(dia->win->evas_win, win->evas_win); else ecore_x_icccm_transient_for_unset(dia->win->evas_win); +#endif ecore_evas_modal_set(dia->win->ecore_evas, !!win); } diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index af6aadec4..6c42ec378 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -17,6 +17,7 @@ static Eina_Bool _e_dnd_cb_key_down(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_key_up(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_mouse_up(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_mouse_move(void *data, int type, void *event); +#ifndef HAVE_WAYLAND_ONLY static Eina_Bool _e_dnd_cb_event_dnd_enter(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_event_dnd_leave(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_event_dnd_position(void *data, int type, void *event); @@ -25,6 +26,7 @@ static Eina_Bool _e_dnd_cb_event_dnd_finished(void *data, int type, void *e static Eina_Bool _e_dnd_cb_event_dnd_drop(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_event_dnd_selection(void *data, int type, void *event); static Eina_Bool _e_dnd_cb_event_hide(void *data, int type, Ecore_X_Event_Window_Hide *ev); +#endif /* local subsystem globals */ @@ -108,13 +110,18 @@ e_dnd_init(void) _type_xds = eina_stringshare_add("XdndDirectSave0"); _type_text_x_moz_url = eina_stringshare_add("text/x-moz-url"); _type_enlightenment_x_file = eina_stringshare_add("enlightenment/x-file"); +#ifndef HAVE_WAYLAND_ONLY _text_atom = ecore_x_atom_get("text/plain"); +#endif _drop_win_hash = eina_hash_int32_new(NULL); _drop_handlers_responsives = eina_hash_int32_new(NULL); E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_dnd_cb_mouse_up, NULL); E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_MOVE, _e_dnd_cb_mouse_move, NULL); + E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_KEY_DOWN, _e_dnd_cb_key_down, NULL); + E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_KEY_UP, _e_dnd_cb_key_up, NULL); +#ifndef HAVE_WAYLAND_ONLY E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_ENTER, _e_dnd_cb_event_dnd_enter, NULL); E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_LEAVE, _e_dnd_cb_event_dnd_leave, NULL); E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_POSITION, _e_dnd_cb_event_dnd_position, NULL); @@ -123,13 +130,14 @@ e_dnd_init(void) E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_DROP, _e_dnd_cb_event_dnd_drop, NULL); E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_SELECTION_NOTIFY, _e_dnd_cb_event_dnd_selection, NULL); E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_WINDOW_HIDE, _e_dnd_cb_event_hide, NULL); - E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_KEY_DOWN, _e_dnd_cb_key_down, NULL); - E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_KEY_UP, _e_dnd_cb_key_up, NULL); +#endif EINA_LIST_FOREACH(e_comp_list(), l, c) e_drop_xdnd_register_set(c->ee_win, 1); +#ifndef HAVE_WAYLAND_ONLY _action = ECORE_X_ATOM_XDND_ACTION_PRIVATE; +#endif return 1; } @@ -204,7 +212,9 @@ e_drag_new(E_Comp *comp, int x, int y, _drag_list = eina_list_append(_drag_list, drag); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_shadow_tree_flush(); +#endif _drag_win_root = drag->comp->man->root; @@ -269,14 +279,18 @@ e_drag_start(E_Drag *drag, int x, int y) E_Drop_Handler *h; if (_drag_win) return 0; +#ifndef HAVE_WAYLAND_ONLY _drag_win = ecore_x_window_input_new(drag->comp->win, drag->comp->man->x, drag->comp->man->y, drag->comp->man->w, drag->comp->man->h); - _drag_win_root = drag->comp->man->root; ecore_x_window_show(_drag_win); +#endif + _drag_win_root = drag->comp->man->root; if (!e_grabinput_get(_drag_win, 1, _drag_win)) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(_drag_win); +#endif return 0; } if (!drag->object) @@ -317,23 +331,29 @@ e_drag_start(E_Drag *drag, int x, int y) EAPI int e_drag_xdnd_start(E_Drag *drag, int x, int y) { +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Atom actions[] = { ECORE_X_DND_ACTION_MOVE, ECORE_X_DND_ACTION_PRIVATE, ECORE_X_DND_ACTION_COPY, ECORE_X_DND_ACTION_ASK, ECORE_X_DND_ACTION_LINK }; +#endif const Eina_List *l; E_Drop_Handler *h; if (_drag_win) return 0; +#ifndef HAVE_WAYLAND_ONLY _drag_win = ecore_x_window_input_new(drag->comp->win, drag->comp->man->x, drag->comp->man->y, drag->comp->man->w, drag->comp->man->h); ecore_x_window_show(_drag_win); +#endif if (!e_grabinput_get(_drag_win, 1, _drag_win)) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(_drag_win); +#endif return 0; } if (!drag->object) @@ -366,10 +386,12 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y) h->entered = 0; } +#ifndef HAVE_WAYLAND_ONLY ecore_x_dnd_aware_set(_drag_win, 1); ecore_x_dnd_types_set(_drag_win, drag->types, drag->num_types); ecore_x_dnd_actions_set(_drag_win, actions, 5); ecore_x_dnd_begin(_drag_win, drag->data, drag->data_size); +#endif _drag_current = drag; return 1; @@ -385,6 +407,7 @@ e_drop_handler_xds_set(E_Drop_Handler *handler, Eina_Bool (*cb)(void *data, cons EAPI void e_drop_xds_update(Eina_Bool enable, const char *value) { +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Window xwin; char buf[PATH_MAX + 8]; char *file; @@ -411,6 +434,7 @@ e_drop_xds_update(Eina_Bool enable, const char *value) } else ecore_x_window_prop_property_del(xwin, ECORE_X_ATOM_XDND_DIRECTSAVE0); +#endif } EAPI E_Drop_Handler * @@ -502,13 +526,17 @@ e_drop_xdnd_register_set(Ecore_Window win, int reg) { if (!eina_hash_find(_drop_win_hash, &win)) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_dnd_aware_set(win, 1); +#endif eina_hash_add(_drop_win_hash, &win, (void *)1); } } else { +#ifndef HAVE_WAYLAND_ONLY ecore_x_dnd_aware_set(win, 0); +#endif eina_hash_del(_drop_win_hash, &win, (void *)1); } return 1; @@ -959,10 +987,12 @@ _e_drag_end(int x, int y) e_grabinput_release(_drag_win, _drag_win); while (_drag_current->type == E_DRAG_XDND) { +#ifndef HAVE_WAYLAND_ONLY if (!(dropped = ecore_x_dnd_drop())) { if (win == e_comp_get(NULL)->ee_win) break; } +#endif if (_drag_current->cb.finished) _drag_current->cb.finished(_drag_current, dropped); _drag_current->cb.finished = NULL; @@ -1117,9 +1147,11 @@ _e_drag_free(E_Drag *drag) for (i = 0; i < drag->num_types; i++) eina_stringshare_del(drag->types[i]); free(drag); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(_drag_win); - _drag_win = 0; ecore_x_window_shadow_tree_flush(); +#endif + _drag_win = 0; } static Eina_Bool @@ -1171,13 +1203,16 @@ _e_dnd_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) if (ev->window != _drag_win) return ECORE_CALLBACK_PASS_ON; +#ifndef HAVE_WAYLAND_ONLY if (!_xdnd) _e_drag_update(_drag_win_root, ev->x, ev->y, _action ?: ECORE_X_ATOM_XDND_ACTION_PRIVATE); +#endif return ECORE_CALLBACK_PASS_ON; } +#ifndef HAVE_WAYLAND_ONLY static Eina_Bool _e_dnd_cb_event_dnd_enter(void *data __UNUSED__, int type __UNUSED__, void *event) { @@ -1380,7 +1415,6 @@ _e_dnd_cb_event_dnd_drop(void *data __UNUSED__, int type __UNUSED__, void *event E_FREE(_xdnd); } } - return ECORE_CALLBACK_PASS_ON; } @@ -1442,4 +1476,5 @@ _e_dnd_cb_event_dnd_selection(void *data __UNUSED__, int type __UNUSED__, void * E_FREE(_xdnd); return ECORE_CALLBACK_PASS_ON; } +#endif diff --git a/src/bin/e_dpms.c b/src/bin/e_dpms.c index ab87ee9c4..ff6104565 100644 --- a/src/bin/e_dpms.c +++ b/src/bin/e_dpms.c @@ -28,7 +28,9 @@ e_dpms_update(void) if (_e_dpms_enabled != enabled) { _e_dpms_enabled = enabled; +#ifndef HAVE_WAYLAND_ONLY ecore_x_dpms_enabled_set(enabled); +#endif } if (!enabled) return; @@ -54,7 +56,9 @@ e_dpms_update(void) _e_dpms_timeout_off = off; changed = EINA_TRUE; } +#ifndef HAVE_WAYLAND_ONLY if (changed) ecore_x_dpms_timeouts_set(standby, suspend, off); +#endif } EAPI void @@ -65,7 +69,9 @@ e_dpms_force_update(void) enabled = ((e_config->screensaver_enable) && (!e_config->mode.presentation)); +#ifndef HAVE_WAYLAND_ONLY ecore_x_dpms_enabled_set(enabled); +#endif if (!enabled) return; if (e_config->screensaver_enable) @@ -75,8 +81,10 @@ e_dpms_force_update(void) suspend += 6; off += 7; } +#ifndef HAVE_WAYLAND_ONLY ecore_x_dpms_timeouts_set(standby + 10, suspend + 10, off + 10); ecore_x_dpms_timeouts_set(standby, suspend, off); +#endif } static Eina_Bool @@ -134,9 +142,11 @@ e_dpms_init(void) _e_dpms_handler_desk_show = ecore_event_handler_add (E_EVENT_DESK_SHOW, _e_dpms_handler_desk_show_cb, NULL); +#ifndef HAVE_WAYLAND_ONLY _e_dpms_enabled = ecore_x_dpms_enabled_get(); ecore_x_dpms_timeouts_get (&_e_dpms_timeout_standby, &_e_dpms_timeout_suspend, &_e_dpms_timeout_off); +#endif e_dpms_force_update(); diff --git a/src/bin/e_entry.c b/src/bin/e_entry.c index 6c0eb0741..e8e0c550f 100644 --- a/src/bin/e_entry.c +++ b/src/bin/e_entry.c @@ -534,6 +534,7 @@ _e_entry_mouse_down_cb(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o static Eina_Bool _e_entry_x_selection_notify_handler(void *data, int type __UNUSED__, void *event) { +#ifndef HAVE_WAYLAND_ONLY Evas_Object *entry; E_Entry_Smart_Data *sd; Ecore_X_Event_Selection_Notify *ev; @@ -563,7 +564,7 @@ _e_entry_x_selection_notify_handler(void *data, int type __UNUSED__, void *event } } } - +#endif return ECORE_CALLBACK_PASS_ON; } @@ -595,9 +596,11 @@ _e_entry_x_selection_update(Evas_Object *entry) if (sd->password_mode) return; +#ifndef HAVE_WAYLAND_ONLY text = edje_object_part_text_selection_get(sd->entry_object, ENTRY_PART_NAME); if (text) ecore_x_selection_primary_set(xwin, text, strlen(text) + 1); +#endif } static void @@ -623,6 +626,7 @@ _entry_paste_request_signal_cb(void *data, else xwin = win->evas_win; +#ifndef HAVE_WAYLAND_ONLY if (emission[sizeof("ntry,paste,request,")] == '1') { ecore_x_selection_primary_request(xwin, @@ -633,6 +637,7 @@ _entry_paste_request_signal_cb(void *data, ecore_x_selection_clipboard_request(xwin, ECORE_X_SELECTION_TARGET_UTF8_STRING); } +#endif } static void @@ -812,9 +817,11 @@ _e_entry_smart_add(Evas_Object *object) _entry_recalc_size(object); +#ifndef HAVE_WAYLAND_ONLY sd->selection_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, _e_entry_x_selection_notify_handler, object); +#endif } static void @@ -976,7 +983,9 @@ _e_entry_cb_copy(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) xwin = c->ee_win; } } +#ifndef HAVE_WAYLAND_ONLY ecore_x_selection_clipboard_set(xwin, range, strlen(range) + 1); +#endif } } @@ -1005,7 +1014,9 @@ _e_entry_cb_paste(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) xwin = c->ee_win; } } +#ifndef HAVE_WAYLAND_ONLY ecore_x_selection_clipboard_request(xwin, ECORE_X_SELECTION_TARGET_UTF8_STRING); +#endif } static void diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 671745740..695f95cde 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -6500,6 +6500,7 @@ _e_fm_drop_menu_queue(Evas_Object *e_fm, void *args, int op) if (!vol->mounted) { /* this should get picked up by the post-mount callback */ +#ifndef HAVE_WAYLAND_ONLY switch (op) { case 0: //copy @@ -6514,6 +6515,7 @@ _e_fm_drop_menu_queue(Evas_Object *e_fm, void *args, int op) mop->action = ECORE_X_ATOM_XDND_ACTION_LINK; break; } +#endif return EINA_TRUE; } switch (op) @@ -6621,6 +6623,7 @@ _e_fm2_cb_dnd_selection_notify_post_mount(E_Volume *vol) if (mp) { mop->args = e_util_string_append_quoted(mop->args, &mop->size, &mop->length, mp); +#ifndef HAVE_WAYLAND_ONLY if (mop->action == ECORE_X_ATOM_XDND_ACTION_ASK) continue; else if (mop->action == ECORE_X_ATOM_XDND_ACTION_MOVE) @@ -6629,6 +6632,7 @@ _e_fm2_cb_dnd_selection_notify_post_mount(E_Volume *vol) e_fm2_client_file_copy(ic->sd->obj, mop->args); else if (mop->action == ECORE_X_ATOM_XDND_ACTION_LINK) e_fm2_client_file_symlink(ic->sd->obj, mop->args); +#endif } else e_util_dialog_show(_("Error"), _("The recent DND operation requested for '%s' has failed."), vol->label ? : vol->udi); @@ -6763,6 +6767,7 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) ((f - fp - 1 > 0) && (!strncmp(sd->realpath, fp, f - fp - 1)))) && ((size_t)(f - fp - 1) == strlen(sd->realpath))) { +#ifndef HAVE_WAYLAND_ONLY if ((e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_MOVE) || (sd->config->view.link_drop)) { lnk = EINA_TRUE; @@ -6770,10 +6775,12 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) goto end; memerr = EINA_TRUE; // prevent actual file move op } +#endif } } if (!fsel) { +#ifndef HAVE_WAYLAND_ONLY if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_COPY) { /* most likely someone is trying to dnd some text to us */ @@ -6782,6 +6789,7 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) isel = eina_list_append(isel, strdup(fp)); ecore_thread_global_data_add("efm_text_uri_list", isel, (Eina_Free_Cb)e_util_string_list_free, 0); } +#endif /* no files, abort! */ return; } @@ -6932,6 +6940,7 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) if (sd->drop_icon->mount_timer) ecore_timer_reset(sd->drop_icon->mount_timer); else sd->drop_icon->mount_timer = ecore_timer_add(15., (Ecore_Task_Cb)_e_fm2_cb_dnd_selection_notify_post_mount_timer, sd->drop_icon); +#ifndef HAVE_WAYLAND_ONLY if ((e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_ASK) || ((sd->config->view.link_drop) || (!sd->drop_icon))) /* this here's some buuuullshit */ @@ -6939,6 +6948,7 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_MOVE) /* set copy if we're over a device */ e_drop_handler_action_set(ECORE_X_ATOM_XDND_ACTION_COPY); +#endif mop = e_fm2_device_mount_op_add(sd->drop_icon->mount, args, size, length); mop->ic = sd->drop_icon; mop->mnt = sd->drop_icon->mount; @@ -7031,6 +7041,7 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) { Eina_Bool do_lnk = EINA_FALSE, do_move = EINA_FALSE, do_copy = EINA_FALSE; +#ifndef HAVE_WAYLAND_ONLY if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_COPY) { lnk = EINA_TRUE; @@ -7061,6 +7072,7 @@ _e_fm2_cb_dnd_selection_notify(void *data, const char *type, void *event) e_fm2_client_file_copy(sd->obj, args); else if (do_move) e_fm2_client_file_move(sd->obj, args); +#endif if ((!do_lnk) && (!do_copy) && (!do_move)) { e_fm2_drop_menu(sd->obj, args); @@ -7404,7 +7416,8 @@ _e_fm2_cb_drag_finished(E_Drag *drag, int dropped __UNUSED__) static void _e_fm_drag_key_down_cb(E_Drag *drag, Ecore_Event_Key *e) { - if (!strncmp(e->key, "Alt", 3)) +#ifndef HAVE_WAYLAND_ONLY + if (!strncmp(e->keyname, "Alt", 3)) { ecore_x_dnd_source_action_set(ECORE_X_ATOM_XDND_ACTION_ASK); e_drop_handler_action_set(ECORE_X_ATOM_XDND_ACTION_ASK); @@ -7440,11 +7453,13 @@ _e_fm_drag_key_down_cb(E_Drag *drag, Ecore_Event_Key *e) edje_object_signal_emit(drag->object, "e,state,copy", "e"); } } +#endif } static void _e_fm_drag_key_up_cb(E_Drag *drag, Ecore_Event_Key *e) { +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Atom act = ECORE_X_ATOM_XDND_ACTION_MOVE; /* Default action would be move. ;) */ @@ -7457,6 +7472,7 @@ _e_fm_drag_key_up_cb(E_Drag *drag, Ecore_Event_Key *e) ecore_x_dnd_source_action_set(act); e_drop_handler_action_set(act); +#endif edje_object_signal_emit(drag->object, "e,state,move", "e"); } @@ -7631,8 +7647,9 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU d->x = ic->sd->x, d->y = ic->sd->y; else d->x = ic->x + ic->sd->x - ic->sd->pos.x, d->y = ic->y + ic->sd->y - ic->sd->pos.y; +#ifndef HAVE_WAYLAND_ONLY e_drop_handler_action_set(ECORE_X_ATOM_XDND_ACTION_MOVE); - +#endif e_drag_object_set(d, layout ?: o); if (layout) { @@ -10299,7 +10316,9 @@ _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic) ic->entry_widget = e_widget_entry_add(e, NULL, NULL, NULL, NULL); evas_object_event_callback_add(ic->entry_widget, EVAS_CALLBACK_KEY_DOWN, _e_fm2_icon_entry_widget_cb_key_down, ic); +#ifndef HAVE_WAYLAND_ONLY evas_event_feed_mouse_out(evas_object_evas_get(ic->obj), ecore_x_current_time_get(), NULL); +#endif if (c) e_comp_grab_input(c, 0, 1); ic->keygrab = !!c; @@ -10312,8 +10331,9 @@ _e_fm2_icon_entry_widget_add(E_Fm2_Icon *ic) e_widget_entry_select_all(ic->entry_widget); ic->sd->iop_icon = ic; ic->sd->typebuf.disabled = EINA_TRUE; +#ifndef HAVE_WAYLAND_ONLY evas_event_feed_mouse_in(e, ecore_x_current_time_get(), NULL); - +#endif return ic->entry_widget; } diff --git a/src/bin/e_focus.c b/src/bin/e_focus.c index d5ab2d949..72bbf8f8a 100644 --- a/src/bin/e_focus.c +++ b/src/bin/e_focus.c @@ -69,9 +69,11 @@ e_focus_event_focus_in(E_Client *ec) if (!ec->button_grabbed) return; e_bindings_mouse_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec)); e_bindings_wheel_ungrab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec)); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_button_ungrab(e_client_util_pwin_get(ec), 1, 0, 1); ecore_x_window_button_ungrab(e_client_util_pwin_get(ec), 2, 0, 1); ecore_x_window_button_ungrab(e_client_util_pwin_get(ec), 3, 0, 1); +#endif e_bindings_mouse_grab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec)); e_bindings_wheel_grab(E_BINDING_CONTEXT_WINDOW, e_client_util_pwin_get(ec)); ec->button_grabbed = 0; @@ -86,6 +88,7 @@ e_focus_event_focus_out(E_Client *ec) (!e_config->always_click_to_focus)) { if (ec->button_grabbed) return; +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_button_grab(e_client_util_pwin_get(ec), 1, ECORE_X_EVENT_MASK_MOUSE_DOWN | ECORE_X_EVENT_MASK_MOUSE_UP | @@ -98,6 +101,7 @@ e_focus_event_focus_out(E_Client *ec) ECORE_X_EVENT_MASK_MOUSE_DOWN | ECORE_X_EVENT_MASK_MOUSE_UP | ECORE_X_EVENT_MASK_MOUSE_MOVE, 0, 1); +#endif ec->button_grabbed = 1; } } diff --git a/src/bin/e_grab_dialog.c b/src/bin/e_grab_dialog.c index f851b2ae4..27a71af07 100644 --- a/src/bin/e_grab_dialog.c +++ b/src/bin/e_grab_dialog.c @@ -72,7 +72,9 @@ _e_grab_dialog_free(E_Grab_Dialog *eg) if (eg->grab_win) { e_grabinput_release(eg->grab_win, eg->grab_win); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(eg->grab_win); +#endif } E_FREE_LIST(eg->handlers, ecore_event_handler_del); @@ -137,9 +139,11 @@ e_grab_dialog_show(E_Win *parent, Eina_Bool is_mouse, Ecore_Event_Handler_Cb key e_object_del_attach_func_set(E_OBJECT(eg->dia), _e_grab_dialog_dia_del); e_win_delete_callback_set(eg->dia->win, _e_grab_dialog_delete); +#ifndef HAVE_WAYLAND_ONLY eg->grab_win = ecore_x_window_input_new(c->man->root, 0, 0, 1, 1); ecore_x_window_show(eg->grab_win); e_grabinput_get(eg->grab_win, 0, eg->grab_win); +#endif eg->key = key; eg->mouse = mouse; diff --git a/src/bin/e_grabinput.c b/src/bin/e_grabinput.c index 215c1a8ac..7910a65d9 100644 --- a/src/bin/e_grabinput.c +++ b/src/bin/e_grabinput.c @@ -40,12 +40,16 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) if (e_comp_get(NULL)->comp_type != E_PIXMAP_TYPE_X) return 1; if (grab_mouse_win) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_pointer_ungrab(); +#endif grab_mouse_win = 0; } if (grab_key_win) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_keyboard_ungrab(); +#endif grab_key_win = 0; focus_win = 0; } @@ -53,15 +57,18 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) { int ret = 0; +#ifndef HAVE_WAYLAND_ONLY if (confine_mouse) ret = ecore_x_pointer_confine_grab(mouse_win); else ret = ecore_x_pointer_grab(mouse_win); +#endif if (!ret) return 0; grab_mouse_win = mouse_win; } if (key_win) { +#ifndef HAVE_WAYLAND_ONLY int ret = 0; ret = ecore_x_keyboard_grab(key_win); @@ -74,6 +81,7 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win) } return 0; } +#endif grab_key_win = key_win; } return 1; @@ -85,12 +93,16 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win) if (e_comp_get(NULL)->comp_type != E_PIXMAP_TYPE_X) return; if (mouse_win == grab_mouse_win) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_pointer_ungrab(); +#endif grab_mouse_win = 0; } if (key_win == grab_key_win) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_keyboard_ungrab(); +#endif grab_key_win = 0; if (focus_win != 0) { @@ -140,11 +152,13 @@ e_grabinput_key_win_get(void) static Eina_Bool _e_grabinput_focus_check(void *data __UNUSED__) { +#ifndef HAVE_WAYLAND_ONLY if (ecore_x_window_focus_get() != focus_fix_win) { /* fprintf(stderr, "foc do 2\n"); */ _e_grabinput_focus_do(focus_fix_win, focus_fix_method); } +#endif focus_fix_timer = NULL; return EINA_FALSE; } @@ -159,16 +173,22 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method) break; case E_FOCUS_METHOD_LOCALLY_ACTIVE: +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_focus_at_time(win, ecore_x_current_time_get()); ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get()); +#endif break; case E_FOCUS_METHOD_GLOBALLY_ACTIVE: +#ifndef HAVE_WAYLAND_ONLY ecore_x_icccm_take_focus_send(win, ecore_x_current_time_get()); +#endif break; case E_FOCUS_METHOD_PASSIVE: +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_focus_at_time(win, ecore_x_current_time_get()); +#endif break; default: diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index 3f7c5e96e..bdd6d4450 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -4,7 +4,7 @@ static void e_hints_openoffice_gnome_fake(Ecore_Window root); //static void e_hints_openoffice_kde_fake(Ecore_Window root); -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY static void e_hints_e16_comms_pretend(Ecore_X_Window root, Ecore_X_Window propwin); EAPI Ecore_X_Atom ATM__QTOPIA_SOFT_MENU = 0; @@ -18,7 +18,7 @@ EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE = 0; EINTERN void e_hints_init(Ecore_Window root, Ecore_Window propwin) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else const char *atom_names[] = { "_QTOPIA_SOFT_MENU", @@ -210,7 +210,7 @@ e_hints_init(Ecore_Window root, Ecore_Window propwin) #endif } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY /* * This is here so we don't have to pretend to be Kwin anymore - we pretend * to do old e16 style ipc. in fact we just ignore it... but set up the @@ -286,7 +286,7 @@ e_hints_manager_init(E_Manager *man) EAPI void e_hints_client_list_set(void) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else E_Manager *man; const Eina_List *l; @@ -321,7 +321,7 @@ e_hints_client_list_set(void) EAPI void e_hints_client_stacking_set(void) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else E_Comp *comp; const Eina_List *l; @@ -387,7 +387,7 @@ EAPI void e_hints_active_window_set(E_Manager *man, E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else E_OBJECT_CHECK(man); if (e_comp_get(man)->comp_type != E_PIXMAP_TYPE_X) return; @@ -401,7 +401,7 @@ e_hints_active_window_set(E_Manager *man, EINTERN void e_hints_window_init(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else E_Remember *rem = NULL; @@ -577,7 +577,7 @@ e_hints_window_init(E_Client *ec) EAPI void e_hints_window_state_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else Ecore_X_Window_State state[10]; int num = 0; @@ -623,7 +623,7 @@ e_hints_window_state_set(E_Client *ec) EAPI void e_hints_allowed_action_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else Ecore_X_Action action[10]; int num = 0; @@ -657,7 +657,7 @@ e_hints_allowed_action_set(E_Client *ec) EAPI void e_hints_window_type_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; ecore_x_netwm_window_type_set(e_client_util_win_get(ec), ec->netwm.type); @@ -667,7 +667,7 @@ e_hints_window_type_set(E_Client *ec) EAPI void e_hints_window_type_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else Ecore_X_Window_Type *types = NULL; int num, i, j; @@ -712,13 +712,10 @@ e_hints_window_type_get(E_Client *ec) #endif } +#ifdef E_COMP_X_H EAPI void -e_hints_window_state_update(E_Client *ec, - Ecore_X_Window_State state, - Ecore_X_Window_State_Action action) +e_hints_window_state_update(E_Client *ec, int state, int action) { -#ifdef WAYLAND_ONLY -#else if (!e_pixmap_is_x(ec->pixmap)) return; switch (state) { @@ -976,13 +973,13 @@ e_hints_window_state_update(E_Client *ec, /* Ignore */ break; } -#endif } +#endif EAPI void e_hints_window_state_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else unsigned int i, num; Ecore_X_Window_State *state; @@ -1069,10 +1066,9 @@ e_hints_window_state_get(E_Client *ec) } EAPI void -e_hints_allowed_action_update(E_Client *ec, - Ecore_X_Action action) +e_hints_allowed_action_update(E_Client *ec, int action) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; switch (action) @@ -1119,7 +1115,7 @@ e_hints_allowed_action_update(E_Client *ec, EAPI void e_hints_allowed_action_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else Ecore_X_Action *action; unsigned int i; @@ -1211,7 +1207,7 @@ _e_hints_process_wakeup(E_Client *ec) EAPI void e_hints_window_visible_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL) @@ -1230,7 +1226,7 @@ e_hints_window_visible_set(E_Client *ec) EAPI void e_hints_window_iconic_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_ICONIC) @@ -1249,7 +1245,7 @@ e_hints_window_iconic_set(E_Client *ec) EAPI void e_hints_window_hidden_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->icccm.state != ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) @@ -1268,7 +1264,7 @@ e_hints_window_hidden_set(E_Client *ec) EAPI void e_hints_window_shaded_set(E_Client *ec, int on) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if ((!ec->netwm.state.shaded) && (on)) @@ -1294,7 +1290,7 @@ e_hints_window_shaded_set(E_Client *ec, int on) EAPI void e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; ecore_x_window_prop_card32_set(e_client_util_win_get(ec), E_ATOM_SHADE_DIRECTION, &dir, 1); @@ -1304,7 +1300,7 @@ e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir) EAPI E_Direction e_hints_window_shade_direction_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else int ret; E_Direction dir; @@ -1315,15 +1311,14 @@ e_hints_window_shade_direction_get(E_Client *ec) &dir, 1); if (ret == 1) return dir; - - return E_DIRECTION_UP; #endif + return E_DIRECTION_UP; } EAPI void e_hints_window_size_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else unsigned int sizes[4]; @@ -1339,7 +1334,7 @@ e_hints_window_size_set(E_Client *ec) EAPI void e_hints_window_size_unset(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; ecore_x_window_prop_property_del(e_client_util_win_get(ec), E_ATOM_BORDER_SIZE); @@ -1349,7 +1344,7 @@ e_hints_window_size_unset(E_Client *ec) EAPI int e_hints_window_size_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else int ret; unsigned int sizes[4]; @@ -1365,15 +1360,15 @@ e_hints_window_size_get(E_Client *ec) ec->y = sizes[1]; ec->w = sizes[2]; ec->h = sizes[3]; +#endif return 1; -#endif } EAPI void e_hints_window_maximized_set(E_Client *ec, int horizontal, int vertical) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if ((horizontal) && (!ec->netwm.state.maximized_h)) @@ -1407,7 +1402,7 @@ EAPI void e_hints_window_fullscreen_set(E_Client *ec, int on) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if ((!ec->netwm.state.fullscreen) && (on)) @@ -1428,7 +1423,7 @@ e_hints_window_fullscreen_set(E_Client *ec, EAPI void e_hints_window_sticky_set(E_Client *ec, int on) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if ((!ec->netwm.state.sticky) && (on)) @@ -1449,7 +1444,7 @@ e_hints_window_sticky_set(E_Client *ec, int on) EAPI void e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; if (ec->netwm.state.stacking == stacking) return; @@ -1462,7 +1457,7 @@ e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking) EAPI void e_hints_window_desktop_set(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else /* This function is only called when really changing desktop, * so just set the property and don't care about the roundtrip. @@ -1489,7 +1484,7 @@ e_hints_window_desktop_set(E_Client *ec) EAPI void e_hints_window_e_state_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else /* Remember to update the count if we add more states! */ Ecore_X_Atom state[1]; @@ -1524,7 +1519,7 @@ e_hints_window_e_state_set(E_Client *ec __UNUSED__) EAPI void e_hints_window_qtopia_soft_menu_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else unsigned int val; @@ -1539,7 +1534,7 @@ e_hints_window_qtopia_soft_menu_get(E_Client *ec) EAPI void e_hints_window_qtopia_soft_menus_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else unsigned int val; @@ -1554,7 +1549,7 @@ e_hints_window_qtopia_soft_menus_get(E_Client *ec) EAPI void e_hints_window_virtual_keyboard_state_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else Ecore_X_Atom atom = 0; @@ -1572,7 +1567,7 @@ e_hints_window_virtual_keyboard_state_get(E_Client *ec) EAPI void e_hints_window_virtual_keyboard_get(E_Client *ec) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!e_pixmap_is_x(ec->pixmap)) return; ec->vkbd.vkbd = ecore_x_e_virtual_keyboard_get(e_client_util_win_get(ec)); @@ -1582,7 +1577,7 @@ e_hints_window_virtual_keyboard_get(E_Client *ec) static void e_hints_openoffice_gnome_fake(Ecore_Window root) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else const char *string = "ATM_GNOME_SM_PROXY"; @@ -1595,7 +1590,7 @@ e_hints_openoffice_gnome_fake(Ecore_Window root) static void e_hints_openoffice_kde_fake(Ecore_Window root) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else Ecore_X_Window win2; @@ -1608,7 +1603,7 @@ e_hints_openoffice_kde_fake(Ecore_Window root) EAPI void e_hints_scale_update(void) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else E_Comp *c; const Eina_List *l; diff --git a/src/bin/e_hints.h b/src/bin/e_hints.h index cfc5cbdbb..2609954b0 100644 --- a/src/bin/e_hints.h +++ b/src/bin/e_hints.h @@ -48,7 +48,7 @@ EAPI void e_hints_scale_update(void); #ifdef E_COMP_X_H -EAPI void e_hints_window_state_update(E_Client *ec, Ecore_X_Window_State state, Ecore_X_Window_State_Action action); +EAPI void e_hints_window_state_update(E_Client *ec, int state, int action); extern EAPI Ecore_X_Atom ATM__QTOPIA_SOFT_MENU; extern EAPI Ecore_X_Atom ATM__QTOPIA_SOFT_MENUS; extern EAPI Ecore_X_Atom ATM_GNOME_SM_PROXY; diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h index 79f7c75d7..959c213ea 100644 --- a/src/bin/e_includes.h +++ b/src/bin/e_includes.h @@ -8,7 +8,7 @@ #include "e_zone.h" #include "e_desk.h" #include "e_auth.h" -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY # include "e_comp_x.h" #endif #include "e_pixmap.h" @@ -154,3 +154,4 @@ #include "e_comp_cfdata.h" #include "e_comp_canvas.h" #include "e_utils.h" +#include "e_hints.h" diff --git a/src/bin/e_int_client_prop.c b/src/bin/e_int_client_prop.c index cbab64b04..f172d842d 100644 --- a/src/bin/e_int_client_prop.c +++ b/src/bin/e_int_client_prop.c @@ -145,6 +145,7 @@ _create_data(E_Dialog *cfd, E_Client *ec) cfdata->client->icccm.max_aspect); cfdata->icccm.aspect = strdup(buf); } +#ifdef E_COMP_X_H if (cfdata->client->icccm.initial_state != ECORE_X_WINDOW_STATE_HINT_NONE) { switch (cfdata->client->icccm.initial_state) @@ -189,6 +190,7 @@ _create_data(E_Dialog *cfd, E_Client *ec) } cfdata->icccm.state = strdup(buf); } +#endif snprintf(buf, sizeof(buf), "0x%08x", (unsigned int)e_client_util_win_get(cfdata->client)); cfdata->icccm.window_id = strdup(buf); @@ -210,6 +212,7 @@ _create_data(E_Dialog *cfd, E_Client *ec) (unsigned int)cfdata->client->icccm.client_leader); cfdata->icccm.client_leader = strdup(buf); } +#ifdef E_COMP_X_H switch (cfdata->client->icccm.gravity) { case ECORE_X_GRAVITY_FORGET: @@ -261,6 +264,7 @@ _create_data(E_Dialog *cfd, E_Client *ec) break; } cfdata->icccm.gravity = strdup(buf); +#endif if (cfdata->client->icccm.command.argv) { int i; diff --git a/src/bin/e_main.c b/src/bin/e_main.c index e813c2a4f..336acda6e 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1490,6 +1490,7 @@ _e_main_screens_init(void) if (!e_client_init()) return 0; TS("\tscreens: win"); if (!e_win_init()) return 0; +#ifndef HAVE_WAYLAND_ONLY TS("E_Xkb Init"); if (!e_xkb_init()) { @@ -1497,6 +1498,7 @@ _e_main_screens_init(void) _e_main_shutdown(-1); } TS("E_Xkb Init Done"); +#endif TS("Compositor Init"); if (!e_comp_init()) @@ -1507,6 +1509,7 @@ _e_main_screens_init(void) _e_main_desk_restore(); +#ifndef HAVE_WAYLAND_ONLY if (e_config->show_splash) e_init_status_set(_("Setup DND")); TS("E_Dnd Init"); @@ -1517,6 +1520,7 @@ _e_main_screens_init(void) } TS("E_Dnd Init Done"); _e_main_shutdown_push(e_dnd_shutdown); +#endif return 1; } @@ -1703,7 +1707,9 @@ static Eina_Bool _e_main_cb_x_flusher(void *data __UNUSED__) { eet_clearcache(); +#ifndef HAVE_WAYLAND_ONLY ecore_x_flush(); +#endif return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/e_module.c b/src/bin/e_module.c index 2ac063541..330650944 100644 --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@ -972,7 +972,8 @@ _e_module_whitelist_check(void) known++; } - { +#ifndef HAVE_WAYLAND_ONLY + { Ecore_X_Atom _x_tainted; char *state; unsigned int _e_tainted; @@ -986,6 +987,7 @@ _e_module_whitelist_check(void) e_env_set("E19_TAINTED", state); } +#endif if (eina_list_count(badl) != known) { diff --git a/src/bin/e_mouse.c b/src/bin/e_mouse.c index cdcb0043f..1074b7703 100644 --- a/src/bin/e_mouse.c +++ b/src/bin/e_mouse.c @@ -6,12 +6,14 @@ e_mouse_update(void) unsigned char map[256] = { 0 }; int n; +#ifndef HAVE_WAYLAND_ONLY if (!ecore_x_pointer_control_set(e_config->mouse_accel_numerator, e_config->mouse_accel_denominator, e_config->mouse_accel_threshold)) return 0; if (!ecore_x_pointer_mapping_get(map, 256)) return 0; +#endif for (n = 0; n < 256; n++) { @@ -35,7 +37,9 @@ e_mouse_update(void) map[2] = 1; } +#ifndef HAVE_WAYLAND_ONLY if (!ecore_x_pointer_mapping_set(map, n)) return 0; +#endif return 1; } diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index 46f66469e..be8c29692 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -3,7 +3,7 @@ #ifdef HAVE_WAYLAND_CLIENTS # include "e_comp_wl.h" #endif -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY # include "e_comp_x.h" #endif @@ -23,7 +23,7 @@ struct _E_Pixmap #ifdef HAVE_WAYLAND_CLIENTS struct wl_resource *resource; #endif -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY uint32_t pixmap; #endif int w, h; @@ -44,7 +44,7 @@ _e_pixmap_clear(E_Pixmap *cp, Eina_Bool cache) cp->image_argb = EINA_FALSE; switch (cp->type) { -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY case E_PIXMAP_TYPE_X: if (cp->pixmap) { @@ -64,7 +64,7 @@ _e_pixmap_clear(E_Pixmap *cp, Eina_Bool cache) } } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY static void _e_pixmap_image_clear_x(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { @@ -78,7 +78,7 @@ _e_pixmap_free(E_Pixmap *cp) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (!cp->images_cache) break; if (cp->client) evas_object_event_callback_add(cp->client->frame, EVAS_CALLBACK_FREE, _e_pixmap_image_clear_x, cp->images_cache); @@ -121,7 +121,7 @@ _e_pixmap_new(E_Pixmap_Type type) static E_Pixmap * _e_pixmap_find(E_Pixmap_Type type, va_list *l) { -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Window xwin; #endif #ifdef HAVE_WAYLAND_CLIENTS @@ -131,7 +131,7 @@ _e_pixmap_find(E_Pixmap_Type type, va_list *l) if (!pixmaps[type]) return NULL; switch (type) { -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY case E_PIXMAP_TYPE_X: xwin = va_arg(*l, uint32_t); return eina_hash_find(pixmaps[type], &xwin); @@ -155,7 +155,7 @@ e_pixmap_free(E_Pixmap *cp) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL); #endif break; @@ -182,7 +182,7 @@ e_pixmap_new(E_Pixmap_Type type, ...) { E_Pixmap *cp = NULL; va_list l; -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Window xwin; #endif #ifdef HAVE_WAYLAND_CLIENTS @@ -194,7 +194,7 @@ e_pixmap_new(E_Pixmap_Type type, ...) switch (type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY xwin = va_arg(l, uint32_t); if (pixmaps[type]) { @@ -323,7 +323,7 @@ e_pixmap_refresh(E_Pixmap *cp) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY { uint32_t pixmap; @@ -482,7 +482,7 @@ e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY ns->type = EVAS_NATIVE_SURFACE_X11; ns->data.x11.visual = cp->visual; ns->data.x11.pixmap = cp->pixmap; @@ -518,7 +518,7 @@ e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (cache) { void *i; @@ -578,7 +578,7 @@ e_pixmap_image_refresh(E_Pixmap *cp) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if ((!cp->visual) || (!cp->client->depth)) return EINA_FALSE; cp->image = ecore_x_image_new(cp->w, cp->h, cp->visual, cp->client->depth); if (cp->image) @@ -629,7 +629,7 @@ e_pixmap_image_data_get(E_Pixmap *cp) switch (cp->type) { case E_PIXMAP_TYPE_X: -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY return ecore_x_image_data_get(cp->image, &cp->ibpl, NULL, &cp->ibpp); #endif break; @@ -653,11 +653,13 @@ e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Recta switch (cp->type) { case E_PIXMAP_TYPE_X: +#ifndef HAVE_WAYLAND_ONLY if (cp->image_argb) return EINA_FALSE; return ecore_x_image_to_argb_convert(ipix, cp->ibpp, cp->ibpl, cp->cmap, cp->visual, r->x, r->y, r->w, r->h, pix, stride, r->x, r->y); +#endif case E_PIXMAP_TYPE_WL: return EINA_TRUE; //already guaranteed to be argb default: @@ -674,8 +676,10 @@ e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r) switch (cp->type) { case E_PIXMAP_TYPE_X: +#ifndef HAVE_WAYLAND_ONLY if (!cp->pixmap) return EINA_FALSE; return ecore_x_image_get(cp->image, cp->pixmap, r->x, r->y, r->x, r->y, r->w, r->h); +#endif case E_PIXMAP_TYPE_WL: return EINA_TRUE; //this call is a NOP default: diff --git a/src/bin/e_pointer.c b/src/bin/e_pointer.c index d1a0f27b6..1e2fe1424 100644 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@ -228,7 +228,7 @@ _e_pointer_type_set(E_Pointer *p, /* Do not set type if in "hidden mode" */ if (!e_config->show_cursor) { -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY evas_object_hide(p->pointer_image); #else if (!p->canvas) @@ -266,55 +266,57 @@ _e_pointer_type_set(E_Pointer *p, return; } fallback: -#ifndef WAYLAND_ONLY if (p->canvas) return; - { - Ecore_X_Cursor cursor = 0; + { + E_FREE_FUNC(p->pointer_image, evas_object_del); + if (p->evas) _e_pointer_canvas_del(p); - E_FREE_FUNC(p->pointer_image, evas_object_del); - if (p->evas) _e_pointer_canvas_del(p); - if (!strcmp(type, "move")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR); -#if 0 - else if (!strcmp(type, "resize")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_SIZING); -#endif - else if (!strcmp(type, "resize_tl")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER); - else if (!strcmp(type, "resize_t")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE); - else if (!strcmp(type, "resize_tr")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER); - else if (!strcmp(type, "resize_r")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE); - else if (!strcmp(type, "resize_br")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER); - else if (!strcmp(type, "resize_b")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE); - else if (!strcmp(type, "resize_bl")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER); - else if (!strcmp(type, "resize_l")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE); - else if (!strcmp(type, "entry")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_XTERM); - else if (!strcmp(type, "default")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR); - else if (!strcmp(type, "plus")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_PLUS); - else if (!strcmp(type, "hand")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_HAND1); - else if (!strcmp(type, "rotate")) - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_EXCHANGE); - else - { - printf("Unknown pointer type: %s\n", type); - cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_ARROW); - } - if (!cursor) printf("X Cursor for %s is missing\n", type); - ecore_x_window_cursor_set(p->win, cursor); - if (cursor) ecore_x_cursor_free(cursor); - } +#ifndef HAVE_WAYLAND_ONLY + Ecore_X_Cursor cursor = 0; + + if (!strcmp(type, "move")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_FLEUR); +# if 0 + else if (!strcmp(type, "resize")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_SIZING); +# endif + else if (!strcmp(type, "resize_tl")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_LEFT_CORNER); + else if (!strcmp(type, "resize_t")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_SIDE); + else if (!strcmp(type, "resize_tr")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_TOP_RIGHT_CORNER); + else if (!strcmp(type, "resize_r")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_RIGHT_SIDE); + else if (!strcmp(type, "resize_br")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER); + else if (!strcmp(type, "resize_b")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_SIDE); + else if (!strcmp(type, "resize_bl")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_BOTTOM_LEFT_CORNER); + else if (!strcmp(type, "resize_l")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_SIDE); + else if (!strcmp(type, "entry")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_XTERM); + else if (!strcmp(type, "default")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_LEFT_PTR); + else if (!strcmp(type, "plus")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_PLUS); + else if (!strcmp(type, "hand")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_HAND1); + else if (!strcmp(type, "rotate")) + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_EXCHANGE); + else + { + printf("Unknown pointer type: %s\n", type); + cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_ARROW); + } + if (!cursor) printf("X Cursor for %s is missing\n", type); + ecore_x_window_cursor_set(p->win, cursor); + if (cursor) ecore_x_cursor_free(cursor); #endif + } + return; } static void @@ -440,15 +442,16 @@ _e_pointer_idle_timer(void *data) return EINA_TRUE; } -#ifndef WAYLAND_ONLY static Eina_Bool _e_pointer_cb_idle_timer_pre(void *data) { E_Pointer *p; - int x, y; + int x = 0, y = 0; if (!(p = data)) return ECORE_CALLBACK_RENEW; +#ifndef HAVE_WAYLAND_ONLY ecore_x_pointer_xy_get(p->win, &x, &y); +#endif p->x = x; p->y = y; if (p->canvas) @@ -486,7 +489,7 @@ static Eina_Bool _e_pointer_cb_idle_poller(void *data) { E_Pointer *p; - int x, y; + int x = 0, y = 0; if (!(p = data)) return ECORE_CALLBACK_RENEW; if ((e_powersave_mode_get() >= E_POWERSAVE_MODE_MEDIUM) || @@ -495,9 +498,11 @@ _e_pointer_cb_idle_poller(void *data) p->idle_poller = NULL; return ECORE_CALLBACK_CANCEL; } +#ifndef HAVE_WAYLAND_ONLY /* check if pointer actually moved since the 1 second post-mouse move idle * pre-timer that fetches the position */ ecore_x_pointer_xy_get(p->win, &x, &y); +#endif if ((x != p->x) || (y != p->y)) { /* it moved - so we are not idle yet - record position and wait @@ -515,7 +520,6 @@ _e_pointer_cb_idle_poller(void *data) _e_pointer_idle(p); return ECORE_CALLBACK_RENEW; } -#endif /* externally accessible functions */ @@ -561,7 +565,7 @@ e_pointer_window_new(Ecore_Window win, p->color = c->pointer->color; } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4); #endif if (filled) e_pointer_type_push(p, p, "default"); @@ -653,7 +657,7 @@ e_pointer_image_set(E_Pointer *p, E_Pixmap *cp, int w, int h, int hot_x, int hot evas_object_show(p->pointer_image); } } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY else if (!p->e_cursor) { Ecore_X_Cursor cur; @@ -685,7 +689,7 @@ e_pointers_size_set(int size) if (!p->canvas) _e_pointer_canvas_resize(p, size, size); } -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY else ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4); #endif @@ -703,8 +707,7 @@ EAPI void e_pointer_hide(E_Pointer *p) { if (!p) return; -#ifdef WAYLAND_ONLY -#else +#ifndef HAVE_WAYLAND_ONLY if (p->win) ecore_x_window_cursor_set(p->win, 0); #endif if (p->canvas) @@ -727,13 +730,13 @@ e_pointer_type_push(E_Pointer *p, if (!p->canvas) { evas_object_hide(p->pointer_image); -#ifndef WAYLAND_ONLY if (p->blocks) { +#ifndef HAVE_WAYLAND_ONLY ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4); +#endif _e_pointer_canvas_resize(p, e_config->cursor_size, e_config->cursor_size); } -#endif } _e_pointer_type_set(p, type); @@ -779,15 +782,13 @@ e_pointer_type_pop(E_Pointer *p, if (p->pointer_image) { evas_object_show(p->pointer_image); -#ifndef WAYLAND_ONLY if (!p->canvas) { int w, h; e_pixmap_size_get(p->pixmap, &w, &h); _e_pointer_canvas_resize(p, w, h); - } -#endif + } } } @@ -801,7 +802,6 @@ e_pointer_type_pop(E_Pointer *p, EAPI void e_pointer_idler_before(void) { -#ifndef WAYLAND_ONLY Eina_List *l; E_Pointer *p; @@ -825,6 +825,7 @@ e_pointer_idler_before(void) evas_object_image_data_set(p->pointer_image, p->pixels); } } +#ifndef HAVE_WAYLAND_ONLY else { Ecore_X_Cursor cur; @@ -834,11 +835,11 @@ e_pointer_idler_before(void) ecore_x_window_cursor_set(p->win, cur); ecore_x_cursor_free(cur); } +#endif evas_render_updates_free(updates); } p->hot.update = 0; } -#endif } /** diff --git a/src/bin/e_scale.c b/src/bin/e_scale.c index 87a2c3b48..b5d5e268a 100644 --- a/src/bin/e_scale.c +++ b/src/bin/e_scale.c @@ -18,12 +18,14 @@ e_scale_shutdown(void) EAPI void e_scale_update(void) { - int dpi; + int dpi = 0; char buf[128]; if (e_config->scale.use_dpi) { +#ifndef HAVE_WAYLAND_ONLY dpi = ecore_x_dpi_get(); +#endif e_scale = (double)dpi / (double)e_config->scale.base_dpi; if (e_scale > e_config->scale.max) e_scale = e_config->scale.max; else if (e_scale < e_config->scale.min) diff --git a/src/bin/e_screensaver.c b/src/bin/e_screensaver.c index 6bc1ee9c3..8964ed790 100644 --- a/src/bin/e_screensaver.c +++ b/src/bin/e_screensaver.c @@ -82,9 +82,9 @@ e_screensaver_update(void) changed = EINA_TRUE; } - if (changed) -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else + if (changed) ecore_x_screensaver_set(timeout, interval, blanking, expose); #endif } @@ -93,7 +93,7 @@ EAPI void e_screensaver_force_update(void) { int timeout = e_screensaver_timeout_get(EINA_TRUE); -#ifdef WAYLAND_ONLY +#ifdef HAVE_WAYLAND_ONLY #else if (!getenv("DISPLAY")) return; ecore_x_screensaver_set(timeout + 10, diff --git a/src/bin/e_signals.c b/src/bin/e_signals.c index 784498161..358ca73d4 100644 --- a/src/bin/e_signals.c +++ b/src/bin/e_signals.c @@ -14,6 +14,7 @@ static volatile Eina_Bool _e_x_composite_shutdown_try = 0; static void _e_x_composite_shutdown(void) { +#ifdef E_COMP_X_H // Ecore_X_Display *dpy; Ecore_X_Window root; @@ -26,6 +27,7 @@ _e_x_composite_shutdown(void) /* ignore errors, we really don't care at this point */ ecore_x_composite_unredirect_subwindows(root, ECORE_X_COMPOSITE_UPDATE_MANUAL); _e_x_composite_shutdown_try = 0; +#endif } #if 0 @@ -64,10 +66,12 @@ EAPI void e_sigseg_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) { _e_x_composite_shutdown(); +#ifdef E_COMP_X_H ecore_x_pointer_ungrab(); ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); +#endif e_alert_show(); } @@ -93,10 +97,12 @@ EAPI void e_sigfpe_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) { _e_x_composite_shutdown(); +#ifdef E_COMP_X_H ecore_x_pointer_ungrab(); ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); +#endif e_alert_show(); } @@ -104,10 +110,12 @@ EAPI void e_sigbus_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) { _e_x_composite_shutdown(); +#ifdef E_COMP_X_H ecore_x_pointer_ungrab(); ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); +#endif e_alert_show(); } @@ -115,10 +123,12 @@ EAPI void e_sigabrt_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) { _e_x_composite_shutdown(); +#ifdef E_COMP_X_H ecore_x_pointer_ungrab(); ecore_x_keyboard_ungrab(); ecore_x_ungrab(); ecore_x_sync(); +#endif e_alert_show(); } diff --git a/src/bin/e_win.c b/src/bin/e_win.c index bb62a88a2..c910467b7 100644 --- a/src/bin/e_win.c +++ b/src/bin/e_win.c @@ -1,6 +1,5 @@ #include "e.h" #ifdef HAVE_WAYLAND_CLIENTS -# include # include "e_comp_wl.h" #endif @@ -77,12 +76,20 @@ _elm_win_trap_show(void *data, Evas_Object *o) EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, EINA_TRUE); if (!ctx->client) { - Ecore_X_Window xwin = elm_win_xwindow_get(o); - E_Client *ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, xwin); + E_Client *ec; + Ecore_Window win; + +#ifndef HAVE_WAYLAND_ONLY + win = elm_win_xwindow_get(o); + ec = e_pixmap_find_client(E_PIXMAP_TYPE_X, win); +#else + win = elm_win_window_id_get(o); + ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, win); +#endif Evas *e = evas_object_evas_get(o); Ecore_Evas *ee = ecore_evas_ecore_evas_get(e); - ctx->xwin = xwin; + ctx->xwin = win; if (ec) ctx->client = ec; @@ -91,10 +98,22 @@ _elm_win_trap_show(void *data, Evas_Object *o) E_Pixmap *cp; E_Comp *c = NULL; - cp = e_pixmap_new(E_PIXMAP_TYPE_X, xwin); +#ifndef HAVE_WAYLAND_ONLY + cp = e_pixmap_new(E_PIXMAP_TYPE_X, win); +#else + cp = e_pixmap_new(E_PIXMAP_TYPE_WL, win); +#endif EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_TRUE); - if (eina_list_count(e_comp_list()) > 1) - c = e_comp_find_by_window(ecore_x_window_root_get(xwin)); + + /* if (eina_list_count(e_comp_list()) > 1) */ + /* { */ +/* #ifndef HAVE_WAYLAND_ONLY */ + /* c = e_comp_find_by_window(ecore_x_window_root_get(win)); */ +/* #else */ + /* c = ; */ +/* #endif */ + /* } */ + if (!c) c = e_comp_get(NULL); ctx->client = e_client_new(c, cp, 0, 1); @@ -104,6 +123,7 @@ _elm_win_trap_show(void *data, Evas_Object *o) ctx->client->internal_ecore_evas = ee; evas_object_data_set(o, "E_Client", ctx->client); } +//#endif if (ctx->centered) e_comp_object_util_center(ctx->client->frame); evas_object_show(ctx->client->frame); return EINA_TRUE; @@ -324,13 +344,17 @@ e_win_new(E_Comp *c) win->max_aspect = 0.0; wins = eina_list_append(wins, win); -#ifndef WAYLAND_ONLY if (c->comp_type == E_PIXMAP_TYPE_X) { win->pointer = e_pointer_window_new(win->evas_win, 1); win->pointer->color = c->pointer->color; } -#endif + else if (c->comp_type == E_PIXMAP_TYPE_WL) + { + win->pointer = e_pointer_canvas_new(win->evas, 1); + win->pointer->color = c->pointer->color; + } + return win; } diff --git a/src/bin/e_xkb.c b/src/bin/e_xkb.c index 5d8f53cc3..a2bbd5ad8 100644 --- a/src/bin/e_xkb.c +++ b/src/bin/e_xkb.c @@ -62,7 +62,9 @@ e_xkb_update(int cur_group) if (cur_group != -1) { _e_xkb_cur_group = cur_group; +#ifndef HAVE_WAYLAND_ONLY ecore_x_xkb_select_group(cur_group); +#endif e_deskenv_xmodmap_run(); _e_xkb_update_event(cur_group); return; diff --git a/src/modules/Makefile.mk b/src/modules/Makefile.mk index 710d821f7..4e9c6c11b 100644 --- a/src/modules/Makefile.mk +++ b/src/modules/Makefile.mk @@ -122,8 +122,7 @@ include src/modules/Makefile_packagekit.mk include src/modules/Makefile_contact.mk -#if HAVE_WAYLAND_DRM -#include src/modules/Makefile_wl_drm.mk +include src/modules/Makefile_wl_drm.mk include src/modules/Makefile_wl_desktop_shell.mk diff --git a/src/modules/Makefile_wl_drm.mk b/src/modules/Makefile_wl_drm.mk new file mode 100644 index 000000000..301e44ef7 --- /dev/null +++ b/src/modules/Makefile_wl_drm.mk @@ -0,0 +1,17 @@ +if USE_MODULE_WL_DRM +wl_drmdir = $(MDIR)/wl_drm + +wl_drmpkgdir = $(MDIR)/wl_drm/$(MODULE_ARCH) +wl_drmpkg_LTLIBRARIES = src/modules/wl_drm/module.la + +src_modules_wl_drm_module_la_DEPENDENCIES = $(MDEPENDENCIES) +src_modules_wl_drm_module_la_CPPFLAGS = $(MOD_CPPFLAGS) @WL_DRM_CFLAGS@ @WAYLAND_CFLAGS@ +src_modules_wl_drm_module_la_LIBADD = $(LIBS) @WL_DRM_LIBS@ @WAYLAND_LIBS@ +src_modules_wl_drm_module_la_LDFLAGS = $(MOD_LDFLAGS) +src_modules_wl_drm_module_la_SOURCES = src/modules/wl_drm/e_mod_main.c + +# TODO: incomplete +#.PHONY: wl_drm install-wl_drm +#wl_drm: $(wl_drmpkg_LTLIBRARIES) $(wl_drm_DATA) +#install-wl_drm: install-wl_drmDATA install-wl_drmpkgLTLIBRARIES +endif diff --git a/src/modules/conf_bindings/e_int_config_acpibindings.c b/src/modules/conf_bindings/e_int_config_acpibindings.c index 449ea2663..e7a30c86f 100644 --- a/src/modules/conf_bindings/e_int_config_acpibindings.c +++ b/src/modules/conf_bindings/e_int_config_acpibindings.c @@ -49,7 +49,7 @@ static Eina_Bool _cb_acpi_event(void *data, /* local variables */ static E_Dialog *grab_dlg = NULL; -static Ecore_X_Window grab_win = 0; +static Ecore_Window grab_win = 0; static Eina_List *grab_hdls = NULL; E_Config_Dialog * @@ -129,7 +129,9 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, if (grab_win) { e_grabinput_release(grab_win, grab_win); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(grab_win); +#endif } grab_win = 0; @@ -528,9 +530,11 @@ _cb_add_binding(void *data, e_win_centered_set(grab_dlg->win, EINA_TRUE); e_win_borderless_set(grab_dlg->win, EINA_TRUE); +#ifndef HAVE_WAYLAND_ONLY grab_win = ecore_x_window_input_new(man->root, 0, 0, 1, 1); ecore_x_window_show(grab_win); e_grabinput_get(grab_win, 0, grab_win); +#endif grab_hdls = eina_list_append(grab_hdls, @@ -545,8 +549,10 @@ _cb_add_binding(void *data, e_acpi_events_freeze(); e_dialog_show(grab_dlg); +#ifndef HAVE_WAYLAND_ONLY ecore_x_icccm_transient_for_set(grab_dlg->win->evas_win, cfdata->cfd->dia->win->evas_win); +#endif } static void @@ -633,7 +639,9 @@ _cb_grab_key_down(void *data, /* kill the dialog window */ e_grabinput_release(grab_win, grab_win); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(grab_win); +#endif grab_win = 0; e_object_del(E_OBJECT(grab_dlg)); grab_dlg = NULL; @@ -663,7 +671,9 @@ _cb_acpi_event(void *data, /* kill the dialog window */ e_grabinput_release(grab_win, grab_win); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(grab_win); +#endif grab_win = 0; e_object_del(E_OBJECT(grab_dlg)); grab_dlg = NULL; diff --git a/src/modules/conf_display/e_int_config_desklock.c b/src/modules/conf_display/e_int_config_desklock.c index d345cc6de..ff7bac561 100644 --- a/src/modules/conf_display/e_int_config_desklock.c +++ b/src/modules/conf_display/e_int_config_desklock.c @@ -150,7 +150,9 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->bg_method = E_DESKLOCK_BACKGROUND_METHOD_CUSTOM; cfdata->bg_method_prev = cfdata->bg_method; +#ifndef HAVE_WAYLAND_ONLY cfdata->use_xscreensaver = ecore_x_screensaver_event_available_get(); +#endif cfdata->desklock_auth_method = e_config->desklock_auth_method; if (e_config->desklock_custom_desklock_cmd) diff --git a/src/modules/conf_theme/e_int_config_scale.c b/src/modules/conf_theme/e_int_config_scale.c index 8024b5bc4..57e0a45bf 100644 --- a/src/modules/conf_theme/e_int_config_scale.c +++ b/src/modules/conf_theme/e_int_config_scale.c @@ -220,12 +220,14 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data { Evas_Object *o, *ob; double sc = 1.0; - int dpi, x = 0, y = 0; + int dpi = 0, x = 0, y = 0; _fill_data(cfdata); o = e_widget_table_add(evas, 1); +#ifndef HAVE_WAYLAND_ONLY dpi = ecore_x_dpi_get(); +#endif if ((dpi > 0) && (cfdata->base_dpi > 0)) sc = (double)dpi / (double)cfdata->base_dpi; @@ -306,8 +308,10 @@ _adv_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *c e_widget_on_change_hook_set(ow, _adv_policy_changed, cfdata); e_widget_list_object_append(o, ow, 1, 1, 0.5); +#ifndef HAVE_WAYLAND_ONLY snprintf(buff, sizeof(buff), _("Base DPI (Currently %i DPI)"), ecore_x_dpi_get()); +#endif ow = e_widget_label_add(evas, buff); cfdata->gui.adv.dpi_lbl = ow; e_widget_list_object_append(o, ow, 1, 1, 0.5); diff --git a/src/modules/fileman/e_fwin.c b/src/modules/fileman/e_fwin.c index 7dfb37b06..6115d5c14 100644 --- a/src/modules/fileman/e_fwin.c +++ b/src/modules/fileman/e_fwin.c @@ -882,6 +882,7 @@ _e_fwin_icon_popup(void *data) e_comp_object_util_del_list_append(fwin->popup, list); e_comp_object_util_del_list_append(fwin->popup, o); evas_object_pass_events_set(fwin->popup, 1); +#ifndef HAVE_WAYLAND_ONLY if (!fwin->popup_handlers) { E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_XDND_ENTER, _e_fwin_icon_popup_handler, fwin); @@ -890,6 +891,7 @@ _e_fwin_icon_popup(void *data) E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_fwin_icon_popup_handler, fwin); E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_MOUSE_OUT, _e_fwin_icon_popup_handler, fwin); } +#endif evas_object_show(fwin->popup); return EINA_FALSE; } @@ -922,6 +924,7 @@ _e_fwin_icon_mouse_in(void *data, Evas_Object *obj __UNUSED__, void *event_info) if (!fileman_config->tooltip.enable) return; fwin->popup_timer = ecore_timer_add(fileman_config->tooltip.delay, _e_fwin_icon_popup, fwin); fwin->popup_icon = ici; +#ifndef HAVE_WAYLAND_ONLY if (!fwin->popup_handlers) { E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_XDND_ENTER, _e_fwin_icon_popup_handler, fwin); @@ -930,6 +933,7 @@ _e_fwin_icon_mouse_in(void *data, Evas_Object *obj __UNUSED__, void *event_info) E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_fwin_icon_popup_handler, fwin); E_LIST_HANDLER_APPEND(fwin->popup_handlers, ECORE_X_EVENT_MOUSE_OUT, _e_fwin_icon_popup_handler, fwin); } +#endif } static void @@ -2109,7 +2113,9 @@ _e_fwin_path(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__) xwin = e_client_util_win_get(page->fwin->win->client); else xwin = page->fwin->zone->comp->ee_win; +#ifndef HAVE_WAYLAND_ONLY ecore_x_selection_clipboard_set(xwin, path, strlen(path) + 1); +#endif } static void diff --git a/src/modules/fileman/e_fwin_nav.c b/src/modules/fileman/e_fwin_nav.c index 6c8bccce1..101b09e1a 100644 --- a/src/modules/fileman/e_fwin_nav.c +++ b/src/modules/fileman/e_fwin_nav.c @@ -215,6 +215,7 @@ _box_button_cb_dnd_selection_notify(void *data, const char *type, void *event) if (!args) goto out; args = e_util_string_append_quoted(args, &size, &length, inst->dnd_path); if (!args) goto out; +#ifndef HAVE_WAYLAND_ONLY if (link_drop || (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_LINK)) e_fm2_client_file_symlink(inst->o_fm, args); else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_COPY) @@ -223,6 +224,7 @@ _box_button_cb_dnd_selection_notify(void *data, const char *type, void *event) e_fm2_client_file_move(inst->o_fm, args); else if (e_drop_handler_action_get() == ECORE_X_ATOM_XDND_ACTION_ASK) e_fm2_drop_menu(inst->o_fm, args); +#endif free(args); out: E_FREE(inst->dnd_path); diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 342e9349c..432929e9b 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -177,7 +177,7 @@ static void _pager_popup_cb_action_switch(E_Object *obj __UNUSED__, /* variables for pager popup on key actions */ static E_Action *act_popup_show = NULL; static E_Action *act_popup_switch = NULL; -static Ecore_X_Window input_window = 0; +static Ecore_Window input_window = 0; static Eina_List *handlers = NULL; static Pager_Popup *act_popup = NULL; /* active popup */ static int hold_count = 0; @@ -1960,7 +1960,7 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped) E_Comp *comp; E_Zone *zone; E_Desk *desk; - int x, y, dx, dy; + int x = 0, y = 0, dx, dy; pw = drag->data; if (!pw) return; @@ -1981,7 +1981,9 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped) e_client_desk_set(pw->client, desk); } +#ifndef HAVE_WAYLAND_ONLY ecore_x_pointer_last_xy_get(&x, &y); +#endif dx = (pw->client->w / 2); dy = (pw->client->h / 2); @@ -2411,12 +2413,14 @@ _pager_popup_cb_timeout(void *data) pp->timer = NULL; _pager_popup_free(pp); +#ifndef HAVE_WAYLAND_ONLY if (input_window) { ecore_x_window_free(input_window); e_grabinput_release(input_window, input_window); input_window = 0; } +#endif return ECORE_CALLBACK_CANCEL; } @@ -2442,6 +2446,7 @@ _pager_popup_show(void) pp = _pager_popup_find(zone); if (pp) _pager_popup_free(pp); +#ifndef HAVE_WAYLAND_ONLY input_window = ecore_x_window_input_new(zone->comp->win, 0, 0, 1, 1); ecore_x_window_show(input_window); if (!e_grabinput_get(input_window, 0, input_window)) @@ -2450,6 +2455,7 @@ _pager_popup_show(void) input_window = 0; return 0; } +#endif handlers = eina_list_append (handlers, ecore_event_handler_add diff --git a/src/modules/pager16/e_mod_main.c b/src/modules/pager16/e_mod_main.c index e71fe3a86..6662500ff 100644 --- a/src/modules/pager16/e_mod_main.c +++ b/src/modules/pager16/e_mod_main.c @@ -156,7 +156,7 @@ static void _pager_popup_cb_action_switch(E_Object *obj __UNUSED__, /* variables for pager popup on key actions */ static E_Action *act_popup_show = NULL; static E_Action *act_popup_switch = NULL; -static Ecore_X_Window input_window = 0; +static Ecore_Window input_window = 0; static Eina_List *handlers = NULL; static Pager_Popup *act_popup = NULL; /* active popup */ static int hold_count = 0; @@ -1629,12 +1629,14 @@ _pager_popup_cb_timeout(void *data) pp->timer = NULL; _pager_popup_free(pp); +#ifndef HAVE_WAYLAND_ONLY if (input_window) { ecore_x_window_free(input_window); e_grabinput_release(input_window, input_window); input_window = 0; } +#endif return ECORE_CALLBACK_CANCEL; } @@ -1660,6 +1662,7 @@ _pager_popup_show(void) pp = _pager_popup_find(zone); if (pp) _pager_popup_free(pp); +#ifndef HAVE_WAYLAND_ONLY input_window = ecore_x_window_input_new(zone->comp->win, 0, 0, 1, 1); ecore_x_window_show(input_window); if (!e_grabinput_get(input_window, 0, input_window)) @@ -1668,6 +1671,7 @@ _pager_popup_show(void) input_window = 0; return 0; } +#endif handlers = eina_list_append (handlers, ecore_event_handler_add diff --git a/src/modules/tiling/e_mod_tiling.c b/src/modules/tiling/e_mod_tiling.c index d7688bc17..f6d226e5f 100644 --- a/src/modules/tiling/e_mod_tiling.c +++ b/src/modules/tiling/e_mod_tiling.c @@ -168,7 +168,7 @@ is_tilable(const E_Client *ec) if (ec->icccm.min_h == ec->icccm.max_h && ec->icccm.max_h > 0) return false; -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (ec->icccm.gravity == ECORE_X_GRAVITY_STATIC) return false; #endif diff --git a/src/modules/winlist/e_winlist.c b/src/modules/winlist/e_winlist.c index e2be7d778..3df21d930 100644 --- a/src/modules/winlist/e_winlist.c +++ b/src/modules/winlist/e_winlist.c @@ -51,7 +51,7 @@ static int _hold_count = 0; static int _hold_mod = 0; static E_Winlist_Activate_Type _activate_type = 0; static Eina_List *_handlers = NULL; -static Ecore_X_Window _input_window = 0; +static Ecore_Window _input_window = 0; static int _scroll_to = 0; static double _scroll_align_to = 0.0; static double _scroll_align = 0.0; @@ -103,6 +103,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) if (_winlist) return 0; +#ifndef HAVE_WAYLAND_ONLY _input_window = ecore_x_window_input_new(zone->comp->man->root, 0, 0, 1, 1); ecore_x_window_show(_input_window); if (!e_grabinput_get(_input_window, 0, _input_window)) @@ -111,6 +112,7 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) _input_window = 0; return 0; } +#endif w = (double)zone->w * e_config->winlist_pos_size_w; if (w > e_config->winlist_pos_max_w) w = e_config->winlist_pos_max_w; @@ -131,9 +133,11 @@ e_winlist_show(E_Zone *zone, E_Winlist_Filter filter) e_client_resize_cancel(); e_client_focus_track_freeze(); +#ifndef HAVE_WAYLAND_ONLY evas_event_feed_mouse_in(zone->comp->evas, ecore_x_current_time_get(), NULL); evas_event_feed_mouse_move(zone->comp->evas, -1000000, -1000000, ecore_x_current_time_get(), NULL); +#endif evas_event_freeze(zone->comp->evas); o = edje_object_add(zone->comp->evas); @@ -258,7 +262,9 @@ e_winlist_hide(void) E_FREE_FUNC(_animator, ecore_animator_del); e_grabinput_release(_input_window, _input_window); +#ifndef HAVE_WAYLAND_ONLY ecore_x_window_free(_input_window); +#endif _input_window = 0; if (ec) { diff --git a/src/modules/wizard/page_150.c b/src/modules/wizard/page_150.c index 20c55bf3c..444e5cb64 100644 --- a/src/modules/wizard/page_150.c +++ b/src/modules/wizard/page_150.c @@ -49,7 +49,7 @@ wizard_page_show(E_Wizard_Page *pg) Evas_Object *o, *of, *ob; Ecore_Evas *ee; -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY Ecore_X_Window_Attributes att; if (!ecore_x_composite_query()) return 0; diff --git a/src/modules/wl_desktop_shell/e_mod_main.c b/src/modules/wl_desktop_shell/e_mod_main.c index 114a7c487..52d47956e 100644 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@ -1336,7 +1336,7 @@ _e_wl_shell_shell_surface_cb_key_up(void *data, Evas *e EINA_UNUSED, Evas_Object /* is the focused surface actually This surface ? */ if (kbd->focus != ews->wl.surface) return; -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (_e_wl_comp->kbd_handler) /* get the keycode for this key from X, since we're definitely in X here */ key = ecore_x_keysym_keycode_get(ev->key) - 8; @@ -1402,7 +1402,7 @@ _e_wl_shell_shell_surface_cb_key_down(void *data, Evas *e EINA_UNUSED, Evas_Obje /* if the compositor has a ping callback, call it on this surface */ if (_e_wl_comp->ping_cb) _e_wl_comp->ping_cb(ews, serial); -#ifndef WAYLAND_ONLY +#ifndef HAVE_WAYLAND_ONLY if (_e_wl_comp->kbd_handler) /* get the keycode for this key from X, since we're definitely in X here */ key = ecore_x_keysym_keycode_get(ev->key) - 8; diff --git a/src/modules/wl_drm/e-module-wl_drm.edj b/src/modules/wl_drm/e-module-wl_drm.edj deleted file mode 100644 index 2c1f4d26e..000000000 Binary files a/src/modules/wl_drm/e-module-wl_drm.edj and /dev/null differ diff --git a/src/modules/wl_drm/e_drm_output.c b/src/modules/wl_drm/e_drm_output.c deleted file mode 100644 index b42bb6bed..000000000 --- a/src/modules/wl_drm/e_drm_output.c +++ /dev/null @@ -1,604 +0,0 @@ -#include "e.h" -#include "e_mod_main.h" - -EINTERN int -e_drm_output_subpixel_convert(int value) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - switch (value) - { - case DRM_MODE_SUBPIXEL_NONE: - return WL_OUTPUT_SUBPIXEL_NONE; - case DRM_MODE_SUBPIXEL_HORIZONTAL_RGB: - return WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB; - case DRM_MODE_SUBPIXEL_HORIZONTAL_BGR: - return WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR; - case DRM_MODE_SUBPIXEL_VERTICAL_RGB: - return WL_OUTPUT_SUBPIXEL_VERTICAL_RGB; - case DRM_MODE_SUBPIXEL_VERTICAL_BGR: - return WL_OUTPUT_SUBPIXEL_VERTICAL_BGR; - case DRM_MODE_SUBPIXEL_UNKNOWN: - default: - return WL_OUTPUT_SUBPIXEL_UNKNOWN; - } -} - -EINTERN Eina_Bool -e_drm_output_add_mode(E_Drm_Output *output, drmModeModeInfo *info) -{ - E_Drm_Output_Mode *mode; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(mode = malloc(sizeof(E_Drm_Output_Mode)))) - return EINA_FALSE; - - mode->base.flags = 0; - mode->base.w = info->hdisplay; - mode->base.h = info->vdisplay; - mode->base.refresh = info->vrefresh; - mode->info = *info; - - wl_list_insert(output->base.modes.prev, &mode->base.link); - - return EINA_TRUE; -} - -EINTERN void -e_drm_output_set_modes(E_Drm_Compositor *dcomp) -{ - E_Drm_Output *output; - E_Drm_Output_Mode *mode; - int ret = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - wl_list_for_each(output, &dcomp->base.outputs, base.link) - { - mode = (E_Drm_Output_Mode *)output->base.current; - ret = drmModeSetCrtc(dcomp->drm.fd, output->crtc_id, - output->fb_id[output->current ^ 1], 0, 0, - &output->conn_id, 1, &mode->info); - if (ret < 0) - printf("Failed to set drm mode: %m\n"); - } -} - -EINTERN void -e_drm_output_scanout_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__) -{ - E_Drm_Output *output; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - output = container_of(listener, E_Drm_Output, scanout_buffer_destroy_listener); - output->scanout_buffer = NULL; - if (!output->pending_scanout_buffer) - e_compositor_schedule_repaint(output->base.compositor); -} - -EINTERN void -e_drm_output_pending_scanout_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__) -{ - E_Drm_Output *output; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - output = container_of(listener, E_Drm_Output, - pending_scanout_buffer_destroy_listener); - output->pending_scanout_buffer = NULL; - e_compositor_schedule_repaint(output->base.compositor); -} - -EINTERN void -e_drm_output_repaint(E_Output *base, pixman_region32_t *damage) -{ - E_Drm_Output *output; - E_Drm_Compositor *dcomp; - E_Surface *es; - E_Sprite *sprite; - unsigned int fb_id = 0; - int ret = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - output = (E_Drm_Output *)base; - dcomp = (E_Drm_Compositor *)output->base.compositor; - - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, output->rbo[output->current]); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) - return; - - e_drm_output_prepare_scanout_surface(output); - - wl_list_for_each_reverse(es, &dcomp->base.surfaces, link) - e_surface_draw(es, &output->base, damage); - - glFlush(); - - output->current ^= 1; - - if (output->pending_fs_surf_fb_id != 0) - fb_id = output->pending_fs_surf_fb_id; - else - fb_id = output->fb_id[output->current ^ 1]; - - if (drmModePageFlip(dcomp->drm.fd, output->crtc_id, fb_id, - DRM_MODE_PAGE_FLIP_EVENT, output) < 0) - return; - - wl_list_for_each(sprite, &dcomp->sprites, link) - { - unsigned int flags = 0; - drmVBlank vbl; - - vbl.request.type = (DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT); - vbl.request.sequence = 1; - if (!e_sprite_crtc_supported(base, sprite->possible_crtcs)) - continue; - ret = drmModeSetPlane(dcomp->drm.fd, sprite->plane_id, output->crtc_id, - sprite->pending_fb_id, flags, sprite->dx, - sprite->dy, sprite->dw, sprite->dh, sprite->sx, - sprite->sy, sprite->sw, sprite->sh); - if (ret) - printf("Setplane Failed: %s\n", strerror(errno)); - - vbl.request.signal = (unsigned long)sprite; - ret = drmWaitVBlank(dcomp->drm.fd, &vbl); - if (ret) - printf("VBlank event request failed: %s\n", strerror(errno)); - } -} - -EINTERN void -e_drm_output_destroy(E_Output *base) -{ - E_Drm_Output *output; - E_Drm_Compositor *dcomp; - drmModeCrtcPtr ocrtc; - int i = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - output = (E_Drm_Output *)base; - dcomp = (E_Drm_Compositor *)output->base.compositor; - ocrtc = output->orig_crtc; - - /* TODO: backlight */ - /* if (base->backlight) */ - - e_drm_output_set_cursor(&output->base, NULL); - - drmModeSetCrtc(dcomp->drm.fd, ocrtc->crtc_id, ocrtc->buffer_id, - ocrtc->x, ocrtc->y, &output->conn_id, 1, &ocrtc->mode); - drmModeFreeCrtc(ocrtc); - - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, 0); - glBindRenderbuffer(GL_RENDERBUFFER, 0); - glDeleteRenderbuffers(2, output->rbo); - - for (i = 0; i < 2; i++) - { - drmModeRmFB(dcomp->drm.fd, output->fb_id[i]); - dcomp->base.destroy_image(dcomp->base.egl_display, output->image[i]); - gbm_bo_destroy(output->bo[i]); - } - - dcomp->crtc_alloc &= ~(1 << output->crtc_id); - dcomp->conn_alloc &= ~(1 << output->conn_id); - - e_output_destroy(&output->base); - wl_list_remove(&output->base.link); - - free(output); -} - -EINTERN void -e_drm_output_assign_planes(E_Output *base) -{ - E_Compositor *comp; - E_Surface *es; - pixman_region32_t overlap, soverlap; - E_Input_Device *dev; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - comp = base->compositor; - pixman_region32_init(&overlap); - wl_list_for_each(es, &comp->surfaces, link) - { - pixman_region32_init(&soverlap); - pixman_region32_intersect(&soverlap, &overlap, &es->transform.box); - dev = (E_Input_Device *)comp->input_device; - if (es == dev->sprite) - { - e_drm_output_set_cursor_region(base, dev, &soverlap); - if (!dev->hw_cursor) - pixman_region32_union(&overlap, &overlap, &es->transform.box); - } - else if (!e_drm_output_prepare_overlay_surface(base, es, &soverlap)) - { - pixman_region32_fini(&es->damage); - pixman_region32_init(&es->damage); - } - else - pixman_region32_union(&overlap, &overlap, &es->transform.box); - - pixman_region32_fini(&soverlap); - } - pixman_region32_fini(&overlap); - - e_drm_output_disable_sprites(base); -} - -EINTERN void -e_drm_output_set_dpms(E_Output *base, E_Dpms_Level level) -{ - E_Drm_Output *output; - E_Compositor *comp; - E_Drm_Compositor *dcomp; - drmModeConnectorPtr conn; - drmModePropertyPtr prop; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - output = (E_Drm_Output *)base; - comp = base->compositor; - dcomp = (E_Drm_Compositor *)comp; - - if (!(conn = drmModeGetConnector(dcomp->drm.fd, output->conn_id))) - return; - if (!(prop = e_drm_output_get_property(dcomp->drm.fd, conn, "DPMS"))) - { - drmModeFreeConnector(conn); - return; - } - drmModeConnectorSetProperty(dcomp->drm.fd, conn->connector_id, - prop->prop_id, level); - drmModeFreeProperty(prop); - drmModeFreeConnector(conn); -} - -EINTERN Eina_Bool -e_drm_output_prepare_scanout_surface(E_Drm_Output *output) -{ - E_Drm_Compositor *dcomp; - E_Surface *es; - EGLint hdl, stride; - int ret = 0; - unsigned int fb_id = 0; - struct gbm_bo *bo; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - dcomp = (E_Drm_Compositor *)output->base.compositor; - es = container_of(dcomp->base.surfaces.next, E_Surface, link); - - /* Need to verify output->region contained in surface opaque - * region. Or maybe just that format doesn't have alpha. */ - return EINA_TRUE; - - if ((es->geometry.x != output->base.x) || - (es->geometry.y != output->base.y) || - (es->geometry.w != output->base.current->w) || - (es->geometry.h != output->base.current->h) || - (es->transform.enabled) || (es->image == EGL_NO_IMAGE_KHR)) - return EINA_FALSE; - - bo = gbm_bo_create_from_egl_image(dcomp->gbm, dcomp->base.egl_display, - es->image, es->geometry.w, - es->geometry.h, GBM_BO_USE_SCANOUT); - hdl = gbm_bo_get_handle(bo).s32; - stride = gbm_bo_get_pitch(bo); - - gbm_bo_destroy(bo); - - if (hdl == 0) return EINA_FALSE; - - ret = drmModeAddFB(dcomp->drm.fd, output->base.current->w, - output->base.current->h, 24, 32, stride, hdl, &fb_id); - if (ret) return EINA_FALSE; - - output->pending_fs_surf_fb_id = fb_id; - - output->pending_scanout_buffer = es->buffer; - output->pending_scanout_buffer->busy_count++; - - wl_signal_add(&output->pending_scanout_buffer->resource.destroy_signal, - &output->pending_scanout_buffer_destroy_listener); - - pixman_region32_fini(&es->damage); - pixman_region32_init(&es->damage); - - return EINA_TRUE; -} - -EINTERN void -e_drm_output_disable_sprites(E_Output *base) -{ - E_Compositor *comp; - E_Drm_Compositor *dcomp; - E_Drm_Output *output; - E_Sprite *s; - int ret = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - comp = base->compositor; - dcomp = (E_Drm_Compositor *)comp; - output = (E_Drm_Output *)base; - - wl_list_for_each(s, &dcomp->sprites, link) - { - if (s->pending_fb_id) continue; - ret = drmModeSetPlane(dcomp->drm.fd, s->plane_id, output->crtc_id, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - if (ret) - printf("Failed to disable plane: %s\n", strerror(errno)); - drmModeRmFB(dcomp->drm.fd, s->fb_id); - s->surface = NULL; - s->pending_surface = NULL; - s->fb_id = 0; - s->pending_fb_id = 0; - } -} - -EINTERN drmModePropertyPtr -e_drm_output_get_property(int fd, drmModeConnectorPtr conn, const char *name) -{ - drmModePropertyPtr props; - int i = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - for (i = 0; i < conn->count_props; i++) - { - if (!(props = drmModeGetProperty(fd, conn->props[i]))) - continue; - if (!strcmp(props->name, name)) return props; - drmModeFreeProperty(props); - } - - return NULL; -} - -EINTERN int -e_drm_output_prepare_overlay_surface(E_Output *base, E_Surface *es, pixman_region32_t *overlap) -{ - E_Compositor *comp; - E_Drm_Compositor *dcomp; - E_Sprite *s; - Eina_Bool found = EINA_FALSE; - EGLint hdl, stride; - struct gbm_bo *bo; - unsigned int fb_id = 0; - unsigned int hdls[4], pitches[4], offsets[4]; - int ret = 0; - pixman_region32_t drect, srect; - pixman_box32_t *box; - unsigned int format; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - comp = base->compositor; - dcomp = (E_Drm_Compositor *)comp; - - if (dcomp->sprites_broken) return -1; - if (e_surface_is_primary(comp, es)) return -1; - if (es->image == EGL_NO_IMAGE_KHR) return -1; - - if (!e_drm_output_surface_transform_supported(es)) - return -1; - if (!e_drm_output_surface_overlap_supported(base, overlap)) - return -1; - - wl_list_for_each(s, &dcomp->sprites, link) - { - if (!e_sprite_crtc_supported(base, s->possible_crtcs)) - continue; - if (!s->pending_fb_id) - { - found = EINA_TRUE; - break; - } - } - - if (!found) return -1; - - bo = gbm_bo_create_from_egl_image(dcomp->gbm, dcomp->base.egl_display, - es->image, es->geometry.w, - es->geometry.h, GBM_BO_USE_SCANOUT); - format = gbm_bo_get_format(bo); - hdl = gbm_bo_get_handle(bo).s32; - stride = gbm_bo_get_pitch(bo); - - gbm_bo_destroy(bo); - - if (!e_drm_output_surface_format_supported(s, format)) - return -1; - - if (!hdl) return -1; - - hdls[0] = hdl; - pitches[0] = stride; - offsets[0] = 0; - - ret = drmModeAddFB2(dcomp->drm.fd, es->geometry.w, es->geometry.h, - format, hdls, pitches, offsets, &fb_id, 0); - if (ret) - { - dcomp->sprites_broken = EINA_TRUE; - return -1; - } - - if ((s->surface) && (s->surface != es)) - { - E_Surface *os; - - os = s->surface; - pixman_region32_fini(&os->damage); - pixman_region32_init_rect(&os->damage, os->geometry.x, os->geometry.y, - os->geometry.w, os->geometry.h); - } - - s->pending_fb_id = fb_id; - s->pending_surface = es; - es->buffer->busy_count++; - - pixman_region32_init(&drect); - pixman_region32_intersect(&drect, &es->transform.box, &base->region); - pixman_region32_translate(&drect, -base->x, -base->y); - - box = pixman_region32_extents(&drect); - s->dx = box->x1; - s->dy = box->y1; - s->dw = (box->x2 - box->x1); - s->dh = (box->y2 - box->y1); - pixman_region32_fini(&drect); - - pixman_region32_init(&srect); - pixman_region32_intersect(&srect, &es->transform.box, &base->region); - pixman_region32_translate(&srect, -es->geometry.x, -es->geometry.y); - - box = pixman_region32_extents(&srect); - s->sx = box->x1 << 16; - s->sy = box->y1 << 16; - s->sw = (box->x2 - box->x1) << 16; - s->sh = (box->y2 - box->y1) << 16; - pixman_region32_fini(&srect); - - wl_signal_add(&es->buffer->resource.destroy_signal, - &s->pending_destroy_listener); - - return 0; -} - -EINTERN Eina_Bool -e_drm_output_surface_transform_supported(E_Surface *es) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((es) && (es->transform.enabled)) return EINA_TRUE; - return EINA_FALSE; -} - -EINTERN Eina_Bool -e_drm_output_surface_overlap_supported(E_Output *base __UNUSED__, pixman_region32_t *overlap) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (pixman_region32_not_empty(overlap)) return EINA_TRUE; - return EINA_FALSE; -} - -EINTERN Eina_Bool -e_drm_output_surface_format_supported(E_Sprite *s, unsigned int format) -{ - unsigned int i = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - for (i = 0; i < s->format_count; i++) - if (s->formats[i] == format) return EINA_TRUE; - - return EINA_FALSE; -} - -EINTERN void -e_drm_output_set_cursor_region(E_Output *output, E_Input_Device *device, pixman_region32_t *overlap) -{ - pixman_region32_t cregion; - Eina_Bool prior = EINA_FALSE; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!device->sprite) return; - pixman_region32_init(&cregion); - pixman_region32_intersect(&cregion, &device->sprite->transform.box, - &output->region); - if (!pixman_region32_not_empty(&cregion)) - { - e_drm_output_set_cursor(output, NULL); - goto out; - } - - prior = device->hw_cursor; - if ((pixman_region32_not_empty(overlap)) || - (!e_drm_output_set_cursor(output, device))) - { - if (prior) - { - e_surface_damage(device->sprite); - e_drm_output_set_cursor(output, NULL); - } - device->hw_cursor = EINA_FALSE; - } - else - { - if (!prior) e_surface_damage_below(device->sprite); - pixman_region32_fini(&device->sprite->damage); - pixman_region32_init(&device->sprite->damage); - device->hw_cursor = EINA_TRUE; - } - -out: - pixman_region32_fini(&cregion); -} - -EINTERN Eina_Bool -e_drm_output_set_cursor(E_Output *output, E_Input_Device *device) -{ - E_Drm_Output *doutput; - E_Drm_Compositor *dcomp; - EGLint hdl, stride; - int ret = -1; - struct gbm_bo *bo; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - doutput = (E_Drm_Output *)output; - dcomp = (E_Drm_Compositor *)doutput->base.compositor; - - if (!device) - { - drmModeSetCursor(dcomp->drm.fd, doutput->crtc_id, 0, 0, 0); - return EINA_TRUE; - } - - if (device->sprite->image == EGL_NO_IMAGE_KHR) return EINA_FALSE; - - if ((device->sprite->geometry.w > 64) || - (device->sprite->geometry.h > 64)) - return EINA_FALSE; - - bo = gbm_bo_create_from_egl_image(dcomp->gbm, dcomp->base.egl_display, - device->sprite->image, 64, 64, - GBM_BO_USE_CURSOR_64X64); - if (!bo) return EINA_FALSE; - - hdl = gbm_bo_get_handle(bo).s32; - stride = gbm_bo_get_pitch(bo); - gbm_bo_destroy(bo); - - if (stride != (64 * 4)) return EINA_FALSE; - - if ((ret = drmModeSetCursor(dcomp->drm.fd, doutput->crtc_id, hdl, 64, 64))) - { - drmModeSetCursor(dcomp->drm.fd, doutput->crtc_id, 0, 0, 0); - return EINA_FALSE; - } - - ret = drmModeMoveCursor(dcomp->drm.fd, doutput->crtc_id, - device->sprite->geometry.x - doutput->base.x, - device->sprite->geometry.y - doutput->base.y); - if (ret) - { - drmModeSetCursor(dcomp->drm.fd, doutput->crtc_id, 0, 0, 0); - return EINA_FALSE; - } - - return EINA_TRUE; -} diff --git a/src/modules/wl_drm/e_evdev.c b/src/modules/wl_drm/e_evdev.c deleted file mode 100644 index 4ce4760ac..000000000 --- a/src/modules/wl_drm/e_evdev.c +++ /dev/null @@ -1,664 +0,0 @@ -#include "e.h" -#include "e_mod_main.h" - -#define E_EVDEV_ABSOLUTE_MOTION (1 << 0) -#define E_EVDEV_ABSOLUTE_MT_DOWN (1 << 1) -#define E_EVDEV_ABSOLUTE_MT_MOTION (1 << 2) -#define E_EVDEV_ABSOLUTE_MT_UP (1 << 3) -#define E_EVDEV_RELATIVE_MOTION (1 << 4) - -#define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) - -#define MODIFIER_CTRL (1 << 8) -#define MODIFIER_ALT (1 << 9) -#define MODIFIER_SUPER (1 << 10) - -/* local function prototypes */ -static Eina_Bool _e_evdev_config_udev_monitor(struct udev *udev, E_Evdev_Input *master); -static E_Evdev_Input_Device *_e_evdev_input_device_create(E_Evdev_Input *master, struct wl_display *display __UNUSED__, const char *path); -static Eina_Bool _e_evdev_configure_device(E_Evdev_Input_Device *dev); -static Eina_Bool _e_evdev_is_motion_event(struct input_event *e); -static void _e_evdev_flush_motion(E_Evdev_Input_Device *dev, unsigned int timestamp); -static void _e_evdev_process_touch(E_Evdev_Input_Device *device, struct input_event *e); -static void _e_evdev_process_events(E_Evdev_Input_Device *device, struct input_event *ev, int count); - -static int _e_evdev_cb_udev(int fd __UNUSED__, unsigned int mask __UNUSED__, void *data); -static void _e_evdev_cb_device_added(struct udev_device *dev, E_Evdev_Input *master); -static void _e_evdev_cb_device_removed(struct udev_device *dev, E_Evdev_Input *master); -static int _e_evdev_cb_device_data(int fd, unsigned int mask __UNUSED__, void *data); - -/* local variables */ -/* wayland interfaces */ -/* external variables */ - -EINTERN void -e_evdev_add_devices(struct udev *udev, E_Input_Device *base) -{ - E_Evdev_Input *input; - struct udev_enumerate *ue; - struct udev_list_entry *entry; - struct udev_device *device; - const char *path = NULL; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - input = (E_Evdev_Input *)base; - ue = udev_enumerate_new(udev); - udev_enumerate_add_match_subsystem(ue, "input"); - udev_enumerate_scan_devices(ue); - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(ue)) - { - path = udev_list_entry_get_name(entry); - device = udev_device_new_from_syspath(udev, path); - if (strncmp("event", udev_device_get_sysname(device), 5) != 0) - continue; - _e_evdev_cb_device_added(device, input); - udev_device_unref(device); - } - udev_enumerate_unref(ue); - - if (wl_list_empty(&input->devices)) - printf("No Input Devices Found\n"); -} - -EINTERN void -e_evdev_remove_devices(E_Input_Device *base) -{ - E_Evdev_Input *input; - E_Evdev_Input_Device *device, *next; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - input = (E_Evdev_Input *)base; - wl_list_for_each_safe(device, next, &input->devices, link) - { - wl_event_source_remove(device->source); - wl_list_remove(&device->link); - if (device->mtdev) mtdev_close_delete(device->mtdev); - close(device->fd); - free(device->devnode); - free(device); - } -} - -EINTERN void -e_evdev_input_create(E_Compositor *comp, struct udev *udev, const char *seat) -{ - E_Evdev_Input *input; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(input = malloc(sizeof(E_Evdev_Input)))) return; - memset(input, 0, sizeof(E_Evdev_Input)); - e_input_device_init(&input->base, comp); - wl_list_init(&input->devices); - input->seat = strdup(seat); - if (!_e_evdev_config_udev_monitor(udev, input)) - { - free(input->seat); - free(input); - return; - } - e_evdev_add_devices(udev, &input->base); - comp->input_device = &input->base.input_device; -} - -EINTERN void -e_evdev_input_destroy(E_Input_Device *base) -{ - E_Evdev_Input *input; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - input = (E_Evdev_Input *)base; - e_evdev_remove_devices(base); - wl_list_remove(&input->base.link); - free(input->seat); - free(input); -} - -/* local functions */ -static Eina_Bool -_e_evdev_config_udev_monitor(struct udev *udev, E_Evdev_Input *master) -{ - struct wl_event_loop *loop; - E_Compositor *comp; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - comp = master->base.compositor; - if (!(master->monitor = udev_monitor_new_from_netlink(udev, "udev"))) - return EINA_FALSE; - udev_monitor_filter_add_match_subsystem_devtype(master->monitor, "input", NULL); - if (udev_monitor_enable_receiving(master->monitor)) - return EINA_FALSE; - loop = wl_display_get_event_loop(comp->display); - wl_event_loop_add_fd(loop, udev_monitor_get_fd(master->monitor), - WL_EVENT_READABLE, _e_evdev_cb_udev, master); - return EINA_TRUE; -} - -static E_Evdev_Input_Device * -_e_evdev_input_device_create(E_Evdev_Input *master, struct wl_display *display __UNUSED__, const char *path) -{ - E_Evdev_Input_Device *device; - E_Compositor *comp; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(device = malloc(sizeof(E_Evdev_Input_Device)))) return NULL; - comp = master->base.compositor; - device->output = container_of(comp->outputs.next, E_Output, link); - device->master = master; - device->is_pad = EINA_FALSE; - device->is_mt = EINA_FALSE; - device->mtdev = NULL; - device->devnode = strdup(path); - device->mt.slot = -1; - device->rel.dx = 0; - device->rel.dy = 0; - - device->fd = open(path, O_RDONLY | O_NONBLOCK); - if (device->fd < 0) goto err0; - - if (!_e_evdev_configure_device(device)) goto err1; - - if (device->is_mt) - { - if (!(device->mtdev = mtdev_new_open(device->fd))) - printf("mtdev Failed to open device: %s\n", path); - } - - device->source = - wl_event_loop_add_fd(comp->input_loop, device->fd, WL_EVENT_READABLE, - _e_evdev_cb_device_data, device); - if (!device->source) goto err1; - - wl_list_insert(master->devices.prev, &device->link); - - return device; - -err1: - close(device->fd); - -err0: - free(device->devnode); - free(device); - return NULL; -} - -static Eina_Bool -_e_evdev_configure_device(E_Evdev_Input_Device *dev) -{ - struct input_absinfo absinfo; - unsigned long ebits[NBITS(EV_MAX)]; - unsigned long abits[NBITS(ABS_MAX)]; - unsigned long kbits[NBITS(KEY_MAX)]; - Eina_Bool has_key = EINA_FALSE, has_abs = EINA_FALSE; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - ioctl(dev->fd, EVIOCGBIT(0, sizeof(ebits)), ebits); - if (TEST_BIT(ebits, EV_ABS)) - { - has_abs = EINA_TRUE; - ioctl(dev->fd, EVIOCGBIT(EV_ABS, sizeof(abits)), abits); - if (TEST_BIT(abits, ABS_X)) - { - ioctl(dev->fd, EVIOCGABS(ABS_X), &absinfo); - dev->absolute.min_x = absinfo.minimum; - dev->absolute.max_x = absinfo.maximum; - } - if (TEST_BIT(abits, ABS_Y)) - { - ioctl(dev->fd, EVIOCGABS(ABS_Y), &absinfo); - dev->absolute.min_y = absinfo.minimum; - dev->absolute.max_y = absinfo.maximum; - } - if (TEST_BIT(abits, ABS_MT_SLOT)) - { - dev->is_mt = EINA_TRUE; - dev->mt.slot = 0; - } - } - if (TEST_BIT(ebits, EV_KEY)) - { - has_key = EINA_TRUE; - ioctl(dev->fd, EVIOCGBIT(EV_KEY, sizeof(kbits)), kbits); - if ((TEST_BIT(kbits, BTN_TOOL_FINGER)) && - (!TEST_BIT(kbits, BTN_TOOL_PEN))) - dev->is_pad = EINA_TRUE; - } - - if ((has_abs) && (!has_key)) return EINA_FALSE; - - return EINA_TRUE; -} - -static Eina_Bool -_e_evdev_is_motion_event(struct input_event *e) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - switch (e->type) - { - case EV_REL: - switch (e->code) - { - case REL_X: - case REL_Y: - return EINA_TRUE; - } - case EV_ABS: - switch (e->code) - { - case ABS_X: - case ABS_Y: - case ABS_MT_POSITION_X: - case ABS_MT_POSITION_Y: - return EINA_TRUE; - } - } - - return EINA_FALSE; -} - -static void -_e_evdev_flush_motion(E_Evdev_Input_Device *dev, unsigned int timestamp) -{ - struct wl_input_device *master; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!dev->type) return; - master = &dev->master->base.input_device; - if (dev->type & E_EVDEV_RELATIVE_MOTION) - { - e_input_notify_motion(master, timestamp, - master->x + dev->rel.dx, - master->y + dev->rel.dy); - dev->type &= ~E_EVDEV_RELATIVE_MOTION; - dev->rel.dx = 0; - dev->rel.dy = 0; - } - if (dev->type & E_EVDEV_ABSOLUTE_MT_DOWN) - { - e_input_notify_touch(master, timestamp, dev->mt.slot, - dev->mt.x[dev->mt.slot], - dev->mt.y[dev->mt.slot], - WL_INPUT_DEVICE_TOUCH_DOWN); - dev->type &= ~E_EVDEV_ABSOLUTE_MT_DOWN; - dev->type &= ~E_EVDEV_ABSOLUTE_MT_MOTION; - } - if (dev->type & E_EVDEV_ABSOLUTE_MT_MOTION) - { - e_input_notify_touch(master, timestamp, dev->mt.slot, - dev->mt.x[dev->mt.slot], - dev->mt.y[dev->mt.slot], - WL_INPUT_DEVICE_TOUCH_MOTION); - dev->type &= ~E_EVDEV_ABSOLUTE_MT_DOWN; - dev->type &= ~E_EVDEV_ABSOLUTE_MT_MOTION; - } - if (dev->type & E_EVDEV_ABSOLUTE_MT_UP) - { - e_input_notify_touch(master, timestamp, dev->mt.slot, 0, 0, - WL_INPUT_DEVICE_TOUCH_UP); - dev->type &= ~E_EVDEV_ABSOLUTE_MT_UP; - } - if (dev->type & E_EVDEV_ABSOLUTE_MOTION) - { - e_input_notify_motion(master, timestamp, - dev->absolute.x, dev->absolute.y); - dev->type &= ~E_EVDEV_ABSOLUTE_MOTION; - } -} - -static inline void -_e_evdev_process_key(E_Evdev_Input_Device *device, struct input_event *e, int timestamp) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (e->value == 2) return; - - switch (e->code) - { - case BTN_TOOL_PEN: - case BTN_TOOL_RUBBER: - case BTN_TOOL_BRUSH: - case BTN_TOOL_PENCIL: - case BTN_TOOL_AIRBRUSH: - case BTN_TOOL_FINGER: - case BTN_TOOL_MOUSE: - case BTN_TOOL_LENS: - if (device->is_pad) - { - device->absolute.rx = 1; - device->absolute.ry = 1; - } - break; - case BTN_TOUCH: - if (device->is_mt) break; - e->code = BTN_LEFT; - case BTN_LEFT: - case BTN_RIGHT: - case BTN_MIDDLE: - case BTN_SIDE: - case BTN_EXTRA: - case BTN_FORWARD: - case BTN_BACK: - case BTN_TASK: - e_input_notify_button(&device->master->base.input_device, - timestamp, e->code, e->value); - break; - default: - e_input_notify_key(&device->master->base.input_device, - timestamp, e->code, e->value); - break; - } -} - -static inline void -_e_evdev_process_absolute_motion(E_Evdev_Input_Device *device, struct input_event *e) -{ - int sw, sh; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - sw = device->output->current->w; - sh = device->output->current->h; - - switch (e->code) - { - case ABS_X: - device->absolute.x = - (e->value - device->absolute.min_x) * sw / - (device->absolute.max_x - device->absolute.min_x) + - device->output->x; - device->type |= E_EVDEV_ABSOLUTE_MOTION; - break; - case ABS_Y: - device->absolute.y = - (e->value - device->absolute.min_y) * sh / - (device->absolute.max_y - device->absolute.min_y) + - device->output->y; - device->type |= E_EVDEV_ABSOLUTE_MOTION; - break; - } -} - -static inline void -_e_evdev_process_absolute_motion_touchpad(E_Evdev_Input_Device *device, struct input_event *e) -{ - /* FIXME: Make this configurable. */ - const int touchpad_speed = 700; - - switch (e->code) - { - case ABS_X: - e->value -= device->absolute.min_x; - if (device->absolute.rx) - device->absolute.rx = 0; - else - { - device->rel.dx = - (e->value - device->absolute.ox) * touchpad_speed / - (device->absolute.max_x - device->absolute.min_x); - } - device->absolute.ox = e->value; - device->type |= E_EVDEV_RELATIVE_MOTION; - break; - case ABS_Y: - e->value -= device->absolute.min_y; - if (device->absolute.ry) - device->absolute.ry = 0; - else - { - device->rel.dy = - (e->value - device->absolute.oy) * touchpad_speed / - (device->absolute.max_y - device->absolute.min_y); - } - device->absolute.oy = e->value; - device->type |= E_EVDEV_RELATIVE_MOTION; - break; - } -} - -static inline void -_e_evdev_process_relative(E_Evdev_Input_Device *device, struct input_event *e, unsigned int timestamp) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - switch (e->code) - { - case REL_X: - device->rel.dx += e->value; - device->type |= E_EVDEV_RELATIVE_MOTION; - break; - case REL_Y: - device->rel.dy += e->value; - device->type |= E_EVDEV_RELATIVE_MOTION; - break; - case REL_WHEEL: - e_input_notify_axis(&device->master->base.input_device, timestamp, - WL_INPUT_DEVICE_AXIS_VERTICAL_SCROLL, e->value); - break; - case REL_HWHEEL: - e_input_notify_axis(&device->master->base.input_device, timestamp, - WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL, e->value); - break; - } -} - -static inline void -_e_evdev_process_absolute(E_Evdev_Input_Device *device, struct input_event *e) -{ - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (device->is_pad) - _e_evdev_process_absolute_motion_touchpad(device, e); - else if (device->is_mt) - _e_evdev_process_touch(device, e); - else - _e_evdev_process_absolute_motion(device, e); -} - -static void -_e_evdev_process_touch(E_Evdev_Input_Device *device, struct input_event *e) -{ - int sw, sh; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - sw = device->output->current->w; - sh = device->output->current->h; - - switch (e->code) - { - case ABS_MT_SLOT: - device->mt.slot = e->value; - break; - case ABS_MT_TRACKING_ID: - if (e->value >= 0) - device->type |= E_EVDEV_ABSOLUTE_MT_DOWN; - else - device->type |= E_EVDEV_ABSOLUTE_MT_UP; - break; - case ABS_MT_POSITION_X: - device->mt.x[device->mt.slot] = - (e->value - device->absolute.min_x) * sw / - (device->absolute.max_x - device->absolute.min_x) + - device->output->x; - device->type |= E_EVDEV_ABSOLUTE_MT_MOTION; - break; - case ABS_MT_POSITION_Y: - device->mt.y[device->mt.slot] = - (e->value - device->absolute.min_y) * sh / - (device->absolute.max_y - device->absolute.min_y) + - device->output->y; - device->type |= E_EVDEV_ABSOLUTE_MT_MOTION; - break; - } -} - -static void -_e_evdev_process_events(E_Evdev_Input_Device *device, struct input_event *ev, int count) -{ - struct input_event *e, *end; - unsigned int timestamp = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - device->type = 0; - e = ev; - end = e + count; - for (e = ev; e < end; e++) - { - timestamp = e->time.tv_sec * 1000 + e->time.tv_usec / 1000; - if (!_e_evdev_is_motion_event(e)) - _e_evdev_flush_motion(device, timestamp); - switch (e->type) - { - case EV_REL: - _e_evdev_process_relative(device, e, timestamp); - break; - case EV_ABS: - _e_evdev_process_absolute(device, e); - break; - case EV_KEY: - _e_evdev_process_key(device, e, timestamp); - break; - } - } - _e_evdev_flush_motion(device, timestamp); -} - -static int -_e_evdev_cb_udev(int fd __UNUSED__, unsigned int mask __UNUSED__, void *data) -{ - E_Evdev_Input *master; - struct udev_device *dev; - const char *action; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(master = data)) return 1; - if (!(dev = udev_monitor_receive_device(master->monitor))) - return 1; - if ((action = udev_device_get_action(dev))) - { - if (strncmp("event", udev_device_get_sysname(dev), 5) != 0) - return 0; - if (!strcmp(action, "add")) - _e_evdev_cb_device_added(dev, master); - else if (!strcmp(action, "remove")) - _e_evdev_cb_device_removed(dev, master); - } - udev_device_unref(dev); - return 0; -} - -static void -_e_evdev_cb_device_added(struct udev_device *dev, E_Evdev_Input *master) -{ - E_Compositor *comp; - const char *node, *seat; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(seat = udev_device_get_property_value(dev, "ID_SEAT"))) - seat = "seat0"; - if (strcmp(seat, master->seat)) return; - comp = master->base.compositor; - node = udev_device_get_devnode(dev); - _e_evdev_input_device_create(master, comp->display, node); -} - -static void -_e_evdev_cb_device_removed(struct udev_device *dev, E_Evdev_Input *master) -{ - const char *node; - E_Evdev_Input_Device *device, *next; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - node = udev_device_get_devnode(dev); - wl_list_for_each_safe(device, next, &master->devices, link) - { - if (!strcmp(device->devnode, node)) - { - wl_event_source_remove(device->source); - wl_list_remove(&device->link); - if (device->mtdev) mtdev_close_delete(device->mtdev); - close(device->fd); - free(device->devnode); - free(device); - break; - } - } -} - -static int -_e_evdev_cb_device_data(int fd, unsigned int mask __UNUSED__, void *data) -{ - E_Compositor *comp; - E_Evdev_Input_Device *device; - struct input_event ev[32]; - int len = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - device = data; - comp = device->master->base.compositor; - if (!comp->focus) return 1; - - do - { - if (device->mtdev) - len = mtdev_get(device->mtdev, fd, ev, - (sizeof(ev) / sizeof(ev)[0]) * - sizeof(struct input_event)); - else - len = read(fd, &ev, sizeof(ev)); - - if ((len < 0) || (len % sizeof(ev[0]) != 0)) - return 1; - - printf("Process Input Events Len: %d\n", len); - - _e_evdev_process_events(device, ev, (len / sizeof(ev[0]))); - - } while (len > 0); - - /* len = read(fd, &ev, sizeof(ev)); */ - - /* device->type = 0; */ - /* e = ev; */ - /* end = (void *)ev + len; */ - /* for (e = ev; e < end; e++) */ - /* { */ - /* timestamp = (e->time.tv_sec * 1000 + e->time.tv_usec / 1000); */ - /* if (!_e_evdev_is_motion_event(e)) */ - /* _e_evdev_flush_motion(device, timestamp); */ - /* switch (e->type) */ - /* { */ - /* case EV_REL: */ - /* _e_evdev_process_relative_motion(device, e); */ - /* break; */ - /* case EV_ABS: */ - /* _e_evdev_process_absolute(device, e); */ - /* break; */ - /* case EV_KEY: */ - /* _e_evdev_process_key(device, e, timestamp); */ - /* break; */ - /* } */ - /* } */ - - /* _e_evdev_flush_motion(device, timestamp); */ - - return 1; -} diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c index 5c5a65c5b..dfcd6431b 100644 --- a/src/modules/wl_drm/e_mod_main.c +++ b/src/modules/wl_drm/e_mod_main.c @@ -1,713 +1,65 @@ #include "e.h" -#include "e_mod_main.h" +#include +#include "e_comp_wl.h" +#include -/* local function prototypes */ -static void _cb_tty(E_Compositor *comp, int event); -static int _cb_drm_input(int fd, unsigned int mask __UNUSED__, void *data __UNUSED__); -static int _cb_drm_udev_event(int fd __UNUSED__, unsigned int mask __UNUSED__, void *data); -static void _cb_drm_page_flip(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec, unsigned int usec, void *data); -static void _cb_drm_vblank(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec __UNUSED__, unsigned int usec __UNUSED__, void *data); -static Eina_Bool _egl_init(E_Drm_Compositor *dcomp, struct udev_device *dev); -static void _sprites_init(E_Drm_Compositor *dcomp); -static void _sprites_shutdown(E_Drm_Compositor *dcomp); -static Eina_Bool _outputs_init(E_Drm_Compositor *dcomp, unsigned int conn, struct udev_device *drm_device); -static Eina_Bool _output_create(E_Drm_Compositor *dcomp, drmModeRes *res, drmModeConnector *conn, int x, int y, struct udev_device *drm_device); -static void _outputs_update(E_Drm_Compositor *dcomp, struct udev_device *drm_device); -static Eina_Bool _udev_event_is_hotplug(E_Drm_Compositor *dcomp, struct udev_device *dev); +#define SCREEN_WIDTH 1920 +#define SCREEN_HEIGHT 1200 -/* local variables */ -static drmModeModeInfo builtin_mode = -{ - 63500, /* clock */ - 1024, 1072, 1176, 1328, 0, - 768, 771, 775, 798, 0, - 59920, - DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC, - 0, - "1024x768" -}; - -/* external variables */ -E_Drm_Compositor *_drm_comp = NULL; - -EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Drm" }; +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" }; EAPI void * e_modapi_init(E_Module *m) { - struct wl_display *disp; - struct udev_enumerate *ue; - struct udev_list_entry *entry; - struct udev_device *drm_dev = NULL; - struct wl_event_loop *loop; - const char *seat = NULL; + E_Comp *comp; - DLOGFN(__FILE__, __LINE__, __FUNCTION__); + printf("LOAD WL_DRM MODULE\n"); - /* try to get the wayland display */ - if (!(disp = (struct wl_display *)m->data)) return NULL; + /* try to init ecore_drm */ + /* if (!ecore_drm_init()) */ + /* { */ + /* fprintf(stderr, "Could not initialize ecore_drm"); */ + /* return NULL; */ + /* } */ - /* allocate space for the drm compositor */ - if (!(_drm_comp = malloc(sizeof(E_Drm_Compositor)))) return NULL; - - memset(_drm_comp, 0, sizeof(E_Drm_Compositor)); - - if (!(_drm_comp->udev = udev_new())) + comp = e_comp_new(); + comp->comp_type = E_PIXMAP_TYPE_WL; + comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + if (!comp->ee) { - free(_drm_comp); + fprintf(stderr, "Could not create ecore_evas_drm canvas"); return NULL; } - _drm_comp->base.display = disp; - if (!(_drm_comp->tty = e_tty_create(&_drm_comp->base, _cb_tty, 0))) + if (!e_xinerama_fake_screens_exist()) { - free(_drm_comp); - return NULL; + E_Screen *screen; + + screen = E_NEW(E_Screen, 1); + screen->escreen = screen->screen = 0; + screen->x = 0; + screen->y = 0; + screen->w = SCREEN_WIDTH; + screen->h = SCREEN_HEIGHT; + e_xinerama_screens_set(eina_list_append(NULL, screen)); } + comp->man = e_manager_new(0, comp, SCREEN_WIDTH, SCREEN_HEIGHT); + if (!e_comp_wl_init()) return NULL; + e_comp_canvas_init(comp); + e_comp_canvas_fake_layers_init(comp); + comp->pointer = e_pointer_canvas_new(comp->evas, 1); - ue = udev_enumerate_new(_drm_comp->udev); - udev_enumerate_add_match_subsystem(ue, "drm"); - udev_enumerate_add_match_sysname(ue, "card[0-9]*"); + ecore_wl_server_mode_set(1); + ecore_wl_init(NULL); - udev_enumerate_scan_devices(ue); - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(ue)) - { - struct udev_device *dev; - const char *path = NULL; - - path = udev_list_entry_get_name(entry); - dev = udev_device_new_from_syspath(_drm_comp->udev, path); - if (!(seat = udev_device_get_property_value(dev, "ID_SEAT"))) - seat = "seat0"; - if (!strcmp(seat, "seat0")) - { - drm_dev = dev; - break; - } - udev_device_unref(dev); - } - - if (!drm_dev) - { - free(_drm_comp); - return NULL; - } - - /* init egl */ - if (!_egl_init(_drm_comp, drm_dev)) - { - free(_drm_comp); - return NULL; - } - - /* _drm_comp->base.destroy = _cb_destroy; */ - _drm_comp->base.focus = EINA_TRUE; - - _drm_comp->prev_state = E_COMPOSITOR_STATE_ACTIVE; - - glGenFramebuffers(1, &_drm_comp->base.fbo); - glBindFramebuffer(GL_FRAMEBUFFER, _drm_comp->base.fbo); - - if (!e_compositor_init(&_drm_comp->base, disp)) - { - free(_drm_comp); - return NULL; - } - - wl_list_init(&_drm_comp->sprites); - _sprites_init(_drm_comp); - - if (!_outputs_init(_drm_comp, 0, drm_dev)) - { - free(_drm_comp); - return NULL; - } - - udev_device_unref(drm_dev); - udev_enumerate_unref(ue); - - e_evdev_input_create(&_drm_comp->base, _drm_comp->udev, seat); - - loop = wl_display_get_event_loop(_drm_comp->base.display); - _drm_comp->drm_source = - wl_event_loop_add_fd(loop, _drm_comp->drm.fd, WL_EVENT_READABLE, - _cb_drm_input, _drm_comp); - - _drm_comp->udev_monitor = - udev_monitor_new_from_netlink(_drm_comp->udev, "udev"); - if (!_drm_comp->udev_monitor) - { - free(_drm_comp); - return NULL; - } - udev_monitor_filter_add_match_subsystem_devtype(_drm_comp->udev_monitor, - "drm", NULL); - - _drm_comp->udev_drm_source = - wl_event_loop_add_fd(loop, udev_monitor_get_fd(_drm_comp->udev_monitor), - WL_EVENT_READABLE, _cb_drm_udev_event, _drm_comp); - if (udev_monitor_enable_receiving(_drm_comp->udev_monitor) < 0) - { - free(_drm_comp); - return NULL; - } - - return &_drm_comp->base; + return m; } EAPI int -e_modapi_shutdown(E_Module *m __UNUSED__) +e_modapi_shutdown(E_Module *m EINA_UNUSED) { - E_Input_Device *input, *next; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - e_compositor_shutdown(&_drm_comp->base); - gbm_device_destroy(_drm_comp->gbm); - _sprites_shutdown(_drm_comp); - drmDropMaster(_drm_comp->drm.fd); - e_tty_destroy(_drm_comp->tty); - - wl_list_for_each_safe(input, next, &_drm_comp->base.inputs, link) - e_evdev_input_destroy(input); - - free(_drm_comp); - _drm_comp = NULL; + /* shutdown ecore_drm */ + /* ecore_drm_shutdown(); */ return 1; } - -EAPI int -e_modapi_save(E_Module *m __UNUSED__) -{ - return 1; -} - -/* local function prototypes */ -static void -_cb_tty(E_Compositor *comp, int event) -{ - E_Output *output; - E_Drm_Output *doutput; - E_Sprite *sprite; - E_Input_Device *input; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - switch (event) - { - case 0: // TTY_ENTER_VT - comp->focus = EINA_TRUE; - if (drmSetMaster(_drm_comp->drm.fd)) - { - printf("Failed to set master: %m\n"); - wl_display_terminate(comp->display); - } - comp->state = _drm_comp->prev_state; - e_drm_output_set_modes(_drm_comp); - e_compositor_damage_all(comp); - wl_list_for_each(input, &comp->inputs, link) - e_evdev_add_devices(_drm_comp->udev, input); - break; - case 1: // TTY_LEAVE_VT - comp->focus = EINA_FALSE; - _drm_comp->prev_state = comp->state; - comp->state = E_COMPOSITOR_STATE_SLEEPING; - wl_list_for_each(output, &comp->outputs, link) - { - output->repaint_needed = EINA_FALSE; - e_drm_output_set_cursor(output, NULL); - } - doutput = - container_of(comp->outputs.next, E_Drm_Output, base.link); - - wl_list_for_each(sprite, &_drm_comp->sprites, link) - drmModeSetPlane(_drm_comp->drm.fd, sprite->plane_id, - doutput->crtc_id, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - - wl_list_for_each(input, &comp->inputs, link) - e_evdev_remove_devices(input); - - if (drmDropMaster(_drm_comp->drm.fd < 0)) - printf("Failed to drop master: %m\n"); - - break; - } -} - -static int -_cb_drm_input(int fd, unsigned int mask __UNUSED__, void *data __UNUSED__) -{ - drmEventContext ectxt; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - memset(&ectxt, 0, sizeof(ectxt)); - - ectxt.version = DRM_EVENT_CONTEXT_VERSION; - ectxt.page_flip_handler = _cb_drm_page_flip; - ectxt.vblank_handler = _cb_drm_vblank; - drmHandleEvent(fd, &ectxt); - - return 1; -} - -static int -_cb_drm_udev_event(int fd __UNUSED__, unsigned int mask __UNUSED__, void *data) -{ - E_Drm_Compositor *dcomp; - struct udev_device *event; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(dcomp = data)) return 1; - event = udev_monitor_receive_device(dcomp->udev_monitor); - if (_udev_event_is_hotplug(dcomp, event)) - _outputs_update(dcomp, event); - udev_device_unref(event); - return 1; -} - -static void -_cb_drm_page_flip(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec, unsigned int usec, void *data) -{ - E_Drm_Output *doutput; - E_Drm_Compositor *dcomp; - unsigned int msecs; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(doutput = data)) return; - dcomp = (E_Drm_Compositor *)doutput->base.compositor; - - if (doutput->scanout_buffer) - { - e_buffer_post_release(doutput->scanout_buffer); - wl_list_remove(&doutput->scanout_buffer_destroy_listener.link); - doutput->scanout_buffer = NULL; - drmModeRmFB(dcomp->drm.fd, doutput->fs_surf_fb_id); - doutput->fs_surf_fb_id = 0; - } - - if (doutput->pending_scanout_buffer) - { - doutput->scanout_buffer = doutput->pending_scanout_buffer; - wl_list_remove(&doutput->pending_scanout_buffer_destroy_listener.link); - wl_signal_add(&doutput->scanout_buffer->resource.destroy_signal, - &doutput->scanout_buffer_destroy_listener); - doutput->pending_scanout_buffer = NULL; - doutput->fs_surf_fb_id = doutput->pending_fs_surf_fb_id; - doutput->pending_fs_surf_fb_id = 0; - } - - msecs = sec * 1000 + usec / 1000; - e_output_finish_frame(&doutput->base, msecs); -} - -static void -_cb_drm_vblank(int fd __UNUSED__, unsigned int frame __UNUSED__, unsigned int sec __UNUSED__, unsigned int usec __UNUSED__, void *data) -{ - E_Sprite *es; - E_Drm_Compositor *dcomp; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(es = data)) return; - dcomp = es->compositor; - - if (es->surface) - { - e_buffer_post_release(es->surface->buffer); - wl_list_remove(&es->destroy_listener.link); - es->surface = NULL; - drmModeRmFB(dcomp->drm.fd, es->fb_id); - es->fb_id = 0; - } - - if (es->pending_surface) - { - wl_list_remove(&es->pending_destroy_listener.link); - wl_signal_add(&es->pending_surface->buffer->resource.destroy_signal, - &es->destroy_listener); - es->surface = es->pending_surface; - es->pending_surface = NULL; - es->fb_id = es->pending_fb_id; - es->pending_fb_id = 0; - } -} - -static Eina_Bool -_egl_init(E_Drm_Compositor *dcomp, struct udev_device *dev) -{ - EGLint maj, min; - const char *ext, *fname, *snum; - int fd = 0; - static const EGLint ctxt_att[] = - { - EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE - }; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((snum = udev_device_get_sysnum(dev))) - dcomp->drm.id = atoi(snum); - if ((!snum) || (dcomp->drm.id < 0)) - return EINA_FALSE; - - fname = udev_device_get_devnode(dev); - if (!(fd = open(fname, (O_RDWR | O_CLOEXEC)))) - return EINA_FALSE; - - dcomp->drm.fd = fd; - dcomp->gbm = gbm_create_device(dcomp->drm.fd); - -// dcomp->base.egl_display = eglGetDisplay(dcomp->base.display); - dcomp->base.egl_display = eglGetDisplay(dcomp->gbm); - if (!dcomp->base.egl_display) - return EINA_FALSE; - - if (!eglInitialize(dcomp->base.egl_display, &maj, &min)) - return EINA_FALSE; - - ext = eglQueryString(dcomp->base.egl_display, EGL_EXTENSIONS); - if (!strstr(ext, "EGL_KHR_surfaceless_gles2")) - return EINA_FALSE; - - if (!eglBindAPI(EGL_OPENGL_ES_API)) return EINA_FALSE; - - dcomp->base.egl_context = - eglCreateContext(dcomp->base.egl_display, NULL, EGL_NO_CONTEXT, ctxt_att); - if (!dcomp->base.egl_context) return EINA_FALSE; - - if (!eglMakeCurrent(dcomp->base.egl_display, EGL_NO_SURFACE, - EGL_NO_SURFACE, dcomp->base.egl_context)) - return EINA_FALSE; - - return EINA_TRUE; -} - -static void -_sprites_init(E_Drm_Compositor *dcomp) -{ - E_Sprite *es; - drmModePlaneRes *res; - drmModePlane *plane; - unsigned int i = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(res = drmModeGetPlaneResources(dcomp->drm.fd))) - return; - - for (i = 0; i < res->count_planes; i++) - { - if (!(plane = drmModeGetPlane(dcomp->drm.fd, res->planes[i]))) - continue; - if (!(es = e_sprite_create(dcomp, plane))) - { - free(plane); - continue; - } - drmModeFreePlane(plane); - wl_list_insert(&dcomp->sprites, &es->link); - } - free(res->planes); - free(res); -} - -static void -_sprites_shutdown(E_Drm_Compositor *dcomp) -{ - E_Drm_Output *doutput; - E_Sprite *es, *next; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - doutput = container_of(dcomp->base.outputs.next, E_Drm_Output, base.link); - - wl_list_for_each_safe(es, next, &dcomp->sprites, link) - { - drmModeSetPlane(dcomp->drm.fd, es->plane_id, doutput->crtc_id, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - drmModeRmFB(dcomp->drm.fd, es->fb_id); - free(es); - } -} - -static Eina_Bool -_outputs_init(E_Drm_Compositor *dcomp, unsigned int conn, struct udev_device *drm_device) -{ - drmModeConnector *connector; - drmModeRes *res; - int i = 0, x = 0, y = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(res = drmModeGetResources(dcomp->drm.fd))) - return EINA_FALSE; - - if (!(dcomp->crtcs = calloc(res->count_crtcs, sizeof(unsigned int)))) - { - drmModeFreeResources(res); - return EINA_FALSE; - } - - dcomp->num_crtcs = res->count_crtcs; - memcpy(dcomp->crtcs, res->crtcs, sizeof(unsigned int) * dcomp->num_crtcs); - - for (i = 0; i < res->count_connectors; i++) - { - if (!(connector = - drmModeGetConnector(dcomp->drm.fd, res->connectors[i]))) - continue; - if ((connector->connection == DRM_MODE_CONNECTED) && - ((conn == 0) || (connector->connector_id == conn))) - { - if (!_output_create(dcomp, res, connector, x, y, drm_device)) - { - drmModeFreeConnector(connector); - continue; - } - x += container_of(dcomp->base.outputs.prev, E_Output, - link)->current->w; - } - drmModeFreeConnector(connector); - } - - if (wl_list_empty(&dcomp->base.outputs)) - { - drmModeFreeResources(res); - return EINA_FALSE; - } - - drmModeFreeResources(res); - - return EINA_TRUE; -} - -static Eina_Bool -_output_create(E_Drm_Compositor *dcomp, drmModeRes *res, drmModeConnector *conn, int x, int y, struct udev_device *drm_device) -{ - E_Drm_Output *output; - E_Drm_Output_Mode *mode, *next; - drmModeEncoder *encoder; - int i = 0, ret = 0; - unsigned int hdl, stride; - - if (!(encoder = drmModeGetEncoder(dcomp->drm.fd, conn->encoders[0]))) - return EINA_FALSE; - - for (i = 0; i < res->count_crtcs; i++) - { - if ((encoder->possible_crtcs & (1 << i)) && - !(dcomp->crtc_alloc & (1 << res->crtcs[i]))) - break; - } - if (i == res->count_crtcs) - { - drmModeFreeEncoder(encoder); - return EINA_FALSE; - } - - if (!(output = malloc(sizeof(E_Drm_Output)))) - { - drmModeFreeEncoder(encoder); - return EINA_FALSE; - } - - memset(output, 0, sizeof(E_Drm_Output)); - - output->fb_id[0] = -1; - output->fb_id[1] = -1; - output->base.subpixel = e_drm_output_subpixel_convert(conn->subpixel); - output->base.make = "unknown"; - output->base.model = "unknown"; - wl_list_init(&output->base.modes); - - output->crtc_id = res->crtcs[i]; - dcomp->crtc_alloc |= (1 << output->crtc_id); - output->conn_id = conn->connector_id; - dcomp->conn_alloc |= (1 << output->conn_id); - - output->orig_crtc = drmModeGetCrtc(dcomp->drm.fd, output->crtc_id); - drmModeFreeEncoder(encoder); - - for (i = 0; i < conn->count_modes; i++) - { - if (!e_drm_output_add_mode(output, &conn->modes[i])) - goto efree; - } - - if (conn->count_modes == 0) - { - if (!e_drm_output_add_mode(output, &builtin_mode)) - goto efree; - } - - mode = container_of(output->base.modes.next, E_Drm_Output_Mode, base.link); - output->base.current = &mode->base; - mode->base.flags = (WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED); - - glGenRenderbuffers(2, output->rbo); - - for (i = 0; i < 2; i++) - { - glBindRenderbuffer(GL_RENDERBUFFER, output->rbo[i]); - output->bo[i] = - gbm_bo_create(dcomp->gbm, output->base.current->w, - output->base.current->h, GBM_BO_FORMAT_XRGB8888, - (GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING)); - if (!output->bo[i]) goto ebuffs; - output->image[i] = - dcomp->base.create_image(dcomp->base.egl_display, NULL, - EGL_NATIVE_PIXMAP_KHR, output->bo[i], NULL); - if (!output->image[i]) goto ebuffs; - dcomp->base.image_target_renderbuffer_storage(GL_RENDERBUFFER, - output->image[i]); - stride = gbm_bo_get_pitch(output->bo[i]); - hdl = gbm_bo_get_handle(output->bo[i]).u32; - ret = drmModeAddFB(dcomp->drm.fd, output->base.current->w, - output->base.current->h, 24, 32, stride, hdl, - &output->fb_id[i]); - if (ret) goto ebuffs; - } - - output->current = 0; - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, output->rbo[output->current]); - ret = drmModeSetCrtc(dcomp->drm.fd, output->crtc_id, - output->fb_id[output->current ^ 1], 0, 0, - &output->conn_id, 1, &mode->info); - if (ret) goto efb; - - /* TODO: backlight init */ - - e_output_init(&output->base, &dcomp->base, x, y, - conn->mmWidth, conn->mmHeight, 0); - - wl_list_insert(dcomp->base.outputs.prev, &output->base.link); - - output->scanout_buffer_destroy_listener.notify = - e_drm_output_scanout_buffer_destroy; - output->pending_scanout_buffer_destroy_listener.notify = - e_drm_output_pending_scanout_buffer_destroy; - - output->pending_fs_surf_fb_id = 0; - output->base.repaint = e_drm_output_repaint; - output->base.destroy = e_drm_output_destroy; - output->base.assign_planes = e_drm_output_assign_planes; - output->base.set_dpms = e_drm_output_set_dpms; - - return EINA_TRUE; - -efb: - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, 0); - -ebuffs: - for (i = 0; i < 2; i++) - { - if ((int)output->fb_id[i] != -1) - drmModeRmFB(dcomp->drm.fd, output->fb_id[i]); - if (output->image[i]) - dcomp->base.destroy_image(dcomp->base.egl_display, output->image[i]); - if (output->bo[i]) gbm_bo_destroy(output->bo[i]); - } - glBindRenderbuffer(GL_RENDERBUFFER, 0); - glDeleteRenderbuffers(2, output->rbo); - -efree: - wl_list_for_each_safe(mode, next, &output->base.modes, base.link) - { - wl_list_remove(&mode->base.link); - free(mode); - } - drmModeFreeCrtc(output->orig_crtc); - dcomp->crtc_alloc &= ~(1 << output->crtc_id); - dcomp->conn_alloc &= ~(1 << output->conn_id); - free(output); - - return EINA_TRUE; -} - -static void -_outputs_update(E_Drm_Compositor *dcomp, struct udev_device *drm_device) -{ - drmModeConnector *conn; - drmModeRes *res; - E_Drm_Output *doutput, *next; - int x = 0, y = 0; - int xo = 0, yo = 0; - unsigned int connected = 0, disconnects = 0; - int i = 0; - - if (!(res = drmModeGetResources(dcomp->drm.fd))) - return; - - for (i = 0; i < res->count_connectors; i++) - { - int conn_id; - - conn_id = res->connectors[i]; - if (!(conn = drmModeGetConnector(dcomp->drm.fd, conn_id))) - continue; - if (conn->connection != DRM_MODE_CONNECTED) - { - drmModeFreeConnector(conn); - continue; - } - connected |= (1 << conn_id); - if (!(dcomp->conn_alloc & (1 << conn_id))) - { - E_Output *last; - - last = container_of(dcomp->base.outputs.prev, E_Output, link); - if (!wl_list_empty(&dcomp->base.outputs)) - x = last->x + last->current->w; - else - x = 0; - y = 0; - _output_create(dcomp, res, conn, x, y, drm_device); - } - drmModeFreeConnector(conn); - } - drmModeFreeResources(res); - - if ((disconnects = dcomp->conn_alloc & ~connected)) - { - wl_list_for_each_safe(doutput, next, &dcomp->base.outputs, base.link) - { - if ((xo != 0) || (yo != 0)) - e_output_move(&doutput->base, doutput->base.x - xo, - doutput->base.y - yo); - if (disconnects & (1 << doutput->conn_id)) - { - disconnects &= ~(1 << doutput->conn_id); - xo += doutput->base.current->w; - e_drm_output_destroy(&doutput->base); - } - } - } - - if (dcomp->conn_alloc == 0) - wl_display_terminate(dcomp->base.display); -} - -static Eina_Bool -_udev_event_is_hotplug(E_Drm_Compositor *dcomp, struct udev_device *dev) -{ - const char *snum, *val; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - snum = udev_device_get_sysnum(dev); - if ((!snum) || (atoi(snum) != dcomp->drm.id)) - return EINA_FALSE; - - if (!(val = udev_device_get_property_value(dev, "HOTPLUG"))) - return EINA_FALSE; - - if (!strcmp(val, "1")) return EINA_TRUE; - - return EINA_FALSE; -} diff --git a/src/modules/wl_drm/e_mod_main.h b/src/modules/wl_drm/e_mod_main.h deleted file mode 100644 index 73be2b6cd..000000000 --- a/src/modules/wl_drm/e_mod_main.h +++ /dev/null @@ -1,234 +0,0 @@ -#ifndef E_MOD_MAIN_H -# define E_MOD_MAIN_H - -# define DLOGFNS 1 - -# ifdef DLOGFNS -# include -# define DLOGFN(fl, ln, fn) printf("-E-DRM: %25s: %5i - %s\n", fl, ln, fn); -# else -# define DLOGFN(fl, ln, fn) -# endif - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -typedef void (*tty_vt_func_t)(E_Compositor *comp, int event); -typedef struct _E_Tty E_Tty; -typedef struct _E_Drm_Compositor E_Drm_Compositor; -typedef struct _E_Sprite E_Sprite; -typedef struct _E_Drm_Output_Mode E_Drm_Output_Mode; -typedef struct _E_Drm_Output E_Drm_Output; -typedef struct _E_Drm_Fb E_Drm_Fb; -typedef struct _E_Evdev_Input E_Evdev_Input; -typedef struct _E_Evdev_Input_Device E_Evdev_Input_Device; - -struct _E_Drm_Fb -{ - E_Drm_Output *output; - unsigned int fb, stride, hdl, size; - int fd; - Eina_Bool client_buffer : 1; - - struct - { - struct wl_buffer *buffer; - struct wl_listener buffer_destroy; - } reference; - - struct gbm_bo *bo; - - void *map; -}; - -struct _E_Drm_Compositor -{ - E_Wayland_Compositor base; - - struct udev *udev; - struct wl_event_source *drm_source; - struct udev_monitor *udev_monitor; - struct wl_event_source *udev_drm_source; - struct - { - int id, fd; - } drm; - struct gbm_device *gbm; - unsigned int *crtcs; - int num_crtcs; - unsigned int crtc_alloc; - unsigned int conn_alloc; - - E_Tty *tty; - - struct - { - unsigned int width, height; - } min, max; - - struct wl_list sprites; - Eina_Bool sprites_broken; - unsigned int prev_state; -}; - -struct _E_Tty -{ - E_Wayland_Compositor *comp; - - int fd; - struct termios term_attribs; - struct wl_event_source *input_source; - struct wl_event_source *vt_source; - tty_vt_func_t vt_func; - int vt, start_vt; - Eina_Bool has_vt : 1; - int kbd_mode; -}; - -struct _E_Sprite -{ - struct wl_list link; - - E_Drm_Output *output; - E_Drm_Fb *current_fb, *next_fb; - E_Drm_Compositor *compositor; - - unsigned int possible_crtcs; - unsigned int plane_id; - - int sx, sy; - unsigned int sw, sh; - unsigned int dx, dy, dw, dh; - - unsigned int format_count; - unsigned int formats[]; -}; - -struct _E_Drm_Output_Mode -{ - E_Wayland_Output_Mode base; - drmModeModeInfo info; -}; - -struct _E_Drm_Output -{ - E_Wayland_Output base; - - unsigned int crtc_id; - unsigned int conn_id; - drmModeCrtcPtr orig_crtc; - - struct - { - Eina_Bool vblank : 1; - Eina_Bool page_flip : 1; - } pending; - - struct gbm_surface *gsurface; - struct gbm_bo *gcursor[2]; - - struct - { - E_Wayland_Surface *surface; - int current; - } cursor; - - E_Drm_Fb *current, *next, *dummy[2]; - - pixman_image_t *img[2]; - int current_img; - - pixman_region32_t prev_damage; - - /* TODO: backlight */ -}; - -struct _E_Evdev_Input -{ - E_Wayland_Input base; - struct wl_list devices; - struct udev_monitor *monitor; - struct wl_event_source *monitor_source; - char *seat; -}; - -struct _E_Evdev_Input_Device -{ - E_Evdev_Input *master; - struct wl_list link; - struct wl_event_source *source; - E_Wayland_Output *output; - char *devnode; - int fd; - struct - { - int min_x, max_x, min_y, max_y; - int ox, oy, rx, ry; - int x, y; - } absolute; - struct - { - int slot; - int x[16], y[16]; - } mt; - struct mtdev *mtdev; - struct - { - int dx, dy; - } rel; - - int type; - - Eina_Bool is_pad : 1; - Eina_Bool is_mt : 1; -}; - -extern E_Drm_Compositor *_comp; - -EAPI extern E_Module_Api e_modapi; - -EAPI void *e_modapi_init(E_Module *m); -EAPI int e_modapi_shutdown(E_Module *m); -EAPI int e_modapi_save(E_Module *m); - -EINTERN E_Sprite *e_sprite_create(E_Drm_Compositor *dcomp, drmModePlane *plane); -EINTERN Eina_Bool e_sprite_crtc_supported(E_Wayland_Output *output, unsigned int supported); - -EINTERN E_Tty *e_tty_create(E_Wayland_Compositor *comp, tty_vt_func_t vt_func, int tty); -EINTERN void e_tty_destroy(E_Tty *et); - -EINTERN int e_drm_output_subpixel_convert(int value); -EINTERN Eina_Bool e_drm_output_add_mode(E_Drm_Output *output, drmModeModeInfo *info); -EINTERN void e_drm_output_set_modes(E_Drm_Compositor *dcomp); -EINTERN void e_drm_output_scanout_buffer_destroy(struct wl_listener *listener, void *data); -EINTERN void e_drm_output_pending_scanout_buffer_destroy(struct wl_listener *listener, void *data); -EINTERN void e_drm_output_repaint(E_Wayland_Output *base, pixman_region32_t *damage); -EINTERN void e_drm_output_destroy(E_Wayland_Output *base); -EINTERN void e_drm_output_assign_planes(E_Wayland_Output *base); -EINTERN void e_drm_output_set_dpms(E_Wayland_Output *base, E_Dpms_Level level); -EINTERN Eina_Bool e_drm_output_prepare_scanout_surface(E_Drm_Output *output); -EINTERN void e_drm_output_disable_sprites(E_Wayland_Output *base); -EINTERN drmModePropertyPtr e_drm_output_get_property(int fd, drmModeConnectorPtr conn, const char *name); -EINTERN int e_drm_output_prepare_overlay_surface(E_Wayland_Output *base, E_Wayland_Surface *es, pixman_region32_t *overlap); -EINTERN Eina_Bool e_drm_output_surface_transform_supported(E_Wayland_Surface *es); -EINTERN Eina_Bool e_drm_output_surface_overlap_supported(E_Wayland_Output *base EINA_UNUSED, pixman_region32_t *overlap); -EINTERN Eina_Bool e_drm_output_surface_format_supported(E_Sprite *s, unsigned int format); -EINTERN void e_drm_output_set_cursor_region(E_Wayland_Output *output, E_Wayland_Input *device, pixman_region32_t *overlap); -EINTERN Eina_Bool e_drm_output_set_cursor(E_Wayland_Output *output, E_Wayland_Input *device); - -EINTERN void e_evdev_add_devices(struct udev *udev, E_Wayland_Input *base); -EINTERN void e_evdev_remove_devices(E_Wayland_Input *base); -EINTERN void e_evdev_input_create(E_Wayland_Compositor *comp, struct udev *udev, const char *seat); -EINTERN void e_evdev_input_destroy(E_Wayland_Input *base); - -#endif diff --git a/src/modules/wl_drm/e_sprite.c b/src/modules/wl_drm/e_sprite.c deleted file mode 100644 index fa33d1ca6..000000000 --- a/src/modules/wl_drm/e_sprite.c +++ /dev/null @@ -1,88 +0,0 @@ -#include "e.h" -#include "e_mod_main.h" - -/* local function prototypes */ -static void _e_sprite_cb_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__); -static void _e_sprite_cb_pending_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__); - -/* local variables */ -/* wayland interfaces */ -/* external variables */ - -EINTERN E_Sprite * -e_sprite_create(E_Drm_Compositor *dcomp, drmModePlane *plane) -{ - E_Sprite *es; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!plane) return NULL; - - es = malloc(sizeof(E_Sprite) + ((sizeof(unsigned int)) * plane->count_formats)); - if (!es) return NULL; - - memset(es, 0, sizeof(E_Sprite)); - - es->compositor = dcomp; - es->possible_crtcs = plane->possible_crtcs; - es->plane_id = plane->plane_id; - es->surface = NULL; - es->pending_surface = NULL; - es->fb_id = 0; - es->pending_fb_id = 0; - es->destroy_listener.notify = _e_sprite_cb_buffer_destroy; - es->pending_destroy_listener.notify = _e_sprite_cb_pending_buffer_destroy; - es->format_count = plane->count_formats; - memcpy(es->formats, plane->formats, - plane->count_formats * sizeof(plane->formats[0])); - - return es; -} - -EINTERN Eina_Bool -e_sprite_crtc_supported(E_Output *output, unsigned int supported) -{ - E_Compositor *comp; - E_Drm_Compositor *dcomp; - E_Drm_Output *doutput; - int crtc = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - comp = output->compositor; - dcomp = (E_Drm_Compositor *)comp; - doutput = (E_Drm_Output *)output; - - for (crtc = 0; crtc < dcomp->num_crtcs; crtc++) - { - if (dcomp->crtcs[crtc] != doutput->crtc_id) - continue; - if (supported & (1 << crtc)) - return EINA_TRUE; - } - - return EINA_FALSE; -} - -/* local functions */ -static void -_e_sprite_cb_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__) -{ - E_Sprite *es; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - es = container_of(listener, E_Sprite, destroy_listener); - es->surface = NULL; -} - -static void -_e_sprite_cb_pending_buffer_destroy(struct wl_listener *listener, void *data __UNUSED__) -{ - E_Sprite *es; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - es = container_of(listener, E_Sprite, pending_destroy_listener); - es->pending_surface = NULL; -} diff --git a/src/modules/wl_drm/e_tty.c b/src/modules/wl_drm/e_tty.c deleted file mode 100644 index 40902b780..000000000 --- a/src/modules/wl_drm/e_tty.c +++ /dev/null @@ -1,201 +0,0 @@ -#include "e.h" -#include "e_mod_main.h" - -/* local function prototypes */ -static int _e_tty_open_vt(E_Tty *et); -static int _e_tty_cb_input(int fd __UNUSED__, uint32_t mask __UNUSED__, void *data); -static int _e_tty_cb_handle(int sig __UNUSED__, void *data); - -EINTERN E_Tty * -e_tty_create(E_Compositor *comp, tty_vt_func_t vt_func, int tty) -{ - E_Tty *et = NULL; - struct stat buff; - struct termios raw_attribs; - struct wl_event_loop *loop; - struct vt_mode mode; - int ret = 0; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!(et = malloc(sizeof(E_Tty)))) - { - e_error_message_show(_("Could not allocate space for E_Tty\n")); - return NULL; - } - - memset(et, 0, sizeof(E_Tty)); - - et->comp = comp; - et->vt_func = vt_func; - if (tty > 0) - { - char fname[16]; - - snprintf(fname, sizeof(fname), "/dev/tty%d", tty); - printf("Using %s for tty\n", fname); - et->fd = open(fname, O_RDWR | O_NOCTTY | O_CLOEXEC); - } - else if ((fstat(et->fd, &buff) == 0) && - (major(buff.st_rdev) == TTY_MAJOR) && (minor(buff.st_rdev) > 0)) - et->fd = fcntl(0, F_DUPFD_CLOEXEC, 0); - else - et->fd = _e_tty_open_vt(et); - - if (et->fd <= 0) - { - e_error_message_show(_("Could not open a tty.\n")); - free(et); - return NULL; - } - - if (tcgetattr(et->fd, &et->term_attribs) < 0) - { - e_error_message_show(_("Could not get terminal attributes: %m\n")); - free(et); - return NULL; - } - - raw_attribs = et->term_attribs; - cfmakeraw(&raw_attribs); - - raw_attribs.c_oflag |= (OPOST | OCRNL); - if (tcsetattr(et->fd, TCSANOW, &raw_attribs) < 0) - { - e_error_message_show(_("Could not put terminal in raw mode: %m\n")); - free(et); - return NULL; - } - - loop = wl_display_get_event_loop(comp->display); - et->input_source = - wl_event_loop_add_fd(loop, et->fd, WL_EVENT_READABLE, _e_tty_cb_input, et); - - if ((ret = ioctl(et->fd, KDSETMODE, KD_GRAPHICS))) - { - e_error_message_show(_("Failed to set graphics mode on tty: %m\n")); - free(et); - return NULL; - } - - et->has_vt = EINA_TRUE; - mode.mode = VT_PROCESS; - mode.relsig = SIGUSR1; - mode.acqsig = SIGUSR1; - if (ioctl(et->fd, VT_SETMODE, &mode) < 0) - { - e_error_message_show(_("Failed to take control of vt handling: %m\n")); - free(et); - return NULL; - } - - et->vt_source = - wl_event_loop_add_signal(loop, SIGUSR1, _e_tty_cb_handle, et); - - return et; -} - -EINTERN void -e_tty_destroy(E_Tty *et) -{ - struct vt_mode mode; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if (!et) return; - if (ioctl(et->fd, KDSETMODE, KD_TEXT)) - e_error_message_show(_("Failed to set KD_TEXT mode on tty: %m\n")); - if (tcsetattr(et->fd, TCSANOW, &et->term_attribs) < 0) - e_error_message_show(_("Could not restore terminal to canonical mode: %m\n")); - mode.mode = VT_AUTO; - if (ioctl(et->fd, VT_SETMODE, &mode) < 0) - e_error_message_show(_("Could not reset vt handling: %m\n")); - if ((et->has_vt) && (et->vt != et->start_vt)) - { - ioctl(et->fd, VT_ACTIVATE, et->start_vt); - ioctl(et->fd, VT_WAITACTIVE, et->start_vt); - } - close(et->fd); - free(et); -} - -/* local functions */ -static int -_e_tty_open_vt(E_Tty *et) -{ - int tty0, fd; - char fname[16]; - struct vt_stat vts; - - DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - if ((tty0 = open("/dev/tty0", O_WRONLY | O_CLOEXEC)) < 0) - { - e_error_message_show(_("Failed to open tty0: %m\n")); - return -1; - } - - if ((ioctl(tty0, VT_OPENQRY, &et->vt) < 0) || (et->vt == -1)) - { - e_error_message_show(_("Failed to open tty0: %m\n")); - close(tty0); - return -1; - } - close(tty0); - - snprintf(fname, sizeof(fname), "/dev/tty%d", et->vt); - printf("Compositor: Using new vt %s\n", fname); - fd = open(fname, O_RDWR | O_NOCTTY | O_CLOEXEC); - if (fd < 0) return fd; - - if (ioctl(fd, VT_GETSTATE, &vts) == 0) - et->start_vt = vts.v_active; - else - et->start_vt = et->vt; - - if ((ioctl(fd, VT_ACTIVATE, et->vt) < 0) || - (ioctl(fd, VT_WAITACTIVE, et->vt) < 0)) - { - e_error_message_show(_("Failed to switch to new vt: %m\n")); - close(fd); - return -1; - } - - return fd; -} - -static int -_e_tty_cb_input(int fd __UNUSED__, uint32_t mask __UNUSED__, void *data) -{ - E_Tty *et; - -// DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - et = data; - tcflush(et->fd, TCIFLUSH); - return 1; -} - -static int -_e_tty_cb_handle(int sig __UNUSED__, void *data) -{ - E_Tty *et; - -// DLOGFN(__FILE__, __LINE__, __FUNCTION__); - - et = data; - if (et->has_vt) - { - et->vt_func(et->comp, 1); - et->has_vt = EINA_FALSE; - ioctl(et->fd, VT_RELDISP, 1); - } - else - { - ioctl(et->fd, VT_RELDISP, VT_ACKACQ); - et->vt_func(et->comp, 0); - et->has_vt = EINA_TRUE; - } - - return 1; -} diff --git a/src/modules/wl_drm/module.desktop b/src/modules/wl_drm/module.desktop deleted file mode 100644 index 7461be660..000000000 --- a/src/modules/wl_drm/module.desktop +++ /dev/null @@ -1,16 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Type=Link -Name=Wayland Drm -Name[eo]=Mastrumado de ciferecaj rajtoj de Wayland -Name[fr]=Gestion des droits numériques Wayland -Comment=Enlightenment DRM Composite Manager -Comment[ca]=Administrador de composició DRM de l'Enlightenment -Comment[eo]=Administrilo de kunmetaĵo Enlightenment DRM -Comment[es]=Administrador de composición DRM de Enlightenment -Comment[fr]=Gestionnaire Composite avec DRM de Enlightenment -Comment[gl]=Xestor de composición DRM de Enlightenment -Comment[it]=Composite manager DRM di Enlightenment -Comment[pt]=Gestor de composição Enlightenment DRM -Icon=e-module-wl_drm -X-Enlightenment-ModuleType=look