From: Seunghun Lee Date: Mon, 28 Dec 2015 07:21:59 +0000 (+0900) Subject: Merge branch 'upstream' into sandbox/shiin/devel X-Git-Tag: accepted/tizen/mobile/20160122.034543~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27fa5ecaabe6f6e0564d2aa6dd32c509e492a5d5;p=platform%2Fupstream%2Fenlightenment.git Merge branch 'upstream' into sandbox/shiin/devel Need to resolve below conflict files. Conflicts: configure.ac src/bin/Makefile.mk src/bin/e_atoms.c src/bin/e_atoms.h src/bin/e_auth.c src/bin/e_auth.h src/bin/e_client.c src/bin/e_client.h src/bin/e_comp.c src/bin/e_comp.h src/bin/e_comp_canvas.c src/bin/e_comp_object.c src/bin/e_comp_wl.c src/bin/e_comp_wl.h src/bin/e_comp_wl_data.c src/bin/e_comp_wl_data.h src/bin/e_comp_wl_input.c src/bin/e_comp_wl_input.h src/bin/e_comp_wl_screenshooter_server.c src/bin/e_comp_x.c src/bin/e_config.h src/bin/e_desk.c src/bin/e_dnd.c src/bin/e_hints.c src/bin/e_hints.h src/bin/e_log.h src/bin/e_main.c src/bin/e_module.c src/bin/e_module.h src/bin/e_pixmap.c src/bin/e_pixmap.h src/bin/e_pointer.c src/bin/e_scale.c src/bin/e_scale.h src/bin/e_signals.c src/bin/e_win.c src/bin/e_zone.c src/bin/e_zone.h src/modules/Makefile.mk src/modules/Makefile_music_control.mk src/modules/Makefile_wl_desktop_shell.mk src/modules/Makefile_wl_screenshot.mk src/modules/packagekit/e_mod_packagekit.c src/modules/shot/screenshooter-client-protocol.h src/modules/wl_desktop_shell/e_desktop_shell_protocol.c src/modules/wl_desktop_shell/e_desktop_shell_protocol.h src/modules/wl_desktop_shell/e_mod_main.c src/modules/wl_drm/e_mod_main.c src/modules/wl_screenshot/e_mod_main.c src/modules/wl_x11/e_mod_main.c Change-Id: Ia5849a1e958e920aed674b62d8f41af4f85e17e9 --- 27fa5ecaabe6f6e0564d2aa6dd32c509e492a5d5 diff --cc config/mobile/e.src index c995266,1431dde..380e9be --- a/config/mobile/e.src +++ b/config/mobile/e.src @@@ -865,7 -865,8 +865,9 @@@ group "E_Config" struct } value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 1; value "use_desktop_window_profile" int: 0; + value "wm_win_rotation" uchar: 0; } diff --cc config/standard/e.src index d8a36df,b41057c..79b89ac --- a/config/standard/e.src +++ b/config/standard/e.src @@@ -1107,7 -1106,8 +1106,9 @@@ group "E_Config" struct } value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 0; value "use_desktop_window_profile" int: 0; + value "wm_win_rotation" uchar: 0; } diff --cc config/tiling/e.src index 44a5b17,afeac1f..fcc6b9f --- a/config/tiling/e.src +++ b/config/tiling/e.src @@@ -1129,7 -1128,8 +1128,9 @@@ group "E_Config" struct } value "xkb.only_label" int: 0; value "xkb.default_model" string: "default"; + value "keyboard.repeat_delay" int: 400; + value "keyboard.repeat_rate" int: 25; value "exe_always_single_instance" uchar: 0; value "use_desktop_window_profile" int: 0; + value "wm_win_rotation" uchar: 0; } diff --cc configure.ac index 8ad10d3,af7586e..dd94435 mode 100755,100644..100755 --- a/configure.ac +++ b/configure.ac @@@ -447,35 -446,13 +446,35 @@@ AM_CONDITIONAL([HAVE_EEZE_MOUNT], [tes # verify "wayland-only" early to adapt dependencies have_wayland_only=no - AC_ARG_ENABLE([wayland-only], - AS_HELP_STRING([--enable-wayland-only],[enable wayland-only version of enlightenment @<:@default=disabled@:>@]), + AC_ARG_ENABLE([wayland], + AS_HELP_STRING([--enable-wayland],[enable wayland support in enlightenment @<:@default=disabled@:>@]), [e_cv_want_wayland_only=$enableval], [e_cv_want_wayland_only=no]) - AC_MSG_CHECKING([whether wayland-only version is enabled]) + AC_MSG_CHECKING([whether wayland support is enabled]) AC_MSG_RESULT([${e_cv_want_wayland_only}]) +quick_init=no +AC_ARG_ENABLE([quick-init], + AS_HELP_STRING([--enable-quick-init],[]), + [ + quick_init=yes + AC_DEFINE_UNQUOTED([ENABLE_QUICK_INIT], [1], [enable quick init]) + ], + [quick_init=no]) +AC_MSG_CHECKING([whether enlightenment quick initialization is enabled]) +AC_MSG_RESULT([${quick_init}]) + +light-e=no +AC_ARG_ENABLE([light-e], + AS_HELP_STRING([--enable-light-e],[]), + [ + light-e=yes + AC_DEFINE_UNQUOTED([DISABLE_FORMAT_TEST], [1], [disable file format test]) + ], + [light-e=no]) +AC_MSG_CHECKING([whether lightweight enlightenment is enabled]) +AC_MSG_RESULT([${light-e}]) + # doxygen program for documentation building EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) @@@ -587,38 -553,9 +575,38 @@@ e_requires=" elementary >= $efl_version \ emotion >= $efl_version \ $eeze_mount \ + libtbm \ $udisks_mount \ $device_libs" - if test "x${e_cv_want_wayland_only}" != "xyes"; then - e_requires="$e_requires ecore-x >= $efl_version" - fi ++<<<<<<< HEAD +PKG_CHECK_MODULES(E, [$e_requires]) +requirements_e="\ +evas >= ${efl_version} \ +ecore >= ${efl_version} \ +ecore-evas >= ${efl_version} \ +ecore-con >= ${efl_version} \ +ecore-ipc >= ${efl_version} \ +ecore-file >= ${efl_version} \ +eet >= ${efl_version} \ +edje >= ${efl_version} \ +efreet >= ${efl_version} \ +efreet-mime >= ${efl_version} \ +efreet-trash >= ${efl_version} \ +eina >= ${efl_version} \ +eldbus >= ${efl_version} \ +eio >= ${efl_version} \ +eo >= ${efl_version} \ +elementary >= ${efl_version} \ +emotion >= ${efl_version} \ +$udisks_mount \ +$eeze_mount \ +$device_libs" +if test "x${e_cv_want_wayland_only}" != "xyes"; then + requirements_e="$requirements_e ecore-x >= $efl_version" +fi ++======= ++>>>>>>> upstream PKG_CHECK_MODULES(E_OPEN, [ eina >= ${efl_version} @@@ -627,21 -564,6 +615,24 @@@ efreet-mime >= ${efl_version} ]) ++<<<<<<< HEAD +PKG_CHECK_MODULES(E_INFO, [ + eina >= ${efl_version} + ecore >= ${efl_version} + eldbus >= ${efl_version} +]) + +e_libs="$E_LIBS $LIBINTL $fnmatch_libs $execinfo_libs" +e_cflags="-DUSE_E_CONFIG_H $E_CFLAGS -D_F_ZONE_WINDOW_ROTATION_ -D_F_E_VIRTUAL_KEYBOARD_TYPE_ -D_F_E_CLIENT_NEW_CLIENT_POST_HOOK_ -D_F_E_COMP_OBJECT_INTERCEPT_HOOK_ -D_F_TRANSIENT_FOR_PATCH -D_F_DISABLE_BACKLIGHT_MOD_SUPPORT" +e_configflags="-DUSE_E_CONFIG_H -D_F_ZONE_WINDOW_ROTATION_ -D_F_E_VIRTUAL_KEYBOARD_TYPE_ -D_F_E_CLIENT_NEW_CLIENT_POST_HOOK_ -D_F_E_COMP_OBJECT_INTERCEPT_HOOK_ -D_F_TRANSIENT_FOR_PATCH -D_F_DISABLE_BACKLIGHT_MOD_SUPPORT" + +AC_SUBST([e_libs]) +AC_SUBST([e_cflags]) +AC_SUBST([e_configflags]) +AC_SUBST([requirements_e]) + ++======= ++>>>>>>> upstream PKG_CHECK_EXISTS([xkeyboard-config],[ xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config 2>/dev/null` AC_DEFINE_UNQUOTED([XKB_BASE],["$xkb_base"],[Define to the base directory for X keyboard configuration data]) @@@ -859,8 -741,8 +810,13 @@@ AC_ARG_ENABLE([wayland-egl] AC_MSG_CHECKING([whether wayland EGL support is enabled]) AC_MSG_RESULT([${e_cv_want_wayland_egl}]) ++<<<<<<< HEAD +if test "x${e_cv_want_wayland_only}" != "xno" || test "x${e_cv_want_wayland_clients}" != "xno";then + PKG_CHECK_MODULES([WAYLAND], [ecore-wayland wayland-server >= 1.7.0 xkbcommon uuid xdg-shell-server scaler-server transform-server screenshooter-server screenshooter-client tizen-extension-server], ++======= + if test "x${e_cv_want_wayland_only}" != "xno" ;then + PKG_CHECK_MODULES([WAYLAND], [ecore-wayland >= 1.16 wayland-server >= 1.8.0 wayland-client >= 1.8.0 xkbcommon uuid], ++>>>>>>> upstream [ have_wayland=yes AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[enable wayland support]) @@@ -884,37 -762,10 +836,38 @@@ if test "x${have_wayland}" = "xyes"; th else have_wayland_egl=no fi ++<<<<<<< HEAD + 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 + + have_wayland_tbm=no + AC_ARG_ENABLE([wayland-tbm], + AS_HELP_STRING([--enable-wayland-tbm],[enable wayland-tbm @<:@default=enabled@:>@]), + [e_cv_want_wayland_tbm=$enableval], + [e_cv_want_wayland_tbm=yes]) + AC_MSG_CHECKING([whether wayland TBM support is enabled]) + AC_MSG_RESULT([${e_cv_want_wayland_tbm}]) + + if test "x$e_cv_want_wayland_tbm" != "xno";then + PKG_CHECK_MODULES([WAYLAND_TBM], [wayland-tbm-server], + [ + have_wayland_tbm=yes + AC_DEFINE_UNQUOTED([HAVE_WAYLAND_TBM],[1],[enable wayland-tbm support]) + ]) + + PKG_CHECK_MODULES([ECORE_DRM], [ecore-drm >= ${efl_version}]) + else + have_wayland_tbm=no + fi ++======= ++>>>>>>> upstream fi AM_CONDITIONAL([HAVE_WAYLAND], [test "x${have_wayland}" = "xyes"]) - AM_CONDITIONAL([HAVE_WAYLAND_ONLY], [test "x${have_wayland_only}" = "xyes"]) - AM_CONDITIONAL([HAVE_WAYLAND_CLIENTS], [test "x${have_wayland_clients}" = "xyes"]) AM_CONDITIONAL([HAVE_WAYLAND_EGL], [test "x${have_wayland_egl}" = "xyes"]) +AM_CONDITIONAL([HAVE_WAYLAND_TBM], [test "x${have_wayland_tbm}" = "xyes"]) if test "x${have_wayland_only}" != "xyes"; then PKG_CHECK_MODULES([ECORE_X], [ecore-x >= ${efl_version}]) @@@ -953,16 -822,7 +924,20 @@@ define([CHECK_MODULE_WL_FB] ]) AM_CONDITIONAL([HAVE_WL_FB], [test "x${WL_FB}" = "xtrue"]) ++<<<<<<< HEAD +define([CHECK_MODULE_WL_SCREENSHOT], +[ + if test "x${have_wayland_clients}" = "xyes" || test "x${e_cv_want_wayland_only}" = "xyes"; then + AC_E_CHECK_PKG(WL_SCREENSHOT, [ ecore >= $efl_version eina >= $efl_version ], [WL_SCREENSHOT=true], [WL_SCREENSHOT=false]) + else + WL_SCREENSHOT=false + fi +]) +AM_CONDITIONAL([HAVE_WL_SCREENSHOT], [test "x${WL_SCREENSHOT}" = "xtrue"]) + ++======= + WL_DRM=false ++>>>>>>> upstream define([CHECK_MODULE_WL_DRM], [ if test "x${have_wayland}" = "xyes" ; then @@@ -973,15 -833,38 +948,50 @@@ ]) AM_CONDITIONAL([HAVE_WL_DRM], [test "x${WL_DRM}" = "xtrue"]) ++<<<<<<< HEAD +define([CHECK_MODULE_BUFFERQUEUE], +[ + if test "x${have_wayland_clients}" = "xyes" || test "x${e_cv_want_wayland_only}" = "xyes"; then + AC_E_CHECK_PKG(BUFFERQUEUE, [ ecore >= $efl_version eina >= $efl_version ], [BUFFERQUEUE=true], [BUFFERQUEUE=false]) + else + BUFFERQUEUE=false + fi +]) +AM_CONDITIONAL([HAVE_BUFFERQUEUE], [test "x${BUFFERQUEUE}" = "xtrue"]) ++======= + HAVE_XWAYLAND_DEPS=false + define([CHECK_MODULE_XWAYLAND], + [ + if test "x${have_wayland}" = "xyes"; then + AC_E_CHECK_PKG(XWAYLAND, [ ecore >= ${efl_version} ecore-x >= ${efl_version} ecore-audio >= ${efl_version} ], [HAVE_XWAYLAND_DEPS=true], [HAVE_XWAYLAND_DEPS=false]) + AC_PATH_PROG([XWAYLAND_BIN], [Xwayland], [false]) + else + HAVE_XWAYLAND_DEPS=false + fi + ]) + AM_CONDITIONAL([HAVE_XWAYLAND], [test "x${HAVE_XWAYLAND}" != "xno"]) + + define([CHECK_MODULE_WL_TEXT_INPUT], + [ + if test "x${have_wayland}" = "xyes"; then + AC_E_CHECK_PKG(WL_TEXT_INPUT, [ ecore >= $efl_version eina >= $efl_version ], [WL_TEXT_INPUT=true], [WL_TEXT_INPUT=false]) + else + WL_TEXT_INPUT=false + fi + ]) + AM_CONDITIONAL([HAVE_WL_TEXT_INPUT], [test "x${WL_TEXT_INPUT}" = "xtrue"]) + + WL_WEEKEYBOARD=false + define([CHECK_MODULE_WL_WEEKEYBOARD], + [ + if test "x${have_wayland}" = "xyes" ; then + AC_E_CHECK_PKG(WL_WEEKEYBOARD, [ eina >= 1.8.0 evas >= 1.8.0 ecore >= 1.8.0 ecore-evas >= 1.8.0 ecore-wayland >= 1.8.0 edje >= 1.8.0 ], [WL_WEEKEYBOARD=true], [WL_WEEKEYBOARD=false]) + else + WL_WEEKEYBOARD=false + fi + ]) + AM_CONDITIONAL([HAVE_WL_WEEKEYBOARD], [test "x${WL_WEEKEYBOARD}" = "xtrue"]) ++>>>>>>> upstream AC_E_OPTIONAL_MODULE([ibar], true) AC_E_OPTIONAL_MODULE([clock], true) @@@ -1027,20 -909,81 +1036,87 @@@ AC_E_OPTIONAL_MODULE([lokker], true AC_E_OPTIONAL_MODULE([shot], true, $ecore_x) AC_E_OPTIONAL_MODULE([backlight], true) AC_E_OPTIONAL_MODULE([tasks], true) - AC_E_OPTIONAL_MODULE([conf_randr], true, $ecore_x) + AC_E_OPTIONAL_MODULE([conf_randr], true) AC_E_OPTIONAL_MODULE([xkbswitch], true, $ecore_x) AC_E_OPTIONAL_MODULE([tiling], true) - #AC_E_OPTIONAL_MODULE([access], false, $ecore_x) AC_E_OPTIONAL_MODULE([music_control], true, [CHECK_MODULE_MUSIC_CONTROL]) AC_E_OPTIONAL_MODULE([packagekit], true) - AC_E_OPTIONAL_MODULE([contact], false) AC_E_OPTIONAL_MODULE([wl_desktop_shell], $have_wayland, [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_x11], $have_wayland, [CHECK_MODULE_WL_X11]) + AC_E_OPTIONAL_MODULE([wl_wl], $have_wayland, [CHECK_MODULE_WL_WL]) + #AC_E_OPTIONAL_MODULE([wl_fb], $have_wayland, [CHECK_MODULE_WL_FB]) AC_E_OPTIONAL_MODULE([wl_drm], $have_wayland, [CHECK_MODULE_WL_DRM]) ++<<<<<<< HEAD +AC_E_OPTIONAL_MODULE([wl_screenshot], $have_wayland, [CHECK_MODULE_WL_SCREENSHOT]) +AC_E_OPTIONAL_MODULE([policy_mobile], true) +AC_E_OPTIONAL_MODULE([bufferqueue], $have_wayland, [CHECK_MODULE_BUFFERQUEUE]) ++======= + AC_E_OPTIONAL_MODULE([wl_text_input], $have_wayland, [CHECK_MODULE_WL_TEXT_INPUT]) + AC_E_OPTIONAL_MODULE([wl_weekeyboard], $have_wayland, [CHECK_MODULE_WL_WEEKEYBOARD]) + AC_E_OPTIONAL_MODULE([policy_mobile], true) + AC_E_OPTIONAL_MODULE([geolocation], true) + AC_E_OPTIONAL_MODULE([xwayland], $have_wayland, [CHECK_MODULE_XWAYLAND]) + + if test "x${HAVE_WL_X11}" != "xyes" && test "x${have_wayland}" = "xyes" && test "x${HAVE_XWAYLAND}" != "xyes"; then + AC_DEFINE_UNQUOTED([HAVE_WAYLAND_ONLY],[1],[enable wayland-only version of enlightenment]) + have_wayland_only=yes + else + have_wayland_only=no + fi + + AM_CONDITIONAL([HAVE_WAYLAND_ONLY], [test "x${have_wayland_only}" = "xyes"]) + + if test "x${have_wayland_only}" != "xyes"; then + PKG_CHECK_MODULES(E_ALERT, [ + xcb + xcb-shape + xcb-keysyms + eina >= ${efl_version} + ecore >= ${efl_version} + ecore-ipc >= ${efl_version} + ]) + fi + + if test "x${have_wayland_only}" != "xyes"; then + e_requires="$e_requires ecore-x >= $efl_version" + fi + + PKG_CHECK_MODULES(E, [$e_requires]) + requirements_e="\ + evas >= ${efl_version} \ + ecore >= ${efl_version} \ + ecore-x >= ${efl_version} \ + ecore-evas >= ${efl_version} \ + ecore-con >= ${efl_version} \ + ecore-ipc >= ${efl_version} \ + ecore-file >= ${efl_version} \ + eet >= ${efl_version} \ + edje >= ${efl_version} \ + efreet >= ${efl_version} \ + efreet-mime >= ${efl_version} \ + efreet-trash >= ${efl_version} \ + eina >= ${efl_version} \ + eldbus >= ${efl_version} \ + eio >= ${efl_version} \ + eo >= ${efl_version} \ + elementary >= ${efl_version} \ + emotion >= ${efl_version} \ + $udisks_mount \ + $eeze_mount \ + $device_libs" + if test "x${have_wayland_only}" != "xyes"; then + requirements_e="$requirements_e ecore-x >= $efl_version" + fi + + e_libs="$E_LIBS $LIBINTL $fnmatch_libs $execinfo_libs" + e_cflags="-DUSE_E_CONFIG_H $E_CFLAGS" + e_configflags="-DUSE_E_CONFIG_H" + + AC_SUBST([e_libs]) + AC_SUBST([e_cflags]) + AC_SUBST([e_configflags]) + AC_SUBST([requirements_e]) ++>>>>>>> upstream HALT="/sbin/shutdown -h now" REBOOT="/sbin/shutdown -r now" diff --cc src/bin/Makefile.mk index 5d43eb0,3e7266d..d6eb784 --- a/src/bin/Makefile.mk +++ b/src/bin/Makefile.mk @@@ -389,33 -375,15 +387,41 @@@ src/bin/e_comp_wl_screenshooter_server. src/bin/e_comp_wl_data.c \ src/bin/e_comp_wl_input.c \ src/bin/e_comp_wl.c + +if HAVE_WAYLAND_TBM +enlightenment_src += \ +src/bin/e_comp_wl_tbm.c +endif + endif ++<<<<<<< HEAD +src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DEFL_BETA_API_SUPPORT -DEFL_EO_API_SUPPORT -DE_LOGGING=1 @WAYLAND_CFLAGS@ @WAYLAND_EGL_CFLAGS@ -DNEED_WL +if ! HAVE_WAYLAND_ONLY +src_bin_enlightenment_CPPFLAGS += @ECORE_X_CFLAGS@ -DNEED_X=1 +endif +if HAVE_WAYLAND_TBM +src_bin_enlightenment_CPPFLAGS += @WAYLAND_TBM_CFLAGS@ @ECORE_DRM_CFLAGS@ +endif ++======= + src_bin_enlightenment_CPPFLAGS = $(E_CPPFLAGS) -DEFL_BETA_API_SUPPORT -DEFL_EO_API_SUPPORT -DE_LOGGING=1 @WAYLAND_CFLAGS@ @WAYLAND_EGL_CFLAGS@ @ECORE_X_CFLAGS@ ++>>>>>>> upstream src_bin_enlightenment_SOURCES = \ src/bin/e_main.c \ $(enlightenment_src) src_bin_enlightenment_LDFLAGS = -export-dynamic ++<<<<<<< HEAD +src_bin_enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @WAYLAND_LIBS@ @WL_DRM_LIBS@ @WAYLAND_EGL_LIBS@ -lm @SHM_OPEN_LIBS@ +if ! HAVE_WAYLAND_ONLY +src_bin_enlightenment_LDADD += @ECORE_X_LIBS@ +endif +if HAVE_WAYLAND_TBM +src_bin_enlightenment_LDADD += @WAYLAND_TBM_LIBS@ @ECORE_DRM_LIBS@ +endif ++======= + src_bin_enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ @WAYLAND_LIBS@ @WL_DRM_LIBS@ @WAYLAND_EGL_LIBS@ -lm @SHM_OPEN_LIBS@ @ECORE_X_LIBS@ ++>>>>>>> upstream src_bin_enlightenment_imc_SOURCES = \ src/bin/e.h \ diff --cc src/bin/e_atoms.c index bdd917c,a1f58eb..c411b6c --- a/src/bin/e_atoms.c +++ b/src/bin/e_atoms.c @@@ -2,18 -2,18 +2,33 @@@ /* Atoms */ #ifndef HAVE_WAYLAND_ONLY ++<<<<<<< HEAD +EAPI Ecore_X_Atom E_ATOM_MANAGED = 0; +EAPI Ecore_X_Atom E_ATOM_ZONE = 0; +EAPI Ecore_X_Atom E_ATOM_DESK = 0; +EAPI Ecore_X_Atom E_ATOM_MAPPED = 0; +EAPI Ecore_X_Atom E_ATOM_SHADE_DIRECTION = 0; +EAPI Ecore_X_Atom E_ATOM_HIDDEN = 0; +EAPI Ecore_X_Atom E_ATOM_BORDER_SIZE = 0; +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_WINDOW_OPAQUE = 0; +EAPI Ecore_X_Atom E_ATOM_DESKTOP_FILE = 0; +EAPI Ecore_X_Atom E_ATOM_ZONE_GEOMETRY = 0; ++======= + E_API Ecore_X_Atom E_ATOM_MANAGED = 0; + E_API Ecore_X_Atom E_ATOM_ZONE = 0; + E_API Ecore_X_Atom E_ATOM_DESK = 0; + E_API Ecore_X_Atom E_ATOM_MAPPED = 0; + E_API Ecore_X_Atom E_ATOM_SHADE_DIRECTION = 0; + E_API Ecore_X_Atom E_ATOM_HIDDEN = 0; + E_API Ecore_X_Atom E_ATOM_BORDER_SIZE = 0; + E_API Ecore_X_Atom E_ATOM_WINDOW_STATE = 0; + E_API Ecore_X_Atom E_ATOM_WINDOW_STATE_CENTERED = 0; + E_API Ecore_X_Atom E_ATOM_DESKTOP_FILE = 0; + E_API Ecore_X_Atom E_ATOM_ZONE_GEOMETRY = 0; + E_API Ecore_X_Atom WL_SURFACE_ID = 0; ++>>>>>>> upstream #endif /* externally accessible functions */ @@@ -31,13 -31,13 +46,18 @@@ e_atoms_init(void "__E_WINDOW_BORDER_SIZE", "__E_ATOM_WINDOW_STATE", "__E_ATOM_WINDOW_STATE_CENTERED", + "__E_ATOM_WINDOW_OPAQUE", "__E_ATOM_DESKTOP_FILE", - "E_ZONE_GEOMETRY" + "E_ZONE_GEOMETRY", + "WL_SURFACE_ID" }; ++<<<<<<< HEAD + Ecore_X_Atom atoms[12]; ++======= + Ecore_X_Atom atoms[EINA_C_ARRAY_LENGTH(atom_names)]; ++>>>>>>> upstream - ecore_x_atoms_get(atom_names, 11, atoms); + ecore_x_atoms_get(atom_names, EINA_C_ARRAY_LENGTH(atom_names), atoms); E_ATOM_MANAGED = atoms[0]; E_ATOM_ZONE = atoms[1]; E_ATOM_DESK = atoms[2]; @@@ -47,9 -47,9 +67,15 @@@ E_ATOM_BORDER_SIZE = atoms[6]; E_ATOM_WINDOW_STATE = atoms[7]; E_ATOM_WINDOW_STATE_CENTERED = atoms[8]; ++<<<<<<< HEAD + E_ATOM_WINDOW_OPAQUE = atoms[9]; + E_ATOM_DESKTOP_FILE = atoms[10]; + E_ATOM_ZONE_GEOMETRY = atoms[11]; ++======= + E_ATOM_DESKTOP_FILE = atoms[9]; + E_ATOM_ZONE_GEOMETRY = atoms[10]; + WL_SURFACE_ID = atoms[11]; ++>>>>>>> upstream #endif return 1; } diff --cc src/bin/e_atoms.h index 2187270,a22ff65..39840bf --- a/src/bin/e_atoms.h +++ b/src/bin/e_atoms.h @@@ -20,12 -20,11 +20,17 @@@ extern E_API Ecore_X_Atom E_ATOM_DESKTO * * e_hints_window_e_state_set() * * _e_win_state_update() + e_win */ - extern EAPI Ecore_X_Atom E_ATOM_WINDOW_STATE; - extern EAPI Ecore_X_Atom E_ATOM_WINDOW_STATE_CENTERED; + extern E_API Ecore_X_Atom E_ATOM_WINDOW_STATE; + extern E_API Ecore_X_Atom E_ATOM_WINDOW_STATE_CENTERED; ++<<<<<<< HEAD +extern EAPI Ecore_X_Atom E_ATOM_WINDOW_OPAQUE; + +extern EAPI Ecore_X_Atom E_ATOM_ZONE_GEOMETRY; ++======= + extern E_API Ecore_X_Atom E_ATOM_ZONE_GEOMETRY; + extern E_API Ecore_X_Atom WL_SURFACE_ID; ++>>>>>>> upstream EINTERN int e_atoms_init(void); EINTERN int e_atoms_shutdown(void); diff --cc src/bin/e_auth.h index 67c7ada,a91f064..0f7576f --- a/src/bin/e_auth.h +++ b/src/bin/e_auth.h @@@ -1,6 -1,9 +1,12 @@@ #ifndef E_AUTH_H #define E_AUTH_H ++<<<<<<< HEAD ++======= + E_API int e_auth_begin(char *passwd); + E_API char *e_auth_hostname_get(void); + ++>>>>>>> upstream static inline int e_auth_hash_djb2(const char *key, int len) { diff --cc src/bin/e_backlight.c index aa3bfd5,89552e3..0dc51b5 --- a/src/bin/e_backlight.c +++ b/src/bin/e_backlight.c @@@ -198,17 -202,8 +202,17 @@@ e_backlight_devices_get(void /* local subsystem functions */ static void - _e_backlight_update(E_Zone *zone) + _e_backlight_update(void) { +#ifdef _F_DISABLE_BACKLIGHT_MOD_SUPPORT + /* MODE_SYS makes e possible to change nodes in /sys/class/leds. + * Thus, it can turn on the backlight of the camera. + * In order to avoid this case, we always fix sysmode to MODE_NONE. + */ + sysmode = MODE_NONE; + return; +#endif /* end of _F_DISABLE_BACKLIGHT_MOD_SUPPORT */ + #ifndef HAVE_WAYLAND_ONLY double x_bl = -1.0; Ecore_X_Window root; diff --cc src/bin/e_client.c index 362ae1c,28191e9..81abb4b --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@@ -3,35 -3,26 +3,58 @@@ static int _e_client_hooks_delete = 0; static int _e_client_hooks_walking = 0; ++<<<<<<< HEAD +EAPI int E_EVENT_CLIENT_ADD = -1; +EAPI int E_EVENT_CLIENT_REMOVE = -1; +EAPI int E_EVENT_CLIENT_ZONE_SET = -1; +EAPI int E_EVENT_CLIENT_DESK_SET = -1; +EAPI int E_EVENT_CLIENT_RESIZE = -1; +EAPI int E_EVENT_CLIENT_MOVE = -1; +EAPI int E_EVENT_CLIENT_SHOW = -1; +EAPI int E_EVENT_CLIENT_HIDE = -1; +EAPI int E_EVENT_CLIENT_ICONIFY = -1; +EAPI int E_EVENT_CLIENT_UNICONIFY = -1; +EAPI int E_EVENT_CLIENT_STACK = -1; +EAPI int E_EVENT_CLIENT_FOCUS_IN = -1; +EAPI int E_EVENT_CLIENT_FOCUS_OUT = -1; +EAPI int E_EVENT_CLIENT_PROPERTY = -1; +EAPI int E_EVENT_CLIENT_FULLSCREEN = -1; +EAPI int E_EVENT_CLIENT_UNFULLSCREEN = -1; +#ifdef _F_ZONE_WINDOW_ROTATION_ +EAPI int E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = -1; +EAPI int E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = -1; +EAPI int E_EVENT_CLIENT_ROTATION_CHANGE_END = -1; +#endif +EAPI int E_EVENT_CLIENT_VISIBILITY_CHANGE = -1; +#ifdef HAVE_WAYLAND_ONLY +EAPI int E_EVENT_CLIENT_BUFFER_CHANGE = -1; +#endif + +static Eina_Hash *clients_hash = NULL; // pixmap->client + +static int focus_track_frozen = 0; ++======= + E_API int E_EVENT_CLIENT_ADD = -1; + E_API int E_EVENT_CLIENT_REMOVE = -1; + E_API int E_EVENT_CLIENT_ZONE_SET = -1; + E_API int E_EVENT_CLIENT_DESK_SET = -1; + E_API int E_EVENT_CLIENT_RESIZE = -1; + E_API int E_EVENT_CLIENT_MOVE = -1; + E_API int E_EVENT_CLIENT_SHOW = -1; + E_API int E_EVENT_CLIENT_HIDE = -1; + E_API int E_EVENT_CLIENT_ICONIFY = -1; + E_API int E_EVENT_CLIENT_UNICONIFY = -1; + E_API int E_EVENT_CLIENT_STACK = -1; + E_API int E_EVENT_CLIENT_FOCUS_IN = -1; + E_API int E_EVENT_CLIENT_FOCUS_OUT = -1; + E_API int E_EVENT_CLIENT_PROPERTY = -1; + E_API int E_EVENT_CLIENT_FULLSCREEN = -1; + E_API int E_EVENT_CLIENT_UNFULLSCREEN = -1; + + static Eina_Hash *clients_hash[2] = {NULL}; // pixmap->client + + static unsigned int focus_track_frozen = 0; ++>>>>>>> upstream static int warp_to = 0; static int warp_to_x = 0; @@@ -354,8 -343,8 +384,9 @@@ _e_client_event_simple(E_Client *ec, in E_Event_Client *ev; ev = E_NEW(E_Event_Client, 1); + if (!ev) return; ev->ec = ec; + REFD(ec, 3); e_object_ref(E_OBJECT(ec)); ecore_event_add(type, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL); } @@@ -366,9 -355,9 +397,10 @@@ _e_client_event_property(E_Client *ec, E_Event_Client_Property *ev; ev = E_NEW(E_Event_Client_Property, 1); + if (!ev) return; ev->ec = ec; ev->property = prop; + REFD(ec, 33); e_object_ref(E_OBJECT(ec)); ecore_event_add(E_EVENT_CLIENT_PROPERTY, ev, (Ecore_End_Cb)_e_client_event_simple_free, NULL); } @@@ -722,8 -420,8 +764,9 @@@ _e_client_revert_focus(E_Client *ec if (stopping) return; if (!ec->focused) return; + if (!ec->zone) return; desk = e_desk_current_get(ec->zone); + if (!desk) return; if (ec->desk == desk) evas_object_focus_set(ec->frame, 0); @@@ -849,9 -547,21 +892,25 @@@ _e_client_free(E_Client *ec raise_stack = eina_list_remove(raise_stack, ec); e_hints_client_list_set(); + if (ec->e.state.profile.wait_desk) + { + e_object_delfn_del(E_OBJECT(ec->e.state.profile.wait_desk), + ec->e.state.profile.wait_desk_delfn); + ec->e.state.profile.wait_desk_delfn = NULL; + e_object_unref(E_OBJECT(ec->e.state.profile.wait_desk)); + } + ec->e.state.profile.wait_desk = NULL; evas_object_del(ec->frame); E_OBJECT(ec)->references--; ++<<<<<<< HEAD + ELOG("CLIENT FREE", ec->pixmap, ec); ++======= + + #ifdef HAVE_WAYLAND + e_uuid_store_entry_del(ec->uuid); + #endif + ++>>>>>>> upstream free(ec); } @@@ -943,10 -653,9 +1004,10 @@@ _e_client_del(E_Client *ec EINA_LIST_FREE(ec->group, child) child->leader = NULL; - eina_hash_del_by_key(clients_hash, &ec->pixmap); - ec->comp->clients = eina_list_remove(ec->comp->clients, ec); + eina_hash_del_by_key(clients_hash[e_pixmap_type_get(ec->pixmap)], &ec->pixmap); + e_comp->clients = eina_list_remove(e_comp->clients, ec); e_comp_object_render_update_del(ec->frame); + e_comp_post_update_purge(ec); if (e_pixmap_free(ec->pixmap)) e_pixmap_client_set(ec->pixmap, NULL); ec->pixmap = NULL; @@@ -1828,26 -1519,14 +1894,26 @@@ _e_client_cb_evas_restack(void *data, E E_LIST_REVERSE_FREE(list, child) { /* Don't stack iconic transients. If the user wants these shown, - * thats another option. + * that's another option. */ if (child->iconic) continue; - if (below) - evas_object_stack_below(child->frame, below->frame); - else - evas_object_stack_above(child->frame, ec->frame); - below = child; + if (child->transient_policy == E_TRANSIENT_ABOVE) + { + if (below) + evas_object_stack_below(child->frame, below->frame); + else + evas_object_stack_above(child->frame, ec->frame); + below = child; + } + else if (child->transient_policy == E_TRANSIENT_BELOW) + { + if (above) + evas_object_stack_above(child->frame, above->frame); + else + evas_object_stack_below(child->frame, ec->frame); + above = child; + } + } } if (ec->unredirected_single) return; @@@ -2501,13 -2180,18 +2570,21 @@@ _e_client_eval(E_Client *ec } e_comp_object_frame_icon_update(ec->frame); - if ((ec->new_client || ec->re_manage) && ec->desktop && (!ec->exe_inst)) - e_exec_phony(ec); + if (ec->desktop) + { + if (!ec->exe_inst) + e_exec_phony(ec); + if (!ec->exe_inst->desktop) + { + efreet_desktop_ref(ec->desktop); + ec->exe_inst->desktop = ec->desktop; + } + } ec->changes.icon = 0; prop |= E_CLIENT_PROPERTY_ICON; +#else + ec->changes.icon = 0; +#endif } ec->new_client = 0; @@@ -2896,11 -2335,9 +2977,11 @@@ e_client_idler_before(void EINA_LIST_FOREACH(e_comp->clients, l, ec) { Eina_Stringshare *title; + int client_type; + // pass 1 - eval0. fetch properties on new or on change and // call hooks to decide what to do - maybe move/resize - if (!ec->changed) continue; + if (ec->ignored || (!ec->changed)) continue; if (!_e_client_hook_call(E_CLIENT_HOOK_EVAL_PRE_FETCH, ec)) continue; /* FETCH is hooked by the compositor to get client hints */ @@@ -3014,17 -2442,8 +3098,17 @@@ e_client_init(void E_EVENT_CLIENT_PROPERTY = ecore_event_type_new(); E_EVENT_CLIENT_FULLSCREEN = ecore_event_type_new(); E_EVENT_CLIENT_UNFULLSCREEN = ecore_event_type_new(); +#ifdef _F_ZONE_WINDOW_ROTATION_ + E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN = ecore_event_type_new(); + E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL = ecore_event_type_new(); + E_EVENT_CLIENT_ROTATION_CHANGE_END = ecore_event_type_new(); +#endif + E_EVENT_CLIENT_VISIBILITY_CHANGE = ecore_event_type_new(); +#ifdef HAVE_WAYLAND_ONLY + E_EVENT_CLIENT_BUFFER_CHANGE = ecore_event_type_new(); +#endif - return (!!clients_hash); + return (!!clients_hash[1]); } EINTERN void @@@ -3081,12 -2518,8 +3183,12 @@@ e_client_new(E_Pixmap *cp, int first_ma } ec->offer_resistance = 1; ec->new_client = 1; - ec->comp->new_clients++; + e_comp->new_clients++; + ec->exp_iconify.by_client = 0; + ec->exp_iconify.not_raise = 0; + ec->exp_iconify.skip_iconify = 0; + if (!_e_client_hook_call(E_CLIENT_HOOK_NEW_CLIENT, ec)) { /* delete the above allocated object */ @@@ -3151,10 -2577,10 +3253,15 @@@ EC_CHANGED(ec); e_comp->clients = eina_list_append(e_comp->clients, ec); - eina_hash_add(clients_hash, &ec->pixmap, ec); + eina_hash_add(clients_hash[e_pixmap_type_get(cp)], &ec->pixmap, ec); ++<<<<<<< HEAD + ELOG("CLIENT ADD", ec->pixmap, ec); + _e_client_event_simple(ec, E_EVENT_CLIENT_ADD); ++======= + if (!ec->ignored) + _e_client_event_simple(ec, E_EVENT_CLIENT_ADD); ++>>>>>>> upstream e_comp_object_client_add(ec); if (ec->frame) { @@@ -3290,14 -2716,12 +3402,23 @@@ e_client_desk_set(E_Client *ec, E_Desk if (old_desk) { ev = E_NEW(E_Event_Client_Desk_Set, 1); ++<<<<<<< HEAD + if (ev) + { + ev->ec = ec; + e_object_ref(E_OBJECT(ec)); + ev->desk = old_desk; + e_object_ref(E_OBJECT(old_desk)); + ecore_event_add(E_EVENT_CLIENT_DESK_SET, ev, (Ecore_End_Cb)_e_client_event_desk_set_free, NULL); + } ++======= + ev->ec = ec; + UNREFD(ec, 4); + e_object_ref(E_OBJECT(ec)); + ev->desk = old_desk; + e_object_ref(E_OBJECT(old_desk)); + ecore_event_add(E_EVENT_CLIENT_DESK_SET, ev, (Ecore_End_Cb)_e_client_event_desk_set_free, NULL); ++>>>>>>> upstream if (old_desk->zone == ec->zone) { @@@ -3742,7 -3173,9 +3873,8 @@@ e_client_zone_set(E_Client *ec, E_Zone if ((!ec->desk) || (ec->desk->zone != ec->zone)) e_client_desk_set(ec, e_desk_current_get(ec->zone)); - ev = E_NEW(E_Event_Client_Zone_Set, 1); ev->ec = ec; + REFD(ec, 5); e_object_ref(E_OBJECT(ec)); ev->zone = zone; e_object_ref(E_OBJECT(zone)); @@@ -3789,10 -3222,10 +3921,10 @@@ e_client_above_get(const E_Client *ec if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL; /* go up the layers until we find one */ - for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); x++) + for (x = e_comp_canvas_layer_map(ec->layer) + 1; x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT); x++) { - if (!ec->comp->layers[x].clients) continue; - EINA_INLIST_FOREACH(ec->comp->layers[x].clients, ec2) + if (!e_comp->layers[x].clients) continue; + EINA_INLIST_FOREACH(e_comp->layers[x].clients, ec2) if (!e_object_is_del(E_OBJECT(ec2))) return ec2; } @@@ -3819,14 -3252,17 +3951,21 @@@ e_client_below_get(const E_Client *ec return ec2; } } - if (ec->layer == E_LAYER_CLIENT_DESKTOP) return NULL; - if (e_comp_canvas_client_layer_map(ec->layer) == 9999) return NULL; /* go down the layers until we find one */ ++<<<<<<< HEAD + if (e_comp_canvas_layer_map(ec->layer) == 9999) return NULL; + if (e_comp_canvas_layer_map(ec->layer) <= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP)) return NULL; + for (x = e_comp_canvas_layer_map(ec->layer) - 1; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--) ++======= + x = e_comp_canvas_layer_map(ec->layer); + if (x > 0) x--; + + for (; x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--) ++>>>>>>> upstream { - if (!ec->comp->layers[x].clients) continue; - EINA_INLIST_REVERSE_FOREACH(ec->comp->layers[x].clients, ec2) + if (!e_comp->layers[x].clients) continue; + EINA_INLIST_REVERSE_FOREACH(e_comp->layers[x].clients, ec2) if (!e_object_is_del(E_OBJECT(ec2))) return ec2; } @@@ -3838,9 -3274,7 +3977,13 @@@ e_client_bottom_get(void { unsigned int x; ++<<<<<<< HEAD + EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL); + + for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT); x++) ++======= + for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); x++) ++>>>>>>> upstream { E_Client *ec2; @@@ -3857,9 -3291,7 +4000,13 @@@ e_client_top_get(void { unsigned int x; ++<<<<<<< HEAD + EINA_SAFETY_ON_NULL_RETURN_VAL(c, NULL); + + for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--) ++======= + for (x = e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); x >= e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); x--) ++>>>>>>> upstream { E_Client *ec2; @@@ -4035,9 -3473,8 +4185,9 @@@ e_client_focused_set(E_Client *ec Eina_List *l, *ll; if (ec == focused) return; + ELOG("CLIENT FOCUS_SET", NULL, ec); focused = ec; - if (ec) + if ((ec) && (ec->zone)) { ec->focused = 1; e_client_urgent_set(ec, 0); @@@ -4446,13 -3900,10 +4617,19 @@@ e_client_fullscreen(E_Client *ec, E_Ful E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); + if (!ec->zone) return; ++<<<<<<< HEAD + if ((ec->shaded) || (ec->shading) || (ec->fullscreen)) return; + + _e_client_hook_call(E_CLIENT_HOOK_FULLSCREEN_PRE, ec); + + if (ec->skip_fullscreen) return; + ++======= + if ((ec->shaded) || (ec->shading) || ec->fullscreen) return; + if ((!e_config->allow_above_fullscreen) && (!ec->desk->visible)) return; ++>>>>>>> upstream if (ec->new_client) { ec->need_fullscreen = 1; @@@ -4568,11 -4022,7 +4748,15 @@@ e_client_iconify(E_Client *ec { E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); ++<<<<<<< HEAD + + ELOGF("TZVIS", "ICONIFY |not_raise:%d |by_client:%d", + ec->pixmap, ec, (unsigned int)ec->exp_iconify.not_raise, + ec->exp_iconify.by_client); + ++======= + if (!ec->zone) return; ++>>>>>>> upstream if (ec->shading || ec->iconic) return; ec->iconic = 1; ec->want_focus = ec->take_focus = 0; @@@ -4612,11 -4057,7 +4795,15 @@@ e_client_uniconify(E_Client *ec E_OBJECT_CHECK(ec); E_OBJECT_TYPE_CHECK(ec, E_CLIENT_TYPE); ++<<<<<<< HEAD + + ELOGF("TZVIS", "UNICONIFY|not_raise:%d |by_client:%d", + ec->pixmap, ec, (unsigned int)ec->exp_iconify.not_raise, + ec->exp_iconify.by_client); + ++======= + if (!ec->zone) return; ++>>>>>>> upstream if (ec->shading || (!ec->iconic)) return; desk = e_desk_current_get(ec->desk->zone); e_client_desk_set(ec, desk); @@@ -5178,11 -4627,9 +5387,11 @@@ e_client_resize_begin(E_Client *ec if ((ec->shaded) || (ec->shading) || (ec->fullscreen) || (ec->lock_user_size)) goto error; - if (!_e_client_action_input_win_new(ec)) goto error; + if (!_e_client_action_input_win_new()) goto error; ecresize = ec; _e_client_hook_call(E_CLIENT_HOOK_RESIZE_BEGIN, ec); + if (ec->transformed) + _e_client_transform_resize_begin(ec); if (!e_client_util_resizing_get(ec)) { if (ecresize == ec) ecresize = NULL; diff --cc src/bin/e_client.h index de9dd7e,14427b9..cfc66fb --- a/src/bin/e_client.h +++ b/src/bin/e_client.h @@@ -809,20 -696,11 +814,24 @@@ struct E_Clien Eina_Bool ignored : 1; // client is comp-ignored Eina_Bool no_shape_cut : 1; // client shape should not be cut Eina_Bool maximize_override : 1; // client is doing crazy stuff and should "just do it" when moving/resizing ++<<<<<<< HEAD + Eina_Bool transformed : 1; ++======= + Eina_Bool keyboard_resizing : 1; ++>>>>>>> upstream - #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + #ifdef HAVE_WAYLAND uuid_t uuid; #endif + + int client_type; //e_client_type + + struct + { + unsigned char by_client : 1; + unsigned char not_raise : 1; + unsigned char skip_iconify : 1; + } exp_iconify; }; #define e_client_focus_policy_click(ec) \ @@@ -841,127 -719,116 +850,232 @@@ # define EC_CHANGED(EC) EC->changed = 1 #endif - #define E_CLIENT_FOREACH(COMP, EC) \ - for (EC = e_client_bottom_get(COMP); EC; EC = e_client_above_get(EC)) + #define E_CLIENT_FOREACH(EC) \ + for (EC = e_client_bottom_get(); EC; EC = e_client_above_get(EC)) - #define E_CLIENT_REVERSE_FOREACH(COMP, EC) \ - for (EC = e_client_top_get(COMP); EC; EC = e_client_below_get(EC)) + #define E_CLIENT_REVERSE_FOREACH(EC) \ + for (EC = e_client_top_get(); EC; EC = e_client_below_get(EC)) ++<<<<<<< HEAD +EAPI extern int E_EVENT_CLIENT_ADD; +EAPI extern int E_EVENT_CLIENT_REMOVE; +EAPI extern int E_EVENT_CLIENT_ZONE_SET; +EAPI extern int E_EVENT_CLIENT_DESK_SET; +EAPI extern int E_EVENT_CLIENT_RESIZE; +EAPI extern int E_EVENT_CLIENT_MOVE; +EAPI extern int E_EVENT_CLIENT_SHOW; +EAPI extern int E_EVENT_CLIENT_HIDE; +EAPI extern int E_EVENT_CLIENT_ICONIFY; +EAPI extern int E_EVENT_CLIENT_UNICONIFY; +EAPI extern int E_EVENT_CLIENT_STACK; +EAPI extern int E_EVENT_CLIENT_FOCUS_IN; +EAPI extern int E_EVENT_CLIENT_FOCUS_OUT; +EAPI extern int E_EVENT_CLIENT_PROPERTY; +EAPI extern int E_EVENT_CLIENT_FULLSCREEN; +EAPI extern int E_EVENT_CLIENT_UNFULLSCREEN; +#ifdef _F_ZONE_WINDOW_ROTATION_ +EAPI extern int E_EVENT_CLIENT_ROTATION_CHANGE_BEGIN; +EAPI extern int E_EVENT_CLIENT_ROTATION_CHANGE_CANCEL; +EAPI extern int E_EVENT_CLIENT_ROTATION_CHANGE_END; +#endif +EAPI extern int E_EVENT_CLIENT_VISIBILITY_CHANGE; +#ifdef HAVE_WAYLAND_ONLY +EAPI extern int E_EVENT_CLIENT_BUFFER_CHANGE; +#endif ++======= + E_API extern int E_EVENT_CLIENT_ADD; + E_API extern int E_EVENT_CLIENT_REMOVE; + E_API extern int E_EVENT_CLIENT_ZONE_SET; + E_API extern int E_EVENT_CLIENT_DESK_SET; + E_API extern int E_EVENT_CLIENT_RESIZE; + E_API extern int E_EVENT_CLIENT_MOVE; + E_API extern int E_EVENT_CLIENT_SHOW; + E_API extern int E_EVENT_CLIENT_HIDE; + E_API extern int E_EVENT_CLIENT_ICONIFY; + E_API extern int E_EVENT_CLIENT_UNICONIFY; + E_API extern int E_EVENT_CLIENT_STACK; + E_API extern int E_EVENT_CLIENT_FOCUS_IN; + E_API extern int E_EVENT_CLIENT_FOCUS_OUT; + E_API extern int E_EVENT_CLIENT_PROPERTY; + E_API extern int E_EVENT_CLIENT_FULLSCREEN; + E_API extern int E_EVENT_CLIENT_UNFULLSCREEN; + ++>>>>>>> upstream EINTERN void e_client_idler_before(void); EINTERN Eina_Bool e_client_init(void); EINTERN void e_client_shutdown(void); ++<<<<<<< HEAD +EAPI E_Client *e_client_new(E_Comp *c, E_Pixmap *cp, int first_map, int internal); +EAPI void e_client_desk_set(E_Client *ec, E_Desk *desk); +EAPI Eina_Bool e_client_comp_grabbed_get(void); +EAPI E_Client *e_client_action_get(void); +EAPI E_Client *e_client_warping_get(void); +EAPI Eina_List *e_clients_immortal_list(void); +EAPI void e_client_mouse_in(E_Client *ec, int x, int y); +EAPI void e_client_mouse_out(E_Client *ec, int x, int y); +EAPI void e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev); +EAPI void e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev); +EAPI void e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev); +EAPI void e_client_mouse_move(E_Client *ec, Evas_Point *output); +EAPI void e_client_res_change_geometry_save(E_Client *bd); +EAPI void e_client_res_change_geometry_restore(E_Client *ec); +EAPI void e_client_zone_set(E_Client *ec, E_Zone *zone); +EAPI void e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h); +EAPI E_Client *e_client_above_get(const E_Client *ec); +EAPI E_Client *e_client_below_get(const E_Client *ec); +EAPI E_Client *e_client_bottom_get(const E_Comp *c); +EAPI E_Client *e_client_top_get(const E_Comp *c); +EAPI unsigned int e_clients_count(E_Comp *c); +EAPI void e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb); +EAPI E_Client_Hook *e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data); +EAPI void e_client_hook_del(E_Client_Hook *ch); +EAPI void e_client_focus_latest_set(E_Client *ec); +EAPI void e_client_raise_latest_set(E_Client *ec); +EAPI Eina_Bool e_client_focus_track_enabled(void); +EAPI void e_client_focus_track_freeze(void); +EAPI void e_client_focus_track_thaw(void); +EAPI void e_client_refocus(void); +EAPI void e_client_focus_set_with_pointer(E_Client *ec); +EAPI void e_client_activate(E_Client *ec, Eina_Bool just_do_it); +EAPI E_Client *e_client_focused_get(void); +EAPI Eina_List *e_client_focus_stack_get(void); +EAPI Eina_List *e_client_raise_stack_get(void); +EAPI Eina_List *e_client_lost_windows_get(E_Zone *zone); +EAPI void e_client_shade(E_Client *ec, E_Direction dir); +EAPI void e_client_unshade(E_Client *ec, E_Direction dir); +EAPI void e_client_maximize(E_Client *ec, E_Maximize max); +EAPI void e_client_unmaximize(E_Client *ec, E_Maximize max); +EAPI void e_client_fullscreen(E_Client *ec, E_Fullscreen policy); +EAPI void e_client_unfullscreen(E_Client *ec); +EAPI void e_client_iconify(E_Client *ec); +EAPI void e_client_uniconify(E_Client *ec); +EAPI void e_client_urgent_set(E_Client *ec, Eina_Bool urgent); +EAPI void e_client_stick(E_Client *ec); +EAPI void e_client_unstick(E_Client *ec); +EAPI void e_client_pinned_set(E_Client *ec, Eina_Bool set); +EAPI void e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden); +EAPI Eina_Bool e_client_border_set(E_Client *ec, const char *name); +EAPI void e_client_act_move_keyboard(E_Client *ec); +EAPI void e_client_act_resize_keyboard(E_Client *ec); +EAPI void e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev); +EAPI void e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED); +EAPI void e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev); +EAPI void e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED); +EAPI void e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key); +EAPI void e_client_act_close_begin(E_Client *ec); +EAPI void e_client_act_kill_begin(E_Client *ec); +EAPI Evas_Object *e_client_icon_add(E_Client *ec, Evas *evas); +EAPI void e_client_ping(E_Client *cw); +EAPI void e_client_move_cancel(void); +EAPI void e_client_resize_cancel(void); +EAPI Eina_Bool e_client_resize_begin(E_Client *ec); +EAPI void e_client_frame_recalc(E_Client *ec); +EAPI void e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED); +EAPI void e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED); +EAPI void e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED); +EAPI void e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED); +EAPI void e_client_resize_limit(E_Client *ec, int *w, int *h); +EAPI E_Client *e_client_under_pointer_get(E_Desk *desk, E_Client *exclude); +EAPI int e_client_pointer_warp_to_center_now(E_Client *ec); +EAPI int e_client_pointer_warp_to_center(E_Client *ec); +EAPI void e_client_redirected_set(E_Client *ec, Eina_Bool set); +EAPI Eina_Bool e_client_is_stacking(const E_Client *ec); +EAPI Eina_Bool e_client_desk_window_profile_available_check(E_Client *ec, const char *profile); +EAPI void e_client_desk_window_profile_wait_desk_set(E_Client *ec, E_Desk *desk); +EAPI void e_client_layout_cb_set(E_Client_Layout_Cb cb); +EAPI void e_client_visibility_calculate(void); + +EAPI void e_client_transform_update(E_Client *ec); +EAPI void e_client_transform_apply(E_Client *ec, double degree, double zoom, int cx, int cy); +EAPI void e_client_transform_clear(E_Client *ec); + +YOLO EAPI void e_client_focus_stack_set(Eina_List *l); ++======= + E_API E_Client *e_client_new(E_Pixmap *cp, int first_map, int internal); + E_API void e_client_unignore(E_Client *ec); + E_API void e_client_desk_set(E_Client *ec, E_Desk *desk); + E_API Eina_Bool e_client_comp_grabbed_get(void); + E_API E_Client *e_client_action_get(void); + E_API E_Client *e_client_warping_get(void); + E_API Eina_List *e_clients_immortal_list(void); + E_API void e_client_mouse_in(E_Client *ec, int x, int y); + E_API void e_client_mouse_out(E_Client *ec, int x, int y); + E_API void e_client_mouse_wheel(E_Client *ec, Evas_Point *output, E_Binding_Event_Wheel *ev); + E_API void e_client_mouse_down(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button *ev); + E_API void e_client_mouse_up(E_Client *ec, int button, Evas_Point *output, E_Binding_Event_Mouse_Button* ev); + E_API void e_client_mouse_move(E_Client *ec, Evas_Point *output); + E_API void e_client_res_change_geometry_save(E_Client *bd); + E_API void e_client_res_change_geometry_restore(E_Client *ec); + E_API void e_client_zone_set(E_Client *ec, E_Zone *zone); + E_API void e_client_geometry_get(E_Client *ec, int *x, int *y, int *w, int *h); + E_API E_Client *e_client_above_get(const E_Client *ec); + E_API E_Client *e_client_below_get(const E_Client *ec); + E_API E_Client *e_client_bottom_get(void); + E_API E_Client *e_client_top_get(void); + E_API unsigned int e_clients_count(void); + E_API void e_client_move_intercept_cb_set(E_Client *ec, E_Client_Move_Intercept_Cb cb); + E_API E_Client_Hook *e_client_hook_add(E_Client_Hook_Point hookpoint, E_Client_Hook_Cb func, const void *data); + E_API void e_client_hook_del(E_Client_Hook *ch); + E_API void e_client_focus_latest_set(E_Client *ec); + E_API void e_client_raise_latest_set(E_Client *ec); + E_API Eina_Bool e_client_focus_track_enabled(void); + E_API void e_client_focus_track_freeze(void); + E_API void e_client_focus_track_thaw(void); + E_API void e_client_refocus(void); + E_API void e_client_focus_set_with_pointer(E_Client *ec); + E_API void e_client_activate(E_Client *ec, Eina_Bool just_do_it); + E_API E_Client *e_client_focused_get(void); + E_API Eina_List *e_client_focus_stack_get(void); + E_API Eina_List *e_client_raise_stack_get(void); + E_API Eina_List *e_client_lost_windows_get(E_Zone *zone); + E_API void e_client_shade(E_Client *ec, E_Direction dir); + E_API void e_client_unshade(E_Client *ec, E_Direction dir); + E_API void e_client_maximize(E_Client *ec, E_Maximize max); + E_API void e_client_unmaximize(E_Client *ec, E_Maximize max); + E_API void e_client_fullscreen(E_Client *ec, E_Fullscreen policy); + E_API void e_client_unfullscreen(E_Client *ec); + E_API void e_client_iconify(E_Client *ec); + E_API void e_client_uniconify(E_Client *ec); + E_API void e_client_urgent_set(E_Client *ec, Eina_Bool urgent); + E_API void e_client_stick(E_Client *ec); + E_API void e_client_unstick(E_Client *ec); + E_API void e_client_pinned_set(E_Client *ec, Eina_Bool set); + E_API void e_client_comp_hidden_set(E_Client *ec, Eina_Bool hidden); + E_API Eina_Bool e_client_border_set(E_Client *ec, const char *name); + E_API void e_client_act_move_keyboard(E_Client *ec); + E_API void e_client_act_resize_keyboard(E_Client *ec); + E_API void e_client_act_move_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev); + E_API void e_client_act_move_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED); + E_API void e_client_act_resize_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev); + E_API void e_client_act_resize_end(E_Client *ec, E_Binding_Event_Mouse_Button *ev EINA_UNUSED); + E_API void e_client_act_menu_begin(E_Client *ec, E_Binding_Event_Mouse_Button *ev, int key); + E_API void e_client_act_close_begin(E_Client *ec); + E_API void e_client_act_kill_begin(E_Client *ec); + E_API Evas_Object *e_client_icon_add(E_Client *ec, Evas *evas); + E_API void e_client_ping(E_Client *cw); + E_API void e_client_move_cancel(void); + E_API void e_client_resize_cancel(void); + E_API Eina_Bool e_client_resize_begin(E_Client *ec); + E_API void e_client_frame_recalc(E_Client *ec); + E_API void e_client_signal_move_begin(E_Client *ec, const char *sig, const char *src EINA_UNUSED); + E_API void e_client_signal_move_end(E_Client *ec, const char *sig EINA_UNUSED, const char *src EINA_UNUSED); + E_API void e_client_signal_resize_begin(E_Client *ec, const char *dir, const char *sig, const char *src EINA_UNUSED); + E_API void e_client_signal_resize_end(E_Client *ec, const char *dir EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED); + E_API void e_client_resize_limit(E_Client *ec, int *w, int *h); + E_API E_Client *e_client_under_pointer_get(E_Desk *desk, E_Client *exclude); + E_API int e_client_pointer_warp_to_center_now(E_Client *ec); + E_API int e_client_pointer_warp_to_center(E_Client *ec); + E_API void e_client_redirected_set(E_Client *ec, Eina_Bool set); + E_API Eina_Bool e_client_is_stacking(const E_Client *ec); + E_API Eina_Bool e_client_has_xwindow(const E_Client *ec); + E_API Eina_Bool e_client_desk_window_profile_available_check(E_Client *ec, const char *profile); + E_API void e_client_desk_window_profile_wait_desk_set(E_Client *ec, E_Desk *desk); + E_API void e_client_layout_cb_set(E_Client_Layout_Cb cb); + + YOLO E_API void e_client_focus_stack_set(Eina_List *l); ++>>>>>>> upstream #include "e_client.x" #endif diff --cc src/bin/e_comp.c index cc225ba,ce2d1e5..03e2eba --- a/src/bin/e_comp.c +++ b/src/bin/e_comp.c @@@ -36,10 -38,9 +38,16 @@@ static double ecore_frametime = 0 static int _e_comp_log_dom = -1; ++<<<<<<< HEAD +EAPI int E_EVENT_COMPOSITOR_RESIZE = -1; +EAPI int E_EVENT_COMPOSITOR_DISABLE = -1; +EAPI int E_EVENT_COMPOSITOR_ENABLE = -1; +EAPI int E_EVENT_COMPOSITOR_FPS_UPDATE = -1; ++======= + E_API int E_EVENT_COMPOSITOR_RESIZE = -1; + E_API int E_EVENT_COMPOSITOR_DISABLE = -1; + E_API int E_EVENT_COMPOSITOR_ENABLE = -1; ++>>>>>>> upstream ////////////////////////////////////////////////////////////////////////// #undef DBG @@@ -374,10 -397,9 +404,14 @@@ _e_comp_cb_update(void { /* clear update flag */ e_comp_object_render_update_del(ec->frame); ++<<<<<<< HEAD + if (_e_comp_client_update(ec)) + e_comp_post_update_add(ec); ++======= + _e_comp_client_update(ec); ++>>>>>>> upstream } - _e_comp_fps_update(c); + _e_comp_fps_update(); if (conf->fps_show) { char buf[128]; @@@ -433,39 -455,10 +467,39 @@@ break; } } - evas_object_move(c->fps_bg, x, y); - evas_object_resize(c->fps_bg, w, h); - evas_object_move(c->fps_fg, x + 4, y + 4); + evas_object_move(e_comp->fps_bg, x, y); + evas_object_resize(e_comp->fps_bg, w, h); + evas_object_move(e_comp->fps_fg, x + 4, y + 4); } + else + { + if (c->calc_fps) + { + double fps = 0.0, dt; + double t = ecore_time_get(); + int i, avg_range = 60; + + dt = t - c->frametimes[avg_range - 1]; + + if (dt > 0.0) fps = (double)avg_range / dt; + else fps = 0.0; + + if (fps > 60.0) fps = 60.0; + if (fps < 0.0) fps = 0.0; + + for (i = avg_range; i >= 1; i--) + c->frametimes[i] = c->frametimes[i - 1]; + + c->frametimes[0] = t; + c->frameskip++; + if (c->frameskip >= avg_range) + { + c->frameskip = 0; + c->fps = fps; + ecore_event_add(E_EVENT_COMPOSITOR_FPS_UPDATE, NULL, NULL, NULL); + } + } + } if (conf->lock_fps) { DBG("MANUAL RENDER..."); @@@ -734,15 -728,17 +769,24 @@@ _e_comp_shapes_update_job(void *d EINA_ INF("---------------------"); #endif ++<<<<<<< HEAD + E_FREE_LIST(c->debug_rects, evas_object_del); + tb = eina_tiler_new(c->man->w, c->man->h); + EINA_SAFETY_ON_NULL_GOTO(tb, tb_fail); + ++======= + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + win = e_comp->win; + else + win = e_comp->cm_selection; + E_FREE_LIST(e_comp->debug_rects, evas_object_del); + tb = eina_tiler_new(e_comp->w, e_comp->h); ++>>>>>>> upstream eina_tiler_tile_size_set(tb, 1, 1); /* background */ - eina_tiler_rect_add(tb, &(Eina_Rectangle){0, 0, c->man->w, c->man->h}); + eina_tiler_rect_add(tb, &(Eina_Rectangle){0, 0, e_comp->w, e_comp->h}); - ec = e_client_bottom_get(c); + ec = e_client_bottom_get(); if (ec) o = ec->frame; for (; o; o = evas_object_above_get(o)) { @@@ -796,20 -785,17 +840,20 @@@ } #ifndef HAVE_WAYLAND_ONLY - ecore_x_window_shape_input_rectangles_set(c->win, (Ecore_X_Rectangle*)exr, i); + ecore_x_window_shape_input_rectangles_set(win, (Ecore_X_Rectangle*)exr, i); #endif +exr_fail: + free(exr); +ti_fail: + eina_iterator_free(ti); #ifdef SHAPE_DEBUG E_FREE_LIST(rl, free); printf("\n"); #endif - free(exr); - eina_iterator_free(ti); +tb_fail: eina_tiler_free(tb); - c->shape_job = NULL; + e_comp->shape_job = NULL; } ////////////////////////////////////////////////////////////////////////// @@@ -1043,34 -1030,46 +1092,54 @@@ e_comp_init(void { E_Action *act; - act = e_action_add("opacity_change"); - act->func.go = _e_comp_act_opacity_change_go; - e_action_predef_name_set(N_("Compositor"), - N_("Change current window opacity"), "opacity_change", - NULL, "syntax: +/- the amount to change opacity by (>0 for more opaque)", 1); - actions = eina_list_append(actions, act); - act = e_action_add("opacity_set"); - act->func.go = _e_comp_act_opacity_set_go; - e_action_predef_name_set(N_("Compositor"), - N_("Set current window opacity"), "opacity_set", - "255", "syntax: number between 0-255 to set for transparent-opaque", 1); - actions = eina_list_append(actions, act); - act = e_action_add("redirect_toggle"); - act->func.go = _e_comp_act_redirect_toggle_go; - e_action_predef_name_set(N_("Compositor"), - N_("Toggle focused client's redirect state"), "redirect_toggle", - NULL, NULL, 0); - actions = eina_list_append(actions, act); + if ((act = e_action_add("opacity_change"))) + { + act->func.go = _e_comp_act_opacity_change_go; + e_action_predef_name_set(N_("Compositor"), + N_("Change current window opacity"), "opacity_change", + NULL, "syntax: +/- the amount to change opacity by (>0 for more opaque)", 1); + actions = eina_list_append(actions, act); + } + + if ((act = e_action_add("opacity_set"))) + { + act->func.go = _e_comp_act_opacity_set_go; + e_action_predef_name_set(N_("Compositor"), + N_("Set current window opacity"), "opacity_set", + "255", "syntax: number between 0-255 to set for transparent-opaque", 1); + actions = eina_list_append(actions, act); + } + + if ((act = e_action_add("redirect_toggle"))) + { + act->func.go = _e_comp_act_redirect_toggle_go; + e_action_predef_name_set(N_("Compositor"), + N_("Toggle focused client's redirect state"), "redirect_toggle", + NULL, NULL, 0); + actions = eina_list_append(actions, act); + } } + e_comp_new(); + e_comp->comp_type = E_PIXMAP_TYPE_NONE; + + { + const char *gl; + + gl = getenv("E_COMP_ENGINE"); + if (gl) + { + int val; + + val = strtol(gl, NULL, 10); + if ((val == E_COMP_ENGINE_SW) || (val == E_COMP_ENGINE_GL)) + e_comp_config_get()->engine = val; + else if (!strcmp(gl, "gl")) + e_comp_config_get()->engine = E_COMP_ENGINE_GL; + else if (!strcmp(gl, "sw")) + e_comp_config_get()->engine = E_COMP_ENGINE_SW; + } + } { const char *eng; @@@ -1095,30 -1099,36 +1169,47 @@@ "wl_drm", #endif /* probably add other engines here; fb should be last? */ - #ifdef HAVE_WL_FM + #ifdef HAVE_WL_FB "wl_fb", #endif + "wl_desktop_shell", NULL }; e_util_env_set("HYBRIS_EGLPLATFORM", "wayland"); for (test = eng; *test; test++) { ++<<<<<<< HEAD + if (!e_module_enable(e_module_new(*test))) + return EINA_FALSE; ++======= + if (e_module_enable(e_module_new(*test))) + { + e_comp->comp_type = E_PIXMAP_TYPE_WL; + goto out; + } ++>>>>>>> upstream } - return EINA_FALSE; + goto out; } - #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) - e_comp_wl_init(); - #endif - if (!e_comp) return EINA_FALSE; + //#ifdef HAVE_WAYLAND_CLIENTS + //e_comp_wl_init(); + //#endif + if (e_comp->comp_type == E_PIXMAP_TYPE_NONE) return EINA_FALSE; out: ++<<<<<<< HEAD +#ifndef ENABLE_QUICK_INIT ++======= + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + { + e_comp_canvas_fake_layers_init(); + e_screensaver_update(); + } ++>>>>>>> upstream e_comp->elm = elm_win_fake_add(e_comp->ee); + elm_win_fullscreen_set(e_comp->elm, 1); evas_object_show(e_comp->elm); +#endif e_util_env_set("HYBRIS_EGLPLATFORM", NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_ON, _e_comp_screensaver_on, NULL); E_LIST_HANDLER_APPEND(handlers, E_EVENT_SCREENSAVER_OFF, _e_comp_screensaver_off, NULL); @@@ -1336,17 -1345,28 +1425,39 @@@ e_comp_internal_save(void EINTERN int e_comp_shutdown(void) { + Eina_List *l, *ll; + E_Client *ec; + + #ifdef HAVE_WAYLAND + E_Pixmap_Type type = e_comp->comp_type; + #endif E_FREE_FUNC(action_timeout, ecore_timer_del); ++<<<<<<< HEAD + while (e_comp->clients) + e_object_del(eina_list_data_get(e_comp->clients)); +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + e_comp_wl_shutdown(); +#endif ++======= + EINA_LIST_FOREACH_SAFE(e_comp->clients, l, ll, ec) + { + DELD(ec, 99999); + e_object_del(E_OBJECT(ec)); + } ++>>>>>>> upstream e_object_del(E_OBJECT(e_comp)); E_FREE_LIST(handlers, ecore_event_handler_del); E_FREE_LIST(actions, e_object_del); E_FREE_LIST(hooks, e_client_hook_del); ++<<<<<<< HEAD ++======= + #ifdef HAVE_WAYLAND + if (type == E_PIXMAP_TYPE_WL) + e_comp_wl_shutdown(); + #endif + ++>>>>>>> upstream gl_avail = EINA_FALSE; e_comp_cfdata_config_free(conf); E_CONFIG_DD_FREE(conf_match_edd); @@@ -1360,40 -1380,12 +1471,42 @@@ return 1; } ++<<<<<<< HEAD +EAPI void +e_comp_deferred_job(void) +{ + /* Add elm fake win */ + e_comp->elm = elm_win_fake_add(e_comp->ee); + evas_object_show(e_comp->elm); + + /* Bg update */ + if (e_zone_current_get(e_comp)->bg_object) + e_bg_zone_update(e_zone_current_get(e_comp), E_BG_TRANSITION_DESK); + else + e_bg_zone_update(e_zone_current_get(e_comp), E_BG_TRANSITION_START); + + /* Pointer setting */ + if (!e_comp->pointer) + { + e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE); + e_pointer_hide(e_comp->pointer); + } + +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + e_comp_wl_deferred_job(); +#endif +} + +EAPI void +e_comp_render_queue(E_Comp *c) ++======= + E_API void + e_comp_render_queue(void) ++>>>>>>> upstream { - E_OBJECT_CHECK(c); - E_OBJECT_TYPE_CHECK(c, E_COMP_TYPE); - if (conf->lock_fps) { - ecore_animator_thaw(c->render_animator); + ecore_animator_thaw(e_comp->render_animator); } else { @@@ -1625,43 -1600,8 +1726,48 @@@ e_comp_e_object_layer_get(const E_Objec return 0; } ++<<<<<<< HEAD +EAPI void +e_comp_layer_name_get(unsigned int layer, char *buff, int buff_size) +{ + if (!buff) return; + + switch(layer) + { + case E_LAYER_BOTTOM: strncpy(buff, "E_LAYER_BOTTOM", buff_size); break; + case E_LAYER_BG: strncpy(buff, "E_LAYER_BG", buff_size); break; + case E_LAYER_DESKTOP: strncpy(buff, "E_LAYER_DESKTOP", buff_size); break; + case E_LAYER_DESKTOP_TOP: strncpy(buff, "E_LAYER_DESKTOP_TOP", buff_size); break; + case E_LAYER_CLIENT_DESKTOP: strncpy(buff, "E_LAYER_CLIENT_DESKTOP", buff_size); break; + case E_LAYER_CLIENT_BELOW: strncpy(buff, "E_LAYER_CLIENT_BELOW", buff_size); break; + case E_LAYER_CLIENT_NORMAL: strncpy(buff, "E_LAYER_CLIENT_NORMAL", buff_size); break; + case E_LAYER_CLIENT_ABOVE: strncpy(buff, "E_LAYER_CLIENT_ABOVE", buff_size); break; + case E_LAYER_CLIENT_EDGE: strncpy(buff, "E_LAYER_CLIENT_EDGE", buff_size); break; + case E_LAYER_CLIENT_FULLSCREEN: strncpy(buff, "E_LAYER_CLIENT_FULLSCREEN", buff_size); break; + case E_LAYER_CLIENT_EDGE_FULLSCREEN: strncpy(buff, "E_LAYER_CLIENT_EDGE_FULLSCREEN", buff_size); break; + case E_LAYER_CLIENT_POPUP: strncpy(buff, "E_LAYER_CLIENT_POPUP", buff_size); break; + case E_LAYER_CLIENT_TOP: strncpy(buff, "E_LAYER_CLIENT_TOP", buff_size); break; + case E_LAYER_CLIENT_DRAG: strncpy(buff, "E_LAYER_CLIENT_DRAG", buff_size); break; + case E_LAYER_CLIENT_PRIO: strncpy(buff, "E_LAYER_CLIENT_PRIO", buff_size); break; + case E_LAYER_CLIENT_NOTIFICATION_LOW: strncpy(buff, "E_LAYER_CLIENT_NOTIFICATION_LOW", buff_size); break; + case E_LAYER_CLIENT_NOTIFICATION_NORMAL: strncpy(buff, "E_LAYER_CLIENT_NOTIFICATION_NORMAL", buff_size); break; + case E_LAYER_CLIENT_NOTIFICATION_HIGH: strncpy(buff, "E_LAYER_CLIENT_NOTIFICATION_HIGH", buff_size); break; + case E_LAYER_CLIENT_NOTIFICATION_TOP: strncpy(buff, "E_LAYER_CLIENT_NOTIFICATION_TOP", buff_size); break; + case E_LAYER_CLIENT_ALERT: strncpy(buff, "E_LAYER_CLIENT_ALERT", buff_size); break; + case E_LAYER_POPUP: strncpy(buff, "E_LAYER_POPUP", buff_size); break; + case E_LAYER_MENU: strncpy(buff, "E_LAYER_MENU", buff_size); break; + case E_LAYER_DESKLOCK: strncpy(buff, "E_LAYER_DESKLOCK", buff_size); break; + case E_LAYER_MAX: strncpy(buff, "E_LAYER_MAX", buff_size); break; + default:strncpy(buff, "E_LAYER_NONE", buff_size); break; + } +} + +EAPI Eina_Bool +e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd) ++======= + E_API Eina_Bool + e_comp_grab_input(Eina_Bool mouse, Eina_Bool kbd) ++>>>>>>> upstream { Eina_Bool ret = EINA_FALSE; Ecore_Window mwin = 0, kwin = 0; @@@ -1762,12 -1706,11 +1872,17 @@@ e_comp_util_object_is_above_nocomp(Evas EINA_SAFETY_ON_NULL_RETURN_VAL(obj, EINA_FALSE); if (!evas_object_visible_get(obj)) return EINA_FALSE; ++<<<<<<< HEAD + comp = e_comp_util_evas_object_comp_get(obj); + if ((!comp) || (!comp->nocomp_ec)) return EINA_FALSE; + cl = evas_object_layer_get(comp->nocomp_ec->frame); ++======= + if (!e_comp->nocomp_ec) return EINA_FALSE; + cl = evas_object_layer_get(e_comp->nocomp_ec->frame); ++>>>>>>> upstream ol = evas_object_layer_get(obj); if (cl > ol) return EINA_FALSE; - o = evas_object_above_get(comp->nocomp_ec->frame); + o = evas_object_above_get(e_comp->nocomp_ec->frame); if ((cl == ol) && (evas_object_layer_get(o) == cl)) { do { diff --cc src/bin/e_comp.h index d6aff5a,d343036..0309a7b --- a/src/bin/e_comp.h +++ b/src/bin/e_comp.h @@@ -58,9 -51,26 +57,32 @@@ typedef enum _E_Laye # include "e_comp_cfdata.h" ++<<<<<<< HEAD +extern EAPI int E_EVENT_COMPOSITOR_DISABLE; +extern EAPI int E_EVENT_COMPOSITOR_ENABLE; +extern EAPI int E_EVENT_COMPOSITOR_FPS_UPDATE; ++======= + extern E_API int E_EVENT_COMPOSITOR_DISABLE; + extern E_API int E_EVENT_COMPOSITOR_ENABLE; + + typedef void (*E_Comp_Cb)(void); + + typedef struct E_Comp_Screen_Iface + { + /* can screen changes be made at all */ + Eina_Bool (*available)(void); + /* begin listening for screen events */ + void (*init)(void); + /* stop listening for screen events */ + void (*shutdown)(void); + /* gather screen info */ + E_Randr2 *(*create)(void); + /* apply current config */ + void (*apply)(void); + /* set dpms (on, standby, suspend, off) */ + void (*dpms)(int); + } E_Comp_Screen_Iface; ++>>>>>>> upstream struct _E_Comp { @@@ -173,51 -175,49 +199,83 @@@ typedef enu E_COMP_ENGINE_GL = 2 } E_Comp_Engine; + extern E_API E_Comp *e_comp; + extern E_API E_Comp_X_Data *e_comp_x; + extern E_API E_Comp_Wl_Data *e_comp_wl; + EINTERN Eina_Bool e_comp_init(void); - EAPI E_Comp *e_comp_new(void); - EAPI int e_comp_internal_save(void); + E_API E_Comp *e_comp_new(void); + E_API int e_comp_internal_save(void); EINTERN int e_comp_shutdown(void); ++<<<<<<< HEAD +EAPI void e_comp_deferred_job(void); +EAPI void e_comp_render_queue(E_Comp *c); +EAPI void e_comp_shape_queue(E_Comp *c); +EAPI void e_comp_shape_queue_block(E_Comp *c, Eina_Bool block); +EAPI E_Comp_Config *e_comp_config_get(void); +EAPI const Eina_List *e_comp_list(void); +EAPI void e_comp_shadows_reset(void); +EINA_DEPRECATED EAPI E_Comp *e_comp_get(const void *o); +EAPI Ecore_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y); +EAPI void e_comp_util_wins_print(const E_Comp *c); +EAPI void e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win); +EAPI void e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win); +EAPI Eina_Bool e_comp_ignore_win_find(Ecore_Window win); +EAPI void e_comp_override_del(E_Comp *c); +EAPI void e_comp_override_add(E_Comp *c); +EAPI void e_comp_block_window_add(void); +EAPI void e_comp_block_window_del(void); +EAPI E_Comp *e_comp_find_by_window(Ecore_Window win); +EAPI void e_comp_override_timed_pop(E_Comp *c); +EAPI unsigned int e_comp_e_object_layer_get(const E_Object *obj); +EAPI void e_comp_layer_name_get(unsigned int layer, char *buff, int buff_size); +EAPI Eina_Bool e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd); +EAPI void e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd); +EAPI void e_comp_gl_set(Eina_Bool set); +EAPI Eina_Bool e_comp_gl_get(void); +EAPI E_Comp *e_comp_evas_find(const Evas *e); + +EAPI void e_comp_button_bindings_grab_all(void); +EAPI void e_comp_button_bindings_ungrab_all(void); +EAPI void e_comp_client_redirect_toggle(E_Client *ec); +EAPI Eina_Bool e_comp_util_object_is_above_nocomp(Evas_Object *obj); ++======= + E_API void e_comp_render_queue(void); + E_API void e_comp_shape_queue(void); + E_API void e_comp_shape_queue_block(Eina_Bool block); + E_API E_Comp_Config *e_comp_config_get(void); + E_API const Eina_List *e_comp_list(void); + E_API void e_comp_shadows_reset(void); + E_API Ecore_Window e_comp_top_window_at_xy_get(Evas_Coord x, Evas_Coord y); + E_API void e_comp_util_wins_print(void); + E_API void e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win); + E_API void e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win); + E_API Eina_Bool e_comp_ignore_win_find(Ecore_Window win); + E_API void e_comp_override_del(void); + E_API void e_comp_override_add(void); + E_API void e_comp_block_window_add(void); + E_API void e_comp_block_window_del(void); + E_API E_Comp *e_comp_find_by_window(Ecore_Window win); + E_API void e_comp_override_timed_pop(void); + E_API unsigned int e_comp_e_object_layer_get(const E_Object *obj); + E_API Eina_Bool e_comp_grab_input(Eina_Bool mouse, Eina_Bool kbd); + E_API void e_comp_ungrab_input(Eina_Bool mouse, Eina_Bool kbd); + E_API void e_comp_gl_set(Eina_Bool set); + E_API Eina_Bool e_comp_gl_get(void); + + E_API void e_comp_button_bindings_grab_all(void); + E_API void e_comp_button_bindings_ungrab_all(void); + E_API void e_comp_client_redirect_toggle(E_Client *ec); + E_API Eina_Bool e_comp_util_object_is_above_nocomp(Evas_Object *obj); ++>>>>>>> upstream EINTERN Evas_Object *e_comp_style_selector_create(Evas *evas, const char **source); - EAPI E_Config_Dialog *e_int_config_comp(Evas_Object *parent, const char *params); - EAPI E_Config_Dialog *e_int_config_comp_match(Evas_Object *parent, const char *params); + E_API E_Config_Dialog *e_int_config_comp(Evas_Object *parent, const char *params); + E_API E_Config_Dialog *e_int_config_comp_match(Evas_Object *parent, const char *params); - EINA_DEPRECATED static inline E_Comp * - e_comp_util_evas_object_comp_get(Evas_Object *obj) - { - return ecore_evas_data_get(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)), "comp"); - } + + E_API Eina_Bool e_comp_util_kbd_grabbed(void); + E_API Eina_Bool e_comp_util_mouse_grabbed(void); static inline Eina_Bool e_comp_util_client_is_fullscreen(const E_Client *ec) @@@ -231,9 -231,17 +289,19 @@@ ); } - extern EAPI E_Comp *e_comp; + static inline Eina_Bool + e_comp_util_has_x(void) + { + return !!e_comp->root; + } + + static inline Eina_Bool + e_comp_util_has_xwayland(void) + { + return (e_comp->comp_type != E_PIXMAP_TYPE_X) && e_comp_util_has_x(); + } +EAPI void e_comp_post_update_add(E_Client *ec); +EAPI void e_comp_post_update_purge(E_Client *ec); #endif #endif diff --cc src/bin/e_comp_canvas.c index 51423f2,a3d8401..be3619c --- a/src/bin/e_comp_canvas.c +++ b/src/bin/e_comp_canvas.c @@@ -428,13 -551,8 +551,18 @@@ e_comp_canvas_update(void if (!changed) return; if (!starting) { ++<<<<<<< HEAD + ev = calloc(1, sizeof(E_Event_Compositor_Resize)); + if (ev) + { + ev->comp = e_comp; + e_object_ref(E_OBJECT(e_comp)); + ecore_event_add(E_EVENT_COMPOSITOR_RESIZE, ev, _e_comp_canvas_event_compositor_resize_free, NULL); + } ++======= + e_object_ref(E_OBJECT(e_comp)); + ecore_event_add(E_EVENT_COMPOSITOR_RESIZE, NULL, _e_comp_canvas_event_compositor_resize_free, NULL); ++>>>>>>> upstream } EINA_LIST_FOREACH(e_comp->zones, l, zone) @@@ -611,42 -714,32 +739,69 @@@ e_comp_canvas_client_layer_map_nearest( LAYER_MAP(E_LAYER_CLIENT_POPUP); LAYER_MAP(E_LAYER_CLIENT_TOP); LAYER_MAP(E_LAYER_CLIENT_DRAG); - return E_LAYER_CLIENT_PRIO; + LAYER_MAP(E_LAYER_CLIENT_PRIO); + LAYER_MAP(E_LAYER_CLIENT_NOTIFICATION_LOW); + LAYER_MAP(E_LAYER_CLIENT_NOTIFICATION_NORMAL); + LAYER_MAP(E_LAYER_CLIENT_NOTIFICATION_HIGH); + LAYER_MAP(E_LAYER_CLIENT_NOTIFICATION_TOP); + return E_LAYER_CLIENT_ALERT; +} + +EAPI void +e_comp_post_update_add(E_Client *ec) +{ + E_Client *ec2; + + if (!e_comp) return; + + ec2 = eina_list_data_find(e_comp->post_updates, ec); + if (ec2) return; + + e_comp->post_updates = eina_list_append(e_comp->post_updates, ec); + e_object_ref(E_OBJECT(ec)); +} + +EAPI void +e_comp_post_update_purge(E_Client *ec) +{ + Eina_List *l, *ll; + E_Client *ec2; + + if (!e_comp) return; + + EINA_LIST_FOREACH_SAFE(e_comp->post_updates, l, ll, ec2) + { + if (ec2 == ec) + { + e_comp->post_updates = eina_list_remove_list(e_comp->post_updates, l); + e_object_unref(E_OBJECT(ec)); + } + } } + + E_API void + e_comp_canvas_keys_grab(void) + { + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + e_bindings_key_grab(E_BINDING_CONTEXT_ANY, e_comp->root); + } + + E_API void + e_comp_canvas_keys_ungrab(void) + { + if (e_comp->comp_type == E_PIXMAP_TYPE_X) + e_bindings_key_ungrab(E_BINDING_CONTEXT_ANY, e_comp->root); + } + + E_API void + e_comp_canvas_feed_mouse_up(unsigned int activate_time) + { + int button_mask, i; + + button_mask = evas_pointer_button_down_mask_get(e_comp->evas); + for (i = 0; i < 32; i++) + { + if ((button_mask & (1 << i))) + evas_event_feed_mouse_up(e_comp->evas, i + 1, EVAS_BUTTON_NONE, activate_time, NULL); + } + } diff --cc src/bin/e_comp_object.c index 5126e82,924b861..0c5a0d0 --- a/src/bin/e_comp_object.c +++ b/src/bin/e_comp_object.c @@@ -150,53 -145,8 +157,53 @@@ static Eina_Inlist *_e_comp_object_inte EINTERN void e_client_focused_set(E_Client *ec); /* emitted every time a new noteworthy comp object is added */ - EAPI int E_EVENT_COMP_OBJECT_ADD = -1; + E_API int E_EVENT_COMP_OBJECT_ADD = -1; +#ifdef _F_E_COMP_OBJECT_INTERCEPT_HOOK_ +static void +_e_comp_object_intercept_hooks_clean(void) +{ + Eina_Inlist *l; + E_Comp_Object_Intercept_Hook *ch; + unsigned int x; + + for (x = 0; x < E_COMP_OBJECT_INTERCEPT_HOOK_LAST; x++) + EINA_INLIST_FOREACH_SAFE(_e_comp_object_intercept_hooks[x], l, ch) + { + if (!ch->delete_me) continue; + _e_comp_object_intercept_hooks[x] = eina_inlist_remove(_e_comp_object_intercept_hooks[x], EINA_INLIST_GET(ch)); + free(ch); + } +} + +static Eina_Bool +_e_comp_object_intercept_hook_call(E_Comp_Object_Intercept_Hook_Point hookpoint, E_Client *ec) +{ + E_Comp_Object_Intercept_Hook *ch; + Eina_Bool ret = EINA_TRUE; + + if (e_object_is_del(E_OBJECT(ec))) return ret; + e_object_ref(E_OBJECT(ec)); + _e_comp_object_intercept_hooks_walking++; + EINA_INLIST_FOREACH(_e_comp_object_intercept_hooks[hookpoint], ch) + { + if (ch->delete_me) continue; + if (!(ch->func(ch->data, ec))) + { + ret = EINA_FALSE; + break; + } + } + _e_comp_object_intercept_hooks_walking--; + if ((_e_comp_object_intercept_hooks_walking == 0) && (_e_comp_object_intercept_hooks_delete > 0)) + _e_comp_object_intercept_hooks_clean(); + + e_object_unref(E_OBJECT(ec)); + + return ret; +} +#endif + static void _e_comp_object_event_free(void *d EINA_UNUSED, void *event) { @@@ -216,10 -171,14 +228,16 @@@ _e_comp_object_event_add(Evas_Object *o if (stopping) return; ev = E_NEW(E_Event_Comp_Object, 1); + EINA_SAFETY_ON_NULL_RETURN(ev); + evas_object_ref(obj); ev->comp_object = obj; + ec = evas_object_data_get(ev->comp_object, "E_Client"); + if (ec) + { + REFD(ec, 1); + e_object_ref(E_OBJECT(ec)); + } ecore_event_add(E_EVENT_COMP_OBJECT_ADD, ev, _e_comp_object_event_free, NULL); } @@@ -818,17 -930,15 +989,27 @@@ static voi _e_comp_intercept_move(void *data, Evas_Object *obj, int x, int y) { E_Comp_Object *cw = data; - int ix, iy; + int ix, iy, fx, fy; ++<<<<<<< HEAD + if (!e_util_strcmp("wl_pointer-cursor", cw->ec->icccm.window_role)) + { + cw->ec->client.x = x, cw->ec->client.y = y; + cw->ec->x = x, cw->ec->y = y; + evas_object_move(obj, x, y); + return; + } + + if ((cw->x == x) && (cw->y == y)) ++======= + /* if frame_object does not exist, client_inset indicates CSD. + * this means that ec->client matches cw->x/y, the opposite + * of SSD. + */ + fx = (!cw->frame_object) * cw->client_inset.l; + fy = (!cw->frame_object) * cw->client_inset.t; + if ((cw->x == x + fx) && (cw->y == y + fy)) ++>>>>>>> upstream { if ((cw->ec->x != x) || (cw->ec->y != y)) { @@@ -895,17 -1008,15 +1079,27 @@@ static voi _e_comp_intercept_resize(void *data, Evas_Object *obj, int w, int h) { E_Comp_Object *cw = data; - int pw, ph, fw, fh, iw, ih, prev_w, prev_h; + int pw = 0, ph = 0, fw, fh, iw, ih, prev_w, prev_h, x, y; ++<<<<<<< HEAD + if ((!e_util_strcmp("wl_pointer-cursor", cw->ec->icccm.window_role)) || + (!e_util_strcmp("input_panel_surface", cw->ec->icccm.window_role))) + { + cw->ec->w = w, cw->ec->h = h; + evas_object_resize(obj, w, h); + return; + } + + if ((cw->w == w) && (cw->h == h)) ++======= + /* if frame_object does not exist, client_inset indicates CSD. + * this means that ec->client matches cw->w/h, the opposite + * of SSD. + */ + fw = (!cw->frame_object) * (-cw->client_inset.l - cw->client_inset.r); + fh = (!cw->frame_object) * (-cw->client_inset.t - cw->client_inset.b); + if ((cw->w == w + fw) && (cw->h == h + fh)) ++>>>>>>> upstream { if (cw->ec->shading || cw->ec->shaded) return; if (((cw->ec->w != w) || (cw->ec->h != h)) || @@@ -969,15 -1097,16 +1180,21 @@@ cw->ec->client.h = ih; if ((cw->ec->client.w < 0) || (cw->ec->client.h < 0)) CRI("WTF"); } - if ((!cw->ec->input_only) && (!e_pixmap_size_get(cw->ec->pixmap, &pw, &ph))) + if ((!cw->ec->input_only) && cw->redirected && (e_pixmap_dirty_get(cw->ec->pixmap) || + (!e_pixmap_size_get(cw->ec->pixmap, &pw, &ph)))) { ++<<<<<<< HEAD +#ifndef HAVE_WAYLAND_ONLY ++======= + if (e_comp->comp_type != E_PIXMAP_TYPE_X) return; ++>>>>>>> upstream /* client can't be resized if its pixmap isn't usable, try again */ e_pixmap_dirty(cw->ec->pixmap); e_comp_object_render_update_add(obj); + e_comp_render_queue(); cw->ec->changes.size = 1; EC_CHANGED(cw->ec); +#endif return; } prev_w = cw->w, prev_h = cw->h; @@@ -1189,7 -1330,7 +1418,11 @@@ _e_comp_intercept_stack_helper(E_Comp_O /* reached the top client layer somehow * use top client object */ ++<<<<<<< HEAD + o = cw->comp->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT)].obj; ++======= + o = e_comp->layers[e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO)].obj; ++>>>>>>> upstream } if (!o) /* top client layer window hasn't been stacked yet. this probably shouldn't happen? @@@ -1519,11 -1654,14 +1770,11 @@@ _e_comp_intercept_focus(void *data, Eva ec = cw->ec; /* note: this is here as it seems there are enough apps that do not even * expect us to emulate a look of focus but not actually set x input - * focus as we do - so simply abort any focuse set on such windows */ + * focus as we do - so simply abort any focus set on such windows */ /* be strict about accepting focus hint */ - if (e_pixmap_is_x(ec->pixmap)) - { - /* be strict about accepting focus hint */ - if ((!ec->icccm.accepts_focus) && - (!ec->icccm.take_focus)) return; - } + /* be strict about accepting focus hint */ + if ((!ec->icccm.accepts_focus) && + (!ec->icccm.take_focus)) return; if (focus && ec->lock_focus_out) return; if (e_object_is_del(E_OBJECT(ec)) && focus) CRI("CAN'T FOCUS DELETED CLIENT!"); @@@ -2066,11 -2232,10 +2347,15 @@@ _e_comp_smart_show(Evas_Object *obj evas_object_show(cw->effect_obj); if (cw->ec->internal_elm_win && (!evas_object_visible_get(cw->ec->internal_elm_win))) evas_object_show(cw->ec->internal_elm_win); ++<<<<<<< HEAD + if (cw->mask_obj) evas_object_show(cw->mask_obj); + e_comp_render_queue(cw->comp); ++======= + e_comp_render_queue(); ++>>>>>>> upstream if (cw->ec->input_only) { - e_comp_shape_queue(cw->comp); + e_comp_shape_queue(); return; } if (cw->ec->iconic && (!cw->ec->new_client)) @@@ -2105,16 -2263,10 +2383,19 @@@ _e_comp_smart_del(Evas_Object *obj INTERNAL_ENTRY; ++<<<<<<< HEAD + if (cw->animating) + { + cw->comp->animating--; + e_object_unref(E_OBJECT(cw->ec)); + } + cw->animating = 0; ++======= + e_comp_object_render_update_del(cw->smart_obj); ++>>>>>>> upstream E_FREE_FUNC(cw->updates, eina_tiler_free); E_FREE_FUNC(cw->pending_updates, eina_tiler_free); - DBG(" [%p] del", cw->ec); - e_comp_object_render_update_del(cw->smart_obj); + free(cw->ns); if (cw->obj_mirror) { @@@ -2139,10 -2291,18 +2420,23 @@@ evas_object_del(cw->zoomobj); evas_object_del(cw->input_obj); evas_object_del(cw->obj); ++<<<<<<< HEAD + evas_object_del(cw->mask_obj); + e_comp_shape_queue(cw->comp); ++======= + e_comp_shape_queue(); ++>>>>>>> upstream eina_stringshare_del(cw->frame_theme); eina_stringshare_del(cw->frame_name); + if (cw->animating) + { + cw->animating = 0; + e_comp->animating--; + UNREFD(cw->ec, 2); + e_object_unref(E_OBJECT(cw->ec)); + } + // UNREFD(cw->ec, 9); + // e_object_unref(E_OBJECT(cw->ec)); free(cw); } @@@ -2192,9 -2358,10 +2492,16 @@@ _e_comp_smart_resize(Evas_Object *obj, evas_object_resize(cw->effect_obj, w, h); if (cw->zoomobj) e_zoomap_child_resize(cw->zoomobj, pw, ph); if (cw->input_obj) ++<<<<<<< HEAD + evas_object_geometry_set(cw->input_obj, cw->x + cw->input_rect.x, cw->y + cw->input_rect.y, cw->input_rect.w, cw->input_rect.h); + if (cw->mask_obj) + evas_object_resize(cw->mask_obj, w, h); ++======= + evas_object_geometry_set(cw->input_obj, + cw->x + cw->input_rect.x + (!!cw->frame_object * cw->client_inset.l), + cw->y + cw->input_rect.y + (!!cw->frame_object * cw->client_inset.t), + cw->input_rect.w, cw->input_rect.h); ++>>>>>>> upstream /* resize render update tiler */ if (!first) { @@@ -2260,9 -2425,9 +2567,9 @@@ e_comp_object_zoomap_set(Evas_Object *o if (cw->zoomap_disabled == enabled) return; if (enabled) { - cw->zoomobj = e_zoomap_add(cw->comp->evas); + cw->zoomobj = e_zoomap_add(e_comp->evas); e_zoomap_smooth_set(cw->zoomobj, e_comp_config_get()->smooth_windows); - e_zoomap_child_set(cw->zoomobj, cw->ec ? cw->frame_object : cw->obj); + e_zoomap_child_set(cw->zoomobj, cw->frame_object); edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->zoomobj); e_zoomap_child_edje_solid_setup(cw->zoomobj); if (cw->ec->override) @@@ -2393,40 -2564,10 +2706,44 @@@ _e_comp_object_util_moveresize(void *da } if (evas_object_visible_get(obj)) - e_comp_shape_queue(e_comp); + e_comp_shape_queue(); } ++<<<<<<< HEAD +#ifdef _F_E_COMP_OBJECT_INTERCEPT_HOOK_ +EAPI E_Comp_Object_Intercept_Hook * +e_comp_object_intercept_hook_add(E_Comp_Object_Intercept_Hook_Point hookpoint, E_Comp_Object_Intercept_Hook_Cb func, const void *data) +{ + E_Comp_Object_Intercept_Hook *ch; + + EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_COMP_OBJECT_INTERCEPT_HOOK_LAST, NULL); + ch = E_NEW(E_Comp_Object_Intercept_Hook, 1); + if (!ch) return NULL; + ch->hookpoint = hookpoint; + ch->func = func; + ch->data = (void*)data; + _e_comp_object_intercept_hooks[hookpoint] = eina_inlist_append(_e_comp_object_intercept_hooks[hookpoint], EINA_INLIST_GET(ch)); + return ch; +} + +EAPI void +e_comp_object_intercept_hook_del(E_Comp_Object_Intercept_Hook *ch) +{ + ch->delete_me = 1; + if (_e_comp_object_intercept_hooks_walking == 0) + { + _e_comp_object_intercept_hooks[ch->hookpoint] = eina_inlist_remove(_e_comp_object_intercept_hooks[ch->hookpoint], EINA_INLIST_GET(ch)); + free(ch); + } + else + _e_comp_object_intercept_hooks_delete++; +} +#endif + +EAPI Evas_Object * ++======= + E_API Evas_Object * ++>>>>>>> upstream e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type) { Evas_Object *o, *z = NULL; @@@ -3119,12 -3321,9 +3501,12 @@@ e_comp_object_damage(Evas_Object *obj, } cw->updates_exist = 1; e_comp_object_render_update_add(obj); + + if ((cw->ec->visible) && (!evas_object_visible_get(cw->smart_obj))) + evas_object_show(cw->smart_obj); } - EAPI Eina_Bool + E_API Eina_Bool e_comp_object_damage_exists(Evas_Object *obj) { API_ENTRY EINA_FALSE; @@@ -3326,20 -3527,11 +3710,26 @@@ e_comp_object_native_surface_set(Evas_O if (set) { /* native requires gl enabled, texture from pixmap enabled, and a non-shaped client */ - set = (cw->ec->comp->gl && e_comp_config_get()->texture_from_pixmap && (!cw->ec->shaped)); + set = (e_comp->gl && + ((e_comp->comp_type != E_PIXMAP_TYPE_X) || e_comp_config_get()->texture_from_pixmap) && + (!cw->ec->shaped)); if (set) ++<<<<<<< HEAD + set = e_pixmap_native_surface_init(cw->ec->pixmap, &ns); + + /* to show underlay plane on x11, compositor should fill + * alpha value of COW with given 24bit window's alpha. + */ + if (set) + { + E_Pixmap_Type type; + type = e_pixmap_type_get(cw->ec->pixmap); + if ((type == E_PIXMAP_TYPE_X) && (!cw->ec->argb)) + evas_object_render_op_set(cw->obj, EVAS_RENDER_COPY); + } ++======= + set = (!!cw->ns) || e_pixmap_native_surface_init(cw->ec->pixmap, &ns); ++>>>>>>> upstream } cw->native = set; @@@ -3368,29 -3598,7 +3796,8 @@@ e_comp_object_dirty(Evas_Object *obj if (!dirty) evas_object_image_data_set(cw->obj, NULL); evas_object_image_size_set(cw->obj, w, h); + if (cw->mask_obj) evas_object_resize(cw->mask_obj, w, h); - e_pixmap_image_opaque_get(cw->ec->pixmap, &bx, &by, &bxx, &byy); - if (bxx && byy) - bxx = cw->ec->client.w - (bx + bxx), byy = cw->ec->client.h - (by + byy); - else - bx = by = bxx = byy = 0; - evas_object_image_border_set(cw->obj, bx, by, bxx, byy); - { - Edje_Message_Int_Set *msg; - Edje_Message_Int msg2; - Eina_Bool id = (bx || by || bxx || byy); - - msg = alloca(sizeof(Edje_Message_Int_Set) + (sizeof(int) * 3)); - msg->count = 4; - msg->val[0] = bx; - msg->val[1] = by; - msg->val[2] = bxx; - msg->val[3] = byy; - edje_object_message_send(cw->shobj, EDJE_MESSAGE_INT_SET, 1, msg); - msg2.val = id; - edje_object_message_send(cw->shobj, EDJE_MESSAGE_INT, 0, &msg2); - } RENDER_DEBUG("SIZE [%p]: %dx%d", cw->ec, w, h); if (cw->pending_updates) eina_tiler_area_size_set(cw->pending_updates, w, h); @@@ -3614,32 -3855,34 +4054,57 @@@ e_comp_object_effect_set(Evas_Object *o { char buf[4096]; Eina_Stringshare *grp; + E_Comp_Config *config; + Eina_Bool loaded = EINA_FALSE; - API_ENTRY; - if (!cw->shobj) return; //input window + API_ENTRY EINA_FALSE; + if (!cw->shobj) return EINA_FALSE; //input window if (!effect) effect = "none"; snprintf(buf, sizeof(buf), "e/comp/effects/%s", effect); ++<<<<<<< HEAD + + config = e_comp_config_get(); + if ((config) && (config->effect_file)) + { + if (edje_object_file_set(cw->effect_obj, config->effect_file, buf)) + loaded = EINA_TRUE; + } + + if (!loaded) ++======= + edje_object_file_get(cw->effect_obj, NULL, &grp); + cw->effect_set = !eina_streq(effect, "none"); + if (!e_util_strcmp(buf, grp)) return cw->effect_set; + if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf)) ++>>>>>>> upstream { - snprintf(buf, sizeof(buf), "e/comp/effects/auto/%s", effect); + edje_object_file_get(cw->effect_obj, NULL, &grp); + if (!e_util_strcmp(buf, grp)) return; if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf)) ++<<<<<<< HEAD + { + snprintf(buf, sizeof(buf), "e/comp/effects/auto/%s", effect); + if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", buf)) + if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none")) return; + } ++======= + if (!e_theme_edje_object_set(cw->effect_obj, "base/theme/comp", "e/comp/effects/none")) + { + if (cw->effect_running) + { + if (!e_comp_object_effect_stop(obj, evas_object_data_get(cw->effect_obj, "_e_comp.end_cb"))) + return EINA_FALSE; + } + cw->effect_set = EINA_FALSE; + return cw->effect_set; + } + } + if (cw->effect_running) + { + if (!e_comp_object_effect_stop(obj, evas_object_data_get(cw->effect_obj, "_e_comp.end_cb"))) + return EINA_FALSE; ++>>>>>>> upstream } edje_object_part_swallow(cw->effect_obj, "e.swallow.content", cw->shobj); if (cw->effect_clip) @@@ -3677,20 -3922,9 +4144,26 @@@ _e_comp_object_effect_end_cb(void *data E_Comp_Object *cw = data; edje_object_signal_callback_del_full(obj, "e,action,done", "e", _e_comp_object_effect_end_cb, NULL); ++<<<<<<< HEAD + if (cw->animating) + { + cw->comp->animating--; + cw->animating--; + if (e_object_unref(E_OBJECT(cw->ec))) + e_comp_shape_queue(cw->comp); + } + + if (evas_object_data_get(cw->smart_obj, "effect_running")) + { + evas_object_data_del(cw->smart_obj, "effect_running"); + e_client_visibility_calculate(); + } + ++======= + cw->effect_running = 0; + if (!_e_comp_object_animating_end(cw)) return; + e_comp_shape_queue(); ++>>>>>>> upstream end_cb = evas_object_data_get(obj, "_e_comp.end_cb"); if (!end_cb) return; end_data = evas_object_data_get(obj, "_e_comp.end_data"); @@@ -3731,13 -3967,11 +4205,12 @@@ e_comp_object_effect_start(Evas_Object edje_object_signal_callback_add(cw->effect_obj, "e,action,done", "e", _e_comp_object_effect_end_cb, cw); evas_object_data_set(cw->effect_obj, "_e_comp.end_cb", end_cb); evas_object_data_set(cw->effect_obj, "_e_comp.end_data", end_data); + evas_object_data_set(cw->smart_obj, "effect_running", (void*)1); edje_object_signal_emit(cw->effect_obj, "e,action,go", "e"); - if (cw->animating) return; - cw->comp->animating++; - cw->animating++; - e_object_ref(E_OBJECT(cw->ec)); + _e_comp_object_animating_begin(cw); + cw->effect_running = 1; + return EINA_TRUE; } /* stop a currently-running effect immediately */ @@@ -3754,18 -3988,8 +4227,23 @@@ e_comp_object_effect_stop(Evas_Object * } edje_object_signal_emit(cw->effect_obj, "e,action,stop", "e"); edje_object_signal_callback_del_full(cw->effect_obj, "e,action,done", "e", _e_comp_object_effect_end_cb, cw); ++<<<<<<< HEAD + if (cw->animating) + { + cw->animating--; + cw->comp->animating--; + e_object_unref(E_OBJECT(cw->ec)); + } + + if (evas_object_data_get(cw->smart_obj, "effect_running")) + { + evas_object_data_del(cw->smart_obj, "effect_running"); + e_client_visibility_calculate(); + } ++======= + cw->effect_running = 0; + return _e_comp_object_animating_end(cw); ++>>>>>>> upstream } static int diff --cc src/bin/e_comp_object.h index 3feee0f,32d6d92..81b5d65 --- a/src/bin/e_comp_object.h +++ b/src/bin/e_comp_object.h @@@ -32,86 -32,62 +32,92 @@@ struct E_Comp_Object_Fram Eina_Bool calc : 1; // inset has been calculated }; +#ifdef _F_E_COMP_OBJECT_INTERCEPT_HOOK_ +typedef struct _E_Comp_Object_Intercept_Hook E_Comp_Object_Intercept_Hook; + +typedef enum _E_Comp_Object_Intercept_Hook_Point +{ + E_COMP_OBJECT_INTERCEPT_HOOK_SHOW_HELPER, + E_COMP_OBJECT_INTERCEPT_HOOK_HIDE, + E_COMP_OBJECT_INTERCEPT_HOOK_LAST, +} E_Comp_Object_Intercept_Hook_Point; + +typedef Eina_Bool (*E_Comp_Object_Intercept_Hook_Cb)(void *data, E_Client *ec); + +struct _E_Comp_Object_Intercept_Hook +{ + EINA_INLIST; + E_Comp_Object_Intercept_Hook_Point hookpoint; + E_Comp_Object_Intercept_Hook_Cb func; + void *data; + unsigned char delete_me : 1; +}; +#endif - extern EAPI int E_EVENT_COMP_OBJECT_ADD; + extern E_API int E_EVENT_COMP_OBJECT_ADD; - EAPI void e_comp_object_zoomap_set(Evas_Object *obj, Eina_Bool enabled); - EAPI Evas_Object *e_comp_object_client_add(E_Client *ec); - EAPI Evas_Object *e_comp_object_util_mirror_add(Evas_Object *obj); - EAPI Evas_Object *e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type); - EAPI void e_comp_object_frame_xy_adjust(Evas_Object *obj, int x, int y, int *ax, int *ay); - EAPI void e_comp_object_frame_xy_unadjust(Evas_Object *obj, int x, int y, int *ax, int *ay); - EAPI void e_comp_object_frame_wh_adjust(Evas_Object *obj, int w, int h, int *aw, int *ah); - EAPI void e_comp_object_frame_wh_unadjust(Evas_Object *obj, int w, int h, int *aw, int *ah); - EAPI void e_comp_object_frame_extends_get(Evas_Object *obj, int *x, int *y, int *w, int *h); - EAPI E_Client *e_comp_object_client_get(Evas_Object *obj); - EAPI E_Zone *e_comp_object_util_zone_get(Evas_Object *obj); - EAPI void e_comp_object_util_del_list_append(Evas_Object *obj, Evas_Object *to_del); - EAPI void e_comp_object_util_del_list_remove(Evas_Object *obj, Evas_Object *to_del); - EAPI void e_comp_object_util_autoclose(Evas_Object *obj, E_Comp_Object_Autoclose_Cb del_cb, E_Comp_Object_Key_Cb cb, const void *data); - EAPI void e_comp_object_util_center(Evas_Object *obj); - EAPI void e_comp_object_util_center_on(Evas_Object *obj, Evas_Object *on); - EAPI void e_comp_object_util_center_pos_get(Evas_Object *obj, int *x, int *y); - EAPI void e_comp_object_util_fullscreen(Evas_Object *obj); - EAPI void e_comp_object_frame_geometry_get(Evas_Object *obj, int *l, int *r, int *t, int *b); - EAPI void e_comp_object_frame_icon_geometry_get(Evas_Object *obj, int *x, int *y, int *w, int *h); - EAPI Eina_Bool e_comp_object_frame_title_set(Evas_Object *obj, const char *name); - EAPI Eina_Bool e_comp_object_frame_exists(Evas_Object *obj); - EAPI void e_comp_object_frame_icon_update(Evas_Object *obj); - EAPI Eina_Bool e_comp_object_frame_theme_set(Evas_Object *obj, const char *name); - EAPI void e_comp_object_signal_emit(Evas_Object *obj, const char *sig, const char *src); - EAPI void e_comp_object_signal_callback_add(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data); - EAPI void e_comp_object_signal_callback_del(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb); - EAPI void e_comp_object_signal_callback_del_full(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data); - EAPI void e_comp_object_input_area_set(Evas_Object *obj, int x, int y, int w, int h); - EAPI void e_comp_object_damage(Evas_Object *obj, int x, int y, int w, int h); - EAPI Eina_Bool e_comp_object_damage_exists(Evas_Object *obj); - EAPI void e_comp_object_render_update_add(Evas_Object *obj); - EAPI void e_comp_object_render_update_del(Evas_Object *obj); - EAPI void e_comp_object_shape_apply(Evas_Object *obj); - EAPI void e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set); - EAPI void e_comp_object_native_surface_set(Evas_Object *obj, Eina_Bool set); - EAPI void e_comp_object_dirty(Evas_Object *obj); - EAPI Eina_Bool e_comp_object_render(Evas_Object *obj); - EAPI void e_comp_object_effect_set(Evas_Object *obj, const char *effect); - EAPI void e_comp_object_effect_params_set(Evas_Object *obj, int id, int *params, unsigned int count); - EAPI void e_comp_object_effect_clip(Evas_Object *obj); - EAPI void e_comp_object_effect_unclip(Evas_Object *obj); - EAPI void e_comp_object_effect_start(Evas_Object *obj, Edje_Signal_Cb end_cb, const void *end_data); - EAPI void e_comp_object_effect_stop(Evas_Object *obj, Edje_Signal_Cb end_cb); - EAPI E_Comp_Object_Mover *e_comp_object_effect_mover_add(int pri, const char *sig, E_Comp_Object_Mover_Cb provider, const void *data); - EAPI void e_comp_object_effect_mover_del(E_Comp_Object_Mover *prov); + E_API void e_comp_object_zoomap_set(Evas_Object *obj, Eina_Bool enabled); + E_API Eina_Bool e_comp_object_mirror_visibility_check(Evas_Object *obj); + E_API Evas_Object *e_comp_object_client_add(E_Client *ec); + E_API Evas_Object *e_comp_object_util_mirror_add(Evas_Object *obj); + E_API Evas_Object *e_comp_object_util_add(Evas_Object *obj, E_Comp_Object_Type type); + E_API void e_comp_object_frame_xy_adjust(Evas_Object *obj, int x, int y, int *ax, int *ay); + E_API void e_comp_object_frame_xy_unadjust(Evas_Object *obj, int x, int y, int *ax, int *ay); + E_API void e_comp_object_frame_wh_adjust(Evas_Object *obj, int w, int h, int *aw, int *ah); + E_API void e_comp_object_frame_wh_unadjust(Evas_Object *obj, int w, int h, int *aw, int *ah); + E_API void e_comp_object_frame_extends_get(Evas_Object *obj, int *x, int *y, int *w, int *h); + E_API E_Client *e_comp_object_client_get(Evas_Object *obj); + E_API E_Zone *e_comp_object_util_zone_get(Evas_Object *obj); + E_API void e_comp_object_util_del_list_append(Evas_Object *obj, Evas_Object *to_del); + E_API void e_comp_object_util_del_list_remove(Evas_Object *obj, Evas_Object *to_del); + E_API void e_comp_object_util_autoclose(Evas_Object *obj, E_Comp_Object_Autoclose_Cb del_cb, E_Comp_Object_Key_Cb cb, const void *data); + E_API void e_comp_object_util_center(Evas_Object *obj); + E_API void e_comp_object_util_center_on(Evas_Object *obj, Evas_Object *on); + E_API void e_comp_object_util_center_pos_get(Evas_Object *obj, int *x, int *y); + E_API void e_comp_object_util_fullscreen(Evas_Object *obj); + E_API Eina_Bool e_comp_object_frame_allowed(Evas_Object *obj); + E_API void e_comp_object_frame_geometry_get(Evas_Object *obj, int *l, int *r, int *t, int *b); + E_API void e_comp_object_frame_geometry_set(Evas_Object *obj, int l, int r, int t, int b); + E_API void e_comp_object_frame_icon_geometry_get(Evas_Object *obj, int *x, int *y, int *w, int *h); + E_API Eina_Bool e_comp_object_frame_title_set(Evas_Object *obj, const char *name); + E_API Eina_Bool e_comp_object_frame_exists(Evas_Object *obj); + E_API void e_comp_object_frame_icon_update(Evas_Object *obj); + E_API Eina_Bool e_comp_object_frame_theme_set(Evas_Object *obj, const char *name); + E_API void e_comp_object_signal_emit(Evas_Object *obj, const char *sig, const char *src); + E_API void e_comp_object_signal_callback_add(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data); + E_API void e_comp_object_signal_callback_del(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb); + E_API void e_comp_object_signal_callback_del_full(Evas_Object *obj, const char *sig, const char *src, Edje_Signal_Cb cb, const void *data); + E_API void e_comp_object_input_area_set(Evas_Object *obj, int x, int y, int w, int h); + E_API void e_comp_object_damage(Evas_Object *obj, int x, int y, int w, int h); + E_API Eina_Bool e_comp_object_damage_exists(Evas_Object *obj); + E_API void e_comp_object_render_update_add(Evas_Object *obj); + E_API void e_comp_object_render_update_del(Evas_Object *obj); + E_API void e_comp_object_shape_apply(Evas_Object *obj); + E_API void e_comp_object_redirected_set(Evas_Object *obj, Eina_Bool set); + E_API void e_comp_object_native_surface_set(Evas_Object *obj, Eina_Bool set); + E_API void e_comp_object_native_surface_override(Evas_Object *obj, Evas_Native_Surface *ns); + E_API void e_comp_object_blank(Evas_Object *obj, Eina_Bool set); + E_API void e_comp_object_dirty(Evas_Object *obj); + E_API Eina_Bool e_comp_object_render(Evas_Object *obj); + E_API Eina_Bool e_comp_object_effect_allowed_get(Evas_Object *obj); + E_API Eina_Bool e_comp_object_effect_set(Evas_Object *obj, const char *effect); + E_API void e_comp_object_effect_params_set(Evas_Object *obj, int id, int *params, unsigned int count); + E_API void e_comp_object_effect_clip(Evas_Object *obj); + E_API void e_comp_object_effect_unclip(Evas_Object *obj); + E_API Eina_Bool e_comp_object_effect_start(Evas_Object *obj, Edje_Signal_Cb end_cb, const void *end_data); + E_API Eina_Bool e_comp_object_effect_stop(Evas_Object *obj, Edje_Signal_Cb end_cb); + E_API E_Comp_Object_Mover *e_comp_object_effect_mover_add(int pri, const char *sig, E_Comp_Object_Mover_Cb provider, const void *data); + E_API void e_comp_object_effect_mover_del(E_Comp_Object_Mover *prov); +#ifdef _F_E_COMP_OBJECT_INTERCEPT_HOOK_ +EAPI E_Comp_Object_Intercept_Hook *e_comp_object_intercept_hook_add(E_Comp_Object_Intercept_Hook_Point hookpoint, E_Comp_Object_Intercept_Hook_Cb func, const void *data); +EAPI void e_comp_object_intercept_hook_del(E_Comp_Object_Intercept_Hook *ch); +#endif +EAPI unsigned int e_comp_object_is_animating(Evas_Object *obj); +EAPI void e_comp_object_alpha_set(Evas_Object *obj, Eina_Bool alpha); +EAPI void e_comp_object_mask_set(Evas_Object *obj, Eina_Bool set); +EAPI void e_comp_object_size_update(Evas_Object *obj, int w, int h); + #endif #endif diff --cc src/bin/e_comp_wl.c index 5d7998c,467072c..7c62a75 --- a/src/bin/e_comp_wl.c +++ b/src/bin/e_comp_wl.c @@@ -1,8 -1,7 +1,9 @@@ #define E_COMP_WL #include "e.h" + #include "e_comp_wl_screenshooter_server.h" +#include + /* handle include for printing uint64_t */ #define __STDC_FORMAT_MACROS #include @@@ -38,239 -35,17 +49,253 @@@ static double _last_event_time = 0.0 /* local functions */ static void ++<<<<<<< HEAD +_e_comp_wl_transform_stay_within_canvas(E_Client *ec, int x, int y, int *new_x, int *new_y) +{ + int new_x_max, new_y_max; + int zw, zh; + Eina_Bool lw, lh; + + if (!ec->zone) + { + if (new_x) *new_x = x; + if (new_y) *new_y = y; + return; + } + + zw = ec->zone->w; + zh = ec->zone->h; + + new_x_max = zw - ec->w; + new_y_max = zh - ec->h; + lw = ec->w > zw ? EINA_TRUE : EINA_FALSE; + lh = ec->h > zh ? EINA_TRUE : EINA_FALSE; + + if (new_x) + { + if (lw) + { + if (x <= new_x_max) + *new_x = new_x_max; + else if (x >= 0) + *new_x = 0; + } + else + { + if (x >= new_x_max) + *new_x = new_x_max; + else if (x <= 0) + *new_x = 0; + } + } + + if (new_y) + { + if (lh) + { + if (y <= new_y_max) + *new_y = new_y_max; + else if (y >= 0) + *new_y = 0; + } + else + { + if (y >= new_y_max) + *new_y = new_y_max; + else if (y <= 0) + *new_y = 0; + } + } +} + +static void +_e_comp_wl_transform_pull_del(void *data, + Elm_Transit *trans EINA_UNUSED) +{ + E_Client *ec = data; + if (!ec) return; + + e_object_unref(E_OBJECT(ec)); +} + +static void +_e_comp_wl_transform_pull(E_Client *ec) +{ + Elm_Transit *trans; + int new_x, new_y; + + new_x = ec->client.x; + new_y = ec->client.y; + + _e_comp_wl_transform_stay_within_canvas(ec, + ec->client.x, ec->client.y, + &new_x, &new_y); + + if ((ec->client.x == new_x) && (ec->client.y == new_y)) + return; + + e_object_ref(E_OBJECT(ec)); + + trans = elm_transit_add(); + elm_transit_del_cb_set(trans, _e_comp_wl_transform_pull_del, ec); + elm_transit_tween_mode_set(trans, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + elm_transit_effect_translation_add(trans, + 0, 0, + new_x - ec->client.x, + new_y - ec->client.y); + elm_transit_object_add(trans, ec->frame); + elm_transit_objects_final_state_keep_set(trans, EINA_TRUE); + elm_transit_duration_set(trans, 0.4); + elm_transit_go(trans); +} + +static void +_e_comp_wl_transform_effect_end(Elm_Transit_Effect *context, + Elm_Transit *trans) +{ + E_Client *ec = NULL; + E_Comp_Wl_Transform_Context *ctxt = context; + + if (!ctxt) return; + ec = ctxt->ec; + + if ((ec) && (!e_object_is_del(E_OBJECT(ec)))) + { + ec->comp_data->transform.start = 0; + ec->comp_data->transform.cur_degree += ctxt->degree * ctxt->direction; + if (ec->comp_data->transform.cur_degree < 0) + ec->comp_data->transform.cur_degree += 360; + else + ec->comp_data->transform.cur_degree %= 360; + ec->comp_data->transform.scount = 0; + ec->comp_data->transform.stime = 0; + } + + E_FREE(ctxt); +} + +static void +_e_comp_wl_transform_effect_del(void *data, + Elm_Transit *trans EINA_UNUSED) +{ + E_Client *ec = data; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + e_client_transform_apply(ec, ec->comp_data->transform.cur_degree, -1.0, -1, -1); +} + +static void +_e_comp_wl_transform_effect_run(Elm_Transit_Effect *context, + Elm_Transit *trans EINA_UNUSED, + double progress) +{ + E_Comp_Wl_Transform_Context *ctxt = context; + E_Client *ec = NULL; + int cx, cy; + + ec = ctxt->ec; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + cx = ec->client.x + ec->client.w / 2; + cy = ec->client.y + ec->client.h / 2; + + e_client_transform_apply(ec, ec->comp_data->transform.cur_degree + ctxt->degree * ctxt->direction * progress, -1.0, cx, cy); +} + +static void +_e_comp_wl_transform_unset(E_Client *ec) +{ + + Elm_Transit *trans; + E_Comp_Wl_Transform_Context *ctxt; + ctxt = E_NEW(E_Comp_Wl_Transform_Context, 1); + if (!ctxt) return; + + ec->comp_data->transform.start = 1; + ctxt->direction = 1; + ctxt->ec = ec; + ctxt->degree = 360 - ec->comp_data->transform.cur_degree; + + trans = elm_transit_add(); + elm_transit_del_cb_set(trans, _e_comp_wl_transform_effect_del, ec); + elm_transit_tween_mode_set(trans, ELM_TRANSIT_TWEEN_MODE_ACCELERATE); + elm_transit_object_add(trans, ec->frame); + elm_transit_effect_add(trans, + _e_comp_wl_transform_effect_run, + (void*)ctxt, + _e_comp_wl_transform_effect_end); + elm_transit_duration_set(trans, 0.45); + elm_transit_go(trans); +} + +static Eina_Bool +_e_comp_wl_transform_set(E_Client *ec, + int direction, + int count, + unsigned int time) +{ + Elm_Transit *trans; + E_Comp_Wl_Transform_Context *ctxt; + int degree; + + switch (count) + { + case 3: + if (time <= 50) + return EINA_FALSE; + else if (time <= 100) + degree = 100; + else + degree = 50; + break; + case 4: + if (time <= 50) + degree = 350; + else if (time <= 100) + degree = 250; + else + degree = 150; + break; + default: + return EINA_FALSE; + } + + ctxt = E_NEW(E_Comp_Wl_Transform_Context, 1); + if (!ctxt) return EINA_FALSE; + + ec->comp_data->transform.start = 1; + + ctxt->direction = direction / abs(direction); + ctxt->ec = ec; + ctxt->degree = degree; + + trans = elm_transit_add(); + elm_transit_del_cb_set(trans, _e_comp_wl_transform_effect_del, ec); + elm_transit_tween_mode_set(trans, ELM_TRANSIT_TWEEN_MODE_DECELERATE); + elm_transit_object_add(trans, ec->frame); + elm_transit_effect_add(trans, + _e_comp_wl_transform_effect_run, + (void*)ctxt, + _e_comp_wl_transform_effect_end); + elm_transit_duration_set(trans, (double)count/10.0); + elm_transit_go(trans); + + return EINA_TRUE; ++======= + _e_comp_wl_configure_send(E_Client *ec, Eina_Bool edges) + { + int w, h; + + if (e_comp_object_frame_exists(ec->frame)) + w = ec->client.w, h = ec->client.h; + else + w = ec->w, h = ec->h; + ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, + edges * e_comp_wl->resize.edges, + w, h); ++>>>>>>> upstream } static void @@@ -534,7 -128,7 +554,11 @@@ _e_comp_wl_evas_cb_show(void *data, Eva Eina_List *l; if (!(ec = data)) return; ++<<<<<<< HEAD + if (e_object_is_del(E_OBJECT(ec))) return; ++======= + if (e_object_is_del(data)) return; ++>>>>>>> upstream if (!ec->override) e_hints_window_visible_set(ec); @@@ -579,67 -169,6 +603,70 @@@ _e_comp_wl_evas_cb_hide(void *data, Eva EINA_LIST_FOREACH(ec->e.state.video_child, l, tmp) evas_object_hide(tmp->frame); ++<<<<<<< HEAD + + if (ec->comp_data->sub.below_obj) + evas_object_hide(ec->comp_data->sub.below_obj); +} + +static void +_e_comp_wl_evas_cb_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Client *ec; + E_Client *subc; + Eina_List *l; + int x, y; + + if (!(ec = data)) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + { + x = ec->x + subc->comp_data->sub.data->position.x; + y = ec->y + subc->comp_data->sub.data->position.y; + evas_object_move(subc->frame, x, y); + } + + EINA_LIST_FOREACH(ec->comp_data->sub.below_list, l, subc) + { + x = ec->x + subc->comp_data->sub.data->position.x; + y = ec->y + subc->comp_data->sub.data->position.y; + evas_object_move(subc->frame, x, y); + } + + if (ec->comp_data->sub.below_obj) + evas_object_move(ec->comp_data->sub.below_obj, ec->x, ec->y); +} + +static void +_e_comp_wl_evas_cb_restack(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + E_Client *ec; + E_Client *parent = NULL; + + if (!(ec = data)) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + /* return if ec isn't both a parent of a subsurface and a subsurface itself */ + if (!ec->comp_data->sub.list && !ec->comp_data->sub.below_list && !ec->comp_data->sub.data) + { + if (ec->comp_data->sub.below_obj) _e_comp_wl_subsurface_restack(ec); + return; + } + + if (ec->comp_data->sub.data) + parent = ec->comp_data->sub.data->parent; + else + parent = ec; + + EINA_SAFETY_ON_NULL_RETURN(parent); + + /* return if parent is null or is in restacking progress */ + if (parent->comp_data->sub.restacking) return; + + _e_comp_wl_subsurface_restack(parent); ++======= ++>>>>>>> upstream } static void @@@ -657,35 -186,17 +684,42 @@@ _e_comp_wl_evas_cb_mouse_in(void *data if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->comp_data->surface) return; + if (ec->comp_data->transform.start) return; + + if (e_comp->wl_comp_data->dnd.enabled) + { + e_comp_wl_data_dnd_focus(ec); + return; + } + + if (e_config->use_cursor_timer) + { + if (ec->comp->wl_comp_data->ptr.hidden == EINA_TRUE) + { + Evas_Object *o = NULL; + + ecore_evas_cursor_get(ec->comp->pointer->ee, &o, NULL, NULL, NULL); + if (o) + ec->comp->wl_comp_data->ptr.ec = e_comp_object_client_get(o); + return; + } + else + { + E_FREE_FUNC(ec->comp->wl_comp_data->ptr.hide_tmr, ecore_timer_del); + ec->comp->wl_comp_data->ptr.hide_tmr = ecore_timer_add(e_config->cursor_timer_interval, _e_comp_wl_cursor_timer, ec); + } + } + e_comp_wl->ptr.ec = ec; + if (e_comp_wl->drag) + { + e_comp_wl_data_device_send_enter(ec); + return; + } + if (!eina_list_count(e_comp_wl->ptr.resources)) return; wc = wl_resource_get_client(ec->comp_data->surface); - serial = wl_display_next_serial(ec->comp->wl_comp_data->wl.disp); - EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + serial = wl_display_next_serial(e_comp_wl->wl.disp); + EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; @@@ -719,28 -222,24 +753,39 @@@ _e_comp_wl_evas_cb_mouse_out(void *data Evas_Object *o; ecore_evas_cursor_get(e_comp->ee, &o, NULL, NULL, NULL); - if (e_comp->pointer->o_ptr != o) - e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + if ((e_comp->pointer->o_ptr != o) && (e_comp->wl_comp_data->ptr.enabled)) + { + if ((e_config->use_cursor_timer) && (e_comp->wl_comp_data->ptr.hidden)) + e_comp->wl_comp_data->ptr.ec = NULL; + else + e_pointer_object_set(e_comp->pointer, NULL, 0, 0); + } } + if (e_comp_wl->ptr.ec == ec) + e_comp_wl->ptr.ec = NULL; if (e_object_is_del(E_OBJECT(ec))) return; if (!ec->comp_data->surface) return; ++<<<<<<< HEAD + if (ec->comp_data->transform.start) return; + + if (e_comp->wl_comp_data->dnd.enabled) + { + if (e_comp->wl_comp_data->dnd.focus == ec->comp_data->surface) + e_comp_wl_data_dnd_focus(NULL); + } ++======= + if (e_comp_wl->drag) + { + e_comp_wl_data_device_send_leave(ec); + return; + } + if (!eina_list_count(e_comp_wl->ptr.resources)) return; ++>>>>>>> upstream wc = wl_resource_get_client(ec->comp_data->surface); - serial = wl_display_next_serial(ec->comp->wl_comp_data->wl.disp); - EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + serial = wl_display_next_serial(e_comp_wl->wl.disp); + EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; @@@ -749,252 -248,37 +794,279 @@@ } static void ++<<<<<<< HEAD +_e_comp_wl_evas_handle_mouse_move_to_touch(E_Client *ec, uint32_t timestamp, int canvas_x, int canvas_y) +{ + Eina_List *l; + struct wl_client *wc; + struct wl_resource *res; + wl_fixed_t x, y; + + wc = wl_resource_get_client(ec->comp_data->surface); + + x = wl_fixed_from_int(canvas_x - ec->client.x); + y = wl_fixed_from_int(canvas_y - ec->client.y); + + EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + if (!e_comp_wl_input_touch_check(res)) continue; + wl_touch_send_motion(res, timestamp, 0, x, y); //id 0 for the 1st finger + } +} + +static void +_e_comp_wl_cursor_reload(E_Client *ec) +{ + E_Client *ec_cursor; + struct wl_resource *res; + struct wl_client *wc; + Eina_List *l; + uint32_t serial; + int cx, cy; + + if (e_object_is_del(E_OBJECT(ec))) return; + if (!ec->comp_data) return; + + if ((ec_cursor = ec->comp->wl_comp_data->ptr.ec)) + { + ec_cursor->visible = 1; + ecore_evas_object_cursor_set(ec->comp->pointer->ee, ec_cursor->frame, EVAS_LAYER_MAX, ec_cursor->x, ec_cursor->y); + } + + ec->comp->wl_comp_data->ptr.hidden = EINA_FALSE; + + cx = wl_fixed_to_int(e_comp->wl_comp_data->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(e_comp->wl_comp_data->ptr.y) - ec->client.y; + + if (!ec->comp_data->surface) return; + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(ec->comp->wl_comp_data->wl.disp); + EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + { + if (!e_comp_wl_input_pointer_check(res)) continue; + if (wl_resource_get_client(res) != wc) continue; + wl_pointer_send_enter(res, serial, ec->comp_data->surface, + wl_fixed_from_int(cx), wl_fixed_from_int(cy)); + } +} + +static Eina_Bool +_e_comp_wl_cursor_timer(void *data) +{ + E_Client *ec = NULL; + E_Client *ec_cursor = NULL; + Evas_Object *o; + struct wl_resource *res; + struct wl_client *wc; + Eina_List *l; + uint32_t serial; + + if (!(ec = data)) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + if (!ec->comp_data) return EINA_FALSE; + + ecore_evas_cursor_get(ec->comp->pointer->ee, &o, NULL, NULL, NULL); + if (o) + { + ec_cursor = ec->comp->wl_comp_data->ptr.ec = e_comp_object_client_get(o); + if (ec_cursor) + { + ec_cursor->hidden = 1; + ec_cursor->x = ec->comp->pointer->hot.x; + ec_cursor->y = ec->comp->pointer->hot.y; + } + } + + ecore_evas_cursor_unset(ec->comp->pointer->ee); + + ec->comp->wl_comp_data->ptr.hidden = EINA_TRUE; + ec->comp->wl_comp_data->ptr.hide_tmr = NULL; + + if (!ec->comp_data->surface) return EINA_FALSE; + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(ec->comp->wl_comp_data->wl.disp); + EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + { + if (!e_comp_wl_input_pointer_check(res)) continue; + if (wl_resource_get_client(res) != wc) continue; + wl_pointer_send_leave(res, serial, ec->comp_data->surface); + } + + return ECORE_CALLBACK_CANCEL; +} + +static void +_e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) ++======= + _e_comp_wl_send_mouse_move(E_Client *ec, int x, int y, unsigned int timestamp) ++>>>>>>> upstream { - E_Client *ec; - Evas_Event_Mouse_Move *ev; struct wl_resource *res; - struct wl_client *wc; - Eina_List *l; + struct wl_client *wc; + Eina_List *l; + Evas_Device *dev = NULL; + ++<<<<<<< HEAD + ev = event; + + e_comp->wl_comp_data->ptr.x = wl_fixed_from_int(ev->cur.canvas.x); + e_comp->wl_comp_data->ptr.y = wl_fixed_from_int(ev->cur.canvas.y); + + if (!(ec = data)) return; + + if (ec->cur_mouse_action) return; + if (e_object_is_del(E_OBJECT(ec))) return; + if (e_client_util_ignored_get(ec)) return; + if (!ec->comp_data->surface) return; + + if (e_comp->wl_comp_data->dnd.enabled) + { + e_comp_wl_data_dnd_motion(ec, ev->timestamp, + ev->cur.canvas.x - ec->client.x, + ev->cur.canvas.y - ec->client.y); + return; + } + + dev = ev->dev; + if (dev && evas_device_class_get(dev) == EVAS_DEVICE_CLASS_TOUCH) + _e_comp_wl_evas_handle_mouse_move_to_touch(ec, ev->timestamp, ev->cur.canvas.x, ev->cur.canvas.y); + else + { + wc = wl_resource_get_client(ec->comp_data->surface); + EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + { + if (!e_comp_wl_input_pointer_check(res)) continue; + if (wl_resource_get_client(res) != wc) continue; + wl_pointer_send_motion(res, ev->timestamp, + wl_fixed_from_int(ev->cur.canvas.x - ec->client.x), + wl_fixed_from_int(ev->cur.canvas.y - ec->client.y)); + } + } + if (e_config->use_cursor_timer) + { + if (ec->comp->wl_comp_data->ptr.hidden == EINA_TRUE) + _e_comp_wl_cursor_reload(ec); + + E_FREE_FUNC(ec->comp->wl_comp_data->ptr.hide_tmr, ecore_timer_del); + ec->comp->wl_comp_data->ptr.hide_tmr = ecore_timer_add(e_config->cursor_timer_interval, _e_comp_wl_cursor_timer, ec); ++======= ++ wc = wl_resource_get_client(ec->comp_data->surface); ++ EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) ++ { ++ if (!e_comp_wl_input_pointer_check(res)) continue; ++ if (wl_resource_get_client(res) != wc) continue; ++ wl_pointer_send_motion(res, timestamp, ++ wl_fixed_from_int(x - ec->client.x), ++ wl_fixed_from_int(y - ec->client.y)); ++>>>>>>> upstream + } +} + - static Eina_Bool - _e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state) ++static void ++_e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) +{ ++<<<<<<< HEAD + Eina_List *l; + struct wl_client *wc; + uint32_t serial, btn; + struct wl_resource *res; + + if (ec->cur_mouse_action || ec->border_menu) return EINA_FALSE; + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + if (e_client_util_ignored_get(ec)) return EINA_FALSE; + + switch (button_id) + { + case 1: + btn = BTN_LEFT; + break; + case 2: + btn = BTN_MIDDLE; + break; + case 3: + btn = BTN_RIGHT; + break; + default: + btn = button_id; + break; + } + + ec->comp->wl_comp_data->ptr.button = btn; + + if (!ec->comp_data->surface) return EINA_FALSE; + + if ((ec->comp_data->transform.cur_degree != 0) && + (btn == BTN_MIDDLE)) + { + _e_comp_wl_transform_unset(ec); + return EINA_TRUE; + } + + if (e_comp->wl_comp_data->dnd.enabled) + { + e_comp_wl_data_dnd_drop(ec, timestamp, btn, state); + return EINA_FALSE; + } + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(ec->comp->wl_comp_data->wl.disp); + + EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + if (!e_comp_wl_input_pointer_check(res)) continue; + wl_pointer_send_button(res, serial, timestamp, btn, state); + } + return EINA_TRUE; +} + +static void +_e_comp_wl_evas_handle_mouse_button_to_touch(E_Client *ec, uint32_t timestamp, int canvas_x, int canvas_y, Eina_Bool flag) +{ + Eina_List *l; + struct wl_client *wc; + uint32_t serial; + struct wl_resource *res; + wl_fixed_t x, y; + + if (e_object_is_del(E_OBJECT(ec))) return; + if (!ec->comp_data->surface) return; + + if (e_comp->wl_comp_data->dnd.enabled) + { + e_comp_wl_data_dnd_drop_touch(ec, timestamp, canvas_x, canvas_y, flag); + return; + } wc = wl_resource_get_client(ec->comp_data->surface); - EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + + x = wl_fixed_from_int(canvas_x - ec->client.x); + y = wl_fixed_from_int(canvas_y - ec->client.y); + + EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res) { - if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; - wl_pointer_send_motion(res, timestamp, - wl_fixed_from_int(x - ec->client.x), - wl_fixed_from_int(y - ec->client.y)); + if (!e_comp_wl_input_touch_check(res)) continue; + if (flag) + wl_touch_send_down(res, serial, timestamp, ec->comp_data->surface, 0, x, y); //id 0 for the 1st finger + else + wl_touch_send_up(res, serial, timestamp, 0); } -} - -static void -_e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event) -{ ++======= + E_Client *ec = data; + Evas_Event_Mouse_Move *ev = event; + + if (ec->cur_mouse_action) return; + if (e_object_is_del(E_OBJECT(ec))) return; + if (ec->ignored) return; + if (!ec->comp_data->surface) return; + + if ((!e_comp_wl->drag_client) || + (!e_client_has_xwindow(e_comp_wl->drag_client))) + _e_comp_wl_send_mouse_move(ec, ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp); ++>>>>>>> upstream } static void @@@ -1002,26 -286,9 +1074,31 @@@ _e_comp_wl_evas_cb_mouse_down(void *dat { E_Client *ec = data; Evas_Event_Mouse_Down *ev = event; + Evas_Device *dev = NULL; + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + ++<<<<<<< HEAD + dev = ev->dev; + if (dev && evas_device_class_get(dev) == EVAS_DEVICE_CLASS_TOUCH) + _e_comp_wl_evas_handle_mouse_button_to_touch(ec, ev->timestamp, ev->canvas.x, ev->canvas.y, EINA_TRUE); + else + _e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button, + WL_POINTER_BUTTON_STATE_PRESSED); + + if (e_config->use_cursor_timer) + { + if (ec->comp->wl_comp_data->ptr.hidden == EINA_TRUE) + _e_comp_wl_cursor_reload(ec); + + E_FREE_FUNC(ec->comp->wl_comp_data->ptr.hide_tmr, ecore_timer_del); + ec->comp->wl_comp_data->ptr.hide_tmr = ecore_timer_add(e_config->cursor_timer_interval, _e_comp_wl_cursor_timer, ec); + } ++======= + e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button, + WL_POINTER_BUTTON_STATE_PRESSED); ++>>>>>>> upstream } static void @@@ -1029,17 -296,9 +1106,22 @@@ _e_comp_wl_evas_cb_mouse_up(void *data { E_Client *ec = data; Evas_Event_Mouse_Up *ev = event; + Evas_Device *dev = NULL; + + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; ++<<<<<<< HEAD + dev = ev->dev; + if (dev && evas_device_class_get(dev) == EVAS_DEVICE_CLASS_TOUCH) + _e_comp_wl_evas_handle_mouse_button_to_touch(ec, ev->timestamp, ev->canvas.x, ev->canvas.y, EINA_FALSE); + else + _e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button, + WL_POINTER_BUTTON_STATE_RELEASED); ++======= + e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button, + WL_POINTER_BUTTON_STATE_RELEASED); ++>>>>>>> upstream } static void @@@ -1070,29 -329,8 +1152,29 @@@ _e_comp_wl_evas_cb_mouse_wheel(void *da if (!ec->comp_data->surface) return; + if (ec->comp_data->transform.start) return; + if (ec->comp_data->transform.enabled) + { + if (ec->comp_data->transform.stime == 0) + { + ec->comp_data->transform.stime = ev->timestamp; + return; + } + + if (_e_comp_wl_transform_set(ec, ev->z, + ++ec->comp_data->transform.scount, + ev->timestamp - ec->comp_data->transform.stime)) + { + ec->comp_data->transform.scount = 0; + ec->comp_data->transform.stime = 0; + } + + /* do not send wheel event to client */ + return; + } + wc = wl_resource_get_client(ec->comp_data->surface); - EINA_LIST_FOREACH(ec->comp->wl_comp_data->ptr.resources, l, res) + EINA_LIST_FOREACH(e_comp_wl->ptr.resources, l, res) { if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != wc) continue; @@@ -1111,21 -349,20 +1193,37 @@@ _e_comp_wl_evas_cb_multi_down(void *dat Evas_Event_Multi_Down *ev = event; wl_fixed_t x, y; ++<<<<<<< HEAD + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + if (!ec->comp_data->surface) return; + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); ++======= + if (!ec->comp_data->surface) return; + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp_wl->wl.disp); ++>>>>>>> upstream x = wl_fixed_from_int(ev->canvas.x - ec->client.x); y = wl_fixed_from_int(ev->canvas.y - ec->client.y); ++<<<<<<< HEAD + EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + if (!e_comp_wl_input_touch_check(res)) continue; + wl_touch_send_down(res, serial, ev->timestamp, ec->comp_data->surface, ev->device, x, y); ++======= + EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + if (!e_comp_wl_input_touch_check(res)) continue; + wl_touch_send_down(res, serial, ev->timestamp, + ec->comp_data->surface, ev->device, x, y); ++>>>>>>> upstream } } @@@ -1139,14 -376,12 +1237,23 @@@ _e_comp_wl_evas_cb_multi_up(void *data E_Client *ec = data; Evas_Event_Multi_Up *ev = event; ++<<<<<<< HEAD + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; + if (!ec->comp_data->surface) return; + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + + EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res) ++======= + if (!ec->comp_data->surface) return; + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp_wl->wl.disp); + + EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res) ++>>>>>>> upstream { if (wl_resource_get_client(res) != wc) continue; if (!e_comp_wl_input_touch_check(res)) continue; @@@ -1164,8 -399,6 +1271,11 @@@ _e_comp_wl_evas_cb_multi_move(void *dat Evas_Event_Multi_Move *ev = event; wl_fixed_t x, y; ++<<<<<<< HEAD + if (!ec) return; + if (e_object_is_del(E_OBJECT(ec))) return; ++======= ++>>>>>>> upstream if (!ec->comp_data->surface) return; wc = wl_resource_get_client(ec->comp_data->surface); @@@ -1173,7 -406,7 +1283,11 @@@ x = wl_fixed_from_int(ev->cur.canvas.x - ec->client.x); y = wl_fixed_from_int(ev->cur.canvas.y - ec->client.y); ++<<<<<<< HEAD + EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res) ++======= + EINA_LIST_FOREACH(e_comp_wl->touch.resources, l, res) ++>>>>>>> upstream { if (wl_resource_get_client(res) != wc) continue; if (!e_comp_wl_input_touch_check(res)) continue; @@@ -1181,7 -414,6 +1295,10 @@@ } } ++<<<<<<< HEAD + ++======= ++>>>>>>> upstream static void _e_comp_wl_client_priority_adjust(int pid, int set, int adj, Eina_Bool use_adj, Eina_Bool adj_child, Eina_Bool do_child) { @@@ -1246,59 -478,30 +1363,73 @@@ _e_comp_wl_client_priority_normal(E_Cli EINA_FALSE, EINA_TRUE, EINA_FALSE); } - static void - _e_comp_wl_client_focus(E_Client *ec) + static Eina_Bool + _e_comp_wl_evas_cb_focus_in_timer(E_Client *ec) { ++<<<<<<< HEAD + struct wl_resource *res; ++======= ++>>>>>>> upstream uint32_t serial, *k; + struct wl_resource *res; Eina_List *l; + double t; - /* update keyboard modifier state */ - wl_array_for_each(k, &e_comp->wl_comp_data->kbd.keys) - e_comp_wl_input_keyboard_state_update(e_comp->wl_comp_data, *k, EINA_TRUE); - - ec->comp_data->focus_update = 1; - if (!ec->comp_data->surface) return; + ec->comp_data->on_focus_timer = NULL; ++<<<<<<< HEAD + /* send keyboard_enter to all keyboard resources */ + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + EINA_LIST_FOREACH(e_comp->wl_comp_data->kbd.focused, l, res) + { + wl_keyboard_send_enter(res, serial, ec->comp_data->surface, + &e_comp->wl_comp_data->kbd.keys); + ec->comp_data->focus_update = 0; + } ++======= + if (!e_comp_wl->kbd.focused) return EINA_FALSE; + serial = wl_display_next_serial(e_comp_wl->wl.disp); + t = ecore_time_unix_get(); + EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) + wl_array_for_each(k, &e_comp_wl->kbd.keys) + wl_keyboard_send_key(res, serial, t, + *k, WL_KEYBOARD_KEY_STATE_PRESSED); + return EINA_FALSE; ++>>>>>>> upstream +} + +static Eina_Bool +_e_comp_wl_evas_cb_focus_in_timer(E_Client *ec) +{ + E_Comp_Data *cdata; + uint32_t serial, *k; + struct wl_resource *res; + Eina_List *l; + double t; + + if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE; + + ec->comp_data->on_focus_timer = NULL; + cdata = ec->comp->wl_comp_data; + + if (!cdata->kbd.focused) return EINA_FALSE; + serial = wl_display_next_serial(cdata->wl.disp); + t = ecore_time_unix_get(); + EINA_LIST_FOREACH(cdata->kbd.focused, l, res) + wl_array_for_each(k, &cdata->kbd.keys) + wl_keyboard_send_key(res, serial, t, + *k, WL_KEYBOARD_KEY_STATE_PRESSED); + return EINA_FALSE; } static void _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { E_Client *ec, *focused; ++<<<<<<< HEAD + E_Comp_Data *cdata; ++======= ++>>>>>>> upstream struct wl_resource *res; struct wl_client *wc; Eina_List *l; @@@ -1306,10 -509,7 +1437,9 @@@ if (!(ec = data)) return; if (e_object_is_del(E_OBJECT(ec))) return; if (ec->iconic) return; - if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; + cdata = ec->comp->wl_comp_data; + /* block spurious focus events */ focused = e_client_focused_get(); if ((focused) && (ec != focused)) return; @@@ -1318,15 -518,14 +1448,26 @@@ _e_comp_wl_client_priority_raise(ec); wc = wl_resource_get_client(ec->comp_data->surface); ++<<<<<<< HEAD + EINA_LIST_FOREACH(cdata->kbd.resources, l, res) + if (wl_resource_get_client(res) == wc) + cdata->kbd.focused = eina_list_append(cdata->kbd.focused, res); + + _e_comp_wl_client_focus(ec); + + ec->comp_data->on_focus_timer = + ecore_timer_add(((e_config->xkb.delay_held_key_input_to_focus)/1000.0), + (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec); ++======= + EINA_LIST_FOREACH(e_comp_wl->kbd.resources, l, res) + if (wl_resource_get_client(res) == wc) + e_comp_wl->kbd.focused = eina_list_append(e_comp_wl->kbd.focused, res); + if (!e_comp_wl->kbd.focused) return; + e_comp_wl_input_keyboard_enter_send(ec); + e_comp_wl_data_device_keyboard_focus_set(); + ec->comp_data->on_focus_timer = + ecore_timer_add(0.8, (Ecore_Task_Cb)_e_comp_wl_evas_cb_focus_in_timer, ec); ++>>>>>>> upstream } static void @@@ -1340,35 -538,31 +1480,52 @@@ _e_comp_wl_evas_cb_focus_out(void *data double t; if (!(ec = data)) return; - if (e_object_is_del(E_OBJECT(ec))) return; - if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; ++<<<<<<< HEAD + E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); + + /* lower client priority */ + _e_comp_wl_client_priority_normal(ec); ++======= + if (!ec->comp_data) return; ++>>>>>>> upstream - cdata = ec->comp->wl_comp_data; + E_FREE_FUNC(ec->comp_data->on_focus_timer, ecore_timer_del); - /* update keyboard modifier state */ - wl_array_for_each(k, &cdata->kbd.keys) - e_comp_wl_input_keyboard_state_update(cdata, *k, EINA_FALSE); + /* lower client priority */ + if (!e_object_is_del(data)) + _e_comp_wl_client_priority_normal(ec); if (!ec->comp_data->surface) return; ++<<<<<<< HEAD + /* send key release and keyboard_leave to all focused resources */ + serial = wl_display_next_serial(cdata->wl.disp); + t = ecore_time_unix_get(); + EINA_LIST_FOREACH_SAFE(cdata->kbd.focused, l, ll, res) + { + wl_array_for_each(k, &cdata->kbd.keys) + wl_keyboard_send_key(res, serial, t, + *k, WL_KEYBOARD_KEY_STATE_RELEASED); + wl_keyboard_send_leave(res, serial, ec->comp_data->surface); + cdata->kbd.focused = + eina_list_remove_list(cdata->kbd.focused, l); ++======= + if (!eina_list_count(e_comp_wl->kbd.resources)) return; + + /* send keyboard_leave to all keyboard resources */ + serial = wl_display_next_serial(e_comp_wl->wl.disp); + t = ecore_time_unix_get(); + EINA_LIST_FOREACH_SAFE(e_comp_wl->kbd.focused, l, ll, res) + { + wl_array_for_each(k, &e_comp_wl->kbd.keys) + wl_keyboard_send_key(res, serial, t, + *k, WL_KEYBOARD_KEY_STATE_RELEASED); + wl_keyboard_send_leave(res, serial, ec->comp_data->surface); + e_comp_wl->kbd.focused = + eina_list_remove_list(e_comp_wl->kbd.focused, l); ++>>>>>>> upstream } - ec->comp_data->focus_update = 0; } static void @@@ -1380,12 -574,9 +1537,15 @@@ _e_comp_wl_evas_cb_resize(void *data, E if ((ec->shading) || (ec->shaded)) return; if (!ec->comp_data->shell.configure_send) return; ++<<<<<<< HEAD + + /* TODO: calculate x, y with transfrom object */ + if ((e_client_util_resizing_get(ec)) && (!ec->transformed)) ++======= + if (e_client_util_resizing_get(ec) && e_comp_wl->resize.edges) ++>>>>>>> upstream { - int x, y, ax, ay; + int x, y; x = ec->mouse.last_down[ec->moveinfo.down.button - 1].w; y = ec->mouse.last_down[ec->moveinfo.down.button - 1].h; @@@ -1425,24 -610,20 +1579,34 @@@ case E_POINTER_RESIZE_BL: case E_POINTER_RESIZE_B: case E_POINTER_RESIZE_BR: - y += ec->mouse.current.my - ec->mouse.last_down[ec->moveinfo.down.button - 1].my - - ec->comp_data->shell.window.y; + y += ec->mouse.current.my - ec->mouse.last_down[ec->moveinfo.down.button - 1].my; break; default: - y -= ay; + break; } ++<<<<<<< HEAD + ++======= + x = E_CLAMP(x, 1, x); + y = E_CLAMP(y, 1, y); ++>>>>>>> upstream ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, - ec->comp->wl_comp_data->resize.edges, - x, y); + e_comp_wl->resize.edges, + x, y); } ++<<<<<<< HEAD + else + ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, + ec->comp->wl_comp_data->resize.edges, + ec->client.w, ec->client.h); + + if (ec->comp_data->sub.below_obj) + evas_object_resize(ec->comp_data->sub.below_obj, ec->w, ec->h); ++======= + else if ((!ec->fullscreen) && (!ec->maximized) && + (!ec->comp_data->maximize_pre)) + _e_comp_wl_configure_send(ec, 1); ++>>>>>>> upstream } static void @@@ -1563,32 -737,65 +1735,94 @@@ static voi _e_comp_wl_client_evas_init(E_Client *ec) { if (ec->comp_data->evas_init) return; ++<<<<<<< HEAD + + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, _e_comp_wl_evas_cb_show, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, _e_comp_wl_evas_cb_hide, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOVE, _e_comp_wl_evas_cb_move, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_RESTACK, _e_comp_wl_evas_cb_restack, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_IN, _e_comp_wl_evas_cb_mouse_in, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_OUT, _e_comp_wl_evas_cb_mouse_out, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_MOVE, _e_comp_wl_evas_cb_mouse_move, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_DOWN, _e_comp_wl_evas_cb_mouse_down, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_UP, _e_comp_wl_evas_cb_mouse_up, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_MOUSE_WHEEL, _e_comp_wl_evas_cb_mouse_wheel, ec); + + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_DOWN, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_multi_down, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_UP, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_multi_up, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_MOVE, EVAS_CALLBACK_PRIORITY_AFTER, _e_comp_wl_evas_cb_multi_move, ec); + + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_FOCUS_IN, _e_comp_wl_evas_cb_focus_in, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_FOCUS_OUT, _e_comp_wl_evas_cb_focus_out, ec); + + if (!ec->override) + { + evas_object_smart_callback_add(ec->frame, "client_resize", _e_comp_wl_evas_cb_resize, ec); + evas_object_smart_callback_add(ec->frame, "maximize_done", _e_comp_wl_evas_cb_state_update, ec); + evas_object_smart_callback_add(ec->frame, "unmaximize_done", _e_comp_wl_evas_cb_state_update, ec); + evas_object_smart_callback_add(ec->frame, "fullscreen", _e_comp_wl_evas_cb_state_update, ec); + evas_object_smart_callback_add(ec->frame, "unfullscreen", _e_comp_wl_evas_cb_state_update, ec); ++======= + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_SHOW, + _e_comp_wl_evas_cb_show, ec); + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_HIDE, + _e_comp_wl_evas_cb_hide, ec); + + /* setup input callbacks */ + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_IN, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_mouse_in, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_OUT, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_mouse_out, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_MOVE, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_mouse_move, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_DOWN, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_mouse_down, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_UP, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_mouse_up, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MOUSE_WHEEL, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_mouse_wheel, ec); + + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_DOWN, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_multi_down, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_UP, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_multi_up, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_MULTI_MOVE, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_multi_move, ec); + + + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_FOCUS_IN, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_focus_in, ec); + evas_object_event_callback_priority_add(ec->frame, EVAS_CALLBACK_FOCUS_OUT, + EVAS_CALLBACK_PRIORITY_AFTER, + _e_comp_wl_evas_cb_focus_out, ec); + + if (!ec->override) + { + evas_object_smart_callback_add(ec->frame, "client_resize", + _e_comp_wl_evas_cb_resize, ec); + evas_object_smart_callback_add(ec->frame, "maximize_done", + _e_comp_wl_evas_cb_state_update, ec); + evas_object_smart_callback_add(ec->frame, "unmaximize_done", + _e_comp_wl_evas_cb_state_update, ec); + evas_object_smart_callback_add(ec->frame, "maximize_pre", + _e_comp_wl_evas_cb_maximize_pre, ec); + evas_object_smart_callback_add(ec->frame, "unmaximize_pre", + _e_comp_wl_evas_cb_maximize_pre, ec); + evas_object_smart_callback_add(ec->frame, "fullscreen", + _e_comp_wl_evas_cb_state_update, ec); + evas_object_smart_callback_add(ec->frame, "unfullscreen", + _e_comp_wl_evas_cb_state_update, ec); ++>>>>>>> upstream } /* setup delete/kill callbacks */ @@@ -1663,117 -882,8 +1904,120 @@@ _e_comp_wl_cb_comp_object_add(void *dat return ECORE_CALLBACK_RENEW; } ++<<<<<<< HEAD +static void +_e_comp_wl_cb_key_down(void *event) +{ + E_Comp_Data *cdata; + E_Client *ec; + Ecore_Event_Key *ev; + uint32_t serial, *end, *k, keycode; + + ev = event; + keycode = (ev->keycode - 8); + if (!(cdata = e_comp->wl_comp_data)) return; + +#ifdef HAVE_WAYLAND_ONLY + #ifndef E_RELEASE_BUILD + if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + ((ev->modifiers & ECORE_EVENT_MODIFIER_ALT) || + (ev->modifiers & ECORE_EVENT_MODIFIER_ALTGR)) && + eina_streq(ev->key, "BackSpace")) + exit(0); + #endif +#endif + + end = (uint32_t *)cdata->kbd.keys.data + (cdata->kbd.keys.size / sizeof(*k)); + + for (k = cdata->kbd.keys.data; k < end; k++) + { + /* ignore server-generated key repeats */ + if (*k == keycode) return; + } + + /* update modifier state */ + e_comp_wl_input_keyboard_state_update(cdata, keycode, EINA_TRUE); + + if ((!e_client_action_get()) && (!e_comp->input_key_grabs) && (!e_menu_grab_window_get())) + { + if ((ec = e_client_focused_get())) + { + if (ec->comp_data->surface) + { + struct wl_resource *res; + Eina_List *l; + + serial = wl_display_next_serial(cdata->wl.disp); + EINA_LIST_FOREACH(cdata->kbd.focused, l, res) + wl_keyboard_send_key(res, serial, ev->timestamp, + keycode, WL_KEYBOARD_KEY_STATE_PRESSED); + + /* A key only sent to clients is added to the list */ + cdata->kbd.keys.size = (const char *)end - (const char *)cdata->kbd.keys.data; + k = wl_array_add(&cdata->kbd.keys, sizeof(*k)); + *k = keycode; + } + } + } + + if (cdata->kbd.mod_changed) + { + e_comp_wl_input_keyboard_modifiers_update(cdata); + cdata->kbd.mod_changed = 0; + } +} + +static void +_e_comp_wl_cb_key_up(void *event) +{ + E_Comp_Data *cdata; + Ecore_Event_Key *ev; + uint32_t serial, *end, *k, keycode; + uint32_t delivered_key; + + ev = event; + keycode = (ev->keycode - 8); + delivered_key = 0; + if (!(cdata = e_comp->wl_comp_data)) return; + + end = (uint32_t *)cdata->kbd.keys.data + (cdata->kbd.keys.size / sizeof(*k)); + for (k = cdata->kbd.keys.data; k < end; k++) + { + if (*k == keycode) + { + *k = *--end; + delivered_key = 1; + } + } + + cdata->kbd.keys.size = (const char *)end - (const char *)cdata->kbd.keys.data; + + /* update modifier state */ + e_comp_wl_input_keyboard_state_update(cdata, keycode, EINA_FALSE); + + /* If a key down event have been sent to clients, send a key up event to client for garantee key event sequence pair. (down/up) */ + if (delivered_key || ((!e_client_action_get()) && (!e_comp->input_key_grabs) && (!e_menu_grab_window_get()))) + { + struct wl_resource *res; + Eina_List *l; + + serial = wl_display_next_serial(cdata->wl.disp); + EINA_LIST_FOREACH(cdata->kbd.focused, l, res) + wl_keyboard_send_key(res, serial, ev->timestamp, + keycode, WL_KEYBOARD_KEY_STATE_RELEASED); + } + + if (cdata->kbd.mod_changed) + { + e_comp_wl_input_keyboard_modifiers_update(cdata); + cdata->kbd.mod_changed = 0; + } +} + ++======= ++>>>>>>> upstream static Eina_Bool - _e_comp_wl_cb_input_event(void *data EINA_UNUSED, int type, void *ev) + _e_comp_wl_cb_mouse_move(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev) { _last_event_time = ecore_loop_time_get(); @@@ -1786,77 -910,13 +2044,70 @@@ } static void +_e_comp_wl_subsurface_restack(E_Client *ec) +{ + E_Client *subc, *temp; + Eina_List *l; + + ec->comp_data->sub.restacking = EINA_TRUE; + + temp = ec; + EINA_LIST_FOREACH(ec->comp_data->sub.list, l, subc) + { + evas_object_stack_above(subc->frame, temp->frame); + temp = subc; + } + + temp = ec; + EINA_LIST_REVERSE_FOREACH(ec->comp_data->sub.below_list, l, subc) + { + evas_object_stack_below(subc->frame, temp->frame); + temp = subc; + } + + if (ec->comp_data->sub.below_obj) + evas_object_stack_below(ec->comp_data->sub.below_obj, temp->frame); + + ec->comp_data->sub.restacking = EINA_FALSE; +} + +static void +_e_comp_wl_surface_subsurface_order_commit(E_Client *ec) +{ + E_Client *subc; + Eina_List *l; + + if (!ec->comp_data->sub.list_changed) return; + ec->comp_data->sub.list_changed = EINA_FALSE; + + /* TODO: need to check more complicated subsurface tree */ + EINA_LIST_FOREACH(ec->comp_data->sub.list_pending, l, subc) + { + ec->comp_data->sub.list = eina_list_remove(ec->comp_data->sub.list, subc); + ec->comp_data->sub.list = eina_list_append(ec->comp_data->sub.list, subc); + + _e_comp_wl_surface_subsurface_order_commit(subc); + } + + EINA_LIST_FOREACH(ec->comp_data->sub.below_list_pending, l, subc) + { + ec->comp_data->sub.below_list = eina_list_remove(ec->comp_data->sub.below_list, subc); + ec->comp_data->sub.below_list = eina_list_append(ec->comp_data->sub.below_list, subc); + + _e_comp_wl_surface_subsurface_order_commit(subc); + } + + _e_comp_wl_subsurface_restack(ec); +} + +static void _e_comp_wl_surface_state_size_update(E_Client *ec, E_Comp_Wl_Surface_State *state) { - int w = 0, h = 0; + Eina_Rectangle *window; /* double scale = 0.0; */ - if (!ec->comp_data->buffer_ref.buffer) - { - state->bw = 0; - state->bh = 0; - return; - } - - /* scale = e_comp->wl_comp_data->output.scale; */ - /* switch (e_comp->wl_comp_data->output.transform) */ + /* scale = e_comp_wl->output.scale; */ + /* switch (e_comp_wl->output.transform) */ /* { */ /* case WL_OUTPUT_TRANSFORM_90: */ /* case WL_OUTPUT_TRANSFORM_270: */ @@@ -1949,38 -1007,40 +2204,56 @@@ _e_comp_wl_surface_state_commit(E_Clien { Eina_Bool first = EINA_FALSE; Eina_Rectangle *dmg; - Eina_List *l; - struct wl_resource *cb; - Eina_Bool placed = EINA_TRUE; - int x = 0, y = 0; + Eina_Bool ignored, placed = EINA_TRUE; + int x = 0, y = 0, w, h; first = !e_pixmap_usable_get(ec->pixmap); + ignored = ec->ignored; + ec->comp_data->scaler.buffer_viewport = state->buffer_viewport; + if (state->new_attach) e_comp_wl_surface_attach(ec, state->buffer); _e_comp_wl_surface_state_buffer_set(state, NULL); - if (state->new_attach) + if (state->new_attach || state->buffer_viewport.changed) { ++<<<<<<< HEAD + _e_comp_wl_surface_state_size_update(ec, state); + _e_comp_wl_map_size_cal_from_viewport(ec); + ++======= ++>>>>>>> upstream if (ec->changes.pos) - e_comp_object_frame_xy_adjust(ec->frame, ec->x, ec->y, &x, &y); + e_comp_object_frame_xy_unadjust(ec->frame, ec->x, ec->y, &x, &y); else x = ec->client.x, y = ec->client.y; if (ec->new_client) placed = ec->placed; ++<<<<<<< HEAD + if (!ec->lock_client_size) + { + ec->w = ec->client.w = state->bw; + ec->h = ec->client.h = state->bh; + } ++======= + if (first && e_client_has_xwindow(ec)) + /* use client geometry to avoid race condition from x11 configure request */ + x = ec->x, y = ec->y; + else + { + ec->client.w = state->bw; + ec->client.h = state->bh; + e_comp_object_frame_wh_adjust(ec->frame, ec->client.w, ec->client.h, &ec->w, &ec->h); + } + w = ec->client.w; + h = ec->client.h; ++>>>>>>> upstream } + else + w = state->bw, h = state->bh; if (!e_pixmap_usable_get(ec->pixmap)) { if (ec->comp_data->mapped) @@@ -1989,13 -1049,11 +2262,18 @@@ ec->comp_data->shell.unmap(ec->comp_data->shell.surface); else { + ec->visible = EINA_FALSE; evas_object_hide(ec->frame); ++<<<<<<< HEAD + ec->comp_data->mapped = EINA_FALSE; ++======= + ec->comp_data->mapped = 0; ++>>>>>>> upstream } } + + if (ec->comp_data->sub.below_obj && evas_object_visible_get(ec->comp_data->sub.below_obj)) + evas_object_hide(ec->comp_data->sub.below_obj); } else { @@@ -2005,22 -1063,59 +2283,70 @@@ ec->comp_data->shell.map(ec->comp_data->shell.surface); else { + ec->visible = EINA_TRUE; + ec->ignored = 0; evas_object_show(ec->frame); ++<<<<<<< HEAD + ec->comp_data->mapped = EINA_TRUE; ++======= + ec->comp_data->mapped = 1; ++>>>>>>> upstream } } + + if (ec->comp_data->sub.below_obj && !evas_object_visible_get(ec->comp_data->sub.below_obj)) + evas_object_show(ec->comp_data->sub.below_obj); } - if (state->new_attach) + if (state->new_attach || state->buffer_viewport.changed) { if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.configure)) ec->comp_data->shell.configure(ec->comp_data->shell.surface, - x, y, state->bw, state->bh); + x, y, ec->w, ec->h); else ++<<<<<<< HEAD + e_client_util_move_resize_without_frame(ec, x, y, ec->w, ec->h); ++======= + { + if (ec->netwm.sync.wait) + { + E_Client_Pending_Resize *pnd = NULL; + + ec->netwm.sync.wait--; + + /* skip pending for which we didn't get a reply */ + while (ec->pending_resize) + { + pnd = eina_list_data_get(ec->pending_resize); + ec->pending_resize = eina_list_remove(ec->pending_resize, pnd); + + if ((state->bw == pnd->w) && (state->bh == pnd->h)) + break; + + E_FREE(pnd); + } + + if (pnd) + { + e_comp_object_frame_wh_adjust(ec->frame, pnd->w, pnd->h, &ec->w, &ec->h); + E_FREE(pnd); + } + ecore_evas_pointer_xy_get(e_comp->ee, &ec->mouse.current.mx, &ec->mouse.current.my); + ec->netwm.sync.send_time = ecore_loop_time_get(); + } + if (e_comp_wl->drag && e_comp_wl->drag_client && + (e_comp_wl->drag_client == ec)) + { + e_comp_wl->drag->dx -= state->sx; + e_comp_wl->drag->dy -= state->sy; + e_drag_move(e_comp_wl->drag, + e_comp_wl->drag->x + state->sx, e_comp_wl->drag->y + state->sy); + e_drag_resize(e_comp_wl->drag, state->bw, state->bh); + } + else + e_client_util_move_resize_without_frame(ec, x, y, w, h); + } ++>>>>>>> upstream if (ec->new_client) ec->placed = placed; @@@ -2042,35 -1129,23 +2368,42 @@@ state->sx = 0; state->sy = 0; state->new_attach = EINA_FALSE; + state->buffer_viewport.changed = 0; + /* insert state frame callbacks into comp_data->frames + * NB: This clears state->frames list */ + ec->comp_data->frames = eina_list_merge(ec->comp_data->frames, + state->frames); + state->frames = NULL; + + ec->ignored = ignored; if (!ec->comp_data->mapped) goto unmapped; /* put state damages into surface */ - if ((!ec->comp->nocomp) && (ec->frame)) + if ((!e_comp->nocomp) && (ec->frame)) { - EINA_LIST_FREE(state->damages, dmg) + /* FIXME: workaround for bad wayland egl driver which doesn't send damage request */ + if (!eina_list_count(state->damages)) + { + if (ec->comp_data->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) + { + e_comp_object_damage(ec->frame, + 0, 0, + ec->comp_data->buffer_ref.buffer->w, + ec->comp_data->buffer_ref.buffer->h); + } + } + else { - e_comp_object_damage(ec->frame, dmg->x, dmg->y, dmg->w, dmg->h); - eina_rectangle_free(dmg); + EINA_LIST_FREE(state->damages, dmg) + { + /* not creating damage for ec that shows a underlay video */ + if (ec->comp_data->buffer_ref.buffer->type != E_COMP_WL_BUFFER_TYPE_VIDEO || + !e_comp->wl_comp_data->available_hw_accel.underlay) + e_comp_object_damage(ec->frame, dmg->x, dmg->y, dmg->w, dmg->h); + + eina_rectangle_free(dmg); + } } } @@@ -2119,17 -1197,11 +2455,15 @@@ e_comp_object_input_area_set(ec->frame, 0, 0, ec->w, ec->h); eina_tiler_free(tmp); - } - /* insert state frame callbacks into comp_data->frames - * NB: This clears state->frames list */ - EINA_LIST_FOREACH(state->frames, l, cb) - eina_list_move(&ec->comp_data->frames, &state->frames, cb); + /* clear input tiler */ + eina_tiler_clear(state->input); + } + if (ec->comp_data->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_VIDEO && + e_comp->wl_comp_data->available_hw_accel.underlay) + e_pixmap_image_clear(ec->pixmap, 1); + return; unmapped: @@@ -2257,29 -1314,7 +2581,32 @@@ _e_comp_wl_surface_cb_opaque_region_set return; eina_tiler_union(ec->comp_data->pending.opaque, tmp); + + if (!eina_tiler_empty(ec->comp_data->pending.opaque)) + { + if (ec->argb) + { + ec->argb = EINA_FALSE; + e_comp_object_alpha_set(ec->frame, EINA_FALSE); + } + } + } ++<<<<<<< HEAD + else + { + if (ec->comp_data->pending.opaque) + { + eina_tiler_clear(ec->comp_data->pending.opaque); + /* eina_tiler_free(ec->comp_data->pending.opaque); */ + } + if (!ec->argb) + { + ec->argb = EINA_TRUE; + e_comp_object_alpha_set(ec->frame, EINA_TRUE); + } } ++======= ++>>>>>>> upstream } static void @@@ -2396,36 -1389,33 +2721,52 @@@ static const struct wl_surface_interfac }; static void + _e_comp_wl_surface_render_stop(E_Client *ec) + { + /* FIXME: this may be fine after e_pixmap can create textures for wl clients? */ + //if ((!ec->internal) && (!e_comp_gl_get())) + ec->dead = ec->hidden = 1; + evas_object_hide(ec->frame); + } + + static void _e_comp_wl_surface_destroy(struct wl_resource *resource) { - E_Pixmap *ep; E_Client *ec; ++<<<<<<< HEAD + if (!(ep = wl_resource_get_user_data(resource))) return; + + /* try to get the e_client from this pixmap */ + if (!(ec = e_pixmap_client_get(ep))) + { + e_pixmap_free(ep); + return; + } + else + e_pixmap_del(ep); + + evas_object_hide(ec->frame); ++======= + if (!(ec = wl_resource_get_user_data(resource))) return; + + _e_comp_wl_surface_render_stop(ec); ++>>>>>>> upstream e_object_del(E_OBJECT(ec)); } static void _e_comp_wl_compositor_cb_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id) { - E_Comp *comp; struct wl_resource *res; ++<<<<<<< HEAD + E_Pixmap *ep = NULL; ++======= + E_Client *wc, *ec = NULL; + Eina_List *l; ++>>>>>>> upstream pid_t pid; - if (!(comp = wl_resource_get_user_data(resource))) return; - DBG("Compositor Cb Surface Create: %d", id); /* try to create an internal surface */ @@@ -2443,24 -1433,13 +2784,32 @@@ wl_resource_set_implementation(res, &_e_surface_interface, NULL, _e_comp_wl_surface_destroy); - wl_client_get_credentials(client, &pid, NULL, NULL); + wl_client_get_credentials(client, &pid, NULL, NULL); ++<<<<<<< HEAD + if (pid == getpid()) + { + /* pixmap of internal win was supposed to be created at trap show */ + ep = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)id); + } + else + { + if ((ep = e_pixmap_find(E_PIXMAP_TYPE_WL, (uintptr_t)res))) + { + ERR("There is e_pixmap already, Delete old e_pixmap %p", ep); + e_pixmap_del(ep); + ep = NULL; + } + } + + if (!ep) ++======= + if (pid == getpid()) //internal! + ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, (uintptr_t)id); + if (!ec) ++>>>>>>> upstream { + E_Pixmap *ep; + /* try to create new pixmap */ if (!(ep = e_pixmap_new(E_PIXMAP_TYPE_WL, res))) { @@@ -2469,18 -1448,35 +2818,48 @@@ wl_client_post_no_memory(client); return; } ++<<<<<<< HEAD + } + DBG("\tUsing Pixmap: %p", ep); + + /* set reference to pixmap so we can fetch it later */ + wl_resource_set_user_data(res, ep); + + E_Comp_Wl_Client_Data *cdata = e_pixmap_cdata_get(ep); + if (cdata) + cdata->wl_surface = res; + ++======= + DBG("\tUsing Pixmap: %p", ep); + + ec = e_client_new(ep, 0, 0); + } + if (ec) + { + if (ec->new_client) + e_comp->new_clients--; + ec->new_client = 0; + if ((!ec->client.w) && (ec->client.h)) + ec->client.w = ec->client.h = 1; + ec->comp_data->surface = res; + } + + /* set reference to pixmap so we can fetch it later */ + DBG("\tUsing Client: %p", ec); + wl_resource_set_user_data(res, ec); + #ifndef HAVE_WAYLAND_ONLY + EINA_LIST_FOREACH(e_comp_wl->xwl_pending, l, wc) + { + if (!e_pixmap_is_x(wc->pixmap)) continue; + if (wl_resource_get_id(res) != + ((E_Comp_X_Client_Data*)wc->comp_data)->surface_id) continue; + e_comp_x_xwayland_client_setup(wc, ec); + break; + } + #endif ++>>>>>>> upstream /* emit surface create signal */ - wl_signal_emit(&comp->wl_comp_data->signals.surface.create, res); + wl_signal_emit(&e_comp_wl->signals.surface.create, res); } static void @@@ -2593,148 -1568,20 +2951,153 @@@ static const struct wl_compositor_inter }; static void ++<<<<<<< HEAD +_e_comp_wl_pname_get(pid_t pid, char *name, int size) +{ + if (!name) return; + + FILE *h; + char proc[512], pname[512]; + size_t len; + + snprintf(proc, 512,"/proc/%d/cmdline", pid); + + h = fopen(proc, "r"); + if (!h) return; + + len = fread(pname, sizeof(char), 512, h); + if (len > 0) + { + if ('\n' == pname[len - 1]) + pname[len - 1] = '\0'; + } + + fclose(h); + + strncpy(name, pname, size); +} + +static void +_e_comp_wl_pname_print(pid_t pid) +{ + FILE *h; + char proc[512], pname[512]; + size_t len; + + snprintf(proc, 512,"/proc/%d/cmdline", pid); + + h = fopen(proc, "r"); + if (!h) return; + + len = fread(pname, sizeof(char), 512, h); + if (len > 0) + { + if ('\n' == pname[len - 1]) + pname[len - 1] = '\0'; + } + + fclose(h); + + ELOGF("COMP", " |%s", NULL, NULL, pname); +} + + +static void +_e_comp_wl_compositor_cb_unbind(struct wl_resource *res_comp) +{ + struct wl_client *client; + pid_t pid = 0; + uid_t uid = 0; + gid_t gid = 0; + + client = wl_resource_get_client(res_comp); + if (client) + wl_client_get_credentials(client, + &pid, + &uid, + &gid); + + ELOGF("COMP", + "UNBIND |res_comp:0x%08x|client:0x%08x|%d|%d|%d", + NULL, NULL, + (unsigned int)res_comp, + (unsigned int)client, + pid, uid, gid); + + E_Comp *comp; + if ((comp = wl_resource_get_user_data(res_comp))) + { + Eina_List *l; + E_Comp_Connected_Client_Info *cinfo; + EINA_LIST_FOREACH(comp->connected_clients, l, cinfo) + { + if (cinfo->pid == pid) + break; + cinfo = NULL; + } + if (cinfo) + { + if (cinfo->name) + eina_stringshare_del(cinfo->name); + comp->connected_clients = eina_list_remove(comp->connected_clients, cinfo); + E_FREE(cinfo); + } + } +} + +static void +_e_comp_wl_compositor_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) ++======= + _e_comp_wl_compositor_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t version, uint32_t id) ++>>>>>>> upstream { - E_Comp *comp; struct wl_resource *res; + pid_t pid = 0; + uid_t uid = 0; + gid_t gid = 0; - if (!(comp = data)) return; - if (!(res = wl_resource_create(client, &wl_compositor_interface, - MIN(version, COMPOSITOR_VERSION), id))) + version, id))) { ERR("Could not create compositor resource: %m"); wl_client_post_no_memory(client); return; } ++<<<<<<< HEAD + wl_resource_set_implementation(res, + &_e_comp_interface, + comp, + _e_comp_wl_compositor_cb_unbind); + + wl_client_get_credentials(client, &pid, &uid, &gid); + + ELOGF("COMP", + "BIND |res_comp:0x%08x|client:0x%08x|%d|%d|%d", + NULL, NULL, + (unsigned int)res, + (unsigned int)client, + pid, uid, gid); + + _e_comp_wl_pname_print(pid); + + char name[512]; + _e_comp_wl_pname_get(pid, name, sizeof(name)); + + E_Comp_Connected_Client_Info *cinfo; + cinfo = E_NEW(E_Comp_Connected_Client_Info, 1); + if (cinfo) + { + cinfo->name = eina_stringshare_add(name); + cinfo->pid = pid; + cinfo->uid = uid; + cinfo->gid = gid; + comp->connected_clients= eina_list_append(comp->connected_clients, cinfo); + } ++======= + wl_resource_set_implementation(res, &_e_comp_interface, e_comp, NULL); ++>>>>>>> upstream } static void @@@ -2755,12 -1601,10 +3117,12 @@@ _e_comp_wl_compositor_cb_del(void *dat } /* delete fd handler */ - if (cdata->fd_hdlr) ecore_main_fd_handler_del(cdata->fd_hdlr); + if (e_comp_wl->fd_hdlr) ecore_main_fd_handler_del(e_comp_wl->fd_hdlr); + E_FREE_FUNC(cdata->ptr.hide_tmr, ecore_timer_del); + /* free allocated data structure */ - free(cdata); + free(e_comp_wl); } static void @@@ -2926,12 -1722,6 +3288,15 @@@ _e_comp_wl_subsurface_commit_from_cache _e_comp_wl_surface_state_commit(ec, &sdata->cached); e_comp_wl_buffer_reference(&sdata->cached_buffer_ref, NULL); ++<<<<<<< HEAD + + _e_comp_wl_surface_subsurface_order_commit(ec); + + /* schedule repaint */ + if (e_pixmap_refresh(ec->pixmap)) + e_comp_post_update_add(ec); ++======= ++>>>>>>> upstream } static void @@@ -3169,20 -1947,7 +3534,23 @@@ _e_comp_wl_subsurface_create(E_Client * ec->comp_data->surface = surface_resource; ec->comp_data->sub.data = sdata; ++<<<<<<< HEAD + ec->lock_user_location = 0; + ec->lock_client_location = 0; + ec->lock_user_size = 0; + ec->lock_client_size = 0; + ec->lock_client_stacking = 0; + ec->lock_user_shade = 0; + ec->lock_client_shade = 0; + ec->lock_user_maximize = 0; + ec->lock_client_maximize = 0; + ec->changes.need_maximize = 0; + ec->maximized = E_MAXIMIZE_NONE; + EC_CHANGED(ec); + + return EINA_TRUE; ++======= + return EINA_TRUE; res_err: free(sdata); @@@ -3276,6 -2021,114 +3624,115 @@@ _e_comp_wl_subcompositor_cb_bind(struc /* TODO: add handlers for client iconify/uniconify */ } ++>>>>>>> upstream + + static void + _e_comp_wl_sr_cb_provide_uuid(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, const char *uuid) + { + DBG("Provide UUID callback called for UUID: %s", uuid); + } + + static const struct session_recovery_interface _e_session_recovery_interface = + { + _e_comp_wl_sr_cb_provide_uuid, + }; + + static void + _e_comp_wl_session_recovery_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t version EINA_UNUSED, uint32_t id) + { + struct wl_resource *res; + + if (!(res = wl_resource_create(client, &session_recovery_interface, 1, id))) + { + ERR("Could not create session_recovery interface"); + wl_client_post_no_memory(client); + return; + } + + /* set implementation on resource */ + wl_resource_set_implementation(res, &_e_session_recovery_interface, e_comp, NULL); + } + + static void + _e_comp_wl_screenshooter_cb_shoot(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *buffer_resource) + { + E_Comp_Wl_Output *output; + E_Comp_Wl_Buffer *buffer; + struct wl_shm_buffer *shm_buffer; + int stride; + void *pixels, *d; + + output = wl_resource_get_user_data(output_resource); + buffer = e_comp_wl_buffer_get(buffer_resource); + + if (!buffer) + { + wl_resource_post_no_memory(resource); + return; + } + + if ((buffer->w < output->w) || (buffer->h < output->h)) + { + ERR("Buffer size less than output"); + /* send done with bad buffer error */ + return; + } + + stride = buffer->w * sizeof(int); + + pixels = malloc(stride * buffer->h); + if (!pixels) + { + /* send done with bad buffer error */ + ERR("Could not allocate space for destination"); + return; + } + + if (e_comp_wl->screenshooter.read_pixels) + e_comp_wl->screenshooter.read_pixels(output, pixels); + + shm_buffer = wl_shm_buffer_get(buffer->resource); + if (!shm_buffer) + { + ERR("Could not get shm_buffer from resource"); + return; + } + + stride = wl_shm_buffer_get_stride(shm_buffer); + d = wl_shm_buffer_get_data(shm_buffer); + if (!d) + { + ERR("Could not get buffer data"); + return; + } + + wl_shm_buffer_begin_access(shm_buffer); + memcpy(d, pixels, buffer->h * stride); + wl_shm_buffer_end_access(shm_buffer); + + screenshooter_send_done(resource); + } + + static const struct screenshooter_interface _e_screenshooter_interface = + { + _e_comp_wl_screenshooter_cb_shoot + }; + + static void + _e_comp_wl_screenshooter_cb_bind(struct wl_client *client, void *data, uint32_t version EINA_UNUSED, uint32_t id) + { + struct wl_resource *res; + + res = wl_resource_create(client, &screenshooter_interface, 1, id); + if (!res) + { + ERR("Could not create screenshooter resource: %m"); + wl_client_post_no_memory(client); + return; + } + + wl_resource_set_implementation(res, &_e_screenshooter_interface, data, NULL); + } static void _e_comp_wl_client_cb_new(void *data EINA_UNUSED, E_Client *ec) @@@ -3324,27 -2177,8 +3781,30 @@@ ec->comp_data->need_reparent = !ec->internal; + ec->comp_data->scaler.buffer_viewport.buffer.transform = WL_OUTPUT_TRANSFORM_NORMAL; + ec->comp_data->scaler.buffer_viewport.buffer.scale = 1; + ec->comp_data->scaler.buffer_viewport.buffer.src_width = wl_fixed_from_int(-1); + ec->comp_data->scaler.buffer_viewport.surface.width = -1; + + E_Comp_Client_Data *p_cdata = e_pixmap_cdata_get(ec->pixmap); + EINA_SAFETY_ON_NULL_RETURN(p_cdata); + ec->comp_data->accepts_focus = p_cdata->accepts_focus; + ec->comp_data->conformant = p_cdata->conformant; + ec->comp_data->aux_hint.hints = p_cdata->aux_hint.hints; + ec->comp_data->win_type = p_cdata->win_type; + ec->comp_data->layer = p_cdata->layer; + ec->comp_data->fetch.win_type = p_cdata->fetch.win_type; + ec->comp_data->fetch.layer = p_cdata->fetch.layer; + ec->comp_data->video_client = p_cdata->video_client; + /* add this client to the hash */ /* eina_hash_add(clients_win_hash, &win, ec); */ ++<<<<<<< HEAD + e_hints_client_list_set(); + + e_pixmap_cdata_set(ec->pixmap, ec->comp_data); ++======= ++>>>>>>> upstream } static void @@@ -3367,32 -2201,9 +3827,38 @@@ _e_comp_wl_client_cb_del(void *data EIN e_pixmap_parent_window_set(ec->pixmap, 0); } ++<<<<<<< HEAD + if (ec->comp_data->sub.data) + { + E_Comp_Wl_Subsurf_Data *sdata = ec->comp_data->sub.data; + if (sdata->parent && sdata->parent->comp_data) + { + /* remove this client from parents sub list */ + sdata->parent->comp_data->sub.list = + eina_list_remove(sdata->parent->comp_data->sub.list, ec); + sdata->parent->comp_data->sub.list_pending = + eina_list_remove(sdata->parent->comp_data->sub.list_pending, ec); + sdata->parent->comp_data->sub.below_list = + eina_list_remove(sdata->parent->comp_data->sub.below_list, ec); + sdata->parent->comp_data->sub.below_list_pending = + eina_list_remove(sdata->parent->comp_data->sub.below_list_pending, ec); + } + } + + /* remove sub list */ + EINA_LIST_FREE(ec->comp_data->sub.list, subc) + if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL; + EINA_LIST_FREE(ec->comp_data->sub.list_pending, subc) + if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL; + EINA_LIST_FREE(ec->comp_data->sub.below_list, subc) + if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL; + EINA_LIST_FREE(ec->comp_data->sub.below_list_pending, subc) + if (subc->comp_data && subc->comp_data->sub.data) subc->comp_data->sub.data->parent = NULL; ++======= + /* remove sub list */ + EINA_LIST_FREE(ec->comp_data->sub.list, subc) + subc->comp_data->sub.data->parent = NULL; ++>>>>>>> upstream if ((ec->parent) && (ec->parent->modal == ec)) { @@@ -3412,41 -2221,9 +3876,47 @@@ if (ec->comp_data->surface) wl_resource_set_user_data(ec->comp_data->surface, NULL); ++<<<<<<< HEAD + if (ec->comp_data->aux_hint.hints) + { + E_Comp_Wl_Aux_Hint *hint; + EINA_LIST_FREE(ec->comp_data->aux_hint.hints, hint) + { + eina_stringshare_del(hint->hint); + eina_stringshare_del(hint->val); + E_FREE(hint); + } + } + + e_pixmap_cdata_set(ec->pixmap, NULL); + + E_FREE(ec->comp_data); + + _e_comp_wl_focus_check(ec->comp); +} + +static void +_e_comp_wl_client_cb_post_new(void *data EINA_UNUSED, E_Client *ec) +{ + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + ec->need_shape_merge = EINA_FALSE; + + if (ec->need_shape_export) + { +// ec->shape_changed = EINA_TRUE; + e_comp_shape_queue(ec->comp); + ec->need_shape_export = EINA_FALSE; + } + + if (ec->argb && ec->frame && !e_util_strcmp("video", ec->icccm.window_role)) + _e_comp_wl_subsurface_create_below_bg_rectangle(ec); ++======= + if (ec->internal_elm_win) + _e_comp_wl_surface_render_stop(ec); + _e_comp_wl_focus_check(); ++>>>>>>> upstream } #if 0 @@@ -3930,15 -2523,30 +4393,39 @@@ _e_comp_wl_compositor_create(void goto comp_global_err; } ++<<<<<<< HEAD + /* initialize shm mechanism */ + wl_display_init_shm(cdata->wl.disp); + +#ifndef HAVE_WAYLAND_ONLY + _e_comp_wl_cb_randr_change(NULL, 0, NULL); +#endif ++======= + /* try to add session_recovery to wayland globals */ + if (!wl_global_create(cdata->wl.disp, &session_recovery_interface, 1, + e_comp, _e_comp_wl_session_recovery_cb_bind)) + { + ERR("Could not add session_recovery to wayland globals: %m"); + goto comp_global_err; + } + + /* initialize shm mechanism */ + wl_display_init_shm(cdata->wl.disp); + + cdata->screenshooter.global = + wl_global_create(cdata->wl.disp, &screenshooter_interface, 1, + e_comp, _e_comp_wl_screenshooter_cb_bind); + if (!cdata->screenshooter.global) + { + ERR("Could not create screenshooter global: %m"); + goto comp_global_err; + } + + /* _e_comp_wl_cb_randr_change(NULL, 0, NULL); */ ++>>>>>>> upstream /* try to init data manager */ - if (!e_comp_wl_data_manager_init(cdata)) + if (!e_comp_wl_data_manager_init()) { ERR("Could not initialize data manager"); goto data_err; @@@ -3951,10 -2559,8 +4438,10 @@@ goto input_err; } + _e_comp_wl_gl_init(cdata); + #ifndef HAVE_WAYLAND_ONLY - if (getenv("DISPLAY")) + if (e_comp_util_has_x()) { E_Config_XKB_Layout *ekbd; Ecore_X_Atom xkb = 0; @@@ -4008,12 -2614,7 +4495,16 @@@ /* setup module idler to load shell mmodule */ ecore_idler_add(_e_comp_wl_cb_module_idle, cdata); ++<<<<<<< HEAD +#ifndef ENABLE_QUICK_INIT + /* check if gl init succeded */ + ecore_idler_add(_e_comp_wl_gl_idle, cdata); + +#endif + if (comp->comp_type == E_PIXMAP_TYPE_X) ++======= + if (e_comp->comp_type == E_PIXMAP_TYPE_X) ++>>>>>>> upstream { e_comp_wl_input_pointer_enabled_set(EINA_TRUE); e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); @@@ -4065,48 -2708,50 +4598,91 @@@ e_comp_wl_init(void return EINA_FALSE; } + wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, -1); //server calls wl_client_create() + + ecore_wl_flush(); // client sendmsg wl_display.get_registry request + wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, -1); // server calls display_get_registry() + wl_display_flush_clients(e_comp->wl_comp_data->wl.disp); // server flushes wl_registry.global events + + ecore_wl_display_iterate(); // client handles global events and make 'bind' requests to each global interfaces + + ecore_wl_flush(); // client sendmsg wl_registry.bind requests + wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, -1); // server calls registry_bind() using given interfaces' name + /* create hash to store clients */ /* clients_win_hash = eina_hash_int64_new(NULL); */ + clients_buffer_hash = eina_hash_pointer_new(NULL); + +#ifdef HAVE_WAYLAND_TBM + e_comp_wl_tbm_init(); +#endif /* add event handlers to catch E events */ ++<<<<<<< HEAD +#ifndef HAVE_WAYLAND_ONLY + E_LIST_HANDLER_APPEND(handlers, E_EVENT_RANDR_CHANGE, _e_comp_wl_cb_randr_change, NULL); +#endif + E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD, _e_comp_wl_cb_comp_object_add, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _e_comp_wl_cb_input_event, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_UP, _e_comp_wl_cb_input_event, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_DOWN, _e_comp_wl_cb_input_event, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_comp_wl_cb_input_event, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, _e_comp_wl_cb_input_event, NULL); + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_WHEEL, _e_comp_wl_cb_input_event, NULL); + + /* add hooks to catch e_client events */ + e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT, _e_comp_wl_client_cb_new, NULL); + e_client_hook_add(E_CLIENT_HOOK_DEL, _e_comp_wl_client_cb_del, NULL); + e_client_hook_add(E_CLIENT_HOOK_EVAL_POST_NEW_CLIENT, _e_comp_wl_client_cb_post_new, NULL); + e_client_hook_add(E_CLIENT_HOOK_FOCUS_SET, _e_comp_wl_client_cb_focus_set, NULL); + e_client_hook_add(E_CLIENT_HOOK_FOCUS_UNSET, _e_comp_wl_client_cb_focus_unset, NULL); + e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, _e_comp_wl_client_cb_resize_begin, NULL); + e_client_hook_add(E_CLIENT_HOOK_RESIZE_END, _e_comp_wl_client_cb_resize_end, NULL); + e_client_hook_add(E_CLIENT_HOOK_MOVE_END, _e_comp_wl_client_cb_move_end, NULL); + e_client_hook_add(E_CLIENT_HOOK_ICONIFY, _e_comp_wl_client_cb_iconify, NULL); + e_client_hook_add(E_CLIENT_HOOK_UNICONIFY, _e_comp_wl_client_cb_uniconify, NULL); ++======= + if (e_comp->comp_type != E_PIXMAP_TYPE_X) + { + if (e_randr2_init()) + e_randr2_screens_setup(-1, -1); + elm_config_preferred_engine_set("wayland_shm"); + } + e_util_env_set("ELM_DISPLAY", "wl"); + if (e_comp_gl_get()) + ecore_job_add(_e_comp_wl_gl_init, NULL); + + E_LIST_HANDLER_APPEND(handlers, E_EVENT_RANDR_CHANGE, + _e_comp_wl_cb_randr_change, NULL); + + E_LIST_HANDLER_APPEND(handlers, E_EVENT_COMP_OBJECT_ADD, + _e_comp_wl_cb_comp_object_add, NULL); + + E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_MOUSE_MOVE, + _e_comp_wl_cb_mouse_move, NULL); + + /* add hooks to catch e_client events */ + e_client_hook_add(E_CLIENT_HOOK_NEW_CLIENT, _e_comp_wl_client_cb_new, NULL); + e_client_hook_add(E_CLIENT_HOOK_DEL, _e_comp_wl_client_cb_del, NULL); + + /* e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, */ + /* _e_comp_wl_client_cb_pre_frame, NULL); */ + + e_client_hook_add(E_CLIENT_HOOK_FOCUS_SET, + _e_comp_wl_client_cb_focus_set, NULL); + e_client_hook_add(E_CLIENT_HOOK_FOCUS_UNSET, + _e_comp_wl_client_cb_focus_unset, NULL); + + e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, + _e_comp_wl_client_cb_resize_begin, NULL); + e_client_hook_add(E_CLIENT_HOOK_RESIZE_END, + _e_comp_wl_client_cb_resize_end, NULL); ++>>>>>>> upstream + + e_desklock_show_hook_add(_e_comp_wl_desklock_show); + e_desklock_hide_hook_add(_e_comp_wl_desklock_hide); + + E_EVENT_WAYLAND_GLOBAL_ADD = ecore_event_type_new(); _last_event_time = ecore_loop_time_get(); @@@ -4134,23 -2773,24 +4710,44 @@@ e_comp_wl_surface_create_signal_get(voi EINTERN void e_comp_wl_shutdown(void) { ++<<<<<<< HEAD + /* free evas gl */ + E_Comp_Data *cdata; + if ((cdata = e_comp->wl_comp_data)) + _e_comp_wl_gl_shutdown(cdata); + +#ifndef HAVE_WAYLAND_ONLY + _e_comp_wl_compositor_cb_del(e_comp); +#endif + /* free buffer hash */ + E_FREE_FUNC(clients_buffer_hash, eina_hash_free); + + /* free handlers */ + E_FREE_LIST(handlers, ecore_event_handler_del); + +#ifdef HAVE_WAYLAND_TBM + e_comp_wl_tbm_shutdown(); +#endif ++======= + /* free handlers */ + E_FREE_LIST(handlers, ecore_event_handler_del); + + while (e_comp_wl->wl.globals) + { + Ecore_Wl_Global *global; + + global = + EINA_INLIST_CONTAINER_GET(e_comp_wl->wl.globals, Ecore_Wl_Global); + + e_comp_wl->wl.globals = + eina_inlist_remove(e_comp_wl->wl.globals, e_comp_wl->wl.globals); + + free(global->interface); + free(global); + } + if (e_comp_wl->wl.shm) wl_shm_destroy(e_comp_wl->wl.shm); + _e_comp_wl_gl_shutdown(); ++>>>>>>> upstream /* shutdown ecore_wayland */ ecore_wl_shutdown(); @@@ -4177,42 -2810,25 +4774,54 @@@ e_comp_wl_surface_event_simple_free(voi EINTERN void e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer) { ++<<<<<<< HEAD + E_Event_Client *ev; + ev = E_NEW(E_Event_Client, 1); + if (!ev) return; + + e_comp_wl_buffer_reference(&ec->comp_data->buffer_ref, buffer); + ++======= ++>>>>>>> upstream /* set usable early because shell module checks this */ e_pixmap_usable_set(ec->pixmap, (buffer != NULL)); e_pixmap_resource_set(ec->pixmap, buffer); e_pixmap_dirty(ec->pixmap); + e_pixmap_refresh(ec->pixmap); _e_comp_wl_surface_state_size_update(ec, &ec->comp_data->pending); + _e_comp_wl_map_size_cal_from_buffer(ec); + + ev->ec = ec; + e_object_ref(E_OBJECT(ec)); + ecore_event_add(E_EVENT_CLIENT_BUFFER_CHANGE, ev, + (Ecore_End_Cb)e_comp_wl_surface_event_simple_free, NULL); } EINTERN Eina_Bool e_comp_wl_surface_commit(E_Client *ec) { + Eina_Bool ignored; + _e_comp_wl_surface_state_commit(ec, &ec->comp_data->pending); + if (!e_comp_object_damage_exists(ec->frame)) + e_pixmap_image_clear(ec->pixmap, 1); ++<<<<<<< HEAD + if (ec->comp_data->sub.below_list || ec->comp_data->sub.below_list_pending) + { + if (!ec->comp_data->sub.below_obj) + _e_comp_wl_subsurface_create_below_bg_rectangle(ec); + } ++======= + ignored = ec->ignored; ++>>>>>>> upstream + + _e_comp_wl_surface_subsurface_order_commit(ec); + + /* schedule repaint */ + if (e_pixmap_refresh(ec->pixmap)) + e_comp_post_update_add(ec); if (!e_pixmap_usable_get(ec->pixmap)) { @@@ -4222,13 -2838,11 +4831,18 @@@ ec->comp_data->shell.unmap(ec->comp_data->shell.surface); else { + ec->visible = EINA_FALSE; evas_object_hide(ec->frame); ++<<<<<<< HEAD + ec->comp_data->mapped = EINA_FALSE; ++======= + ec->comp_data->mapped = 0; ++>>>>>>> upstream } } + + if (ec->comp_data->sub.below_obj && evas_object_visible_get(ec->comp_data->sub.below_obj)) + evas_object_hide(ec->comp_data->sub.below_obj); } else { @@@ -4238,15 -2852,14 +4852,21 @@@ ec->comp_data->shell.map(ec->comp_data->shell.surface); else { + ec->visible = EINA_TRUE; + ec->ignored = 0; evas_object_show(ec->frame); ++<<<<<<< HEAD + ec->comp_data->mapped = EINA_TRUE; ++======= + ec->comp_data->mapped = 1; ++>>>>>>> upstream } } + + if (ec->comp_data->sub.below_obj && !evas_object_visible_get(ec->comp_data->sub.below_obj)) + evas_object_show(ec->comp_data->sub.below_obj); } - + ec->ignored = ignored; return EINA_TRUE; } @@@ -4322,15 -2930,12 +4942,20 @@@ e_comp_wl_buffer_reference(E_Comp_Wl_Bu * @param resource that owns the desired buffer * @returns a new E_Comp_Wl_Buffer object */ ++<<<<<<< HEAD +EAPI E_Comp_Wl_Buffer * +e_comp_wl_buffer_get(struct wl_resource *resource, struct wl_resource *surface) ++======= + E_API E_Comp_Wl_Buffer * + e_comp_wl_buffer_get(struct wl_resource *resource) ++>>>>>>> upstream { - E_Comp_Wl_Buffer *buffer; + E_Comp_Wl_Buffer *buffer = NULL; struct wl_listener *listener; struct wl_shm_buffer *shmbuff; + E_Comp_Data *cdata; + Eina_Bool res; + tbm_surface_h tbm_surf; listener = wl_resource_get_destroy_listener(resource, _e_comp_wl_buffer_cb_destroy); @@@ -4338,48 -2943,18 +4963,63 @@@ return container_of(listener, E_Comp_Wl_Buffer, destroy_listener); if (!(buffer = E_NEW(E_Comp_Wl_Buffer, 1))) return NULL; ++<<<<<<< HEAD + + shmbuff = wl_shm_buffer_get(resource); + + if (shmbuff) + { + buffer->type = E_COMP_WL_BUFFER_TYPE_SHM; + + buffer->w = wl_shm_buffer_get_width(shmbuff); + buffer->h = wl_shm_buffer_get_height(shmbuff); + } + else + { + E_Pixmap *ep = wl_resource_get_user_data(surface); + E_Comp_Wl_Client_Data *p_cdata = e_pixmap_cdata_get(ep); + + cdata = e_comp->wl_comp_data; + if (p_cdata && p_cdata->video_client) + { + tbm_surf = wayland_tbm_server_get_surface(cdata->tbm.server, resource); + buffer->type = E_COMP_WL_BUFFER_TYPE_VIDEO; + buffer->w = tbm_surface_get_width(tbm_surf); + buffer->h = tbm_surface_get_height(tbm_surf); + } + else if (cdata->gl.api) + { + buffer->type = E_COMP_WL_BUFFER_TYPE_NATIVE; + + res = cdata->gl.api->evasglQueryWaylandBuffer(cdata->gl.evasgl, + resource, + EVAS_GL_WIDTH, + &buffer->w); + EINA_SAFETY_ON_FALSE_GOTO(res, err); + + res = cdata->gl.api->evasglQueryWaylandBuffer(cdata->gl.evasgl, + resource, + EVAS_GL_HEIGHT, + &buffer->h); + EINA_SAFETY_ON_FALSE_GOTO(res, err); + } + else + goto err; + } ++======= + shmbuff = wl_shm_buffer_get(resource); + if (shmbuff) + { + buffer->w = wl_shm_buffer_get_width(shmbuff); + buffer->h = wl_shm_buffer_get_height(shmbuff); + } + else if (e_comp->gl) + { + e_comp_wl->wl.glapi->evasglQueryWaylandBuffer(e_comp_wl->wl.gl, resource, EGL_WIDTH, &buffer->w); + e_comp_wl->wl.glapi->evasglQueryWaylandBuffer(e_comp_wl->wl.gl, resource, EGL_HEIGHT, &buffer->h); + } + buffer->shm_buffer = shmbuff; ++>>>>>>> upstream buffer->resource = resource; wl_signal_init(&buffer->destroy_signal); @@@ -4435,39 -3005,38 +5075,48 @@@ _e_comp_wl_output_get(Eina_List *output * @param h output's height in pixels * @param pw output's physical width in millimeters * @param ph output's physical height in millimeters - * @param refresh output's refresh rate in Hz + * @param refresh output's refresh rate in mHz * @param subpixel output's subpixel layout * @param transform output's rotation and/or mirror transformation + * + * @returns True if a display output object could be added or updated */ - EAPI void - e_comp_wl_output_init(const char *id, const char *make, const char *model, int x, int y, int w, int h, int pw, int ph, unsigned int refresh, unsigned int subpixel, unsigned int transform) + E_API Eina_Bool + e_comp_wl_output_init(const char *id, const char *make, const char *model, + int x, int y, int w, int h, int pw, int ph, + unsigned int refresh, unsigned int subpixel, + unsigned int transform) { - E_Comp_Data *cdata; E_Comp_Wl_Output *output; Eina_List *l2; struct wl_resource *resource; - if (!(cdata = e_comp->wl_comp_data)) return; - /* retrieve named output; or create it if it doesn't exist */ - output = _e_comp_wl_output_get(cdata->outputs, id); + output = _e_comp_wl_output_get(e_comp_wl->outputs, id); if (!output) { ++<<<<<<< HEAD + if (!(output = E_NEW(E_Comp_Wl_Output, 1))) return; ++======= + if (!(output = E_NEW(E_Comp_Wl_Output, 1))) return EINA_FALSE; + ++>>>>>>> upstream if (id) output->id = eina_stringshare_add(id); - if (make) output->make = eina_stringshare_add(make); - if (model) output->model = eina_stringshare_add(model); + if (make) + output->make = eina_stringshare_add(make); + else + output->make = eina_stringshare_add("unknown"); + if (model) + output->model = eina_stringshare_add(model); + else + output->model = eina_stringshare_add("unknown"); - cdata->outputs = eina_list_append(cdata->outputs, output); + e_comp_wl->outputs = eina_list_append(e_comp_wl->outputs, output); + + output->global = + wl_global_create(e_comp_wl->wl.disp, &wl_output_interface, + 2, output, _e_comp_wl_cb_output_bind); - output->global = wl_global_create(cdata->wl.disp, &wl_output_interface, - 2, output, _e_comp_wl_cb_output_bind); output->resources = NULL; output->scale = e_scale; } diff --cc src/bin/e_comp_wl.h index 6a6dc9c,7142f4d..2473615 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@@ -193,11 -163,8 +207,15 @@@ struct _E_Comp_Wl_Dat wl_fixed_t x, y; wl_fixed_t grab_x, grab_y; uint32_t button; ++<<<<<<< HEAD + Ecore_Timer *hide_tmr; + E_Client *ec; + Eina_Bool hidden :1; + unsigned int num_devices; ++======= + E_Client *ec; + Eina_Bool enabled : 1; ++>>>>>>> upstream } ptr; struct @@@ -265,22 -228,10 +292,29 @@@ struct { ++<<<<<<< HEAD + Evas_GL *evasgl; + Evas_GL_API *api; + Evas_GL_Surface *sfc; + Evas_GL_Context *ctx; + } gl; + + struct + { + Eina_Bool underlay; + Eina_Bool scaler; + } available_hw_accel; + + struct + { + void *server; + } tbm; ++======= + struct wl_global *global; + struct wl_client *client; + void (*read_pixels)(E_Comp_Wl_Output *output, void *pixels); + } screenshooter; ++>>>>>>> upstream Eina_List *outputs; @@@ -294,8 -248,6 +331,11 @@@ struct _E_Comp_Wl_Client_Data { ++<<<<<<< HEAD + struct wl_resource *wl_surface; + ++======= ++>>>>>>> upstream Ecore_Timer *on_focus_timer; struct @@@ -339,36 -283,11 +379,43 @@@ { int32_t x, y; } popup; + #ifndef HAVE_WAYLAND_ONLY + E_Pixmap *xwayland_pixmap; + E_Comp_X_Client_Data *xwayland_data; + #endif ++<<<<<<< HEAD + struct + { + struct wl_resource *viewport; + E_Comp_Wl_Buffer_Viewport buffer_viewport; + } scaler; + + struct + { + Eina_Bool enabled : 1; + Eina_Bool start : 1; + + unsigned int scount, stime; + int sx, sy, dx, dy; + int prev_degree, cur_degree; + } transform; + + struct + { + Eina_List *hints; + } aux_hint; + + /* before applying viewport */ + int width_from_buffer; + int height_from_buffer; + + /* after applying viewport */ + int width_from_viewport; + int height_from_viewport; + ++======= ++>>>>>>> upstream Eina_Bool keep_buffer : 1; Eina_Bool mapped : 1; Eina_Bool change_icon : 1; @@@ -378,19 -297,7 +425,23 @@@ Eina_Bool first_damage : 1; Eina_Bool set_win_type : 1; Eina_Bool frame_update : 1; ++<<<<<<< HEAD + Eina_Bool focus_update : 1; + Eina_Bool opaque_state : 1; + Eina_Bool video_client : 1; + unsigned char accepts_focus : 1; + unsigned char conformant : 1; + E_Window_Type win_type; + E_Layer layer; + + struct + { + unsigned char win_type : 1; + unsigned char layer : 1; + } fetch; ++======= + Eina_Bool maximize_pre : 1; ++>>>>>>> upstream }; struct _E_Comp_Wl_Output @@@ -404,24 -311,60 +455,70 @@@ unsigned int subpixel; unsigned int transform; double scale; + + /* added for screenshot ability */ + struct wl_output *wl_output; + struct wl_buffer *buffer; + void *data; }; - EAPI Eina_Bool e_comp_wl_init(void); + E_API Eina_Bool e_comp_wl_init(void); EINTERN void e_comp_wl_shutdown(void); +EAPI void e_comp_wl_deferred_job(void); + EINTERN struct wl_resource *e_comp_wl_surface_create(struct wl_client *client, int version, uint32_t id); EINTERN void e_comp_wl_surface_destroy(struct wl_resource *resource); EINTERN void e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer); EINTERN Eina_Bool e_comp_wl_surface_commit(E_Client *ec); EINTERN Eina_Bool e_comp_wl_subsurface_commit(E_Client *ec); ++<<<<<<< HEAD +EAPI void e_comp_wl_buffer_reference(E_Comp_Wl_Buffer_Ref *ref, E_Comp_Wl_Buffer *buffer); +EAPI E_Comp_Wl_Buffer *e_comp_wl_buffer_get(struct wl_resource *resource, struct wl_resource *surface); ++======= + EINTERN void e_comp_wl_buffer_reference(E_Comp_Wl_Buffer_Ref *ref, E_Comp_Wl_Buffer *buffer); + E_API E_Comp_Wl_Buffer *e_comp_wl_buffer_get(struct wl_resource *resource); ++>>>>>>> upstream + + E_API struct wl_signal e_comp_wl_surface_create_signal_get(void); + E_API double e_comp_wl_idle_time_get(void); + E_API Eina_Bool e_comp_wl_output_init(const char *id, const char *make, const char *model, int x, int y, int w, int h, int pw, int ph, unsigned int refresh, unsigned int subpixel, unsigned int transform); + E_API void e_comp_wl_output_remove(const char *id); + ++<<<<<<< HEAD ++======= + EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev); + EINTERN Eina_Bool e_comp_wl_key_up(Ecore_Event_Key *ev); + E_API Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state); + + E_API extern int E_EVENT_WAYLAND_GLOBAL_ADD; + + # ifndef HAVE_WAYLAND_ONLY + EINTERN void e_comp_wl_xwayland_client_queue(E_Client *ec); + static inline E_Comp_X_Client_Data * + e_comp_wl_client_xwayland_data(const E_Client *ec) + { + return ec->comp_data ? ((E_Comp_Wl_Client_Data*)ec->comp_data)->xwayland_data : NULL; + } - EAPI struct wl_signal e_comp_wl_surface_create_signal_get(E_Comp *comp); - EAPI double e_comp_wl_idle_time_get(void); - EAPI void e_comp_wl_output_init(const char *id, const char *make, const char *model, int x, int y, int w, int h, int pw, int ph, unsigned int refresh, unsigned int subpixel, unsigned int transform); + static inline E_Pixmap * + e_comp_wl_client_xwayland_pixmap(const E_Client *ec) + { + return ec->comp_data ? ((E_Comp_Wl_Client_Data*)ec->comp_data)->xwayland_pixmap : NULL; + } + static inline void + e_comp_wl_client_xwayland_setup(E_Client *ec, E_Comp_X_Client_Data *cd, E_Pixmap *ep) + { + if (cd && ep) + { + ((E_Comp_Wl_Client_Data*)ec->comp_data)->xwayland_data = cd; + ((E_Comp_Wl_Client_Data*)ec->comp_data)->xwayland_pixmap = ep; + } + if (e_comp_wl->xwl_pending) + e_comp_wl->xwl_pending = eina_list_remove(e_comp_wl->xwl_pending, ec); + } + # endif ++>>>>>>> upstream # endif #endif diff --cc src/bin/e_comp_wl_data.c index 2e7ee9b,2da7de4..1935b95 --- a/src/bin/e_comp_wl_data.c +++ b/src/bin/e_comp_wl_data.c @@@ -184,41 -174,9 +173,41 @@@ _e_comp_wl_data_device_destroy_selectio wl_data_device_send_selection(data_device_res, NULL); } - wl_signal_emit(&cdata->selection.signal, cdata); + wl_signal_emit(&e_comp_wl->selection.signal, e_comp->wl_comp_data); } +static void +_e_comp_wl_data_device_destroy_dnd_data_source(struct wl_listener *listener EINA_UNUSED, void *data) +{ + E_Comp_Data *cdata; + E_Comp_Wl_Data_Source *source; + struct wl_resource *data_device_res, *focus = NULL; + + if (!(source = (E_Comp_Wl_Data_Source*)data)) + return; + + if (!(cdata = container_of(listener, E_Comp_Data, + selection.data_source_listener))) + return; + + cdata->selection.data_source = NULL; + + if (cdata->kbd.enabled) + focus = cdata->kbd.focus; + + if (focus) + { + data_device_res = + _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, + wl_resource_get_client(source->resource)); + + if (data_device_res) + wl_data_device_send_selection(data_device_res, NULL); + } + + wl_signal_emit(&cdata->selection.signal, cdata); +} + static struct wl_resource* _e_comp_wl_data_device_data_offer_create(E_Comp_Wl_Data_Source *source, struct wl_resource *data_device_res) { @@@ -320,36 -281,62 +312,93 @@@ _e_comp_wl_data_device_selection_set(vo } static void ++<<<<<<< HEAD +_e_comp_wl_drag_icon_map(struct wl_resource *resource) +{ + E_Pixmap *ep; + E_Client *ec; + + if (!(ep = wl_resource_get_user_data(resource))) return; + if (!(ec = e_pixmap_client_get(ep))) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + evas_object_show(ec->frame); + ec->comp_data->mapped = EINA_TRUE; +} + +static void +_e_comp_wl_drag_icon_confiugre(struct wl_resource *resource, + Evas_Coord x, Evas_Coord y, + Evas_Coord w, Evas_Coord h) +{ + /* do nothing */ +} + + +static void +_e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resource *resource, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial) ++======= + _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped) + { + Evas_Object *o; + + o = edje_object_part_swallow_get(drag->comp_object, "e.swallow.content"); + if (eina_streq(evas_object_type_get(o), "e_comp_object")) + edje_object_part_unswallow(drag->comp_object, o); + else + e_zoomap_child_set(o, NULL); + evas_object_hide(o); + evas_object_pass_events_set(o, 1); + if (e_comp_wl->drag != drag) return; + e_comp_wl->drag = NULL; + e_comp_wl->drag_client = NULL; + e_screensaver_inhibit_toggle(0); + if (e_comp_wl->selection.target && (!dropped)) + { + #ifndef HAVE_WAYLAND_ONLY + if (e_client_has_xwindow(e_comp_wl->selection.target)) + { + ecore_x_client_message32_send(e_client_util_win_get(e_comp_wl->selection.target), + ECORE_X_ATOM_XDND_DROP, ECORE_X_EVENT_MASK_NONE, + e_comp->cm_selection, 0, ecore_x_current_time_get(), 0, 0); + } + else + #endif + { + struct wl_resource *res; + + res = e_comp_wl_data_find_for_client(wl_resource_get_client(e_comp_wl->selection.target->comp_data->surface)); + if (res) + { + wl_data_device_send_drop(res); + wl_data_device_send_leave(res); + } + #ifndef HAVE_WAYLAND_ONLY + if (e_comp_util_has_xwayland()) + { + ecore_x_selection_owner_set(0, ECORE_X_ATOM_SELECTION_XDND, ecore_x_current_time_get()); + ecore_x_window_hide(e_comp->cm_selection); + } + #endif + e_comp_wl->selection.target = NULL; + e_comp_wl->drag_source = NULL; + } + } + } + + static void + _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial) ++>>>>>>> upstream { - E_Comp_Data *cdata; E_Comp_Wl_Data_Source *source; Eina_List *l; struct wl_resource *res; ++<<<<<<< HEAD + E_Client *focused = NULL; ++======= + E_Client *ec = NULL; + int x, y; ++>>>>>>> upstream DBG("Data Device Drag Start"); @@@ -360,35 -347,19 +409,51 @@@ if (icon_resource) { ++<<<<<<< HEAD + E_Pixmap *cp; + E_Client *ec; + + DBG("\tHave Icon Resource: %p", icon_resource); + cp = wl_resource_get_user_data(icon_resource); + + if ((cp) && !(ec = e_pixmap_client_get(cp))) + { + int x, y; + + ec = e_client_new(NULL, cp, 1, 0); + ec->lock_focus_out = ec->layer_block = ec->visible = ec->override = 1; + ec->new_client = 0; + e_comp->new_clients--; + ec->icccm.title = eina_stringshare_add("drag-win"); + evas_object_pass_events_set(ec->frame, 1); + ec->client.w = ec->client.h = 1; + l = e_client_focus_stack_get(); + e_client_focus_stack_set(eina_list_remove(l, ec)); + + ecore_evas_pointer_xy_get(e_comp->ee, &x, &y); + evas_object_move(ec->frame, x, y); + evas_object_show(ec->frame); + + ec->comp_data->shell.surface = icon_resource; + ec->comp_data->shell.configure = _e_comp_wl_drag_icon_confiugre; + ec->comp_data->shell.map = _e_comp_wl_drag_icon_map; + + cdata->dnd.icon = ec; ++======= + DBG("\tHave Icon Resource: %p", icon_resource); + ec = wl_resource_get_user_data(icon_resource); + if (!ec->re_manage) + { + ec->re_manage = 1; + + ec->lock_focus_out = ec->override = 1; + ec->icccm.title = eina_stringshare_add("noshadow"); + ec->layer = E_LAYER_CLIENT_DRAG; + evas_object_layer_set(ec->frame, E_LAYER_CLIENT_DRAG); + e_client_focus_stack_set(eina_list_remove(e_client_focus_stack_get(), ec)); + EC_CHANGED(ec); + e_comp_wl->drag_client = ec; ++>>>>>>> upstream } } @@@ -396,25 -367,27 +461,46 @@@ { if (!e_comp_wl_input_pointer_check(res)) continue; if (wl_resource_get_client(res) != client) continue; - wl_pointer_send_leave(res, serial, cdata->kbd.focus); + wl_pointer_send_leave(res, serial, e_comp_wl->kbd.focus); } ++<<<<<<< HEAD + cdata->dnd.enabled = EINA_TRUE; + cdata->dnd.data_source = source; + cdata->dnd.client = client; + + if (source) + { + cdata->dnd.data_source_listener.notify = + _e_comp_wl_data_device_destroy_dnd_data_source; + wl_signal_add(&source->destroy_signal, + &cdata->dnd.data_source_listener); + } + + focused = e_client_focused_get(); + if (!focused) return; + + e_comp_wl_data_dnd_focus(focused); ++======= + evas_pointer_canvas_xy_get(e_comp->evas, &x, &y); + e_comp_wl->drag = e_drag_new(x, y, + NULL, 0, NULL, 0, NULL, _e_comp_wl_data_device_drag_finished); + e_comp_wl->drag->button_mask = evas_pointer_button_down_mask_get(e_comp->evas); + if (ec) + e_drag_object_set(e_comp_wl->drag, ec->frame); + e_drag_start(e_comp_wl->drag, x, y); + #ifndef HAVE_WAYLAND_ONLY + if (e_comp_util_has_xwayland()) + { + ecore_x_window_show(e_comp->cm_selection); + ecore_x_selection_owner_set(e_comp->cm_selection, ECORE_X_ATOM_SELECTION_XDND, ecore_x_current_time_get()); + } + #endif + if (e_comp_wl->ptr.ec) + e_comp_wl_data_device_send_enter(e_comp_wl->ptr.ec); + e_screensaver_inhibit_toggle(1); + e_comp_canvas_feed_mouse_up(0); ++>>>>>>> upstream } static void @@@ -550,40 -477,8 +590,45 @@@ _e_comp_wl_data_cb_bind_manager(struct return; } ++<<<<<<< HEAD + wl_resource_set_implementation(res, &_e_manager_interface, cdata, NULL); +} + +static int +_e_comp_wl_clipboard_source_ref(E_Comp_Wl_Clipboard_Source *source) +{ + source->ref ++; + return source->ref; +} + +static int +_e_comp_wl_clipboard_source_unref(E_Comp_Wl_Clipboard_Source *source) +{ + char* t; + + source->ref --; + if (source->ref > 0) + return source->ref; + + if (source->fd_handler) + { + ecore_main_fd_handler_del(source->fd_handler); + close(source->fd[0]); + close(source->fd[1]); + } + + EINA_LIST_FREE(source->data_source.mime_types, t) + eina_stringshare_del(t); + + wl_signal_emit(&source->data_source.destroy_signal, &source->data_source); + wl_array_release(&source->contents); + free(source); + + return 0; ++======= + wl_resource_set_implementation(res, &_e_manager_interface, + e_comp->wl_comp_data, NULL); ++>>>>>>> upstream } static Eina_Bool @@@ -667,8 -557,8 +711,13 @@@ _e_comp_wl_clipboard_source_save(void * } else if (len < 0) { ++<<<<<<< HEAD + if (!(_e_comp_wl_clipboard_source_unref(source))) + cdata->clipboard.source = NULL; ++======= + e_comp_wl_clipboard_source_unref(source); + e_comp_wl->clipboard.source = NULL; ++>>>>>>> upstream } else { @@@ -704,49 -594,9 +753,51 @@@ _e_comp_wl_clipboard_source_cancelled_s { } ++<<<<<<< HEAD +static E_Comp_Wl_Clipboard_Source* +_e_comp_wl_clipboard_source_create(E_Comp_Data *cdata, const char *mime_type, uint32_t serial, int* fd) +{ + E_Comp_Wl_Clipboard_Source *source; + + source = E_NEW(E_Comp_Wl_Clipboard_Source, 1); + if (!source) return NULL; + + source->data_source.resource = NULL; + source->data_source.target = _e_comp_wl_clipboard_source_target_send; + source->data_source.send = _e_comp_wl_clipboard_source_send_send; + source->data_source.cancelled = _e_comp_wl_clipboard_source_cancelled_send; + + wl_array_init(&source->contents); + wl_signal_init(&source->data_source.destroy_signal); + + source->ref = 1; + source->serial = serial; + + source->data_source.mime_types = + eina_list_append(source->data_source.mime_types, + eina_stringshare_add(mime_type)); + + source->fd_handler = + ecore_main_fd_handler_add(fd[0], ECORE_FD_READ, + _e_comp_wl_clipboard_source_save, + cdata, NULL, NULL); + if (!source->fd_handler) + { + E_FREE(source); + return NULL; + } + + source->fd[0] = fd[0]; + source->fd[1] = fd[1]; + + return source; +} + ++======= ++>>>>>>> upstream static void - _e_comp_wl_clipboard_selection_set(struct wl_listener *listener EINA_UNUSED, void *data) + _e_comp_wl_clipboard_selection_set(struct wl_listener *listener EINA_UNUSED, void *data EINA_UNUSED) { - E_Comp_Data *cdata; E_Comp_Wl_Data_Source *sel_source; E_Comp_Wl_Clipboard_Source *clip_source; int p[2]; @@@ -767,29 -616,23 +817,46 @@@ else if (sel_source->target == _e_comp_wl_clipboard_source_target_send) return; ++<<<<<<< HEAD + mime_type = eina_list_nth(sel_source->mime_types, 0); ++======= + if (clip_source) + e_comp_wl_clipboard_source_unref(clip_source); + + e_comp_wl->clipboard.source = NULL; + mime_type = eina_array_data_get(sel_source->mime_types, 0); ++>>>>>>> upstream - if (pipe2(p, O_CLOEXEC) == -1) - return; + if (!clip_source) + { + if (pipe2(p, O_CLOEXEC) == -1) + return; + + sel_source->send(sel_source, mime_type, p[1]); - sel_source->send(sel_source, mime_type, p[1]); ++<<<<<<< HEAD + cdata->clipboard.source = + _e_comp_wl_clipboard_source_create(cdata, mime_type, + cdata->selection.serial, p); + if (!cdata->clipboard.source) + { + close(p[0]); + close(p[1]); + } + } + else + { + sel_source->send(sel_source, mime_type, clip_source->fd[1]); + } ++======= + e_comp_wl->clipboard.source = + e_comp_wl_clipboard_source_create(mime_type, + e_comp_wl->selection.serial, p[0]); + + if (!e_comp_wl->clipboard.source) + close(p[0]); ++>>>>>>> upstream } static void @@@ -799,21 -643,123 +867,125 @@@ _e_comp_wl_clipboard_create(void } static void - _e_comp_wl_clipboard_create(E_Comp_Data *cdata) + _e_comp_wl_data_device_target_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) + { + E_Client *ec = data; + + if (e_comp_wl->selection.target == ec) + e_comp_wl->selection.target = NULL; + } + + E_API void + e_comp_wl_data_device_send_enter(E_Client *ec) + { + struct wl_resource *data_device_res, *offer_res; + uint32_t serial; + int x, y; + + if (e_client_has_xwindow(ec) && e_client_has_xwindow(e_comp_wl->drag_client)) return; + if (!e_client_has_xwindow(ec)) + { + data_device_res = + e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); + if (!data_device_res) return; + offer_res = e_comp_wl_data_device_send_offer(ec); + if (e_comp_wl->drag_source && (!offer_res)) return; + } + e_comp_wl->selection.target = ec; + evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL, _e_comp_wl_data_device_target_del, ec); + + #ifndef HAVE_WAYLAND_ONLY + if (e_client_has_xwindow(ec)) + { + int d1 = 0x5UL, d2, d3, d4; + E_Comp_Wl_Data_Source *source; + + d2 = d3 = d4 = 0; + source = e_comp_wl->drag_source; + + if (eina_array_count(source->mime_types) > 3) + { + const char *type, *types[eina_array_count(source->mime_types)]; + int i = 0; + Eina_Iterator *it; + + d1 |= 0x1UL; + it = eina_array_iterator_new(source->mime_types); + EINA_ITERATOR_FOREACH(it, type) + types[i++] = type; + eina_iterator_free(it); + ecore_x_dnd_types_set(e_comp->cm_selection, types, i); + } + else if (source->mime_types) + { + if (eina_array_count(source->mime_types)) + d2 = ecore_x_atom_get(eina_array_data_get(source->mime_types, 0)); + if (eina_array_count(source->mime_types) > 1) + d3 = ecore_x_atom_get(eina_array_data_get(source->mime_types, 1)); + if (eina_array_count(source->mime_types) > 2) + d4 = ecore_x_atom_get(eina_array_data_get(source->mime_types, 2)); + } + + ecore_x_client_message32_send(e_client_util_win_get(ec), + ECORE_X_ATOM_XDND_ENTER, ECORE_X_EVENT_MASK_NONE, + e_comp->cm_selection, d1, d2, d3, d4); + return; + } + #endif + x = wl_fixed_to_int(e_comp_wl->ptr.x) - e_comp_wl->selection.target->client.x; + y = wl_fixed_to_int(e_comp_wl->ptr.y) - e_comp_wl->selection.target->client.y; + serial = wl_display_next_serial(e_comp_wl->wl.disp); + wl_data_device_send_enter(data_device_res, serial, ec->comp_data->surface, + wl_fixed_from_int(x), wl_fixed_from_int(y), offer_res); + } + + E_API void + e_comp_wl_data_device_send_leave(E_Client *ec) { - cdata->clipboard.listener.notify = _e_comp_wl_clipboard_selection_set; - wl_signal_add(&cdata->selection.signal, &cdata->clipboard.listener); + struct wl_resource *res; + + if (e_client_has_xwindow(ec) && e_client_has_xwindow(e_comp_wl->drag_client)) return; + evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_DEL, _e_comp_wl_data_device_target_del, ec); + if (e_comp_wl->selection.target == ec) + e_comp_wl->selection.target = NULL; + #ifndef HAVE_WAYLAND_ONLY + if (e_client_has_xwindow(ec)) + { + ecore_x_client_message32_send(e_client_util_win_get(ec), + ECORE_X_ATOM_XDND_LEAVE, ECORE_X_EVENT_MASK_NONE, + e_comp->cm_selection, 0, 0, 0, 0); + return; + } + #endif + res = e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); + if (res) + wl_data_device_send_leave(res); } - EINTERN void - e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata) + EINTERN void * + e_comp_wl_data_device_send_offer(E_Client *ec) { - struct wl_resource *data_device_res, *offer_res, *focus; + struct wl_resource *data_device_res, *offer_res = NULL; + E_Comp_Wl_Data_Source *source; + + data_device_res = + e_comp_wl_data_find_for_client(wl_resource_get_client(ec->comp_data->surface)); + if (!data_device_res) return NULL; + source = e_comp_wl->drag_source; + if (source) + offer_res = _e_comp_wl_data_device_data_offer_create(source, data_device_res); + return offer_res; + } + + E_API void + e_comp_wl_data_device_keyboard_focus_set(void) + { + struct wl_resource *data_device_res, *offer_res = NULL, *focus; E_Comp_Wl_Data_Source *source; + E_Pixmap *ep; + E_Client *ec; - if (!cdata->kbd.enabled) + if (!e_comp_wl->kbd.enabled) { ERR("Keyboard not enabled"); return; @@@ -824,34 -770,32 +996,58 @@@ ERR("No focused resource"); return; } + source = (E_Comp_Wl_Data_Source*)e_comp_wl->selection.data_source; ++<<<<<<< HEAD + if (!(ep = wl_resource_get_user_data(focus))) return; + if (!(ec = e_pixmap_client_get(ep))) return; + if (e_object_is_del(E_OBJECT(ec))) return; + ++======= + #ifndef HAVE_WAYLAND_ONLY + do + { + if (!e_comp_util_has_xwayland()) break; + if (e_comp_wl->clipboard.xwl_owner) + { + if (e_client_has_xwindow(e_client_focused_get())) return; + break; + } + else if (source && e_client_has_xwindow(e_client_focused_get())) + { + /* wl -> x11 */ + ecore_x_selection_owner_set(e_comp->cm_selection, ECORE_X_ATOM_SELECTION_CLIPBOARD, ecore_x_current_time_get()); + return; + } + } while (0); + #endif ++>>>>>>> upstream data_device_res = - _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, - wl_resource_get_client(focus)); + e_comp_wl_data_find_for_client(wl_resource_get_client(focus)); if (!data_device_res) return; - source = (E_Comp_Wl_Data_Source*)cdata->selection.data_source; if (source) ++<<<<<<< HEAD + { + uint32_t serial; + int cx, cy; + + serial = wl_display_next_serial(cdata->wl.disp); + + offer_res = _e_comp_wl_data_device_data_offer_create(source, + data_device_res); + + cx = wl_fixed_to_int(cdata->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(cdata->ptr.y) - ec->client.y; + + wl_data_device_send_enter(data_device_res, serial, focus, + wl_fixed_from_int(cx), wl_fixed_from_int(cy), offer_res); + wl_data_device_send_selection(data_device_res, offer_res); + } ++======= + offer_res = _e_comp_wl_data_device_data_offer_create(source, data_device_res); + wl_data_device_send_selection(data_device_res, offer_res); ++>>>>>>> upstream } EINTERN Eina_Bool @@@ -883,170 -821,112 +1073,272 @@@ e_comp_wl_data_manager_init(void } EINTERN void - e_comp_wl_data_manager_shutdown(E_Comp_Data *cdata) + e_comp_wl_data_manager_shutdown(void) { /* destroy the global manager resource */ - /* if (cdata->mgr.global) wl_global_destroy(cdata->mgr.global); */ + /* if (e_comp_wl->mgr.global) wl_global_destroy(e_comp_wl->mgr.global); */ + + wl_list_remove(&e_comp_wl->clipboard.listener.link); + E_FREE_FUNC(e_comp_wl->mgr.data_resources, eina_hash_free); + } + + E_API struct wl_resource * + e_comp_wl_data_find_for_client(struct wl_client *client) + { + return eina_hash_find(e_comp_wl->mgr.data_resources, &client); + } + + E_API E_Comp_Wl_Data_Source * + e_comp_wl_data_manager_source_create(struct wl_client *client, struct wl_resource *resource, uint32_t id) + { + E_Comp_Wl_Data_Source *source; + + DBG("Data Manager Source Create"); + + source = E_NEW(E_Comp_Wl_Data_Source, 1); + if (!source) + { + wl_resource_post_no_memory(resource); + return NULL; + } + + wl_signal_init(&source->destroy_signal); + source->target = _e_comp_wl_data_source_target_send; + source->send = _e_comp_wl_data_source_send_send; + source->cancelled = _e_comp_wl_data_source_cancelled_send; + + source->resource = + wl_resource_create(client, &wl_data_source_interface, 1, id); + if (!source->resource) + { + ERR("Could not create data source resource: %m"); + free(source); + wl_resource_post_no_memory(resource); + return NULL; + } + + wl_resource_set_implementation(source->resource, + &_e_data_source_interface, source, + _e_comp_wl_data_source_cb_resource_destroy); + return source; + } + + E_API E_Comp_Wl_Clipboard_Source * + e_comp_wl_clipboard_source_create(const char *mime_type, uint32_t serial, int fd) + { + E_Comp_Wl_Clipboard_Source *source; + + source = E_NEW(E_Comp_Wl_Clipboard_Source, 1); + if (!source) return NULL; + + source->data_source.resource = NULL; + source->data_source.target = _e_comp_wl_clipboard_source_target_send; + source->data_source.send = _e_comp_wl_clipboard_source_send_send; + source->data_source.cancelled = _e_comp_wl_clipboard_source_cancelled_send; + + wl_array_init(&source->contents); + wl_signal_init(&source->data_source.destroy_signal); + + source->ref = 1; + source->serial = serial; + + if (mime_type) + { + if (!source->data_source.mime_types) + source->data_source.mime_types = eina_array_new(1); + eina_array_push(source->data_source.mime_types, eina_stringshare_add(mime_type)); + } - _e_comp_wl_clipboard_destroy(cdata); + if (fd > 0) + { + source->fd_handler = + ecore_main_fd_handler_add(fd, ECORE_FD_READ, + _e_comp_wl_clipboard_source_save, + e_comp->wl_comp_data, NULL, NULL); + if (!source->fd_handler) return NULL; + } + + source->fd = fd; + + return source; + } + + E_API void + e_comp_wl_clipboard_source_unref(E_Comp_Wl_Clipboard_Source *source) + { + EINA_SAFETY_ON_NULL_RETURN(source); + source->ref--; + if (source->ref > 0) return; + + if (source->fd_handler) + { + ecore_main_fd_handler_del(source->fd_handler); + close(source->fd); + } + + _mime_types_free(&source->data_source); + + wl_signal_emit(&source->data_source.destroy_signal, &source->data_source); + wl_array_release(&source->contents); + free(source); } + +EINTERN Eina_Bool +e_comp_wl_data_dnd_focus(E_Client *ec) +{ + E_Comp_Data *cdata; + struct wl_resource *data_device_res = NULL, *surface = NULL; + struct wl_resource *offer; + uint32_t serial; + + cdata = e_comp->wl_comp_data; + + if (ec && cdata->dnd.focus == ec->comp_data->surface) return EINA_TRUE; + + surface = cdata->dnd.focus?:ec->comp_data->surface; + if (surface) + data_device_res = + _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, + wl_resource_get_client(surface)); + + if (!data_device_res) return EINA_FALSE; + + if (cdata->dnd.focus) + { + wl_data_device_send_leave(data_device_res); + cdata->dnd.focus = NULL; + } + + if (!ec) return EINA_FALSE; + + if (!cdata->dnd.data_source && + wl_resource_get_client(ec->comp_data->surface) != cdata->dnd.client) + return EINA_FALSE; + + serial = wl_display_next_serial(cdata->wl.disp); + + if (cdata->dnd.data_source) + { + offer = _e_comp_wl_data_device_data_offer_create(cdata->dnd.data_source, + data_device_res); + } + + wl_data_device_send_enter(data_device_res, serial, + ec->comp_data->surface, + ec->x, ec->y, + offer); + + cdata->dnd.focus = ec->comp_data->surface; + + return EINA_TRUE; +} + +EINTERN void +e_comp_wl_data_dnd_motion(E_Client *ec, unsigned int time, int x, int y) +{ + struct wl_resource *data_device_res; + E_Comp_Data *cdata; + + cdata = e_comp->wl_comp_data; + if (!cdata->dnd.focus) return; + + if (cdata->dnd.icon) + evas_object_move(cdata->dnd.icon->frame, x, y); + + data_device_res = _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, + wl_resource_get_client(cdata->dnd.focus)); + if (!data_device_res) return; + + wl_data_device_send_motion(data_device_res, + time, + wl_fixed_from_int(x), wl_fixed_from_int(y)); +} + +EINTERN void +e_comp_wl_data_dnd_drop(E_Client *ec, unsigned int time, uint32_t btn, uint32_t state) +{ + E_Comp_Data *cdata; + struct wl_resource *data_device_res, *res; + struct wl_client *wc; + uint32_t serial; + Eina_List *l; + + cdata = e_comp->wl_comp_data; + if (!cdata->dnd.focus) return; + + data_device_res = _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, + wl_resource_get_client(cdata->dnd.focus)); + if (!data_device_res) return; + + if (state == WL_POINTER_BUTTON_STATE_RELEASED) + { + wl_data_device_send_drop(data_device_res); + e_comp_wl_data_dnd_focus(NULL); + if (cdata->dnd.data_source) + wl_list_remove(&cdata->dnd.data_source_listener.link); + cdata->dnd.enabled = 0; + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + EINA_LIST_FOREACH(e_comp->wl_comp_data->ptr.resources, l, res) + { + if (!e_comp_wl_input_pointer_check(res)) continue; + if (wl_resource_get_client(res) != wc) continue; + wl_pointer_send_button(res, serial, time, btn, state); + wl_pointer_send_enter(res, serial, ec->comp_data->surface, + wl_fixed_from_int(ec->client.x), + wl_fixed_from_int(ec->client.y)); + } + } +} + +EINTERN void +e_comp_wl_data_dnd_drop_touch(E_Client *ec, + unsigned int time, + int x, int y, + Eina_Bool flag) +{ + E_Comp_Data *cdata; + struct wl_resource *data_device_res, *res; + struct wl_client *wc; + uint32_t serial; + Eina_List *l; + wl_fixed_t fx, fy; + + cdata = e_comp->wl_comp_data; + if (!cdata->dnd.focus) return; + + data_device_res = _e_comp_wl_data_find_for_client(cdata->mgr.data_resources, + wl_resource_get_client(cdata->dnd.focus)); + if (!data_device_res) return; + + + if (!flag) + { + wl_data_device_send_drop(data_device_res); + e_comp_wl_data_dnd_focus(NULL); + if (cdata->dnd.data_source) + wl_list_remove(&cdata->dnd.data_source_listener.link); + cdata->dnd.enabled = 0; + + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + + fx = wl_fixed_from_int(x - ec->client.x); + fy = wl_fixed_from_int(y - ec->client.y); + + EINA_LIST_FOREACH(e_comp->wl_comp_data->ptr.resources, l, res) + { + if (!e_comp_wl_input_pointer_check(res)) continue; + if (wl_resource_get_client(res) != wc) continue; + wl_pointer_send_enter(res, serial, ec->comp_data->surface, fx, fy); + } + + EINA_LIST_FOREACH(e_comp->wl_comp_data->touch.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + if (!e_comp_wl_input_touch_check(res)) continue; + wl_touch_send_up(res, serial, time, 0); + } + } +} diff --cc src/bin/e_comp_wl_data.h index 16f1882,18fa0e8..4e7a78a --- a/src/bin/e_comp_wl_data.h +++ b/src/bin/e_comp_wl_data.h @@@ -51,13 -50,15 +50,26 @@@ struct _E_Comp_Wl_Clipboard_Offe size_t offset; }; ++<<<<<<< HEAD +EINTERN void e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata); +EINTERN Eina_Bool e_comp_wl_data_manager_init(E_Comp_Data *cdata); +EINTERN void e_comp_wl_data_manager_shutdown(E_Comp_Data *cdata); +EINTERN Eina_Bool e_comp_wl_data_dnd_focus(E_Client *ec); +EINTERN void e_comp_wl_data_dnd_motion(E_Client *ec, unsigned int time, int x, int y); +EINTERN void e_comp_wl_data_dnd_drop(E_Client *ec, unsigned int time, uint32_t btn, uint32_t state); +EINTERN void e_comp_wl_data_dnd_drop_touch(E_Client *ec, unsigned int time, int x, int y, Eina_Bool flag); + ++======= + E_API void e_comp_wl_data_device_send_enter(E_Client *ec); + E_API void e_comp_wl_data_device_send_leave(E_Client *ec); + EINTERN void *e_comp_wl_data_device_send_offer(E_Client *ec); + E_API void e_comp_wl_data_device_keyboard_focus_set(void); + EINTERN Eina_Bool e_comp_wl_data_manager_init(void); + EINTERN void e_comp_wl_data_manager_shutdown(void); + E_API struct wl_resource *e_comp_wl_data_find_for_client(struct wl_client *client); + E_API E_Comp_Wl_Data_Source *e_comp_wl_data_manager_source_create(struct wl_client *client, struct wl_resource *resource, uint32_t id); + E_API void e_comp_wl_clipboard_source_unref(E_Comp_Wl_Clipboard_Source *source); + E_API E_Comp_Wl_Clipboard_Source *e_comp_wl_clipboard_source_create(const char *mime_type, uint32_t serial, int fd); ++>>>>>>> upstream # endif #endif diff --cc src/bin/e_comp_wl_input.c index 0c82dd8,7e8f2e9..ae8a35f --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@@ -3,8 -3,10 +3,15 @@@ #include "e.h" #include ++<<<<<<< HEAD +static void +_e_comp_wl_input_update_seat_caps(E_Comp_Data *cdata) ++======= + E_API int E_EVENT_TEXT_INPUT_PANEL_VISIBILITY_CHANGE = -1; + + static void + _e_comp_wl_input_update_seat_caps(void) ++>>>>>>> upstream { Eina_List *l; struct wl_resource *res; @@@ -22,35 -24,6 +29,38 @@@ } static void ++<<<<<<< HEAD +_e_comp_wl_input_pointer_map(struct wl_resource *resource) +{ + E_Pixmap *ep; + E_Client *ec; + + if (!(ep = wl_resource_get_user_data(resource))) return; + if (!(ec = e_pixmap_client_get(ep))) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + e_pointer_object_set(e_comp->pointer, ec->frame, ec->x, ec->y); + ec->comp_data->mapped = EINA_TRUE; +} + +static void +_e_comp_wl_input_pointer_configure(struct wl_resource *resource, + Evas_Coord x, Evas_Coord y, + Evas_Coord w, Evas_Coord h) +{ + E_Pixmap *ep; + E_Client *ec; + + if (!(ep = wl_resource_get_user_data(resource))) return; + if (!(ec = e_pixmap_client_get(ep))) return; + if (e_object_is_del(E_OBJECT(ec))) return; + + e_client_util_resize_without_frame(ec, w, h); +} + +static void ++======= ++>>>>>>> upstream _e_comp_wl_input_cb_resource_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) { wl_resource_destroy(resource); @@@ -59,19 -32,19 +69,21 @@@ static void _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource, int32_t x, int32_t y) { ++<<<<<<< HEAD + E_Comp_Data *cdata; ++======= ++>>>>>>> upstream E_Client *ec; Eina_Bool got_mouse = EINA_FALSE; + int cursor_w = 0, cursor_h = 0; - /* get compositor data */ - if (!(cdata = wl_resource_get_user_data(resource))) return; - E_CLIENT_FOREACH(e_comp, ec) + E_CLIENT_FOREACH(ec) { + if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) continue; if (!ec->comp_data->surface) continue; if (client != wl_resource_get_client(ec->comp_data->surface)) continue; - if (ec->mouse.in) - { - got_mouse = EINA_TRUE; - break; - } + got_mouse = EINA_TRUE; + break; } if (!got_mouse) return; if (!surface_resource) @@@ -79,39 -52,21 +91,55 @@@ e_pointer_object_set(e_comp->pointer, NULL, x, y); return; } ++<<<<<<< HEAD + if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, (uintptr_t)surface_resource))) + { + Eina_List *l; + E_Pixmap *ep = NULL; + + ep = e_pixmap_find(E_PIXMAP_TYPE_WL, surface_resource); + if (!ep) ep = e_pixmap_new(E_PIXMAP_TYPE_WL, surface_resource); + EINA_SAFETY_ON_NULL_RETURN(ep); + + ec = e_client_new(NULL, ep, 1, 0); + if (!ec) return; + ec->lock_focus_out = ec->layer_block = ec->visible = ec->override = 1; + ec->new_client = 0; + e_comp->new_clients--; ++======= + ec = wl_resource_get_user_data(surface_resource); + if (!ec->re_manage) + { + ec->re_manage = 1; + ec->ignored = 0; + + ec->lock_focus_out = ec->layer_block = ec->visible = ec->override = 1; ++>>>>>>> upstream ec->icccm.title = eina_stringshare_add("noshadow"); + ec->icccm.window_role = eina_stringshare_add("wl_pointer-cursor"); evas_object_pass_events_set(ec->frame, 1); ++<<<<<<< HEAD + ec->client.w = ec->client.h = 1; + l = e_client_focus_stack_get(); + e_client_focus_stack_set(eina_list_remove(l, ec)); + + /* Set fuctions to prevent unwanted handling by shell */ + ec->comp_data->shell.surface = surface_resource; + ec->comp_data->shell.configure = _e_comp_wl_input_pointer_configure; + ec->comp_data->shell.map = _e_comp_wl_input_pointer_map; ++======= + e_client_focus_stack_set(eina_list_remove(e_client_focus_stack_get(), ec)); + EC_CHANGED(ec); ++>>>>>>> upstream } + /* ignore cursor changes during resize/move I guess */ if (e_client_action_get()) return; + + evas_object_geometry_get(ec->frame, NULL, NULL, &cursor_w, &cursor_h); + if ((cursor_w == 0) || (cursor_h == 0)) + return; + e_pointer_object_set(e_comp->pointer, ec->frame, x, y); } @@@ -122,39 -77,28 +150,45 @@@ static const struct wl_pointer_interfac }; static const struct wl_keyboard_interface _e_keyboard_interface = ++<<<<<<< HEAD { _e_comp_wl_input_cb_resource_destroy }; static const struct wl_touch_interface _e_touch_interface = ++======= ++>>>>>>> upstream +{ + _e_comp_wl_input_cb_resource_destroy +}; + ++<<<<<<< HEAD + +static void +_e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource) ++======= ++static const struct wl_touch_interface _e_touch_interface = ++>>>>>>> upstream { - E_Comp_Data *cdata; + _e_comp_wl_input_cb_resource_destroy + }; - /* get compositor data */ - if (!(cdata = wl_resource_get_user_data(resource))) return; - cdata->ptr.resources = eina_list_remove(cdata->ptr.resources, resource); + static void + _e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource) + { + e_comp_wl->ptr.resources = + eina_list_remove(e_comp_wl->ptr.resources, resource); } static void _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *resource, uint32_t id) { - E_Comp_Data *cdata; struct wl_resource *res; + E_Client *ec; + uint32_t serial; + int cx, cy; - /* get compositor data */ - if (!(cdata = wl_resource_get_user_data(resource))) return; - /* try to create pointer resource */ res = wl_resource_create(client, &wl_pointer_interface, wl_resource_get_version(resource), id); @@@ -165,40 -110,60 +200,80 @@@ return; } ++<<<<<<< HEAD + cdata->ptr.resources = eina_list_append(cdata->ptr.resources, res); + wl_resource_set_implementation(res, &_e_pointer_interface, cdata, ++======= + e_comp_wl->ptr.resources = + eina_list_append(e_comp_wl->ptr.resources, res); + wl_resource_set_implementation(res, &_e_pointer_interface, + e_comp->wl_comp_data, ++>>>>>>> upstream _e_comp_wl_input_cb_pointer_unbind); } static void _e_comp_wl_input_cb_keyboard_unbind(struct wl_resource *resource) { ++<<<<<<< HEAD + E_Comp_Data *cdata; ++======= ++>>>>>>> upstream Eina_List *l, *ll; struct wl_resource *res; - /* get compositor data */ - if (!(cdata = wl_resource_get_user_data(resource))) return; + e_comp_wl->kbd.resources = + eina_list_remove(e_comp_wl->kbd.resources, resource); + EINA_LIST_FOREACH_SAFE(e_comp_wl->kbd.focused, l, ll, res) + if (res == resource) + e_comp_wl->kbd.focused = + eina_list_remove_list(e_comp_wl->kbd.focused, l); + } ++<<<<<<< HEAD + cdata->kbd.resources = eina_list_remove(cdata->kbd.resources, resource); + EINA_LIST_FOREACH_SAFE(cdata->kbd.focused, l, ll, res) + if (res == resource) + cdata->kbd.focused = eina_list_remove_list(cdata->kbd.focused, l); ++======= + void + e_comp_wl_input_keyboard_enter_send(E_Client *ec) + { + struct wl_resource *res; + Eina_List *l; + uint32_t serial; + + if (!ec->comp_data->surface) return; + + if (!e_comp_wl->kbd.focused) return; + + e_comp_wl_input_keyboard_modifiers_serialize(); + + serial = wl_display_next_serial(e_comp_wl->wl.disp); + + EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) + { + wl_keyboard_send_enter(res, serial, ec->comp_data->surface, + &e_comp_wl->kbd.keys); + wl_keyboard_send_modifiers(res, serial, + e_comp_wl->kbd.mod_depressed, + e_comp_wl->kbd.mod_latched, + e_comp_wl->kbd.mod_locked, + e_comp_wl->kbd.mod_group); + } ++>>>>>>> upstream } static void _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *resource, uint32_t id) { - E_Comp_Data *cdata; + E_Client *focused; struct wl_resource *res; + E_Client *ec; + struct wl_client *wc; + uint32_t serial, *k; + Eina_List *l; - /* get compositor data */ - if (!(cdata = wl_resource_get_user_data(resource))) return; - /* try to create keyboard resource */ res = wl_resource_create(client, &wl_keyboard_interface, wl_resource_get_version(resource), id); @@@ -209,77 -175,58 +285,126 @@@ return; } ++<<<<<<< HEAD + cdata->kbd.resources = eina_list_append(cdata->kbd.resources, res); + wl_resource_set_implementation(res, &_e_keyboard_interface, cdata, ++======= + e_comp_wl->kbd.resources = + eina_list_append(e_comp_wl->kbd.resources, res); + wl_resource_set_implementation(res, &_e_keyboard_interface, + e_comp->wl_comp_data, ++>>>>>>> upstream _e_comp_wl_input_cb_keyboard_unbind); /* send current repeat_info */ if (wl_resource_get_version(res) >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) ++<<<<<<< HEAD + wl_keyboard_send_repeat_info(res, cdata->kbd.repeat_rate, cdata->kbd.repeat_delay); + + /* send current keymap */ + wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, + cdata->xkb.fd, cdata->xkb.size); + + /* if client has focus, send keyboard enter */ + E_CLIENT_FOREACH(e_comp, ec) + { + if (!ec->comp_data->surface) continue; + if (client != wl_resource_get_client(ec->comp_data->surface)) continue; + + { + /* update keyboard modifier state */ + wl_array_for_each(k, &e_comp->wl_comp_data->kbd.keys) + e_comp_wl_input_keyboard_state_update(e_comp->wl_comp_data, *k, EINA_TRUE); + ec->comp_data->focus_update = 1; + if (!ec->comp_data->surface) return; + + /* send keyboard_enter to all keyboard resources */ + wc = wl_resource_get_client(ec->comp_data->surface); + serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp); + EINA_LIST_FOREACH(e_comp->wl_comp_data->kbd.resources, l, res) + { + if (wl_resource_get_client(res) != wc) continue; + wl_keyboard_send_enter(res, serial, ec->comp_data->surface, + &e_comp->wl_comp_data->kbd.keys); + ec->comp_data->focus_update = 0; + } + } + } +} + +static void +_e_comp_wl_input_cb_touch_unbind(struct wl_resource *resource) +{ + E_Comp_Data *cdata; + + /* get compositor data */ + if (!(cdata = wl_resource_get_user_data(resource))) return; + + cdata->touch.resources = eina_list_remove(cdata->touch.resources, resource); ++======= + wl_keyboard_send_repeat_info(res, e_config->keyboard.repeat_rate, e_config->keyboard.repeat_delay); + + /* send current keymap */ + wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, + e_comp_wl->xkb.fd, + e_comp_wl->xkb.size); + + /* if the client owns the focused surface, we need to send an enter */ + focused = e_client_focused_get(); + if (!focused) return; + + if (client != wl_resource_get_client(focused->comp_data->surface)) return; + e_comp_wl->kbd.focused = eina_list_append(e_comp_wl->kbd.focused, res); + + e_comp_wl_input_keyboard_enter_send(focused); + } + + static void + _e_comp_wl_input_cb_touch_unbind(struct wl_resource *resource) + { + e_comp_wl->touch.resources = + eina_list_remove(e_comp_wl->touch.resources, resource); ++>>>>>>> upstream } static void _e_comp_wl_input_cb_touch_get(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t id EINA_UNUSED) { ++<<<<<<< HEAD + E_Comp_Data *cdata; + struct wl_resource *res; + + /* get compositor data */ + if (!(cdata = wl_resource_get_user_data(resource))) return; + ++======= + struct wl_resource *res; + ++>>>>>>> upstream /* try to create pointer resource */ res = wl_resource_create(client, &wl_touch_interface, wl_resource_get_version(resource), id); if (!res) { ++<<<<<<< HEAD + ERR("Could not create touch on seat %s: %m", cdata->seat.name); ++======= + ERR("Could not create touch on seat %s: %m", + e_comp_wl->seat.name); ++>>>>>>> upstream wl_client_post_no_memory(client); return; } ++<<<<<<< HEAD + cdata->touch.resources = eina_list_append(cdata->touch.resources, res); + wl_resource_set_implementation(res, &_e_touch_interface, cdata, ++======= + e_comp_wl->touch.resources = + eina_list_append(e_comp_wl->touch.resources, res); + wl_resource_set_implementation(res, &_e_touch_interface, + e_comp->wl_comp_data, ++>>>>>>> upstream _e_comp_wl_input_cb_touch_unbind); } @@@ -301,14 -245,11 +423,21 @@@ _e_comp_wl_input_cb_unbind_seat(struct } static void ++<<<<<<< HEAD +_e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id) ++======= + _e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data EINA_UNUSED, uint32_t version, uint32_t id) ++>>>>>>> upstream { - E_Comp_Data *cdata; struct wl_resource *res; ++<<<<<<< HEAD + /* try to create the seat resource */ + cdata = data; + res = wl_resource_create(client, &wl_seat_interface, MIN(version, 4), id); ++======= + res = wl_resource_create(client, &wl_seat_interface, version, id); ++>>>>>>> upstream if (!res) { ERR("Could not create seat resource: %m"); @@@ -316,43 -257,19 +445,56 @@@ } /* store version of seat interface for reuse in updating capabilities */ - cdata->seat.version = version; - cdata->seat.resources = eina_list_append(cdata->seat.resources, res); + e_comp_wl->seat.version = version; + e_comp_wl->seat.resources = + eina_list_append(e_comp_wl->seat.resources, res); ++<<<<<<< HEAD + wl_resource_set_implementation(res, &_e_seat_interface, cdata, + _e_comp_wl_input_cb_unbind_seat); + + _e_comp_wl_input_update_seat_caps(cdata); + if (cdata->seat.version >= WL_SEAT_NAME_SINCE_VERSION) + wl_seat_send_name(res, cdata->seat.name); +} + +static void +_e_comp_wl_input_keymap_cache_create(const char *keymap_path, char *keymap_data) +{ + FILE *file = NULL; + + if (EINA_FALSE == e_config->xkb.use_cache) return; + + if (keymap_path) + { + file = fopen(keymap_path, "w"); + EINA_SAFETY_ON_NULL_RETURN(file); + + if (fputs(keymap_data, file) < 0) + { + WRN("Failed to write keymap file: %s\n", keymap_path); + fclose(file); + unlink(keymap_path); + } + else + { + INF("Success to make keymap file: %s\n", keymap_path); + fclose(file); + } + } +} + ++======= + wl_resource_set_implementation(res, &_e_seat_interface, + e_comp->wl_comp_data, + _e_comp_wl_input_cb_unbind_seat); + + _e_comp_wl_input_update_seat_caps(); + if (e_comp_wl->seat.version >= WL_SEAT_NAME_SINCE_VERSION) + wl_seat_send_name(res, e_comp_wl->seat.name); + } + ++>>>>>>> upstream static int _e_comp_wl_input_keymap_fd_get(off_t size) { @@@ -401,32 -318,35 +543,50 @@@ } static void ++<<<<<<< HEAD +_e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap, const char *keymap_path) ++======= + _e_comp_wl_input_keymap_update(struct xkb_keymap *keymap) ++>>>>>>> upstream { char *tmp; xkb_mod_mask_t latched = 0, locked = 0, group = 0; struct wl_resource *res; Eina_List *l; - uint32_t serial; /* unreference any existing keymap */ - if (cdata->xkb.keymap) xkb_map_unref(cdata->xkb.keymap); + if (e_comp_wl->xkb.keymap) + xkb_map_unref(e_comp_wl->xkb.keymap); /* unmap any existing keyboard area */ - if (cdata->xkb.area) munmap(cdata->xkb.area, cdata->xkb.size); - if (cdata->xkb.fd >= 0) close(cdata->xkb.fd); + if (e_comp_wl->xkb.area) + munmap(e_comp_wl->xkb.area, e_comp_wl->xkb.size); + if (e_comp_wl->xkb.fd >= 0) close(e_comp_wl->xkb.fd); /* unreference any existing keyboard state */ ++<<<<<<< HEAD + if (cdata->xkb.state) + { + latched = + xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LATCHED); + locked = + xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LOCKED); + group = + xkb_state_serialize_layout(cdata->xkb.state, ++======= + if (e_comp_wl->xkb.state) + { + latched = + xkb_state_serialize_mods(e_comp_wl->xkb.state, + XKB_STATE_MODS_LATCHED); + locked = + xkb_state_serialize_mods(e_comp_wl->xkb.state, + XKB_STATE_MODS_LOCKED); + group = + xkb_state_serialize_layout(e_comp_wl->xkb.state, ++>>>>>>> upstream XKB_STATE_LAYOUT_EFFECTIVE); - xkb_state_unref(cdata->xkb.state); + xkb_state_unref(e_comp_wl->xkb.state); } /* create a new xkb state */ @@@ -459,14 -387,13 +627,22 @@@ return; } ++<<<<<<< HEAD + _e_comp_wl_input_keymap_cache_create(keymap_path, tmp); + + cdata->xkb.area = + mmap(NULL, cdata->xkb.size, (PROT_READ | PROT_WRITE), + MAP_SHARED, cdata->xkb.fd, 0); + if (cdata->xkb.area == MAP_FAILED) ++======= + e_comp_wl->xkb.area = + mmap(NULL, e_comp_wl->xkb.size, (PROT_READ | PROT_WRITE), + MAP_SHARED, e_comp_wl->xkb.fd, 0); + if (e_comp_wl->xkb.area == MAP_FAILED) ++>>>>>>> upstream { ERR("Failed to mmap keymap area: %m"); + free(tmp); return; } @@@ -474,52 -401,29 +650,75 @@@ free(tmp); /* send updated keymap */ ++<<<<<<< HEAD + EINA_LIST_FOREACH(cdata->kbd.resources, l, res) + wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, + cdata->xkb.fd, cdata->xkb.size); + + /* update modifiers */ + e_comp_wl_input_keyboard_modifiers_update(cdata); + + if ((!latched) && (!locked)) return; + + /* send modifiers */ + serial = wl_display_get_serial(cdata->wl.disp); + EINA_LIST_FOREACH(cdata->kbd.resources, l, res) + wl_keyboard_send_modifiers(res, serial, cdata->kbd.mod_depressed, + cdata->kbd.mod_latched, cdata->kbd.mod_locked, + cdata->kbd.mod_group); +} + +EINTERN Eina_Bool +e_comp_wl_input_init(E_Comp_Data *cdata) +{ + /* check for valid compositor data */ + if (!cdata) + { + ERR("No compositor data"); + return EINA_FALSE; + } + ++======= + EINA_LIST_FOREACH(e_comp_wl->kbd.resources, l, res) + wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, + e_comp_wl->xkb.fd, + e_comp_wl->xkb.size); + + /* update modifiers */ + e_comp_wl_input_keyboard_modifiers_update(); + } + + EINTERN Eina_Bool + e_comp_wl_input_init(void) + { ++>>>>>>> upstream /* set default seat name */ - if (!cdata->seat.name) cdata->seat.name = "default"; + if (!e_comp_wl->seat.name) + e_comp_wl->seat.name = "default"; - cdata->xkb.fd = -1; + e_comp_wl->xkb.fd = -1; + /* get default keyboard repeat rate/delay from configuration */ + cdata->kbd.repeat_delay = e_config->keyboard.repeat_delay; + cdata->kbd.repeat_rate = e_config->keyboard.repeat_rate; + + /* check for valid repeat_delay and repeat_rate value */ + /* if invalid, set the default value of repeat delay and rate value */ + if (cdata->kbd.repeat_delay < 0) cdata->kbd.repeat_delay = 400; + if (cdata->kbd.repeat_delay < 0) cdata->kbd.repeat_rate = 25; + /* create the global resource for input seat */ ++<<<<<<< HEAD + cdata->seat.global = + wl_global_create(cdata->wl.disp, &wl_seat_interface, 4, + cdata, _e_comp_wl_input_cb_bind_seat); + if (!cdata->seat.global) ++======= + e_comp_wl->seat.global = + wl_global_create(e_comp_wl->wl.disp, &wl_seat_interface, 4, + e_comp->wl_comp_data, _e_comp_wl_input_cb_bind_seat); + if (!e_comp_wl->seat.global) ++>>>>>>> upstream { ERR("Could not create global for seat: %m"); return EINA_FALSE; @@@ -531,19 -437,12 +732,26 @@@ } EINTERN void ++<<<<<<< HEAD +e_comp_wl_input_shutdown(E_Comp_Data *cdata) +{ + struct wl_resource *res; + + /* check for valid compositor data */ + if (!cdata) + { + ERR("No compositor data"); + return; + } + ++======= + e_comp_wl_input_shutdown(void) + { + struct wl_resource *res; + ++>>>>>>> upstream /* destroy pointer resources */ - EINA_LIST_FREE(cdata->ptr.resources, res) + EINA_LIST_FREE(e_comp_wl->ptr.resources, res) wl_resource_destroy(res); /* destroy keyboard resources */ @@@ -589,33 -494,57 +803,85 @@@ e_comp_wl_input_keyboard_check(struct w &_e_keyboard_interface); } ++<<<<<<< HEAD +EINTERN void +e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata) ++======= + EINTERN Eina_Bool + e_comp_wl_input_keyboard_modifiers_serialize(void) + { + Eina_Bool changed = EINA_FALSE; + xkb_mod_mask_t mod; + xkb_layout_index_t grp; + + mod = xkb_state_serialize_mods(e_comp_wl->xkb.state, + XKB_STATE_DEPRESSED); + changed |= mod != e_comp_wl->kbd.mod_depressed; + e_comp_wl->kbd.mod_depressed = mod; + + mod = xkb_state_serialize_mods(e_comp_wl->xkb.state, + XKB_STATE_MODS_LATCHED); + changed |= mod != e_comp_wl->kbd.mod_latched; + e_comp_wl->kbd.mod_latched = mod; + + mod = xkb_state_serialize_mods(e_comp_wl->xkb.state, + XKB_STATE_MODS_LOCKED); + changed |= mod != e_comp_wl->kbd.mod_locked; + e_comp_wl->kbd.mod_locked = mod; + + grp = xkb_state_serialize_layout(e_comp_wl->xkb.state, + XKB_STATE_LAYOUT_EFFECTIVE); + changed |= grp != e_comp_wl->kbd.mod_group; + e_comp_wl->kbd.mod_group = grp; + return changed; + } + + EINTERN void + e_comp_wl_input_keyboard_modifiers_update(void) ++>>>>>>> upstream { uint32_t serial; struct wl_resource *res; Eina_List *l; ++<<<<<<< HEAD + cdata->kbd.mod_depressed = + xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_DEPRESSED); + cdata->kbd.mod_latched = + xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LATCHED); + cdata->kbd.mod_locked = + xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_MODS_LOCKED); + cdata->kbd.mod_group = + xkb_state_serialize_layout(cdata->xkb.state, XKB_STATE_LAYOUT_EFFECTIVE); + + serial = wl_display_next_serial(cdata->wl.disp); + EINA_LIST_FOREACH(cdata->kbd.resources, l, res) + wl_keyboard_send_modifiers(res, serial, + cdata->kbd.mod_depressed, + cdata->kbd.mod_latched, + cdata->kbd.mod_locked, + cdata->kbd.mod_group); +} + +EINTERN void +e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina_Bool pressed) ++======= + if (!e_comp_wl_input_keyboard_modifiers_serialize()) return; + + if (!e_comp_wl->kbd.focused) return; + + serial = wl_display_next_serial(e_comp_wl->wl.disp); + EINA_LIST_FOREACH(e_comp_wl->kbd.focused, l, res) + wl_keyboard_send_modifiers(res, serial, + e_comp_wl->kbd.mod_depressed, + e_comp_wl->kbd.mod_latched, + e_comp_wl->kbd.mod_locked, + e_comp_wl->kbd.mod_group); + } + + EINTERN void + e_comp_wl_input_keyboard_state_update(uint32_t keycode, Eina_Bool pressed) ++>>>>>>> upstream { enum xkb_key_direction dir; @@@ -624,11 -553,13 +890,21 @@@ if (pressed) dir = XKB_KEY_DOWN; else dir = XKB_KEY_UP; ++<<<<<<< HEAD + cdata->kbd.mod_changed = + xkb_state_update_key(cdata->xkb.state, keycode + 8, dir); +} + +EAPI void ++======= + e_comp_wl->kbd.mod_changed = + xkb_state_update_key(e_comp_wl->xkb.state, keycode + 8, dir); + + e_comp_wl_input_keyboard_modifiers_update(); + } + + E_API void ++>>>>>>> upstream e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled) { /* check for valid compositor data */ @@@ -638,11 -569,11 +914,19 @@@ return; } ++<<<<<<< HEAD + e_comp->wl_comp_data->ptr.enabled = !!enabled; + _e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data); +} + +EAPI void ++======= + e_comp_wl->ptr.enabled = !!enabled; + _e_comp_wl_input_update_seat_caps(); + } + + E_API void ++>>>>>>> upstream e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled) { /* check for valid compositor data */ @@@ -652,78 -583,49 +936,110 @@@ return; } ++<<<<<<< HEAD + e_comp->wl_comp_data->kbd.enabled = !!enabled; + _e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data); +} + +EAPI void +e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *model, const char *layout) ++======= + e_comp_wl->kbd.enabled = !!enabled; + _e_comp_wl_input_update_seat_caps(); + } + + E_API void + e_comp_wl_input_keymap_set(const char *rules, const char *model, const char *layout) ++>>>>>>> upstream { struct xkb_keymap *keymap; struct xkb_rule_names names; + FILE *file = NULL; + const char *keymap_path = NULL; + ++<<<<<<< HEAD + /* check for valid compositor data */ + if (!cdata) + { + ERR("No compositor data"); + return; + } ++======= ++>>>>>>> upstream /* DBG("COMP_WL: Keymap Set: %s %s %s", rules, model, layout); */ /* assemble xkb_rule_names so we can fetch keymap */ memset(&names, 0, sizeof(names)); if (rules) names.rules = strdup(rules); + else names.rules = strdup("evdev"); if (model) names.model = strdup(model); + else names.model = strdup("pc105"); if (layout) names.layout = strdup(layout); + else names.layout = strdup("us"); /* unreference any existing context */ - if (cdata->xkb.context) xkb_context_unref(cdata->xkb.context); + if (e_comp_wl->xkb.context) + xkb_context_unref(e_comp_wl->xkb.context); /* create a new xkb context */ ++<<<<<<< HEAD + cdata->xkb.context = xkb_context_new(0); + if (!cdata->xkb.context) + return; + + if (e_config->xkb.use_cache) + { + keymap_path = eina_stringshare_printf("/var/lib/xkb/%s-%s-%s-%s-%s.xkb", + names.rules ? names.rules : "", + names.model ? names.model : "", + names.layout ? names.layout : "", + names.variant ? names.variant : "", + names.options ? names.options : ""); + + file = fopen(keymap_path, "r"); + } + + if (!file) + { + INF("There is a no keymap file (%s). Generate keymap using rmlvo\n", keymap_path); + /* fetch new keymap based on names */ + keymap = xkb_map_new_from_names(cdata->xkb.context, &names, 0); + } + else + { + INF("Keymap file (%s) has been found. xkb_keymap is going to be generated with it.\n", keymap_path); + keymap = xkb_map_new_from_file(cdata->xkb.context, file, XKB_KEYMAP_FORMAT_TEXT_V1, 0); + eina_stringshare_del(keymap_path); + keymap_path = NULL; + } + + /* update compositor keymap */ + _e_comp_wl_input_keymap_update(cdata, keymap, keymap_path); ++======= + e_comp_wl->xkb.context = xkb_context_new(0); + + /* fetch new keymap based on names */ + keymap = xkb_map_new_from_names(e_comp_wl->xkb.context, &names, 0); + if (keymap) + { + /* update compositor keymap */ + _e_comp_wl_input_keymap_update(keymap); + } ++>>>>>>> upstream /* cleanup */ + if (keymap_path) eina_stringshare_del(keymap_path); free((char *)names.rules); free((char *)names.model); free((char *)names.layout); } ++<<<<<<< HEAD +EAPI void ++======= + E_API void ++>>>>>>> upstream e_comp_wl_input_touch_enabled_set(Eina_Bool enabled) { /* check for valid compositor data */ @@@ -733,8 -635,8 +1049,13 @@@ return; } ++<<<<<<< HEAD + e_comp->wl_comp_data->touch.enabled = !!enabled; + _e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data); ++======= + e_comp_wl->touch.enabled = !!enabled; + _e_comp_wl_input_update_seat_caps(); ++>>>>>>> upstream } EINTERN Eina_Bool diff --cc src/bin/e_comp_wl_input.h index f859e1f,b3300c8..0a6a25c --- a/src/bin/e_comp_wl_input.h +++ b/src/bin/e_comp_wl_input.h @@@ -9,14 -18,16 +18,22 @@@ EINTERN Eina_Bool e_comp_wl_input_point EINTERN Eina_Bool e_comp_wl_input_keyboard_check(struct wl_resource *res); EINTERN Eina_Bool e_comp_wl_input_touch_check(struct wl_resource *res); - EINTERN void e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata); - EINTERN void e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina_Bool pressed); + EINTERN Eina_Bool e_comp_wl_input_keyboard_modifiers_serialize(void); + EINTERN void e_comp_wl_input_keyboard_modifiers_update(void); + EINTERN void e_comp_wl_input_keyboard_state_update(uint32_t keycode, Eina_Bool pressed); + EINTERN void e_comp_wl_input_keyboard_enter_send(E_Client *client); ++<<<<<<< HEAD +EAPI void e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled); +EAPI void e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled); +EAPI void e_comp_wl_input_touch_enabled_set(Eina_Bool enabled); ++======= + E_API void e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled); + E_API void e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled); + E_API void e_comp_wl_input_touch_enabled_set(Eina_Bool enabled); ++>>>>>>> upstream - EAPI void e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *model, const char *layout); + E_API void e_comp_wl_input_keymap_set(const char *rules, const char *model, const char *layout); # endif #endif diff --cc src/bin/e_comp_x.c index 0b619b5,fde492e..09d51d1 --- a/src/bin/e_comp_x.c +++ b/src/bin/e_comp_x.c @@@ -54,9 -64,18 +64,21 @@@ static int screen_size_index = -1 static Ecore_X_Atom backlight_atom = 0; extern double e_bl_val; ++<<<<<<< HEAD ++======= + static void _e_comp_x_hook_client_pre_frame_assign(void *d EINA_UNUSED, E_Client *ec); + + static inline E_Comp_X_Client_Data * + _e_comp_x_client_data_get(const E_Client *ec) + { + #ifdef HAVE_WAYLAND + if (!e_pixmap_is_x(ec->pixmap)) + return e_comp_wl_client_xwayland_data(ec); + #endif + return ec->comp_data; + } + ++>>>>>>> upstream static Eina_Bool _e_comp_x_flusher(void *data EINA_UNUSED) { @@@ -1409,24 -1542,13 +1549,28 @@@ _e_comp_x_configure_request(void *dat if (e_comp_find_by_window(ev->win)) return ECORE_CALLBACK_RENEW; ec = _e_comp_x_client_find_by_window(ev->win); + /* ignore requests for windows that don't have E_Client yet */ + if (!ec) + { + Ecore_X_Window_Attributes att; + + memset(&att, 0, sizeof(Ecore_X_Window_Attributes)); + ecore_x_window_attributes_get(ev->win, &att); + + if (!att.override) + return ECORE_CALLBACK_PASS_ON; + } /* pass through requests for windows we haven't/won't reparent yet */ ++<<<<<<< HEAD + if ((ec) && (!ec->comp_data->need_reparent) && (!ec->comp_data->reparented)) - { - ec->comp_data->initial_attributes.x = ev->x; - ec->comp_data->initial_attributes.y = ev->y; - ec->w = ec->client.w = ec->comp_data->initial_attributes.w = ev->w; - ec->h = ec->client.h = ec->comp_data->initial_attributes.h = ev->h; ++======= + if (ec && (!_e_comp_x_client_data_get(ec)->need_reparent) && (!_e_comp_x_client_data_get(ec)->reparented)) ++>>>>>>> upstream + { + _e_comp_x_client_data_get(ec)->initial_attributes.x = ev->x; + _e_comp_x_client_data_get(ec)->initial_attributes.y = ev->y; + ec->w = ec->client.w = _e_comp_x_client_data_get(ec)->initial_attributes.w = ev->w; + ec->h = ec->client.h = _e_comp_x_client_data_get(ec)->initial_attributes.h = ev->h; ec->border_size = ev->border; ec->changes.size = 1; ec = NULL; @@@ -2572,24 -2878,23 +2905,44 @@@ _e_comp_x_damage(void *data EINA_UNUSED } //WRN("DAMAGE %p: %dx%d", ec, ev->area.width, ev->area.height); ++<<<<<<< HEAD + ec->comp_data->damage_count++; + + if (ec->comp->nocomp) + e_pixmap_dirty(ec->pixmap); + /* discard unwanted xy position of first damage + * to avoid wrong composition for override redirect window */ + else if ((ec->override) && (!ec->comp_data->first_damage)) + e_comp_object_damage(ec->frame, 0, 0, ev->area.width, ev->area.height); + else + e_comp_object_damage(ec->frame, ev->area.x, ev->area.y, ev->area.width, ev->area.height); + + if ((e_comp_config_get()->skip_first_damage) && + (!ec->re_manage) && (!ec->override) && (!ec->comp_data->first_damage)) + e_comp_object_render_update_del(ec->frame); + else + E_FREE_FUNC(ec->comp_data->first_draw_delay, ecore_timer_del); + ec->comp_data->first_damage = 1; + ++======= + if (e_comp->nocomp) + e_pixmap_dirty(ec->pixmap); + else if (skip) + e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h); + else if (n) + { + int i; + + for (i = 0; i < n; i++) + e_comp_object_damage(ec->frame, rects[i].x, rects[i].y, rects[i].width, rects[i].height); + } + free(rects); + if ((!ec->re_manage) && (!ec->override) && (!_e_comp_x_client_data_get(ec)->first_damage)) + e_comp_object_render_update_del(ec->frame); + else + E_FREE_FUNC(_e_comp_x_client_data_get(ec)->first_draw_delay, ecore_timer_del); + _e_comp_x_client_data_get(ec)->first_damage = 1; ++>>>>>>> upstream return ECORE_CALLBACK_RENEW; } @@@ -5171,18 -5248,19 +5306,19 @@@ _e_comp_x_setup(Ecore_X_Window root, in ECORE_EVENT_MODIFIER_CTRL | ECORE_EVENT_MODIFIER_ALT, 0); - ecore_evas_callback_resize_set(c->ee, _e_comp_x_ee_resize); - ecore_evas_data_set(c->ee, "comp", c); - c->grab_cb = (Ecore_Cb)_e_comp_x_grab_cb; - c->bindings_grab_cb = (Ecore_Cb)_e_comp_x_bindings_grab_cb; - c->bindings_ungrab_cb = (Ecore_Cb)_e_comp_x_bindings_ungrab_cb; + ecore_evas_data_set(e_comp->ee, "comp", e_comp); + e_comp->bindings_grab_cb = _e_comp_x_bindings_grab_cb; + e_comp->bindings_ungrab_cb = _e_comp_x_bindings_ungrab_cb; - if (!e_comp_canvas_init(c)) return EINA_FALSE; + if (e_comp->comp_type == E_PIXMAP_TYPE_NONE) + { + if (!e_comp_canvas_init(w, h)) return EINA_FALSE; + } - e_grabinput_focus(c->ee_win, E_FOCUS_METHOD_PASSIVE); + e_grabinput_focus(e_comp->ee_win, E_FOCUS_METHOD_PASSIVE); /* init layers */ - for (i = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); i <= e_comp_canvas_layer_map(E_LAYER_CLIENT_PRIO); i++) + for (i = e_comp_canvas_layer_map(E_LAYER_CLIENT_DESKTOP); i <= e_comp_canvas_layer_map(E_LAYER_CLIENT_ALERT); i++) { char buf[64]; E_Client *ec; @@@ -5231,49 -5304,27 +5362,56 @@@ static Eina_Bool _e_comp_x_screens_setup(void) { - int n, i; - Ecore_X_Window *roots; - Eina_Bool success = EINA_FALSE; + Ecore_X_Window root; + int rw, rh; - roots = ecore_x_window_root_list(&n); - if ((!roots) || (n <= 0)) + if (e_comp->comp_type == E_PIXMAP_TYPE_NONE) { - free(roots); - e_error_message_show("X reports there are no root windows and %i screens!\n", - n); - return 0; + e_comp_x_randr_screen_iface_set(); + if (!e_randr2_init()) return 0; } - for (i = 0; i < 1; i++) + root = ecore_x_window_root_first_get(); + if (!root) { ++<<<<<<< HEAD + int rw, rh; + Ecore_X_Window root = roots[i]; + E_Comp *c; + + ecore_x_window_size_get(root, &rw, &rh); + if (n == 1) + { + /* more than 1 root window - xinerama wont be active */ + success = _e_comp_x_xinerama_setup(rw, rh); + if (!success) break; + } + if (!success) break; + c = e_comp_new(); + c->comp_type = E_PIXMAP_TYPE_X; + success = _e_comp_x_setup(c, root, rw, rh); + if (!success) break; +#ifdef _F_ZONE_WINDOW_ROTATION_ + if (e_config->wm_win_rotation) + { + ecore_x_e_window_rotation_supported_set(roots[i], + e_config->wm_win_rotation); + } +#endif + } + free(roots); + return success; ++======= + e_error_message_show("X reports there are no root windows!\n"); + return 0; + } + ecore_x_window_size_get(root, &rw, &rh); + if (e_comp->comp_type == E_PIXMAP_TYPE_NONE) + e_randr2_screens_setup(rw, rh); + return _e_comp_x_setup(root, rw, rh); ++>>>>>>> upstream } - EINTERN Eina_Bool + E_API Eina_Bool e_comp_x_init(void) { if (!ecore_x_init(NULL)) @@@ -5412,6 -5463,21 +5550,24 @@@ ecore_x_sync(); _x_idle_flush = ecore_idle_enterer_add(_e_comp_x_flusher, NULL); ++<<<<<<< HEAD ++======= + + if (e_comp->comp_type != E_PIXMAP_TYPE_WL) + { + int timeout = e_screensaver_timeout_get(EINA_TRUE); + ecore_x_screensaver_set(timeout + 10, + 0, + !e_config->screensaver_blanking, + !e_config->screensaver_expose); + ecore_x_screensaver_set(timeout, + 0, + e_config->screensaver_blanking, + e_config->screensaver_expose); + } + else + e_dnd_init(); ++>>>>>>> upstream return EINA_TRUE; } diff --cc src/bin/e_comp_x.h index 1936eba,30f8981..653bdfb --- a/src/bin/e_comp_x.h +++ b/src/bin/e_comp_x.h @@@ -38,8 -35,9 +35,10 @@@ struct _E_Comp_X_Client_Dat Ecore_Timer *first_draw_delay; //configurable placebo Eina_Bool first_damage : 1; //ignore first damage on non-re_manage clients + unsigned int damage_count; + unsigned int parent_activate_count; //number of times a win has activated itself when parent was focused + struct { struct diff --cc src/bin/e_config.c index a97bfd4,80501aa..bdf8d4c --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@@ -50,11 -50,10 +50,11 @@@ static E_Config_DD *_e_config_syscon_ac static E_Config_DD *_e_config_env_var_edd = NULL; static E_Config_DD *_e_config_xkb_layout_edd = NULL; static E_Config_DD *_e_config_xkb_option_edd = NULL; +static E_Config_DD *_e_config_client_type_edd = NULL; - EAPI int E_EVENT_CONFIG_ICON_THEME = 0; - EAPI int E_EVENT_CONFIG_MODE_CHANGED = 0; - EAPI int E_EVENT_CONFIG_LOADED = 0; + E_API int E_EVENT_CONFIG_ICON_THEME = 0; + E_API int E_EVENT_CONFIG_MODE_CHANGED = 0; + E_API int E_EVENT_CONFIG_LOADED = 0; static E_Dialog *_e_config_error_dialog = NULL; @@@ -758,12 -732,10 +753,15 @@@ _e_config_edd_init(Eina_Bool old E_CONFIG_VAL(D, T, xkb.only_label, INT); E_CONFIG_VAL(D, T, xkb.dont_touch_my_damn_keyboard, UCHAR); E_CONFIG_VAL(D, T, xkb.default_model, STR); + E_CONFIG_VAL(D, T, xkb.use_cache, UCHAR); + E_CONFIG_VAL(D, T, xkb.delay_held_key_input_to_focus, UINT); + + E_CONFIG_VAL(D, T, keyboard.repeat_delay, INT); + E_CONFIG_VAL(D, T, keyboard.repeat_rate, INT); + E_CONFIG_VAL(D, T, keyboard.repeat_delay, INT); + E_CONFIG_VAL(D, T, keyboard.repeat_rate, INT); + if (old) { E_CONFIG_SUB(D, T, xkb.current_layout, _e_config_xkb_option_edd); @@@ -1545,18 -1511,13 +1558,21 @@@ e_config_load(void E_CONFIG_LIMIT(e_config->multiscreen_flip, 0, 1); - E_CONFIG_LIMIT(e_config->backlight.normal, 0.1, 1.0); - E_CONFIG_LIMIT(e_config->backlight.dim, 0.1, 1.0); - E_CONFIG_LIMIT(e_config->backlight.idle_dim, 0.1, 1.0); + E_CONFIG_LIMIT(e_config->backlight.normal, 0.05, 1.0); + E_CONFIG_LIMIT(e_config->backlight.dim, 0.05, 1.0); + E_CONFIG_LIMIT(e_config->backlight.idle_dim, 0, 1); + + E_CONFIG_LIMIT(e_config->keyboard.repeat_delay, -1, 1000); // 1 second + E_CONFIG_LIMIT(e_config->keyboard.repeat_rate, -1, 1000); // 1 second + E_CONFIG_LIMIT(e_config->keyboard.repeat_delay, -1, 1000); // 1 second + E_CONFIG_LIMIT(e_config->keyboard.repeat_rate, -1, 1000); // 1 second + + E_CONFIG_LIMIT(e_config->xkb.delay_held_key_input_to_focus, 0,5000); // 5000(ms) == 5(s) + + E_CONFIG_LIMIT(e_config->use_cursor_timer, 0, 1); + E_CONFIG_LIMIT(e_config->cursor_timer_interval, 0.0, 9.9); + if (!e_config->icon_theme) e_config->icon_theme = eina_stringshare_add("hicolor"); // FDO default diff --cc src/bin/e_config.h index 31aa28b,2874ac7..b097530 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@@ -439,7 -428,7 +434,11 @@@ struct _E_Confi const char *selected_layout; // whatever teh current layout that the user has selected is const char *desklock_layout; } xkb; ++<<<<<<< HEAD + ++======= + ++>>>>>>> upstream struct { int repeat_delay;//delay in milliseconds since key down until repeating starts diff --cc src/bin/e_desk.c index 1f7d2ac,77f157a..d663d6c --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@@ -220,10 -213,11 +213,15 @@@ e_desk_show(E_Desk *desk E_Event_Desk_Show *ev; E_Event_Desk_Before_Show *eev; E_Event_Desk_After_Show *eeev; - Edje_Message_Int_Set *msg; + Edje_Message_Float_Set *msg; Eina_List *l; E_Shelf *es; ++<<<<<<< HEAD + int x, y, dx = 0, dy = 0; ++======= + E_Desk *desk2; + int was_zone = 0, dx = 0, dy = 0; ++>>>>>>> upstream E_OBJECT_CHECK(desk); E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); @@@ -277,29 -263,19 +267,23 @@@ desk->zone->desk_y_current = desk->y; desk->visible = 1; - msg = alloca(sizeof(Edje_Message_Int_Set) + (3 * sizeof(int))); - msg->count = 4; - msg->val[0] = desk->x; - msg->val[1] = desk->zone->desk_x_count; - msg->val[2] = desk->y; - msg->val[3] = desk->zone->desk_y_count; + msg = alloca(sizeof(Edje_Message_Float_Set) + (4 * sizeof(double))); + msg->count = 5; + msg->val[0] = 0.2 * (!!e_config->desk_flip_animate_mode);//e_config->desk_flip_animate_time; + msg->val[1] = desk->x; + msg->val[2] = desk->zone->desk_x_count; + msg->val[3] = desk->y; + msg->val[4] = desk->zone->desk_y_count; if (desk->zone->bg_object) - edje_object_message_send(desk->zone->bg_object, EDJE_MESSAGE_INT_SET, 0, msg); + edje_object_message_send(desk->zone->bg_object, EDJE_MESSAGE_FLOAT_SET, 0, msg); +#ifndef ENABLE_QUICK_INIT + int was_zone = 0; if (desk->zone->bg_object) was_zone = 1; +#endif _e_desk_show_begin(desk, dx, dy); - if (!e_config->desk_flip_animate_type) - { - if (e_config->focus_last_focused_per_desktop) - e_desk_last_focused_focus(desk); - else if (e_client_focused_get()) - evas_object_focus_set(e_client_focused_get()->frame, 0); - } +#ifndef ENABLE_QUICK_INIT if (was_zone) e_bg_zone_update(desk->zone, E_BG_TRANSITION_DESK); else diff --cc src/bin/e_dnd.c index 031798d,b0e9fbd..5f34881 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@@ -2,17 -2,15 +2,27 @@@ /* local subsystem functions */ -static void _e_drag_move(E_Drag *drag, int x, int y); static void _e_drag_coords_update(const E_Drop_Handler *h, int *dx, int *dy); ++<<<<<<< HEAD +static Ecore_X_Window _e_drag_win_get(const E_Drop_Handler *h, int xdnd); +static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd); +static void _e_drag_win_hide(E_Drop_Handler *h); +#ifndef HAVE_WAYLAND_ONLY +static void _e_drag_win_show(E_Drop_Handler *h); +static void _e_drag_move(E_Drag *drag, int x, int y); +static int _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action); +static void _e_drag_xdnd_end(Ecore_X_Window root, int x, int y); +#endif +static void _e_drag_end(int x, int y); ++======= + static Ecore_Window _e_drag_win_get(const E_Drop_Handler *h, int xdnd); + static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_Window win, int xdnd); + static void _e_drag_win_show(E_Drop_Handler *h); + static void _e_drag_win_hide(E_Drop_Handler *h); + static int _e_drag_update(Ecore_Window root, int x, int y, Ecore_X_Atom action); + static void _e_drag_end(int x, int y); + static void _e_drag_xdnd_end(Ecore_Window root, int x, int y); ++>>>>>>> upstream static void _e_drag_free(E_Drag *drag); static Eina_Bool _e_dnd_cb_key_down(void *data, int type, void *event); @@@ -1099,11 -1074,12 +1096,13 @@@ _e_drag_end(int x, int y _drag_current->cb.finished = NULL; e_object_del(E_OBJECT(_drag_current)); + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + e_comp_ungrab_input(1, 1); } +#ifndef HAVE_WAYLAND_ONLY static void - _e_drag_xdnd_end(Ecore_X_Window win, int x, int y) + _e_drag_xdnd_end(Ecore_Window win, int x, int y) { const Eina_List *l; E_Event_Dnd_Drop ev; diff --cc src/bin/e_hints.c index 12dfc05,91de8e3..fd390f6 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@@ -6,19 -5,18 +5,20 @@@ static void e_hints_e16_comms_pretend(E static void e_hints_openoffice_gnome_fake(Ecore_Window root); //static void e_hints_openoffice_kde_fake(Ecore_Window root); - EAPI Ecore_X_Atom ATM__QTOPIA_SOFT_MENU = 0; - EAPI Ecore_X_Atom ATM__QTOPIA_SOFT_MENUS = 0; - EAPI Ecore_X_Atom ATM_GNOME_SM_PROXY = 0; - EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_COMMS = 0; - EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION = 0; - EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE = 0; + E_API Ecore_X_Atom ATM__QTOPIA_SOFT_MENU = 0; + E_API Ecore_X_Atom ATM__QTOPIA_SOFT_MENUS = 0; + E_API Ecore_X_Atom ATM_GNOME_SM_PROXY = 0; + E_API Ecore_X_Atom ATM_ENLIGHTENMENT_COMMS = 0; + E_API Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION = 0; + E_API Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE = 0; - EAPI Ecore_X_Atom ATM_NETWM_SHOW_WINDOW_MENU = 0; - EAPI Ecore_X_Atom ATM_NETWM_PERFORM_BUTTON_ACTION = 0; + E_API Ecore_X_Atom ATM_NETWM_SHOW_WINDOW_MENU = 0; + E_API Ecore_X_Atom ATM_NETWM_PERFORM_BUTTON_ACTION = 0; + E_API Ecore_X_Atom ATM_GTK_FRAME_EXTENTS = 0; #endif +static Eina_List *aux_hints_supported = NULL; + EINTERN void e_hints_init(Ecore_Window root, Ecore_Window propwin) { @@@ -1607,28 -1570,7 +1606,32 @@@ e_hints_window_e_state_set(E_Client *e /* TODO */ } ++<<<<<<< HEAD +EAPI void +e_hints_window_e_opaque_get(E_Client *ec) +{ +#ifdef HAVE_WAYLAND_ONLY +#else + unsigned int opaque; + int ret = -1; + + if (!e_pixmap_is_x(ec->pixmap)) return; + + ret = + ecore_x_window_prop_card32_get(e_client_util_win_get(ec), E_ATOM_WINDOW_OPAQUE, + &opaque, 1); + if (ret == -1) + ec->visibility.opaque = -1; + else + ec->visibility.opaque = (int)opaque; + +#endif +} + +EAPI void ++======= + E_API void ++>>>>>>> upstream e_hints_window_qtopia_soft_menu_get(E_Client *ec) { #ifdef HAVE_WAYLAND_ONLY diff --cc src/bin/e_hints.h index d10d96f,b402541..6231309 --- a/src/bin/e_hints.h +++ b/src/bin/e_hints.h @@@ -4,62 -4,60 +4,74 @@@ #define E_HINTS_H EINTERN void e_hints_init(Ecore_Window win, Ecore_Window propwin); - EINTERN void e_hints_manager_init(E_Manager *man); - EAPI void e_hints_client_list_set(void); - EAPI void e_hints_client_stacking_set(void); + //EINTERN void e_hints_manager_init(E_Manager *man); + E_API void e_hints_client_list_set(void); + E_API void e_hints_client_stacking_set(void); - EAPI void e_hints_active_window_set(E_Manager *man, E_Client *ec); + E_API void e_hints_active_window_set(E_Client *ec); EINTERN void e_hints_window_init(E_Client *ec); - EAPI void e_hints_window_state_set(E_Client *ec); - EAPI void e_hints_window_state_get(E_Client *ec); - EAPI void e_hints_window_type_set(E_Client *ec); - EAPI void e_hints_window_type_get(E_Client *ec); + E_API void e_hints_window_state_set(E_Client *ec); + E_API void e_hints_window_state_get(E_Client *ec); + E_API void e_hints_window_type_set(E_Client *ec); + E_API void e_hints_window_type_get(E_Client *ec); - EAPI void e_hints_window_visible_set(E_Client *ec); - EAPI void e_hints_window_iconic_set(E_Client *ec); - EAPI void e_hints_window_hidden_set(E_Client *ec); + E_API void e_hints_window_visible_set(E_Client *ec); + E_API void e_hints_window_iconic_set(E_Client *ec); + E_API void e_hints_window_hidden_set(E_Client *ec); - EAPI void e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir); - EAPI E_Direction e_hints_window_shade_direction_get(E_Client *ec); + E_API void e_hints_window_shade_direction_set(E_Client *ec, E_Direction dir); + E_API E_Direction e_hints_window_shade_direction_get(E_Client *ec); - EAPI void e_hints_window_size_set(E_Client *ec); - EAPI void e_hints_window_size_unset(E_Client *ec); - EAPI int e_hints_window_size_get(E_Client *ec); + E_API void e_hints_window_size_set(E_Client *ec); + E_API void e_hints_window_size_unset(E_Client *ec); + E_API int e_hints_window_size_get(E_Client *ec); - EAPI void e_hints_window_shaded_set(E_Client *ec, int on); - EAPI void e_hints_window_maximized_set(E_Client *ec, int horizontal, int vertical); - EAPI void e_hints_window_fullscreen_set(E_Client *ec, int on); - EAPI void e_hints_window_sticky_set(E_Client *ec, int on); - EAPI void e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking); - EAPI void e_hints_window_desktop_set(E_Client *ec); + E_API void e_hints_window_shaded_set(E_Client *ec, int on); + E_API void e_hints_window_maximized_set(E_Client *ec, int horizontal, int vertical); + E_API void e_hints_window_fullscreen_set(E_Client *ec, int on); + E_API void e_hints_window_sticky_set(E_Client *ec, int on); + E_API void e_hints_window_stacking_set(E_Client *ec, E_Stacking stacking); + E_API void e_hints_window_desktop_set(E_Client *ec); - EAPI void e_hints_window_e_state_set(E_Client *ec); - EAPI void e_hints_window_e_state_get(E_Client *ec); + E_API void e_hints_window_e_state_set(E_Client *ec); + E_API void e_hints_window_e_state_get(E_Client *ec); ++<<<<<<< HEAD +EAPI void e_hints_window_e_opaque_get(E_Client *ec); + +EAPI void e_hints_window_qtopia_soft_menu_get(E_Client *ec); +EAPI void e_hints_window_qtopia_soft_menus_get(E_Client *ec); ++======= + E_API void e_hints_window_qtopia_soft_menu_get(E_Client *ec); + E_API void e_hints_window_qtopia_soft_menus_get(E_Client *ec); ++>>>>>>> upstream - EAPI void e_hints_window_virtual_keyboard_state_get(E_Client *ec); - EAPI void e_hints_window_virtual_keyboard_get(E_Client *ec); + E_API void e_hints_window_virtual_keyboard_state_get(E_Client *ec); + E_API void e_hints_window_virtual_keyboard_get(E_Client *ec); ++<<<<<<< HEAD +EAPI void e_hints_scale_update(void); +EAPI const Eina_List * e_hints_aux_hint_supported_add(const char *hint); +EAPI const Eina_List * e_hints_aux_hint_supported_del(const char *hint); +EAPI const Eina_List * e_hints_aux_hint_supported_get(void); ++======= + + E_API void e_hints_scale_update(void); + ++>>>>>>> upstream #ifdef E_COMP_X_H - 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; - extern EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_COMMS; - extern EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION; - extern EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE; - extern EAPI Ecore_X_Atom ATM_NETWM_SHOW_WINDOW_MENU; - extern EAPI Ecore_X_Atom ATM_NETWM_PERFORM_BUTTON_ACTION; + E_API void e_hints_window_state_update(E_Client *ec, int state, int action); + extern E_API Ecore_X_Atom ATM__QTOPIA_SOFT_MENU; + extern E_API Ecore_X_Atom ATM__QTOPIA_SOFT_MENUS; + extern E_API Ecore_X_Atom ATM_GNOME_SM_PROXY; + extern E_API Ecore_X_Atom ATM_ENLIGHTENMENT_COMMS; + extern E_API Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION; + extern E_API Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE; + extern E_API Ecore_X_Atom ATM_NETWM_SHOW_WINDOW_MENU; + extern E_API Ecore_X_Atom ATM_NETWM_PERFORM_BUTTON_ACTION; + extern E_API Ecore_X_Atom ATM_GTK_FRAME_EXTENTS; #endif #endif #endif diff --cc src/bin/e_log.h index b422dde,325539f..01df431 --- a/src/bin/e_log.h +++ b/src/bin/e_log.h @@@ -57,15 -27,11 +57,23 @@@ EINTERN int e_log_shutdown(void) #undef WRN #undef ERR #undef CRI ++<<<<<<< HEAD +#undef ELOG +#undef ELOGF +#define DBG(...) printf(__VA_ARGS__); putc('\n', stdout) +#define INF(...) printf(__VA_ARGS__); putc('\n', stdout) +#define WRN(...) printf(__VA_ARGS__); putc('\n', stdout) +#define ERR(...) printf(__VA_ARGS__); putc('\n', stdout) +#define CRI(...) printf(__VA_ARGS__); putc('\n', stdout) +#define ELOG(...) ; +#define ELOGF(...) ; ++======= + #define DBG(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) + #define INF(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) + #define WRN(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) + #define ERR(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) + #define CRI(...) do { printf(__VA_ARGS__); putc('\n', stdout); } while(0) ++>>>>>>> upstream #endif #endif diff --cc src/bin/e_main.c index 82d03ad,b4df9a8..cc74554 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@@ -86,9 -84,9 +86,15 @@@ static void _e_main_desk_save(void static void _e_main_desk_restore(void); static void _e_main_efreet_paths_init(void); static void _e_main_modules_load(Eina_Bool safe_mode); ++<<<<<<< HEAD +static Eina_Bool _e_main_cb_idle_before(void *data __UNUSED__); +static Eina_Bool _e_main_cb_idle_after(void *data __UNUSED__); +static Eina_Bool _e_main_cb_startup_fake_end(void *data __UNUSED__); ++======= + static Eina_Bool _e_main_cb_idle_before(void *data EINA_UNUSED); + static Eina_Bool _e_main_cb_idle_after(void *data EINA_UNUSED); + static Eina_Bool _e_main_cb_startup_fake_end(void *data EINA_UNUSED); ++>>>>>>> upstream /* local variables */ static Eina_Bool really_know = EINA_FALSE; @@@ -1103,9 -989,9 +1112,15 @@@ main(int argc, char **argv TS("E_Order Init Done"); _e_main_shutdown_push(e_order_shutdown); ++<<<<<<< HEAD + TS("E_Manager Keys Grab"); + e_managers_keys_grab(); + TS("E_Manager Keys Grab Done"); ++======= + TS("E_Comp_Canvas Keys Grab"); + e_comp_canvas_keys_grab(); + TS("E_Comp_Canvas Keys Grab Done"); ++>>>>>>> upstream if (e_config->show_splash) e_init_status_set(_("Load Modules")); @@@ -1962,15 -1565,10 +1984,12 @@@ _e_main_test_formats(void static int _e_main_screens_init(void) { - TS("\tscreens: manager"); - if (!e_manager_init()) return 0; - TS("\tscreens: client"); if (!e_client_init()) return 0; +#ifndef ENABLE_QUICK_INIT TS("\tscreens: win"); if (!e_win_init()) return 0; +#endif #ifndef HAVE_WAYLAND_ONLY TS("E_Xkb Init"); if (!e_xkb_init()) @@@ -2044,20 -1641,19 +2062,25 @@@ _e_main_desk_restore(void { const Eina_List *l; E_Zone *zone; ++<<<<<<< HEAD + const char *env; ++======= + E_Client *ec; + char *env; ++>>>>>>> upstream char name[1024]; EINA_LIST_FOREACH(e_comp->zones, l, zone) { E_Desk *desk; int desk_x, desk_y; + char buf_e[64]; - snprintf(name, sizeof(name), "DESK_%d_%d", e_comp->num, zone->num); + snprintf(name, sizeof(name), "DESK_%d_%d", 0, zone->num); env = getenv(name); if (!env) continue; - if (!sscanf(env, "%d,%d", &desk_x, &desk_y)) continue; + snprintf(buf_e, sizeof(buf_e), "%s", env); + if (!sscanf(buf_e, "%d,%d", &desk_x, &desk_y)) continue; desk = e_desk_at_xy_get(zone, desk_x, desk_y); if (!desk) continue; e_desk_show(desk); @@@ -2177,7 -1780,7 +2207,11 @@@ _e_main_cb_idle_after(void *data EINA_U } static Eina_Bool ++<<<<<<< HEAD +_e_main_cb_startup_fake_end(void *data __UNUSED__) ++======= + _e_main_cb_startup_fake_end(void *data EINA_UNUSED) ++>>>>>>> upstream { e_init_hide(); return ECORE_CALLBACK_CANCEL; diff --cc src/bin/e_module.c index db445a0,c211b93..aedb79d --- a/src/bin/e_module.c +++ b/src/bin/e_module.c @@@ -9,8 -9,7 +9,12 @@@ /* local subsystem functions */ static void _e_module_free(E_Module *m); ++<<<<<<< HEAD +static void _e_module_dialog_disable_defer(const char *title, const char *body, E_Module *m); +static void _e_module_dialog_disable_show(const char *title, const char *body, E_Module *m); ++======= + static void _e_module_dialog_disable_create(const char *title, const char *body, E_Module *m); ++>>>>>>> upstream static void _e_module_cb_dialog_disable(void *data, E_Dialog *dia); static void _e_module_event_update_free(void *data, void *event); static Eina_Bool _e_module_cb_idler(void *data); @@@ -31,18 -30,10 +35,18 @@@ static Eina_List *_e_module_path_lists static Eina_List *handlers = NULL; static Eina_Hash *_e_module_path_hash = NULL; - EAPI int E_EVENT_MODULE_UPDATE = 0; - EAPI int E_EVENT_MODULE_INIT_END = 0; + E_API int E_EVENT_MODULE_UPDATE = 0; + E_API int E_EVENT_MODULE_INIT_END = 0; static Eina_Stringshare *mod_src_path = NULL; +static Eina_List *deferred_dialogs = NULL; + +typedef struct _Defer_Dialog +{ + const char *title; + const char *body; + E_Module *m; +} Defer_Dialog; static Eina_Bool _module_filter_cb(void *d EINA_UNUSED, Eio_File *ls EINA_UNUSED, const Eina_File_Direct_Info *info) @@@ -705,22 -720,7 +751,26 @@@ e_module_desktop_list(void return l; } ++<<<<<<< HEAD +EAPI void +e_module_deferred_job(void) +{ + Defer_Dialog *dd; + + if (!deferred_dialogs) return; + + EINA_LIST_FREE(deferred_dialogs, dd) + { + _e_module_dialog_disable_show(dd->title, dd->body, dd->m); + eina_stringshare_del(dd->title); + eina_stringshare_del(dd->body); + } +} + +EAPI void ++======= + E_API void ++>>>>>>> upstream e_module_desktop_free(E_Module_Desktop *md) { if (!md) return; @@@ -786,49 -781,22 +836,49 @@@ _e_module_desktop_list_cb(const Eina_Ha return EINA_TRUE; } + typedef struct Disable_Dialog + { + char *title; + char *body; + E_Module *m; + } Disable_Dialog; + static void +_e_module_dialog_disable_defer(const char *title, const char *body, E_Module *m) +{ + Defer_Dialog *dd; + + dd = E_NEW(Defer_Dialog, 1); + if (!dd) + { + ERR("Failed to allocate Defer_Dialog"); + return; + } + + dd->title = eina_stringshare_add(title); + dd->body = eina_stringshare_add(body); + dd->m = m; + + deferred_dialogs = eina_list_append(deferred_dialogs, dd); +} + +static void _e_module_dialog_disable_show(const char *title, const char *body, E_Module *m) { E_Dialog *dia; char buf[4096]; +#ifdef ENABLE_QUICK_INIT + if (!_e_modules_init_end) + { + _e_module_dialog_disable_defer(title, body, m); + return; + } +#endif + printf("MODULE ERR:\n%s\n", body); - /* FIXME: Stupid hack for ELM_WIN_DIALOG_BASIC not working in wayland */ - #warning REMOVE STUPID ELM HACK FOR WAYLAND BEFORE RELEASE - if (e_comp && e_comp->comp_type != E_PIXMAP_TYPE_WL) - dia = e_dialog_new(NULL, "E", "_module_unload_dialog"); - else - dia = e_dialog_normal_win_new(NULL, "E", "_module_unload_dialog"); - - EINA_SAFETY_ON_NULL_RETURN(dia); + dia = e_dialog_new(NULL, "E", "_module_unload_dialog"); snprintf(buf, sizeof(buf), "%s
%s", body, _("What action should be taken with this module?
")); diff --cc src/bin/e_module.h index 18cf257,192810e..f5e6ad7 --- a/src/bin/e_module.h +++ b/src/bin/e_module.h @@@ -62,22 -62,21 +62,41 @@@ struct _E_Module_Ap EINTERN int e_module_init(void); EINTERN int e_module_shutdown(void); ++<<<<<<< HEAD +EAPI void e_module_deferred_job(void); +EAPI void e_module_all_load(void); +EAPI E_Module *e_module_new(const char *name); +EAPI int e_module_save(E_Module *m); +EAPI const char *e_module_dir_get(E_Module *m); +EAPI int e_module_enable(E_Module *m); +EAPI int e_module_disable(E_Module *m); +EAPI int e_module_enabled_get(E_Module *m); +EAPI int e_module_save_all(void); +EAPI E_Module *e_module_find(const char *name); +EAPI Eina_List *e_module_list(void); +EAPI Eina_List *e_module_desktop_list(void); +EAPI void e_module_desktop_free(E_Module_Desktop *md); +EAPI void e_module_dialog_show(E_Module *m, const char *title, const char *body); +EAPI void e_module_delayed_set(E_Module *m, int delayed); +EAPI void e_module_priority_set(E_Module *m, int priority); +EAPI Eina_Bool e_module_loading_get(void); ++======= + E_API void e_module_all_load(void); + E_API E_Module *e_module_new(const char *name); + E_API int e_module_save(E_Module *m); + E_API const char *e_module_dir_get(E_Module *m); + E_API int e_module_enable(E_Module *m); + E_API int e_module_disable(E_Module *m); + E_API int e_module_enabled_get(E_Module *m); + E_API int e_module_save_all(void); + E_API E_Module *e_module_find(const char *name); + E_API Eina_List *e_module_list(void); + E_API Eina_List *e_module_desktop_list(void); + E_API void e_module_desktop_free(E_Module_Desktop *md); + E_API void e_module_dialog_show(E_Module *m, const char *title, const char *body); + E_API void e_module_delayed_set(E_Module *m, int delayed); + E_API void e_module_priority_set(E_Module *m, int priority); + E_API Eina_Bool e_module_loading_get(void); ++>>>>>>> upstream #endif #endif diff --cc src/bin/e_mouse.c index c5ef85b,5de709d..7579a36 --- a/src/bin/e_mouse.c +++ b/src/bin/e_mouse.c @@@ -1,11 -1,11 +1,11 @@@ #include "e.h" +#ifdef HAVE_WL_DRM +#include +#endif - EAPI int + E_API int e_mouse_update(void) { - unsigned char map[256] = { 0 }; - int n; - #ifndef HAVE_WAYLAND_ONLY if (e_comp->comp_type == E_PIXMAP_TYPE_X) { diff --cc src/bin/e_object.c index 8379902,3af9dce..8090258 --- a/src/bin/e_object.c +++ b/src/bin/e_object.c @@@ -11,13 -11,8 +11,13 @@@ static void _e_object_segv(int sig) static sigjmp_buf _e_object_segv_buf; #endif +#ifdef OBJECT_HASH_CHECK +EAPI Eina_Bool e_obj_hash_check = EINA_FALSE; +EAPI Eina_Hash *e_obj_hash = NULL; +#endif + /* externally accessible functions */ - EAPI void * + E_API void * e_object_alloc(int size, int type, E_Object_Cleanup_Func cleanup_func) { E_Object *obj; @@@ -126,13 -117,9 +126,13 @@@ e_object_free(E_Object *obj obj->magic = E_OBJECT_MAGIC_FREED; #endif obj->cleanup_func(obj); +#ifdef OBJECT_HASH_CHECK + if (e_obj_hash_check) + eina_hash_del_by_key(e_obj_hash, &obj); +#endif } - EAPI int + E_API int e_object_ref(E_Object *obj) { E_OBJECT_CHECK_RETURN(obj, -1); diff --cc src/bin/e_object.h index 0f6eaee,75304ac..f2a9597 --- a/src/bin/e_object.h +++ b/src/bin/e_object.h @@@ -100,46 -81,32 +100,46 @@@ struct _E_Object_Delf Eina_Bool delete_me : 1; }; - EAPI void *e_object_alloc (int size, int type, E_Object_Cleanup_Func cleanup_func); - EAPI void e_object_del (E_Object *obj); - EAPI void e_object_delay_del_set (E_Object *obj, void *func); - EAPI int e_object_is_del (E_Object *obj); - EAPI void e_object_del_func_set (E_Object *obj, E_Object_Cleanup_Func del_func); - EAPI void e_object_type_set (E_Object *obj, int type); - EAPI void e_object_free (E_Object *obj); - EAPI int e_object_ref (E_Object *obj); - EAPI int e_object_unref (E_Object *obj); - EAPI int e_object_ref_get (E_Object *obj); - EAPI int e_object_error (E_Object *obj); - EAPI void e_object_data_set (E_Object *obj, const void *data); - EAPI void *e_object_data_get (E_Object *obj); - EAPI void e_object_free_attach_func_set(E_Object *obj, E_Object_Cleanup_Func func); - EAPI void e_object_del_attach_func_set (E_Object *obj, E_Object_Cleanup_Func func); - - EAPI E_Object_Delfn *e_object_delfn_add (E_Object *obj, void (*func) (void *data, void *obj), void *data); - EAPI void e_object_delfn_del (E_Object *obj, E_Object_Delfn *dfn); - EAPI void e_object_delfn_clear(E_Object *obj); - - EAPI void e_object_ref_debug_set(E_Object *obj, Eina_Bool set); + E_API void *e_object_alloc (int size, int type, E_Object_Cleanup_Func cleanup_func); + E_API void e_object_del (E_Object *obj); + E_API void e_object_delay_del_set (E_Object *obj, void *func); + E_API int e_object_is_del (E_Object *obj); + E_API void e_object_del_func_set (E_Object *obj, E_Object_Cleanup_Func del_func); + E_API void e_object_type_set (E_Object *obj, int type); + E_API void e_object_free (E_Object *obj); + E_API int e_object_ref (E_Object *obj); + E_API int e_object_unref (E_Object *obj); + E_API int e_object_ref_get (E_Object *obj); + E_API int e_object_error (E_Object *obj); + E_API void e_object_data_set (E_Object *obj, const void *data); + E_API void *e_object_data_get (E_Object *obj); + E_API void e_object_free_attach_func_set(E_Object *obj, E_Object_Cleanup_Func func); + E_API void e_object_del_attach_func_set (E_Object *obj, E_Object_Cleanup_Func func); + + E_API E_Object_Delfn *e_object_delfn_add (E_Object *obj, void (*func) (void *data, void *obj), void *data); + E_API void e_object_delfn_del (E_Object *obj, E_Object_Delfn *dfn); + E_API void e_object_delfn_clear(E_Object *obj); + + E_API void e_object_ref_debug_set(E_Object *obj, Eina_Bool set); +#ifdef OBJECT_HASH_CHECK +extern EAPI Eina_Bool e_obj_hash_check; +extern EAPI Eina_Hash *e_obj_hash; + +EAPI void e_object_hash_init (void); +EAPI void e_object_hash_shutdown (void); + +static inline E_Object * +e_object_hash_find(E_Object *obj) +{ + return (E_Object *)eina_hash_find(e_obj_hash, &obj); +} +#endif + /* - EAPI void e_object_breadcrumb_add (E_Object *obj, char *crumb); - EAPI void e_object_breadcrumb_del (E_Object *obj, char *crumb); - EAPI void e_object_breadcrumb_debug (E_Object *obj); + E_API void e_object_breadcrumb_add (E_Object *obj, char *crumb); + E_API void e_object_breadcrumb_del (E_Object *obj, char *crumb); + E_API void e_object_breadcrumb_debug (E_Object *obj); */ #endif diff --cc src/bin/e_pixmap.c index 6172374,8837bce..b87b425 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@@ -1,18 -1,22 +1,33 @@@ #include "e.h" - #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + #ifdef HAVE_WAYLAND # include "e_comp_wl.h" ++<<<<<<< HEAD +# include +#include ++======= + # ifndef EGL_TEXTURE_FORMAT + # define EGL_TEXTURE_FORMAT 0x3080 + # endif + # ifndef EGL_TEXTURE_RGBA + # define EGL_TEXTURE_RGBA 0x305E + # endif ++>>>>>>> upstream #endif #ifndef HAVE_WAYLAND_ONLY # include "e_comp_x.h" #endif + #include + static Eina_Hash *pixmaps[2] = {NULL}; ++<<<<<<< HEAD +static Eina_Hash *deleted[2] = {NULL}; +static Eina_Hash *res_ids = NULL; +static uint32_t res_id = 0; ++======= + static Eina_Hash *aliases[2] = {NULL}; ++>>>>>>> upstream struct _E_Pixmap { @@@ -42,9 -46,7 +58,13 @@@ struct wl_listener buffer_destroy_listener; void *data; Eina_Rectangle opaque; ++<<<<<<< HEAD + + E_Comp_Wl_Client_Data *cdata; + Eina_Bool own_cdata : 1; ++======= + uuid_t uuid; ++>>>>>>> upstream #endif Eina_Bool usable : 1; @@@ -52,49 -54,7 +72,53 @@@ Eina_Bool image_argb : 1; }; ++<<<<<<< HEAD +static int _e_pixmap_hooks_delete = 0; +static int _e_pixmap_hooks_walking = 0; + +static Eina_Inlist *_e_pixmap_hooks[] = +{ + [E_PIXMAP_HOOK_NEW] = NULL, + [E_PIXMAP_HOOK_DEL] = NULL, +}; + +static void +_e_pixmap_hooks_clean(void) +{ + Eina_Inlist *l; + E_Pixmap_Hook *ph; + unsigned int x; + + for (x = 0; x < E_PIXMAP_HOOK_LAST; x++) + EINA_INLIST_FOREACH_SAFE(_e_pixmap_hooks[x], l, ph) + { + if (!ph->delete_me) continue; + _e_pixmap_hooks[x] = eina_inlist_remove(_e_pixmap_hooks[x], + EINA_INLIST_GET(ph)); + free(ph); + } +} + +static void +_e_pixmap_hook_call(E_Pixmap_Hook_Point hookpoint, E_Pixmap *cp) +{ + E_Pixmap_Hook *ph; + + _e_pixmap_hooks_walking++; + EINA_INLIST_FOREACH(_e_pixmap_hooks[hookpoint], ph) + { + if (ph->delete_me) continue; + ph->func(ph->data, cp); + } + _e_pixmap_hooks_walking--; + if ((_e_pixmap_hooks_walking == 0) && (_e_pixmap_hooks_delete > 0)) + _e_pixmap_hooks_clean(); +} + +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) ++======= + #ifdef HAVE_WAYLAND ++>>>>>>> upstream static void _e_pixmap_cb_buffer_destroy(struct wl_listener *listener, void *data EINA_UNUSED) { @@@ -125,17 -85,8 +149,22 @@@ _e_pixmap_clear(E_Pixmap *cp, Eina_Boo #endif break; case E_PIXMAP_TYPE_WL: ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if (cp->buffer_destroy_listener.notify) + { + wl_list_remove(&cp->buffer_destroy_listener.link); + cp->buffer_destroy_listener.notify = NULL; + } + + e_comp_wl_buffer_reference(&cp->buffer_ref, NULL); + ELOG("PIXMAP CLEAR", cp, cp->client); + + (void)cache; ++======= + #ifdef HAVE_WAYLAND + e_pixmap_image_clear(cp, cache); ++>>>>>>> upstream #endif break; default: @@@ -224,9 -152,10 +253,14 @@@ _e_pixmap_find(E_Pixmap_Type type, va_l #ifndef HAVE_WAYLAND_ONLY Ecore_X_Window xwin; #endif ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) ++======= + #ifdef HAVE_WAYLAND ++>>>>>>> upstream uintptr_t id; #endif + E_Pixmap *cp; if (!pixmaps[type]) return NULL; switch (type) @@@ -238,9 -169,11 +274,17 @@@ #endif break; case E_PIXMAP_TYPE_WL: ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + id = va_arg(*l, uintptr_t); + return eina_hash_find(pixmaps[type], &id); ++======= + #ifdef HAVE_WAYLAND + id = va_arg(*l, uintptr_t); + cp = eina_hash_find(aliases[type], &id); + if (!cp) cp = eina_hash_find(pixmaps[type], &id); + return cp; ++>>>>>>> upstream #endif break; default: break; @@@ -253,46 -186,12 +297,53 @@@ e_pixmap_free(E_Pixmap *cp { if (!cp) return 0; if (--cp->refcount) return cp->refcount; + ELOG("PIXMAP DEL", cp, cp->client); + _e_pixmap_hook_call(E_PIXMAP_HOOK_DEL, cp); e_pixmap_image_clear(cp, EINA_FALSE); ++<<<<<<< HEAD + if (cp->parent) eina_hash_set(pixmaps[cp->type], &cp->parent, NULL); + eina_hash_del_by_key(res_ids, &cp->res_id); ++======= ++>>>>>>> upstream eina_hash_del_by_key(pixmaps[cp->type], &cp->win); + + if (e_pixmap_is_del(cp)) + eina_hash_del_by_key(deleted[cp->type], &cp->win); + else + _e_pixmap_free(cp); + return 0; } ++<<<<<<< HEAD +EAPI void +e_pixmap_del(E_Pixmap *cp) +{ +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if (!cp) return; + if (cp->type != E_PIXMAP_TYPE_WL) return; + if (eina_hash_find(pixmaps[cp->type], &cp->win)) + { + eina_hash_del_by_key(pixmaps[cp->type], &cp->win); + eina_hash_add(deleted[cp->type], &cp->win, cp); + } +#endif +} + +EAPI Eina_Bool +e_pixmap_is_del(E_Pixmap *cp) +{ +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if (!cp) return 0; + if (cp->type != E_PIXMAP_TYPE_WL) return 0; + return !!eina_hash_find(deleted[cp->type], &cp->win); +#endif +} + +EAPI E_Pixmap * ++======= + E_API E_Pixmap * ++>>>>>>> upstream e_pixmap_ref(E_Pixmap *cp) { EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL); @@@ -308,7 -207,7 +359,11 @@@ e_pixmap_new(E_Pixmap_Type type, ... #ifndef HAVE_WAYLAND_ONLY Ecore_X_Window xwin; #endif ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) ++======= + #ifdef HAVE_WAYLAND ++>>>>>>> upstream uintptr_t id; #endif @@@ -336,7 -235,7 +391,11 @@@ #endif break; case E_PIXMAP_TYPE_WL: ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) ++======= + #ifdef HAVE_WAYLAND ++>>>>>>> upstream id = va_arg(l, uintptr_t); if (pixmaps[type]) { @@@ -348,24 -247,16 +407,33 @@@ } } else ++<<<<<<< HEAD + { + pixmaps[type] = eina_hash_pointer_new(NULL); + deleted[type] = eina_hash_pointer_new((Eina_Free_Cb)_e_pixmap_free); + } + cp = _e_pixmap_new(type); + cp->win = id; + eina_hash_add(pixmaps[type], &id, cp); + if (!res_ids) + res_ids = eina_hash_int32_new(NULL); + cp->res_id = res_id; + eina_hash_add(res_ids, &res_id, cp); + res_id++; + ELOG("PIXMAP NEW", cp, cp->client); ++======= + pixmaps[type] = eina_hash_pointer_new((Eina_Free_Cb)_e_pixmap_free); + cp = _e_pixmap_new(type); + cp->win = id; + eina_hash_add(pixmaps[type], &id, cp); + uuid_generate(cp->uuid); ++>>>>>>> upstream #endif break; + default: break; } va_end(l); + _e_pixmap_hook_call(E_PIXMAP_HOOK_NEW, cp); return cp; } @@@ -382,30 -273,13 +450,27 @@@ e_pixmap_parent_window_set(E_Pixmap *cp EINA_SAFETY_ON_NULL_RETURN(cp); if (cp->parent == win) return; - e_pixmap_usable_set(cp, 0); - e_pixmap_clear(cp); + switch (cp->type) + { + case E_PIXMAP_TYPE_X: +#ifndef HAVE_WAYLAND_ONLY + e_pixmap_usable_set(cp, 0); + if (win) e_pixmap_clear(cp); + else ecore_x_e_comp_pixmap_set(cp->parent, 0); +#endif + break; + case E_PIXMAP_TYPE_WL: +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + e_pixmap_usable_set(cp, 0); + e_pixmap_clear(cp); +#endif + break; + } - if (cp->parent) - eina_hash_set(pixmaps[cp->type], &cp->parent, NULL); cp->parent = win; - if (win) eina_hash_add(pixmaps[cp->type], &win, cp); } - EAPI void + E_API void e_pixmap_visual_cmap_set(E_Pixmap *cp, void *visual, unsigned int cmap) { EINA_SAFETY_ON_NULL_RETURN(cp); @@@ -604,25 -519,7 +710,29 @@@ e_pixmap_find_client(E_Pixmap_Type type return (!cp) ? NULL : cp->client; } ++<<<<<<< HEAD +EAPI E_Client * +e_pixmap_find_client_by_res_id(uint32_t res_id) +{ + E_Pixmap *cp; + + if (!res_ids) return NULL; + cp = eina_hash_find(res_ids, &res_id); + + return (!cp) ? NULL : cp->client; +} + +EAPI uint32_t +e_pixmap_res_id_get(E_Pixmap *cp) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0); + return cp->res_id; +} + +EAPI Ecore_Window ++======= + E_API uint64_t ++>>>>>>> upstream e_pixmap_window_get(E_Pixmap *cp) { EINA_SAFETY_ON_NULL_RETURN_VAL(cp, 0); @@@ -648,112 -545,8 +758,117 @@@ E_API voi e_pixmap_resource_set(E_Pixmap *cp, void *resource) { if ((!cp) || (cp->type != E_PIXMAP_TYPE_WL)) return; ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + { + E_Comp_Wl_Buffer *buffer; + struct wl_shm_buffer *shm_buffer; + + buffer = (E_Comp_Wl_Buffer *)resource; + e_comp_wl_buffer_reference(&cp->buffer_ref, buffer); + + if (cp->buffer_destroy_listener.notify) + { + wl_list_remove(&cp->buffer_destroy_listener.link); + cp->buffer_destroy_listener.notify = NULL; + } + + cp->w = cp->h = 0; + cp->image_argb = EINA_FALSE; + + if (!buffer) return; + + if (buffer->type == E_COMP_WL_BUFFER_TYPE_SHM) + { + shm_buffer = wl_shm_buffer_get(buffer->resource); + if (!shm_buffer) + { + ERR("No shm_buffer resource:%u", wl_resource_get_id(buffer->resource)); + e_comp_wl_buffer_reference(&cp->buffer_ref, NULL); + return; + } + + buffer->shm_buffer = shm_buffer; + cp->w = buffer->w; + cp->h = buffer->h; + + switch (wl_shm_buffer_get_format(shm_buffer)) + { + case WL_SHM_FORMAT_ARGB8888: + cp->image_argb = EINA_TRUE; + break; + default: + cp->image_argb = EINA_FALSE; + break; + } + + cp->data = wl_shm_buffer_get_data(shm_buffer); + } + else if (buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) + { + if (e_comp->gl) + { + buffer->shm_buffer = NULL; + cp->w = buffer->w; + cp->h = buffer->h; + cp->image_argb = EINA_FALSE; /* TODO: format */ + cp->data = NULL; + + /* TODO: Current buffer management process doesn't ensure + * to render all committed buffer, it means there are buffers + * never rendered. New attached buffer resources should be + * managed and be pending if previous buffer is not rendered yet. */ + /* set size of image object to new buffer size */ + e_comp_object_size_update(cp->client->frame, + buffer->w, buffer->h); + } + else + { + ERR("Invalid native buffer resource:%u", wl_resource_get_id(buffer->resource)); + e_comp_wl_buffer_reference(&cp->buffer_ref, NULL); + return; + } + + } + else if (buffer->type == E_COMP_WL_BUFFER_TYPE_VIDEO) + { + E_Comp_Wl_Data *wl_comp_data = (E_Comp_Wl_Data *)e_comp->wl_comp_data; + tbm_surface_h tbm_surf = wayland_tbm_server_get_surface(wl_comp_data->tbm.server, buffer->resource); + + buffer->shm_buffer = NULL; + cp->w = buffer->w; + cp->h = buffer->h; + switch (tbm_surface_get_format(tbm_surf)) + { + case TBM_FORMAT_ARGB8888: + cp->image_argb = EINA_TRUE; + break; + default: + cp->image_argb = EINA_FALSE; + break; + } + cp->data = NULL; + + if (wl_comp_data->available_hw_accel.underlay) + { + cp->client->argb = EINA_FALSE; + e_comp_object_mask_set(cp->client->frame, EINA_TRUE); + } + } + else + { + ERR("Invalid resource:%u", wl_resource_get_id(buffer->resource)); + e_comp_wl_buffer_reference(&cp->buffer_ref, NULL); + return; + } + + cp->buffer_destroy_listener.notify = _e_pixmap_cb_buffer_destroy; + wl_signal_add(&buffer->destroy_signal, &cp->buffer_destroy_listener); + } ++======= + #ifdef HAVE_WAYLAND + cp->buffer = resource; ++>>>>>>> upstream #else (void)resource; #endif @@@ -786,16 -579,11 +901,24 @@@ e_pixmap_native_surface_init(E_Pixmap * #endif break; case E_PIXMAP_TYPE_WL: ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if (cp->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) + { + ns->type = EVAS_NATIVE_SURFACE_WL; + ns->version = EVAS_NATIVE_SURFACE_VERSION; + ns->data.wl.legacy_buffer = cp->buffer_ref.buffer->resource; + ret = EINA_TRUE; + } + else + ret = EINA_FALSE; ++======= + #ifdef HAVE_WAYLAND + ns->type = EVAS_NATIVE_SURFACE_WL; + ns->version = EVAS_NATIVE_SURFACE_VERSION; + ns->data.wl.legacy_buffer = cp->buffer->resource; + ret = !cp->buffer->shm_buffer; ++>>>>>>> upstream #endif break; default: @@@ -849,9 -638,9 +974,9 @@@ e_pixmap_image_clear(E_Pixmap *cp, Eina if ((!cp->client) || (!cp->client->comp_data)) return; cd = (E_Comp_Wl_Client_Data *)cp->client->comp_data; - EINA_LIST_FREE(cd->frames, cb) + EINA_LIST_FOREACH_SAFE(cd->frames, l, ll, cb) { - wl_callback_send_done(cb, ecore_time_unix_get()); + wl_callback_send_done(cb, ecore_time_unix_get() * 1000); wl_resource_destroy(cb); } } @@@ -1042,54 -860,7 +1196,58 @@@ e_pixmap_image_draw(E_Pixmap *cp, cons return EINA_FALSE; } ++<<<<<<< HEAD +EAPI Eina_Bool +e_pixmap_validate_check(const E_Pixmap *cp) +{ + Eina_Bool success = EINA_FALSE; + EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE); + + switch (cp->type) + { + case E_PIXMAP_TYPE_X: +#ifndef HAVE_WAYLAND_ONLY + { + int pw, ph; + if (!cp->pixmap) break; + ecore_x_pixmap_geometry_get(cp->pixmap, NULL, NULL, &pw, &ph); + success = (pw > 0) && (ph > 0); + } +#endif + break; + case E_PIXMAP_TYPE_WL: +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) +#if 0 //TODO_GL77 + _e_pixmap_update_wl(cp); +#endif + success = (cp->w > 0) && (cp->h > 0); +#endif + break; + default: + break; + } + return success; +} + +EAPI void +e_pixmap_image_draw_done(E_Pixmap *cp) +{ + EINA_SAFETY_ON_NULL_RETURN(cp); + +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + struct wl_shm_buffer *shm_buffer; + + shm_buffer = wl_shm_buffer_get(cp->buffer_ref.buffer->resource); + if (!shm_buffer) return; + + wl_shm_buffer_end_access(shm_buffer); +#endif +} + +EAPI void ++======= + E_API void ++>>>>>>> upstream e_pixmap_image_opaque_set(E_Pixmap *cp, int x, int y, int w, int h) { EINA_SAFETY_ON_NULL_RETURN(cp); @@@ -1120,73 -891,37 +1278,109 @@@ e_pixmap_image_opaque_get(E_Pixmap *cp #endif } ++<<<<<<< HEAD +EAPI E_Comp_Client_Data * +e_pixmap_cdata_get(E_Pixmap *cp) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(cp, NULL); + +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + return (E_Comp_Client_Data*)cp->cdata; +#else + return NULL; +#endif +} + +EAPI void +e_pixmap_cdata_set(E_Pixmap *cp, E_Comp_Client_Data *cdata) +{ +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + E_Comp_Wl_Client_Data *cd = (E_Comp_Wl_Client_Data*)cdata; + + EINA_SAFETY_ON_NULL_RETURN(cp); + + if (cp->cdata) + { + if (cp->own_cdata) + { + if (cd) + { + cd->wl_surface = cp->cdata->wl_surface; + cd->scaler.viewport = cp->cdata->scaler.viewport; + cd->pending.buffer_viewport = cp->cdata->pending.buffer_viewport; + cd->opaque_state = cp->cdata->opaque_state; + } + + E_FREE(cp->cdata); + cp->own_cdata = EINA_FALSE; + } + } + + cp->cdata = cd; +#endif +} + +EAPI E_Pixmap_Hook * +e_pixmap_hook_add(E_Pixmap_Hook_Point hookpoint, E_Pixmap_Hook_Cb func, const void *data) +{ + E_Pixmap_Hook *ph; + + EINA_SAFETY_ON_TRUE_RETURN_VAL(hookpoint >= E_PIXMAP_HOOK_LAST, NULL); + ph = E_NEW(E_Pixmap_Hook, 1); + EINA_SAFETY_ON_NULL_RETURN_VAL(ph, NULL); + ph->hookpoint = hookpoint; + ph->func = func; + ph->data = (void*)data; + _e_pixmap_hooks[hookpoint] = eina_inlist_append(_e_pixmap_hooks[hookpoint], + EINA_INLIST_GET(ph)); + return ph; +} + +EAPI void +e_pixmap_hook_del(E_Pixmap_Hook *ph) +{ + ph->delete_me = 1; + if (_e_pixmap_hooks_walking == 0) + { + _e_pixmap_hooks[ph->hookpoint] = eina_inlist_remove(_e_pixmap_hooks[ph->hookpoint], + EINA_INLIST_GET(ph)); + free(ph); + } + else + _e_pixmap_hooks_delete++; ++======= + E_API void + e_pixmap_alias(E_Pixmap *cp, E_Pixmap_Type type, ...) + { + va_list l; + #ifndef HAVE_WAYLAND_ONLY + Ecore_X_Window xwin; + #endif + #ifdef HAVE_WAYLAND + uintptr_t id; + #endif + + va_start(l, type); + switch (type) + { + case E_PIXMAP_TYPE_X: + #ifndef HAVE_WAYLAND_ONLY + xwin = va_arg(l, uint32_t); + if (!aliases[type]) + aliases[type] = eina_hash_int32_new(NULL); + eina_hash_set(aliases[type], &xwin, cp); + #endif + break; + case E_PIXMAP_TYPE_WL: + #ifdef HAVE_WAYLAND + id = va_arg(l, uintptr_t); + if (!aliases[type]) + aliases[type] = eina_hash_pointer_new(NULL); + eina_hash_set(aliases[type], &id, cp); + #endif + break; + default: break; + } + va_end(l); ++>>>>>>> upstream } diff --cc src/bin/e_pixmap.h index 0894d75,73bf6f8..1589d92 --- a/src/bin/e_pixmap.h +++ b/src/bin/e_pixmap.h @@@ -12,70 -13,44 +13,111 @@@ typedef enu # ifndef E_PIXMAP_H # define E_PIXMAP_H ++<<<<<<< HEAD +typedef struct _E_Pixmap_Hook E_Pixmap_Hook; + +typedef enum _E_Pixmap_Hook_Point +{ + E_PIXMAP_HOOK_NEW, + E_PIXMAP_HOOK_DEL, + E_PIXMAP_HOOK_LAST +} E_Pixmap_Hook_Point; + +typedef void (*E_Pixmap_Hook_Cb)(void *data, E_Pixmap *cp); + +struct _E_Pixmap_Hook +{ + EINA_INLIST; + E_Pixmap_Hook_Point hookpoint; + E_Pixmap_Hook_Cb func; + void *data; + unsigned char delete_me : 1; +}; + +EAPI int e_pixmap_free(E_Pixmap *cp); +EAPI void e_pixmap_del(E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_is_del(E_Pixmap *cp); +EAPI E_Pixmap *e_pixmap_ref(E_Pixmap *cp); +EAPI E_Pixmap *e_pixmap_new(E_Pixmap_Type type, ...); +EAPI E_Pixmap_Type e_pixmap_type_get(const E_Pixmap *cp); +EAPI void *e_pixmap_resource_get(E_Pixmap *cp); +EAPI E_Comp_Client_Data *e_pixmap_cdata_get(E_Pixmap *cp); +EAPI void e_pixmap_cdata_set(E_Pixmap *cp, E_Comp_Client_Data *cdata); +EAPI void e_pixmap_resource_set(E_Pixmap *cp, void *resource); +EAPI void e_pixmap_parent_window_set(E_Pixmap *cp, Ecore_Window win); +EAPI void e_pixmap_visual_cmap_set(E_Pixmap *cp, void *visual, unsigned int cmap); +EAPI unsigned int e_pixmap_failures_get(const E_Pixmap *cp); +EAPI void *e_pixmap_visual_get(const E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_dirty_get(E_Pixmap *cp); +EAPI void e_pixmap_clear(E_Pixmap *cp); +EAPI void e_pixmap_usable_set(E_Pixmap *cp, Eina_Bool set); +EAPI Eina_Bool e_pixmap_usable_get(const E_Pixmap *cp); +EAPI void e_pixmap_dirty(E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_refresh(E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_size_changed(E_Pixmap *cp, int w, int h); +EAPI Eina_Bool e_pixmap_size_get(E_Pixmap *cp, int *w, int *h); +EAPI void e_pixmap_client_set(E_Pixmap *cp, E_Client *ec); +EAPI E_Client *e_pixmap_client_get(E_Pixmap *cp); +EAPI E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...); +EAPI E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...); +EAPI E_Client *e_pixmap_find_client_by_res_id(uint32_t res_id); +EAPI uint32_t e_pixmap_res_id_get(E_Pixmap *cp); +EAPI Ecore_Window e_pixmap_window_get(E_Pixmap *cp); +EAPI Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns); +EAPI void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache); +EAPI Eina_Bool e_pixmap_image_refresh(E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_image_exists(const E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_image_is_argb(const E_Pixmap *cp); +EAPI void *e_pixmap_image_data_get(E_Pixmap *cp); +EAPI Eina_Bool e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Rectangle *r, int stride); +EAPI Eina_Bool e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r); +EAPI Eina_Bool e_pixmap_validate_check(const E_Pixmap *cp); + +EAPI void e_pixmap_image_opaque_set(E_Pixmap *cp, int x, int y, int w, int h); +EAPI void e_pixmap_image_opaque_get(E_Pixmap *cp, int *x, int *y, int *w, int *h); +EAPI E_Pixmap_Hook *e_pixmap_hook_add(E_Pixmap_Hook_Point hookpoint, E_Pixmap_Hook_Cb func, const void *data); +EAPI void e_pixmap_hook_del(E_Pixmap_Hook *ph); ++======= + E_API int e_pixmap_free(E_Pixmap *cp); + E_API E_Pixmap *e_pixmap_ref(E_Pixmap *cp); + E_API E_Pixmap *e_pixmap_new(E_Pixmap_Type type, ...); + E_API E_Pixmap_Type e_pixmap_type_get(const E_Pixmap *cp); + E_API void *e_pixmap_resource_get(E_Pixmap *cp); + E_API void e_pixmap_resource_set(E_Pixmap *cp, void *resource); + E_API void e_pixmap_parent_window_set(E_Pixmap *cp, Ecore_Window win); + E_API void e_pixmap_visual_cmap_set(E_Pixmap *cp, void *visual, unsigned int cmap); + E_API unsigned int e_pixmap_failures_get(const E_Pixmap *cp); + E_API void *e_pixmap_visual_get(const E_Pixmap *cp); + E_API uint32_t e_pixmap_pixmap_get(const E_Pixmap *cp); + E_API Eina_Bool e_pixmap_dirty_get(E_Pixmap *cp); + E_API void e_pixmap_clear(E_Pixmap *cp); + E_API void e_pixmap_usable_set(E_Pixmap *cp, Eina_Bool set); + E_API Eina_Bool e_pixmap_usable_get(const E_Pixmap *cp); + E_API void e_pixmap_dirty(E_Pixmap *cp); + E_API Eina_Bool e_pixmap_refresh(E_Pixmap *cp); + E_API Eina_Bool e_pixmap_size_changed(E_Pixmap *cp, int w, int h); + E_API Eina_Bool e_pixmap_size_get(E_Pixmap *cp, int *w, int *h); + E_API void e_pixmap_client_set(E_Pixmap *cp, E_Client *ec); + E_API E_Client *e_pixmap_client_get(E_Pixmap *cp); + E_API E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...); + E_API E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...); + E_API uint64_t e_pixmap_window_get(E_Pixmap *cp); + E_API Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp); + E_API Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns); + E_API void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache); + E_API Eina_Bool e_pixmap_image_refresh(E_Pixmap *cp); + E_API Eina_Bool e_pixmap_image_exists(const E_Pixmap *cp); + E_API Eina_Bool e_pixmap_image_is_argb(const E_Pixmap *cp); + E_API void *e_pixmap_image_data_get(E_Pixmap *cp); + E_API Eina_Bool e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Rectangle *r, int stride); + E_API Eina_Bool e_pixmap_image_draw(E_Pixmap *cp, const Eina_Rectangle *r); + + E_API void e_pixmap_image_opaque_set(E_Pixmap *cp, int x, int y, int w, int h); + E_API void e_pixmap_image_opaque_get(E_Pixmap *cp, int *x, int *y, int *w, int *h); + + E_API void e_pixmap_alias(E_Pixmap *cp, E_Pixmap_Type type, ...); ++>>>>>>> upstream static inline Eina_Bool e_pixmap_is_x(const E_Pixmap *cp) diff --cc src/bin/e_pointer.c index 25afa09,134950e..397e888 --- a/src/bin/e_pointer.c +++ b/src/bin/e_pointer.c @@@ -10,8 -10,16 +10,17 @@@ struct _E_Pointer_Stac /* local variables */ static Eina_List *_hdlrs = NULL; static Eina_List *_ptrs = NULL; +static Eina_Bool _initted = EINA_FALSE; + static inline void + _e_pointer_theme_buf(E_Pointer *ptr, char cursor[1024]) + { + if (ptr->color) + snprintf(cursor, 1024, "e/pointer/enlightenment/%s/color", ptr->type); + else + snprintf(cursor, 1024, "e/pointer/enlightenment/%s/mono", ptr->type); + } + static inline void _e_pointer_hot_update(E_Pointer *ptr, int x, int y) { @@@ -558,24 -568,23 +573,29 @@@ e_pointers_size_set(int size ptr->h = size; evas_object_resize(ptr->o_ptr, size, size); } - + } #ifndef HAVE_WAYLAND_ONLY - ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4); + if (e_comp_util_has_x()) + ecore_x_cursor_size_set(e_config->cursor_size * 3 / 4); #endif - } } - EAPI void + E_API void e_pointer_hide(E_Pointer *ptr) { ++<<<<<<< HEAD + EINA_SAFETY_ON_NULL_RETURN(ptr); + + if ((ptr->evas) && (!ptr->canvas)) ++======= + if (ptr->buffer_evas) ++>>>>>>> upstream _e_pointer_canvas_del(ptr); - else if (ptr->canvas) + if (ptr->canvas) evas_object_hide(ptr->o_ptr); #ifndef HAVE_WAYLAND_ONLY - ecore_x_window_cursor_set(ptr->win, 0); + if (ptr->win) + ecore_x_window_cursor_set(ptr->win, 0); #endif } @@@ -627,18 -636,9 +647,18 @@@ e_pointer_type_pop(E_Pointer *ptr, voi eina_stringshare_refplace(&ptr->type, stack->type); } - EAPI void + E_API void e_pointer_mode_push(void *obj, E_Pointer_Mode mode) { + E_Client *ec; + Evas_Object *o; + + EINA_SAFETY_ON_NULL_RETURN(e_comp->pointer); + + ecore_evas_cursor_get(e_comp->pointer->ee, &o, NULL, NULL, NULL); + if ((o != e_comp->pointer->o_ptr) && (ec = e_comp_object_client_get(o))) + return; + switch (mode) { case E_POINTER_RESIZE_TL: @@@ -783,7 -774,7 +803,11 @@@ e_pointer_object_set(E_Pointer *ptr, Ev { if (o == obj) { ++<<<<<<< HEAD + ecore_evas_object_cursor_set(ptr->ee, obj, EVAS_LAYER_MAX, x, y); ++======= + ecore_evas_object_cursor_set(ptr->ee, obj, E_LAYER_MAX - 1, x, y); ++>>>>>>> upstream return; } ec = e_comp_object_client_get(o); @@@ -797,10 -788,18 +821,25 @@@ ec = e_comp_object_client_get(obj); if (ec) ec->hidden = 1; - ecore_evas_object_cursor_set(ptr->ee, obj, EVAS_LAYER_MAX, x, y); + ecore_evas_object_cursor_set(ptr->ee, obj, E_LAYER_MAX - 1, x, y); } ++<<<<<<< HEAD + else if (ptr->o_ptr) + { + ecore_evas_object_cursor_set(ptr->ee, ptr->o_ptr, EVAS_LAYER_MAX, ptr->hot.x, ptr->hot.y); + } ++======= + else + ecore_evas_object_cursor_set(ptr->ee, ptr->o_ptr, E_LAYER_MAX - 1, ptr->hot.x, ptr->hot.y); + } + + E_API void + e_pointer_window_add(E_Pointer *ptr, Ecore_Window win) + { + char buf[1024]; + + ptr->win = win; + _e_pointer_theme_buf(ptr, buf); + _e_pointer_x11_setup(ptr, buf); ++>>>>>>> upstream } diff --cc src/bin/e_scale.c index ba13a9e,9c13dec..761f144 --- a/src/bin/e_scale.c +++ b/src/bin/e_scale.c @@@ -1,8 -1,6 +1,12 @@@ #include "e.h" ++<<<<<<< HEAD +EAPI double e_scale = 1.0; +static Eina_Bool _initted = EINA_FALSE; +static int _dpi = -1; ++======= + E_API double e_scale = 1.0; ++>>>>>>> upstream EINTERN int e_scale_init(void) diff --cc src/bin/e_scale.h index f10baa7,8a2591c..3682d07 --- a/src/bin/e_scale.h +++ b/src/bin/e_scale.h @@@ -5,10 -5,9 +5,14 @@@ EINTERN int e_scale_init(void); EINTERN int e_scale_shutdown(void); ++<<<<<<< HEAD +EAPI void e_scale_update(void); +EAPI void e_scale_manual_update(int dpi); ++======= + E_API void e_scale_update(void); ++>>>>>>> upstream - extern EAPI double e_scale; + extern E_API double e_scale; #endif #endif diff --cc src/bin/e_signals.c index 7d2b8e2,9f1668d..4ace7f7 --- a/src/bin/e_signals.c +++ b/src/bin/e_signals.c @@@ -5,8 -5,10 +5,15 @@@ */ #include "e.h" ++<<<<<<< HEAD +#ifdef HAVE_WAYLAND_ONLY +#include ++======= + #ifdef HAVE_WAYLAND + # ifdef HAVE_WL_DRM + #include + # endif ++>>>>>>> upstream #endif #ifdef HAVE_EXECINFO_H @@@ -63,28 -65,33 +70,52 @@@ _e_write_safe_int(int fd, const char *b #endif - /* a tricky little devil, requires e and it's libs to be built - * with the -rdynamic flag to GCC for any sort of decent output. - */ - EAPI void - e_sigseg_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) + static void + _e_crash(void) { ++<<<<<<< HEAD +#ifdef HAVE_WAYLAND_ONLY + Eina_List *list, *l, *ll; + Ecore_Drm_Device *dev; + + list = ecore_drm_devices_get(); + EINA_LIST_FOREACH_SAFE(list, l, ll, dev) + { + ecore_drm_inputs_destroy(dev); + ecore_drm_sprites_destroy(dev); + ecore_drm_device_close(dev); + ecore_drm_launcher_disconnect(dev); + ecore_drm_device_free(dev); + } + + ecore_drm_shutdown(); +#else ++======= + #ifdef HAVE_WAYLAND + if (e_comp->comp_type == E_PIXMAP_TYPE_WL) + { + #ifdef HAVE_WL_DRM + const Eina_List *list, *l, *ll; + Ecore_Drm_Device *dev; + + if (!strstr(ecore_evas_engine_name_get(e_comp->ee), "drm")) return; + list = ecore_drm_devices_get(); + EINA_LIST_FOREACH_SAFE(list, l, ll, dev) + { + ecore_drm_inputs_destroy(dev); + ecore_drm_sprites_destroy(dev); + ecore_drm_device_close(dev); + ecore_drm_launcher_disconnect(dev); + ecore_drm_device_free(dev); + } + + ecore_drm_shutdown(); + #endif + return; + } + #endif + #ifndef HAVE_WAYLAND_ONLY ++>>>>>>> upstream _e_x_composite_shutdown(); ecore_x_pointer_ungrab(); ecore_x_keyboard_ungrab(); @@@ -112,86 -128,20 +152,98 @@@ e_sigill_act(int x EINA_UNUSED, siginfo /* e_alert_show(); */ } - EAPI void - e_sigfpe_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) + E_API void + e_sigfpe_act(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED) { ++<<<<<<< HEAD +#ifdef HAVE_WAYLAND_ONLY + Eina_List *list, *l, *ll; + Ecore_Drm_Device *dev; + + list = ecore_drm_devices_get(); + EINA_LIST_FOREACH_SAFE(list, l, ll, dev) + { + ecore_drm_inputs_destroy(dev); + ecore_drm_sprites_destroy(dev); + ecore_drm_device_close(dev); + ecore_drm_launcher_disconnect(dev); + ecore_drm_device_free(dev); + } + + ecore_drm_shutdown(); +#else + _e_x_composite_shutdown(); + ecore_x_pointer_ungrab(); + ecore_x_keyboard_ungrab(); + ecore_x_ungrab(); + ecore_x_sync(); + e_alert_show(); +#endif ++======= + _e_crash(); ++>>>>>>> upstream } - EAPI void - e_sigbus_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) + E_API void + e_sigbus_act(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED) { ++<<<<<<< HEAD +#ifdef HAVE_WAYLAND_ONLY + Eina_List *list, *l, *ll; + Ecore_Drm_Device *dev; + + list = ecore_drm_devices_get(); + EINA_LIST_FOREACH_SAFE(list, l, ll, dev) + { + ecore_drm_inputs_destroy(dev); + ecore_drm_sprites_destroy(dev); + ecore_drm_device_close(dev); + ecore_drm_launcher_disconnect(dev); + ecore_drm_device_free(dev); + } + + ecore_drm_shutdown(); +#else + _e_x_composite_shutdown(); + ecore_x_pointer_ungrab(); + ecore_x_keyboard_ungrab(); + ecore_x_ungrab(); + ecore_x_sync(); + e_alert_show(); +#endif ++======= + _e_crash(); ++>>>>>>> upstream } - EAPI void - e_sigabrt_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) + E_API void + e_sigabrt_act(int x EINA_UNUSED, siginfo_t *info EINA_UNUSED, void *data EINA_UNUSED) { ++<<<<<<< HEAD +#ifdef HAVE_WAYLAND_ONLY + Eina_List *list, *l, *ll; + Ecore_Drm_Device *dev; + + list = ecore_drm_devices_get(); + EINA_LIST_FOREACH_SAFE(list, l, ll, dev) + { + ecore_drm_inputs_destroy(dev); + ecore_drm_sprites_destroy(dev); + ecore_drm_device_close(dev); + ecore_drm_launcher_disconnect(dev); + ecore_drm_device_free(dev); + } + + ecore_drm_shutdown(); +#else + _e_x_composite_shutdown(); + ecore_x_pointer_ungrab(); + ecore_x_keyboard_ungrab(); + ecore_x_ungrab(); + ecore_x_sync(); + e_alert_show(); +#endif ++======= + _e_crash(); ++>>>>>>> upstream } diff --cc src/bin/e_startup.c index 8931f9b,7a87957..95c25d5 --- a/src/bin/e_startup.c +++ b/src/bin/e_startup.c @@@ -74,27 -74,25 +74,27 @@@ _e_startup_next_cb(void *data EINA_UNUS _e_startup(); } -static void -_e_startup_error_dialog(const char *msg) -{ - E_Dialog *dia; - - dia = e_dialog_new(NULL, "E", "_startup_error_dialog"); - EINA_SAFETY_ON_NULL_RETURN(dia); - - e_dialog_title_set(dia, "ERROR!"); - e_dialog_icon_set(dia, "enlightenment", 64); - e_dialog_text_set(dia, msg); - e_dialog_button_add(dia, _("Close"), NULL, NULL, NULL); - elm_win_center(dia->win, 1, 1); - e_win_no_remember_set(dia->win, 1); - e_dialog_show(dia); -} +/* + *static void + *_e_startup_error_dialog(const char *msg) + *{ + * E_Dialog *dia; + * + * dia = e_dialog_new(NULL, "E", "_startup_error_dialog"); + * EINA_SAFETY_ON_NULL_RETURN(dia); + * + * e_dialog_title_set(dia, "ERROR!"); + * e_dialog_icon_set(dia, "enlightenment", 64); + * e_dialog_text_set(dia, msg); + * e_dialog_button_add(dia, _("Close"), NULL, NULL, NULL); + * elm_win_center(dia->win, 1, 1); + * e_win_no_remember_set(dia->win, 1); + * e_dialog_show(dia); + *} + */ static Eina_Bool - _e_startup_event_cb(void *data, int ev_type __UNUSED__, void *ev) + _e_startup_event_cb(void *data, int ev_type EINA_UNUSED, void *ev) { char *buf; Efreet_Event_Cache_Update *e; diff --cc src/bin/e_win.c index 37bee45,266d43f..1ab9b8a --- a/src/bin/e_win.c +++ b/src/bin/e_win.c @@@ -67,13 -70,13 +70,22 @@@ _e_elm_win_trap_show(void *data, Evas_O { E_Client *ec; Ecore_Window win; ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + uintptr_t wl_win_id = NULL; ++======= + #ifdef HAVE_WAYLAND + uintptr_t wl_win_id; ++>>>>>>> upstream #endif E_Pixmap_Type type = E_PIXMAP_TYPE_X; win = elm_win_window_id_get(o); ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) ++======= + #ifdef HAVE_WAYLAND ++>>>>>>> upstream if (!strncmp(ecore_evas_engine_name_get(ee), "wayland", 7)) { type = E_PIXMAP_TYPE_WL; @@@ -90,12 -91,12 +100,20 @@@ type = E_PIXMAP_TYPE_X; ctx->pointer = e_pointer_window_new(win, EINA_TRUE); } + + #ifdef HAVE_WAYLAND + if (type == E_PIXMAP_TYPE_WL) + ec = e_pixmap_find_client(type, wl_win_id); + else #endif ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if ((type == E_PIXMAP_TYPE_WL) && (wl_win_id)) + ec = e_pixmap_find_client(type, wl_win_id); + else +#endif ++======= ++>>>>>>> upstream ec = e_pixmap_find_client(type, win); if (ec) ctx->client = ec; @@@ -112,19 -113,10 +130,26 @@@ if ((!title) || (!title[0])) title = "E"; ecore_evas_title_set(ee, title); ++<<<<<<< HEAD +#if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) + if (type == E_PIXMAP_TYPE_WL) + { + if ((cp = e_pixmap_find(type, wl_win_id))) + { + ERR("There is e_pixmap already, Delete old e_pixmap %p", cp); + e_pixmap_del(cp); + cp = NULL; + } + /* first creation of pixmap for internal window */ + if (!cp) + cp = e_pixmap_new(type, wl_win_id); + } ++======= + + #ifdef HAVE_WAYLAND + if (type == E_PIXMAP_TYPE_WL) + cp = e_pixmap_new(type, wl_win_id); ++>>>>>>> upstream else #endif cp = e_pixmap_new(type, win); diff --cc src/bin/e_zone.c index 3a8ed10,00600e6..5286054 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@@ -19,22 -19,16 +19,35 @@@ static void _e_zone_object_del_a static E_Zone_Edge _e_zone_detect_edge(E_Zone *zone, Evas_Object *obj); static void _e_zone_edge_move_resize(E_Zone *zone); ++<<<<<<< HEAD +EAPI int E_EVENT_ZONE_DESK_COUNT_SET = 0; +EAPI int E_EVENT_POINTER_WARP = 0; +EAPI int E_EVENT_ZONE_MOVE_RESIZE = 0; +EAPI int E_EVENT_ZONE_ADD = 0; +EAPI int E_EVENT_ZONE_DEL = 0; +EAPI int E_EVENT_ZONE_EDGE_IN = 0; +EAPI int E_EVENT_ZONE_EDGE_OUT = 0; +EAPI int E_EVENT_ZONE_EDGE_MOVE = 0; +EAPI int E_EVENT_ZONE_STOW = 0; +EAPI int E_EVENT_ZONE_UNSTOW = 0; +#ifdef _F_ZONE_WINDOW_ROTATION_ +EAPI int E_EVENT_ZONE_ROTATION_CHANGE_BEGIN = 0; +EAPI int E_EVENT_ZONE_ROTATION_CHANGE_CANCEL = 0; +EAPI int E_EVENT_ZONE_ROTATION_CHANGE_END = 0; +#endif +EAPI int E_EVENT_ZONE_DISPLAY_STATE_CHANGE = 0; ++======= + E_API int E_EVENT_ZONE_DESK_COUNT_SET = 0; + E_API int E_EVENT_POINTER_WARP = 0; + E_API int E_EVENT_ZONE_MOVE_RESIZE = 0; + E_API int E_EVENT_ZONE_ADD = 0; + E_API int E_EVENT_ZONE_DEL = 0; + E_API int E_EVENT_ZONE_EDGE_IN = 0; + E_API int E_EVENT_ZONE_EDGE_OUT = 0; + E_API int E_EVENT_ZONE_EDGE_MOVE = 0; + E_API int E_EVENT_ZONE_STOW = 0; + E_API int E_EVENT_ZONE_UNSTOW = 0; ++>>>>>>> upstream #define E_ZONE_FLIP_LEFT(zone) (((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || ((zone)->desk_x_current > 0)) && (zone)->edge.left) #define E_ZONE_FLIP_RIGHT(zone) (((e_config->desk_flip_wrap && ((zone)->desk_x_count > 1)) || (((zone)->desk_x_current + 1) < (zone)->desk_x_count)) && (zone)->edge.right) diff --cc src/bin/e_zone.h index c967463,2314fdb..43d5249 --- a/src/bin/e_zone.h +++ b/src/bin/e_zone.h @@@ -102,19 -89,7 +101,23 @@@ struct _E_Zon Eina_Bool dirty : 1; } useful_geometry; Eina_Bool stowed : 1; ++<<<<<<< HEAD +#ifdef _F_ZONE_WINDOW_ROTATION_ + struct + { + int prev, curr, next, sub; + int block_count; + + Eina_Bool wait_for_done : 1; + Eina_Bool pending : 1; + Eina_Bool unknown_state : 1; + } rot; +#endif + + E_Zone_Display_State display_state; ++======= + char *randr2_id; // same id we get from randr2 so look it up there ++>>>>>>> upstream }; struct _E_Event_Zone_Generic @@@ -144,82 -119,49 +147,126 @@@ struct _E_Event_Zone_Edg Eina_Bool drag : 1; }; +#ifdef _F_ZONE_WINDOW_ROTATION_ +struct _E_Event_Zone_Rotation_Change_Begin +{ + E_Zone *zone; +}; + +struct _E_Event_Zone_Rotation_Change_Cancel +{ + E_Zone *zone; +}; + +struct _E_Event_Zone_Rotation_Change_End +{ + E_Zone *zone; +}; +#endif + +struct _E_Event_Zone_Display_State_Change +{ + E_Zone *zone; +}; + EINTERN int e_zone_init(void); EINTERN int e_zone_shutdown(void); ++<<<<<<< HEAD +EAPI E_Zone *e_zone_new(E_Comp *con, int num, int id, int x, int y, int w, int h); +EAPI void e_zone_name_set(E_Zone *zone, const char *name); +EAPI void e_zone_move(E_Zone *zone, int x, int y); +EAPI void e_zone_resize(E_Zone *zone, int w, int h); +EAPI Eina_Bool e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h); +EAPI E_Zone *e_zone_current_get(E_Comp *c); +EAPI void e_zone_bg_reconfigure(E_Zone *zone); +EAPI void e_zone_flip_coords_handle(E_Zone *zone, int x, int y); +EAPI void e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count); +EAPI void e_zone_desk_count_get(E_Zone *zone, int *x_count, int *y_count); +EAPI void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy); +EAPI void e_zone_desk_flip_to(E_Zone *zone, int x, int y); +EAPI void e_zone_desk_linear_flip_by(E_Zone *zone, int dx); +EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x); +EAPI void e_zone_edge_flip_eval(E_Zone *zone); +EAPI void e_zone_edge_new(E_Zone_Edge edge); +EAPI void e_zone_edge_free(E_Zone_Edge edge); +EAPI void e_zone_edge_enable(void); +EAPI void e_zone_edge_disable(void); +EAPI void e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b); +EAPI Eina_Bool e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge); +EAPI void e_zone_edge_win_layer_set(E_Zone *zone, E_Layer layer); + +EAPI void e_zone_useful_geometry_dirty(E_Zone *zone); +EAPI void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h); +EAPI void e_zone_desk_useful_geometry_get(const E_Zone *zone, const E_Desk *desk, int *x, int *y, int *w, int *h); +EAPI void e_zone_stow(E_Zone *zone); +EAPI void e_zone_unstow(E_Zone *zone); + +EAPI void e_zone_fade_handle(E_Zone *zone, int out, double tim); + +EAPI void e_zone_display_state_set(E_Zone *zone, E_Zone_Display_State state); +EAPI E_Zone_Display_State e_zone_display_state_get(E_Zone *zone); + +extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET; +extern EAPI int E_EVENT_ZONE_MOVE_RESIZE; +extern EAPI int E_EVENT_ZONE_ADD; +extern EAPI int E_EVENT_ZONE_DEL; +extern EAPI int E_EVENT_POINTER_WARP; +extern EAPI int E_EVENT_ZONE_EDGE_IN; +extern EAPI int E_EVENT_ZONE_EDGE_OUT; +extern EAPI int E_EVENT_ZONE_EDGE_MOVE; +extern EAPI int E_EVENT_ZONE_STOW; +extern EAPI int E_EVENT_ZONE_UNSTOW; ++======= + E_API E_Zone *e_zone_new(int num, int id, int x, int y, int w, int h); + E_API void e_zone_name_set(E_Zone *zone, const char *name); + E_API void e_zone_move(E_Zone *zone, int x, int y); + E_API void e_zone_resize(E_Zone *zone, int w, int h); + E_API Eina_Bool e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h); + E_API E_Zone *e_zone_current_get(void); + E_API void e_zone_bg_reconfigure(E_Zone *zone); + E_API void e_zone_flip_coords_handle(E_Zone *zone, int x, int y); + E_API void e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count); + E_API void e_zone_desk_count_get(E_Zone *zone, int *x_count, int *y_count); + E_API void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy); + E_API void e_zone_desk_flip_to(E_Zone *zone, int x, int y); + E_API void e_zone_desk_linear_flip_by(E_Zone *zone, int dx); + E_API void e_zone_desk_linear_flip_to(E_Zone *zone, int x); + E_API void e_zone_edge_flip_eval(E_Zone *zone); + E_API void e_zone_edge_new(E_Zone_Edge edge); + E_API void e_zone_edge_free(E_Zone_Edge edge); + E_API void e_zone_edge_enable(void); + E_API void e_zone_edge_disable(void); + E_API void e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b); + E_API Eina_Bool e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge); + E_API void e_zone_edge_win_layer_set(E_Zone *zone, E_Layer layer); + + E_API void e_zone_useful_geometry_dirty(E_Zone *zone); + E_API void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h); + E_API void e_zone_desk_useful_geometry_get(const E_Zone *zone, const E_Desk *desk, int *x, int *y, int *w, int *h); + E_API void e_zone_stow(E_Zone *zone); + E_API void e_zone_unstow(E_Zone *zone); + + E_API void e_zone_fade_handle(E_Zone *zone, int out, double tim); + + extern E_API int E_EVENT_ZONE_DESK_COUNT_SET; + extern E_API int E_EVENT_ZONE_MOVE_RESIZE; + extern E_API int E_EVENT_ZONE_ADD; + extern E_API int E_EVENT_ZONE_DEL; + extern E_API int E_EVENT_POINTER_WARP; + extern E_API int E_EVENT_ZONE_EDGE_IN; + extern E_API int E_EVENT_ZONE_EDGE_OUT; + extern E_API int E_EVENT_ZONE_EDGE_MOVE; + extern E_API int E_EVENT_ZONE_STOW; + extern E_API int E_EVENT_ZONE_UNSTOW; ++>>>>>>> upstream + +#ifdef _F_ZONE_WINDOW_ROTATION_ +extern EAPI int E_EVENT_ZONE_ROTATION_CHANGE_BEGIN; +extern EAPI int E_EVENT_ZONE_ROTATION_CHANGE_CANCEL; +extern EAPI int E_EVENT_ZONE_ROTATION_CHANGE_END; +#endif + +extern EAPI int E_EVENT_ZONE_DISPLAY_STATE_CHANGE; #endif #endif diff --cc src/modules/Makefile.mk index ee0f57f,3ea3148..b93c934 --- a/src/modules/Makefile.mk +++ b/src/modules/Makefile.mk @@@ -127,10 -115,14 +115,22 @@@ include src/modules/Makefile_wl_desktop include src/modules/Makefile_wl_x11.mk - include src/modules/Makefile_wl_fb.mk + #include src/modules/Makefile_wl_fb.mk ++<<<<<<< HEAD +include src/modules/Makefile_wl_screenshot.mk + +include src/modules/Makefile_policy_mobile.mk + +include src/modules/Makefile_bufferqueue.mk ++======= + include src/modules/Makefile_xwayland.mk + + include src/modules/Makefile_wl_text_input.mk + + include src/modules/Makefile_wl_weekeyboard.mk + + include src/modules/Makefile_policy_mobile.mk + + include src/modules/Makefile_geolocation.mk ++>>>>>>> upstream diff --cc src/modules/Makefile_music_control.mk index 2797abe,bac89ab..f06e514 --- a/src/modules/Makefile_music_control.mk +++ b/src/modules/Makefile_music_control.mk @@@ -1,5 -1,7 +1,11 @@@ EXTRA_DIST += src/modules/music-control/module.desktop.in \ ++<<<<<<< HEAD +src/modules/music-control/e-module-music-control.edj ++======= + src/modules/music-control/e-module-music-control.edj \ + src/modules/music-control/introspect.xml + ++>>>>>>> upstream if USE_MODULE_MUSIC_CONTROL music_controldir = $(MDIR)/music-control music_control_DATA = src/modules/music-control/module.desktop \ diff --cc src/modules/Makefile_wl_desktop_shell.mk index cb86915,51f5c80..98aa9be --- a/src/modules/Makefile_wl_desktop_shell.mk +++ b/src/modules/Makefile_wl_desktop_shell.mk @@@ -1,6 -1,10 +1,14 @@@ EXTRA_DIST += src/modules/wl_desktop_shell/module.desktop.in \ src/modules/wl_desktop_shell/e-module-wl_desktop_shell.edj \ ++<<<<<<< HEAD +src/modules/wl_desktop_shell/module.desktop.in ++======= + src/modules/wl_desktop_shell/module.desktop.in \ + src/modules/wl_desktop_shell/e_input_method_protocol.h \ + src/modules/wl_desktop_shell/e_input_method_protocol.c \ + src/modules/wl_desktop_shell/e_desktop_shell_protocol.h \ + src/modules/wl_desktop_shell/e_desktop_shell_protocol.c ++>>>>>>> upstream if USE_MODULE_WL_DESKTOP_SHELL wl_desktop_shelldir = $(MDIR)/wl_desktop_shell wl_desktop_shell_DATA = src/modules/wl_desktop_shell/e-module-wl_desktop_shell.edj \ @@@ -16,8 -20,12 +24,17 @@@ src_modules_wl_desktop_shell_module_la_ src_modules_wl_desktop_shell_module_la_SOURCES = \ src/modules/wl_desktop_shell/e_mod_main.c \ ++<<<<<<< HEAD + src/modules/wl_desktop_shell/e_scaler.c \ + src/modules/wl_desktop_shell/e_scaler.h ++======= + src/modules/wl_desktop_shell/e_mod_main.h \ + src/modules/wl_desktop_shell/e_mod_input_panel.c \ + src/modules/wl_desktop_shell/e_input_method_protocol.c \ + src/modules/wl_desktop_shell/e_input_method_protocol.h \ + src/modules/wl_desktop_shell/e_desktop_shell_protocol.c \ + src/modules/wl_desktop_shell/e_desktop_shell_protocol.h ++>>>>>>> upstream PHONIES += wl_desktop_shell install-wl_desktop_shell wl_desktop_shell: $(wl_desktop_shellpkg_LTLIBRARIES) $(wl_desktop_shell_DATA) diff --cc src/modules/packagekit/e_mod_packagekit.c index a1856a6,3aa6caf..be5b707 --- a/src/modules/packagekit/e_mod_packagekit.c +++ b/src/modules/packagekit/e_mod_packagekit.c @@@ -291,8 -328,10 +291,15 @@@ _signal_package_cb(void *data, const El _store_error(ctxt, "could not get package arguments"); return; } ++<<<<<<< HEAD + if (PKITV07) + { DBG("PKGKIT: Package: (%s) %s [ %s ]", info_str, pkg_id, summary); } ++======= + //if (PKITV07) + //{ DBG("PKGKIT: Package: (%s) %s [ %s ]", info_str, pkg_id, summary); } + //else + //{ DBG("PKGKIT: Package: (%d) %s [ %s ]", info, pkg_id, summary); } ++>>>>>>> upstream splitted = eina_str_split_full(pkg_id, ";", 2, &num_elements); if (num_elements == 2) diff --cc src/modules/wl_desktop_shell/e_mod_main.c index 8c5750b,c18abad..10b5195 --- a/src/modules/wl_desktop_shell/e_mod_main.c +++ b/src/modules/wl_desktop_shell/e_mod_main.c @@@ -1,18 -1,15 +1,21 @@@ - #define EXECUTIVE_MODE_ENABLED #define E_COMP_WL #include "e.h" ++<<<<<<< HEAD +#include +#include +#include "e_scaler.h" ++======= + #include "e_mod_main.h" + #include "e_desktop_shell_protocol.h" ++>>>>>>> upstream #define XDG_SERVER_VERSION 5 static void _e_shell_surface_parent_set(E_Client *ec, struct wl_resource *parent_resource) { - E_Pixmap *pp; E_Client *pc; - uint64_t pwin = 0; + Ecore_Window pwin = 0; if (!parent_resource) { @@@ -190,20 -174,18 +180,24 @@@ _e_shell_surface_cb_move(struct wl_clie } e_comp_object_frame_xy_unadjust(ec->frame, ++<<<<<<< HEAD + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), ++======= + wl_fixed_to_int(e_comp_wl->ptr.x), + wl_fixed_to_int(e_comp_wl->ptr.y), ++>>>>>>> upstream &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); } static void - _e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial EINA_UNUSED, uint32_t edges) + _e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED, uint32_t edges) { E_Client *ec; - E_Comp_Data *cdata; E_Binding_Event_Mouse_Button ev; + int cx, cy; /* get the client for this resource */ if (!(ec = wl_resource_get_user_data(resource))) @@@ -219,26 -201,14 +213,24 @@@ if ((ec->maximized) || (ec->fullscreen)) return; - /* get compositor data from seat */ - if (!(cdata = wl_resource_get_user_data(seat_resource))) - { - wl_resource_post_error(seat_resource, - WL_DISPLAY_ERROR_INVALID_OBJECT, - "No Comp_Data for Seat"); - return; - } - DBG("Comp Resize Edges Set: %d", edges); ++<<<<<<< HEAD + cdata->resize.resource = resource; + cdata->resize.edges = edges; + + cx = wl_fixed_to_int(cdata->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(cdata->ptr.y) - ec->client.y; + cdata->ptr.grab_x = wl_fixed_from_int(cx); + cdata->ptr.grab_y = wl_fixed_from_int(cy); ++======= + e_comp_wl->resize.resource = resource; + e_comp_wl->resize.edges = edges; + e_comp_wl->ptr.grab_x = e_comp_wl->ptr.x - wl_fixed_from_int(ec->client.x); + e_comp_wl->ptr.grab_y = e_comp_wl->ptr.y - wl_fixed_from_int(ec->client.y); ++>>>>>>> upstream - switch (cdata->ptr.button) + switch (e_comp_wl->ptr.button) { case BTN_LEFT: ev.button = 1; @@@ -255,8 -225,8 +247,13 @@@ } e_comp_object_frame_xy_unadjust(ec->frame, ++<<<<<<< HEAD + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), ++======= + wl_fixed_to_int(e_comp_wl->ptr.x), + wl_fixed_to_int(e_comp_wl->ptr.y), ++>>>>>>> upstream &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE); @@@ -277,7 -247,6 +274,10 @@@ _e_shell_surface_cb_toplevel_set(struc } /* set toplevel client properties */ ++<<<<<<< HEAD + ec->icccm.accepts_focus = 1; ++======= ++>>>>>>> upstream if (!ec->internal) ec->borderless = !ec->internal; @@@ -569,33 -538,10 +570,40 @@@ _e_shell_cb_shell_surface_get(struct wl return; } ++<<<<<<< HEAD + /* make sure it's a wayland pixmap */ + if (e_pixmap_type_get(ep) != E_PIXMAP_TYPE_WL) return; + + /* find the client for this pixmap */ + if (!(ec = e_pixmap_client_get(ep))) + ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ep)); + + if (!ec) + { + pid_t pid; + int internal = 0; + + /* check if it's internal or external */ + wl_client_get_credentials(client, &pid, NULL, NULL); + if (pid == getpid()) internal = 1; + + if (!(ec = e_client_new(NULL, ep, 0, internal))) + { + wl_resource_post_error(surface_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "No Client For Pixmap"); + return; + } + + ec->netwm.pid = pid; + ec->netwm.ping = EINA_TRUE; + } ++======= + EC_CHANGED(ec); + ec->new_client = ec->netwm.ping = EINA_TRUE; + e_comp->new_clients++; + e_client_unignore(ec); ++>>>>>>> upstream /* get the client data */ if (!(cdata = ec->comp_data)) @@@ -843,20 -751,18 +843,24 @@@ _e_xdg_shell_surface_cb_move(struct wl_ } e_comp_object_frame_xy_unadjust(ec->frame, ++<<<<<<< HEAD + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), ++======= + wl_fixed_to_int(e_comp_wl->ptr.x), + wl_fixed_to_int(e_comp_wl->ptr.y), ++>>>>>>> upstream &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_TRUE); } static void - _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial EINA_UNUSED, uint32_t edges) + _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED, uint32_t edges) { E_Client *ec; - E_Comp_Data *cdata; E_Binding_Event_Mouse_Button ev; + int cx, cy; /* DBG("XDG_SHELL: Surface Resize: %d\tEdges: %d", */ /* wl_resource_get_id(resource), edges); */ @@@ -875,24 -781,12 +879,31 @@@ if ((ec->maximized) || (ec->fullscreen)) return; ++<<<<<<< HEAD + /* get compositor data from seat */ + if (!(cdata = wl_resource_get_user_data(seat_resource))) + { + wl_resource_post_error(seat_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "No Comp_Data for Seat"); + return; + } + + cdata->resize.resource = resource; + cdata->resize.edges = edges; + + cx = wl_fixed_to_int(cdata->ptr.x) - ec->client.x; + cy = wl_fixed_to_int(cdata->ptr.y) - ec->client.y; + cdata->ptr.grab_x = wl_fixed_from_int(cx); + cdata->ptr.grab_y = wl_fixed_from_int(cy); ++======= + e_comp_wl->resize.resource = resource; + e_comp_wl->resize.edges = edges; + e_comp_wl->ptr.grab_x = e_comp_wl->ptr.x - wl_fixed_from_int(ec->client.x); + e_comp_wl->ptr.grab_y = e_comp_wl->ptr.y - wl_fixed_from_int(ec->client.y); ++>>>>>>> upstream - switch (cdata->ptr.button) + switch (e_comp_wl->ptr.button) { case BTN_LEFT: ev.button = 1; @@@ -909,8 -803,8 +920,13 @@@ } e_comp_object_frame_xy_unadjust(ec->frame, ++<<<<<<< HEAD + wl_fixed_to_int(cdata->ptr.x), + wl_fixed_to_int(cdata->ptr.y), ++======= + wl_fixed_to_int(e_comp_wl->ptr.x), + wl_fixed_to_int(e_comp_wl->ptr.y), ++>>>>>>> upstream &ev.canvas.x, &ev.canvas.y); _e_shell_surface_mouse_down_helper(ec, &ev, EINA_FALSE); @@@ -1192,33 -1087,10 +1209,40 @@@ _e_xdg_shell_cb_surface_get(struct wl_c return; } ++<<<<<<< HEAD + /* make sure it's a wayland pixmap */ + if (e_pixmap_type_get(ep) != E_PIXMAP_TYPE_WL) return; + + /* find the client for this pixmap */ + if (!(ec = e_pixmap_client_get(ep))) + ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, e_pixmap_window_get(ep)); + + if (!ec) + { + pid_t pid; + int internal = 0; + + /* check if it's internal or external */ + wl_client_get_credentials(client, &pid, NULL, NULL); + if (pid == getpid()) internal = 1; + + if (!(ec = e_client_new(NULL, ep, 0, internal))) + { + wl_resource_post_error(surface_resource, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "No Client For Pixmap"); + return; + } + ec->netwm.pid = pid; + } + + ec->netwm.ping = EINA_TRUE; ++======= + EC_CHANGED(ec); + ec->new_client = ec->netwm.ping = EINA_TRUE; + e_comp->new_clients++; + e_client_unignore(ec); ++>>>>>>> upstream /* get the client data */ if (!(cdata = ec->comp_data)) @@@ -1385,7 -1220,10 +1389,14 @@@ _e_xdg_shell_cb_popup_get(struct wl_cli cdata->shell.map = _e_xdg_shell_surface_map; cdata->shell.unmap = _e_xdg_shell_surface_unmap; ++<<<<<<< HEAD + ec->override = 1; ++======= + EC_CHANGED(ec); + ec->new_client = ec->override = 1; + e_client_unignore(ec); + e_comp->new_clients++; ++>>>>>>> upstream if (!ec->internal) ec->borderless = !ec->internal_elm_win; ec->lock_border = EINA_TRUE; @@@ -1536,108 -1346,28 +1530,104 @@@ _e_xdg_shell_cb_bind(struct wl_client * return; } - if (!(res = wl_resource_create(client, &xdg_shell_interface, MIN(version, 1), id))) - { - wl_client_post_no_memory(client); - return; - } - - cdata->shell_interface.xdg_shell = res; - wl_resource_set_dispatcher(res, _e_xdg_shell_cb_dispatch, NULL, cdata, NULL); + e_comp_wl->shell_interface.xdg_shell = res; + wl_resource_set_dispatcher(res, _e_xdg_shell_cb_dispatch, NULL, + e_comp->wl_comp_data, NULL); } ++<<<<<<< HEAD +static void +_e_tz_surf_cb_tz_res_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface) +{ + struct wl_resource *res; + E_Pixmap *ep; + uint32_t res_id; + + /* get the pixmap from this surface so we can find the client */ + if (!(ep = wl_resource_get_user_data(surface))) + { + wl_resource_post_error(surface, + WL_DISPLAY_ERROR_INVALID_OBJECT, + "No Pixmap Set On Surface"); + return; + } + + /* make sure it's a wayland pixmap */ + if (e_pixmap_type_get(ep) != E_PIXMAP_TYPE_WL) return; + + /* find the window id for this pixmap */ + res_id = e_pixmap_res_id_get(ep); + + DBG("tizen resource id %" PRIu32, res_id); + + /* try to create a tizen_gid */ + if (!(res = wl_resource_create(client, + &tizen_resource_interface, + wl_resource_get_version(resource), + id))) + { + wl_resource_post_no_memory(resource); + return; + } + + wl_resource_set_implementation(res, + &_e_tz_res_interface, + ep, + NULL); + + tizen_resource_send_resource_id(res, res_id); +} + +static const struct tizen_surface_interface _e_tz_surf_interface = +{ + _e_tz_surf_cb_tz_res_get, +}; + +static void +_e_tz_surf_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id) +{ + E_Comp_Data *cdata; + struct wl_resource *res; + + if (!(cdata = data)) + { + wl_client_post_no_memory(client); + return; + } + + if (!(res = wl_resource_create(client, + &tizen_surface_interface, + MIN(version, 1), + id))) + { + ERR("Could not create tizen_surface resource: %m"); + wl_client_post_no_memory(client); + return; + } + + wl_resource_set_implementation(res, &_e_tz_surf_interface, cdata, NULL); +} + +EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" }; ++======= + E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" }; ++>>>>>>> upstream - EAPI void * + E_API void * e_modapi_init(E_Module *m) { - E_Comp *comp; - E_Comp_Data *cdata; - /* try to get the current compositor */ - if (!(comp = e_comp)) return NULL; + if (!e_comp) return NULL; /* make sure it's a wayland compositor */ - /* if (comp->comp_type != E_PIXMAP_TYPE_WL) return NULL; */ + /* if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return NULL; */ /* try to get the compositor data */ - if (!(cdata = comp->wl_comp_data)) return NULL; + if (!e_comp->wl_comp_data) return NULL; /* try to create global shell interface */ - if (!wl_global_create(cdata->wl.disp, &wl_shell_interface, 1, - cdata, _e_shell_cb_bind)) + if (!wl_global_create(e_comp_wl->wl.disp, &wl_shell_interface, 1, + e_comp->wl_comp_data, _e_shell_cb_bind)) { ERR("Could not create shell global: %m"); return NULL; @@@ -1651,17 -1381,13 +1641,27 @@@ return NULL; } ++<<<<<<< HEAD + e_scaler_init(); + + if (!wl_global_create(cdata->wl.disp, + &tizen_surface_interface, + 1, + cdata, + _e_tz_surf_cb_bind)) + { + ERR("Could not create tizen_surface to wayland globals: %m"); + return NULL; + } ++======= + #ifdef HAVE_WL_TEXT_INPUT + if (!e_input_panel_init()) + { + ERR("Could not init input panel"); + return NULL; + } + #endif ++>>>>>>> upstream return m; } diff --cc src/modules/wl_drm/e_mod_main.c index 94c087d,7a9f6aa..abd5019 --- a/src/modules/wl_drm/e_mod_main.c +++ b/src/modules/wl_drm/e_mod_main.c @@@ -1,10 -1,10 +1,9 @@@ #include "e.h" #include - EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" }; + E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" }; -static Ecore_Event_Handler *activate_handler; -static Ecore_Event_Handler *output_handler; +static Eina_List *event_handlers = NULL; static Eina_Bool session_state = EINA_FALSE; static Eina_Bool @@@ -60,214 -59,679 +58,857 @@@ _e_mod_drm_cb_output(void *data EINA_UN if (!(e = event)) goto end; - if (!e->plug) goto end; + DBG("WL_DRM OUTPUT CHANGE"); ++<<<<<<< HEAD + snprintf(buff, sizeof(buff), "%d", e->id); + e_comp_wl_output_init(buff, e->make, e->model, e->x, e->y, e->w, e->h, + e->phys_width, e->phys_height, e->refresh, + e->subpixel_order, e->transform); ++======= + EINA_LIST_FOREACH(e_randr2->screens, l, screen) + { + if ((!strcmp(screen->info.name, e->name)) && + (!strcmp(screen->info.screen, e->model))) + { + if (e->plug) + { + if (!e_comp_wl_output_init(screen->id, e->make, e->model, + e->x, e->y, e->w, e->h, + e->phys_width, e->phys_height, + e->refresh, e->subpixel_order, + e->transform)) + { + ERR("Could not setup new output: %s", screen->id); + } + } + else + e_comp_wl_output_remove(screen->id); + + break; + } + } ++>>>>>>> upstream + + /* previous calculation of e_scale gave unsuitable value because + * there were no sufficient information to calculate dpi. + * so it's considerable to re-calculate e_scale with output geometry. + */ + e_scale_manual_update(((e->w * 254 / e->phys_width) + 5) / 10); + +end: + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_mod_drm_cb_input_device_add(void *data, int type, void *event) +{ + Ecore_Drm_Event_Input_Device_Add *e; + E_Comp *comp = data; + + if (!(e = event)) goto end; + + if (e->caps & EVDEV_SEAT_POINTER) + { + if (comp->wl_comp_data->ptr.num_devices == 0) + { + if (e_config->use_cursor_timer) + comp->wl_comp_data->ptr.hidden = EINA_TRUE; + else + e_pointer_object_set(comp->pointer, NULL, 0, 0); + e_comp_wl_input_pointer_enabled_set(EINA_TRUE); + } + comp->wl_comp_data->ptr.num_devices++; + } + else if (e->caps & EVDEV_SEAT_KEYBOARD) + { + comp->wl_comp_data->kbd.num_devices++; + e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); + } + else if (e->caps & EVDEV_SEAT_TOUCH) + { + comp->wl_comp_data->touch.num_devices++; + e_comp_wl_input_pointer_enabled_set(EINA_TRUE); + e_comp_wl_input_touch_enabled_set(EINA_TRUE); + } + +end: + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_e_mod_drm_cb_input_device_del(void *data, int type, void *event) +{ + Ecore_Drm_Event_Input_Device_Del *e; + E_Comp *comp = data; + + if (!(e = event)) goto end; + + if (e->caps & EVDEV_SEAT_POINTER) + { + comp->wl_comp_data->ptr.num_devices--; + if (comp->wl_comp_data->ptr.num_devices == 0) + { + e_comp_wl_input_pointer_enabled_set(EINA_FALSE); + e_pointer_hide(e_comp->pointer); + } + } end: + if (!e_randr2_cfg->ignore_hotplug_events) + e_randr2_screen_refresh_queue(EINA_TRUE); + return ECORE_CALLBACK_PASS_ON; } - EAPI void * + static void + _e_mod_drm_cb_ee_resize(Ecore_Evas *ee EINA_UNUSED) + { + e_comp_canvas_update(); + } + + static Ecore_Drm_Output_Mode * + _e_mod_drm_mode_screen_find(E_Randr2_Screen *s, Ecore_Drm_Output *output) + { + Ecore_Drm_Output_Mode *mode, *m = NULL; + const Eina_List *l; + int diff, distance = 0x7fffffff; + + EINA_LIST_FOREACH(ecore_drm_output_modes_get(output), l, mode) + { + diff = (100 * abs(s->config.mode.w - mode->width)) + + (100 * abs(s->config.mode.h - mode->height)) + + fabs((100 * s->config.mode.refresh) - (100 * mode->refresh)); + if (diff < distance) + { + m = mode; + distance = diff; + } + } + + return m; + } + + static Eina_Bool + _e_mod_drm_output_exists(Ecore_Drm_Output *output, unsigned int crtc) + { + /* find out if this output can go into the 'possibles' */ + return ecore_drm_output_possible_crtc_get(output, crtc); + } + + static char * + _e_mod_drm_output_screen_get(Ecore_Drm_Output *output) + { + const char *model; + + model = ecore_drm_output_model_get(output); + if (!model) return NULL; + + return strdup(model); + } + + static E_Randr2_Screen * + _info_unconf_primary_find(E_Randr2 *r) + { + Eina_List *l; + E_Randr2_Screen *s, *s_primary = NULL; + int priority = 0; + + EINA_LIST_FOREACH(r->screens, l, s) + { + if (!((s->config.enabled) && + (s->config.mode.w > 0) && (s->config.mode.h > 0) && + (s->config.geom.w > 0) && (s->config.geom.h > 0))) + continue; + if (s->config.priority > priority) + { + s_primary = s; + priority = s->config.priority; + } + } + + return s_primary; + } + + static E_Randr2_Screen * + _info_unconf_left_find(E_Randr2 *r) + { + Eina_List *l; + E_Randr2_Screen *s, *s_left = NULL; + int left_x = 0x7fffffff; + int left_size = 0; + + EINA_LIST_FOREACH(r->screens, l, s) + { + if (!((s->config.enabled) && + (s->config.mode.w > 0) && (s->config.mode.h > 0) && + (s->config.geom.w > 0) && (s->config.geom.h > 0))) + continue; + if ((s->config.geom.x <= left_x) && + ((s->config.geom.w * s->config.geom.h) > left_size)) + { + left_size = s->config.geom.w * s->config.geom.h; + left_x = s->config.geom.x; + s_left = s; + } + } + return s_left; + } + + static E_Randr2_Screen * + _info_unconf_closest_find(E_Randr2 *r, E_Randr2_Screen *s2, Eina_Bool configured) + { + Eina_List *l; + E_Randr2_Screen *s, *s_sel = NULL; + int dist = 0x7fffffff; + int dx, dy; + + EINA_LIST_FOREACH(r->screens, l, s) + { + if (s == s2) continue; + if (!((s->config.enabled) && + (s->config.mode.w > 0) && (s->config.mode.h > 0) && + (s->config.geom.w > 0) && (s->config.geom.h > 0))) + continue; + if ((!configured) && + (s->config.relative.mode != E_RANDR2_RELATIVE_UNKNOWN)) + continue; + else if ((configured) && + (s->config.relative.mode == E_RANDR2_RELATIVE_UNKNOWN)) + continue; + dx = (s->config.geom.x + (s->config.geom.w / 2)) - + (s2->config.geom.x + (s2->config.geom.w / 2)); + dy = (s->config.geom.y + (s->config.geom.h / 2)) - + (s2->config.geom.y + (s2->config.geom.h / 2)); + dx = sqrt((dx * dx) + (dy * dy)); + if (dx < dist) + { + s_sel = s; + dist = dx; + } + } + return s_sel; + } + + static void + _e_mod_drm_relative_fixup(E_Randr2 *r) + { + E_Randr2_Screen *s, *s2; + int d, dx, dy; + + s = _info_unconf_primary_find(r); + if (s) + s->config.relative.mode = E_RANDR2_RELATIVE_NONE; + else + { + s = _info_unconf_left_find(r); + if (!s) return; + s->config.relative.mode = E_RANDR2_RELATIVE_NONE; + } + + for (;;) + { + // find the next screen that is closest to the last one we configured + /// that is still not configured yet + s = _info_unconf_closest_find(r, s, EINA_FALSE); + if (!s) break; + s2 = _info_unconf_closest_find(r, s, EINA_TRUE); + // fix up s->config.relative.mode, s->config.relative.to and + // s->config.relative.align to match (as closely as possible) + // the geometry given - config s relative to s2 + if (!s2) s->config.relative.mode = E_RANDR2_RELATIVE_NONE; + else + { + s->config.relative.to = strdup(s2->id); + s->config.relative.align = 0.0; + s->config.relative.mode = E_RANDR2_RELATIVE_NONE; + if ((s->config.geom.x + s->config.geom.w) <= + s2->config.geom.x) + { + s->config.relative.mode = E_RANDR2_RELATIVE_TO_LEFT; + d = s->config.geom.h - s2->config.geom.h; + dy = s2->config.geom.y - s->config.geom.y; + if (d != 0) + s->config.relative.align = ((double)dy) / ((double)d); + } + else if (s->config.geom.x >= + (s2->config.geom.x + s2->config.geom.w)) + { + s->config.relative.mode = E_RANDR2_RELATIVE_TO_RIGHT; + d = s->config.geom.h - s2->config.geom.h; + dy = s2->config.geom.y - s->config.geom.y; + if (d != 0) + s->config.relative.align = ((double)dy) / ((double)d); + } + else if ((s->config.geom.y + s->config.geom.h) <= + s2->config.geom.y) + { + s->config.relative.mode = E_RANDR2_RELATIVE_TO_ABOVE; + d = s->config.geom.w - s2->config.geom.w; + dx = s2->config.geom.x - s->config.geom.x; + if (d != 0) + s->config.relative.align = ((double)dx) / ((double)d); + } + else if (s->config.geom.y >= + (s2->config.geom.y + s2->config.geom.h)) + { + s->config.relative.mode = E_RANDR2_RELATIVE_TO_BELOW; + d = s->config.geom.w - s2->config.geom.w; + dx = s2->config.geom.x - s->config.geom.x; + if (d != 0) + s->config.relative.align = ((double)dx) / ((double)d); + } + else if ((s->config.geom.x == s2->config.geom.x) && + (s->config.geom.y == s2->config.geom.y) && + (s->config.geom.w == s2->config.geom.w) && + (s->config.geom.h == s2->config.geom.h)) + { + s->config.relative.mode = E_RANDR2_RELATIVE_CLONE; + } + if (s->config.relative.align < 0.0) + s->config.relative.align = 0.0; + else if (s->config.relative.align > 1.0) + s->config.relative.align = 1.0; + } + } + } + + static E_Randr2 * + _drm_randr_create(void) + { + Ecore_Drm_Device *dev; + Ecore_Drm_Output *output; + const Eina_List *l, *ll; + E_Randr2 *r = NULL; + const char *conn_types[] = + { + "None", "VGA", "DVI-I", "DVI-D", "DVI-A", + "Composite", "S-Video", "LVDS", "Component", "DIN", + "DisplayPort", "HDMI-A", "HDMI-B", "TV", "eDP", "Virtual", + "DSI", "UNKNOWN" + }; + E_Randr2_Connector rtype[] = + { + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_DVI, + E_RANDR2_CONNECTOR_DVI, + E_RANDR2_CONNECTOR_DVI, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_DISPLAY_PORT, + E_RANDR2_CONNECTOR_HDMI_A, + E_RANDR2_CONNECTOR_HDMI_B, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_DISPLAY_PORT, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + E_RANDR2_CONNECTOR_UNDEFINED, + }; + unsigned int type; + + printf("DRM RRR: ................. info get!\n"); + + r = E_NEW(E_Randr2, 1); + if (!r) return NULL; + + EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) + { + EINA_LIST_FOREACH(dev->outputs, ll, output) + { + E_Randr2_Screen *s; + E_Config_Randr2_Screen *cs; + const Eina_List *m; + Ecore_Drm_Output_Mode *omode; + // size_t n, e = 0; + unsigned int j; + int priority; + Eina_Bool ok = EINA_FALSE; + Eina_Bool possible = EINA_FALSE; + + s = E_NEW(E_Randr2_Screen, 1); + if (!s) continue; + + s->info.name = ecore_drm_output_name_get(output); + printf("DRM RRR: .... out %s\n", s->info.name); + + s->info.connected = ecore_drm_output_connected_get(output); + printf("DRM RRR: ...... connected %i\n", s->info.connected); + + s->info.screen = _e_mod_drm_output_screen_get(output); + + s->info.edid = ecore_drm_output_edid_get(output); + if (s->info.edid) + s->id = malloc(strlen(s->info.name) + 1 + strlen(s->info.edid) + 1); + else + s->id = malloc(strlen(s->info.name) + 1 + 1); + if (!s->id) + { + free(s->info.screen); + free(s->info.edid); + free(s); + continue; + } + strcpy(s->id, s->info.name); + strcat(s->id, "/"); + if (s->info.edid) strcat(s->id, s->info.edid); + + printf("DRM RRR: Created Screen: %s\n", s->id); + + type = MIN(ecore_drm_output_connector_type_get(output), + EINA_C_ARRAY_LENGTH(conn_types) - 1); + s->info.connector = rtype[type]; + s->info.is_lid = ((type == DRM_MODE_CONNECTOR_LVDS) || + (type == DRM_MODE_CONNECTOR_eDP)); + s->info.lid_closed = (s->info.is_lid && e_acpi_lid_is_closed()); + printf("DRM RRR: ...... lid_closed = %i (%i && %i)\n", + s->info.lid_closed, s->info.is_lid, e_acpi_lid_is_closed()); + + s->info.backlight = ecore_drm_output_backlight_get(output); + + ecore_drm_output_physical_size_get(output, &s->info.size.w, + &s->info.size.h); + + EINA_LIST_FOREACH(ecore_drm_output_modes_get(output), m, omode) + { + E_Randr2_Mode *rmode; + + rmode = malloc(sizeof(E_Randr2_Mode)); + if (!rmode) continue; + + rmode->w = omode->width; + rmode->h = omode->height; + rmode->refresh = omode->refresh; + rmode->preferred = (omode->flags & DRM_MODE_TYPE_PREFERRED); + + s->info.modes = eina_list_append(s->info.modes, rmode); + } + + cs = NULL; + priority = 0; + if (e_randr2_cfg) + cs = e_randr2_config_screen_find(s, e_randr2_cfg); + if (cs) + priority = cs->priority; + else if (ecore_drm_output_primary_get(dev) == output) + priority = 100; + s->config.priority = priority; + + for (j = 0; j < dev->crtc_count; j++) + { + if (dev->crtcs[j] == ecore_drm_output_crtc_id_get(output)) + { + ok = EINA_TRUE; + break; + } + } + + if (!ok) + { + /* get possible crtcs, compare to output_crtc_id_get */ + for (j = 0; j < dev->crtc_count; j++) + { + if (_e_mod_drm_output_exists(output, dev->crtcs[j])) + { + ok = EINA_TRUE; + possible = EINA_TRUE; + break; + } + } + } + + if (ok) + { + if (!possible) + { + unsigned int refresh; + + ecore_drm_output_position_get(output, &s->config.geom.x, + &s->config.geom.y); + ecore_drm_output_crtc_size_get(output, &s->config.geom.w, + &s->config.geom.h); + + ecore_drm_output_current_resolution_get(output, + &s->config.mode.w, + &s->config.mode.h, + &refresh); + s->config.mode.refresh = refresh; + s->config.enabled = + ((s->config.mode.w != 0) && (s->config.mode.h != 0)); + + printf("DRM RRR: '%s' %i %i %ix%i\n", s->info.name, + s->config.geom.x, s->config.geom.y, + s->config.geom.w, s->config.geom.h); + } + + /* TODO: are rotations possible ?? */ + } + + r->screens = eina_list_append(r->screens, s); + } + } + + _e_mod_drm_relative_fixup(r); + + return r; + } + + static Eina_Bool + _drm_randr_available(void) + { + return EINA_TRUE; + } + + static void + _drm_randr_stub(void) + {} + + static void + _drm_randr_apply(void) + { + Ecore_Drm_Device *dev; + Ecore_Drm_Output *out; + E_Randr2_Screen *s; + const Eina_List *l, *ll; + int nw, nh, pw, ph, ww, hh; + int minw, minh, maxw, maxh; + int top_priority = 0; + + /* TODO: what the actual fuck */ + + nw = e_randr2->w; + nh = e_randr2->h; + EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) + { + ecore_drm_screen_size_range_get(dev, &minw, &minh, &maxw, &maxh); + printf("DRM RRR: size range: %ix%i -> %ix%i\n", minw, minh, maxw, maxh); + + ecore_drm_outputs_geometry_get(dev, NULL, NULL, &pw, &ph); + if (nw > maxw) nw = maxw; + if (nh > maxh) nh = maxh; + if (nw < minw) nw = minw; + if (nh < minh) nh = minh; + ww = nw; + hh = nh; + if (nw < pw) ww = pw; + if (nh < ph) hh = ph; + + printf("DRM RRR: set vsize: %ix%i\n", ww, hh); + + EINA_LIST_FOREACH(e_randr2->screens, ll, s) + { + int orient; + Ecore_Drm_Output_Mode *mode = NULL; + + printf("DRM RRR: find output for '%s'\n", s->info.name); + + out = ecore_drm_device_output_name_find(dev, s->info.name); + if (!out) continue; + + if (s->config.configured) + { + printf("\tDRM RRR: configured by E\n"); + + if (s->config.enabled) + { + printf("\tDRM RRR: Enabled\n"); + mode = _e_mod_drm_mode_screen_find(s, out); + } + else + { + printf("\tDRM RRR: Disabled\n"); + } + + if (s->config.priority > top_priority) + top_priority = s->config.priority; + + printf("\tDRM RRR: Priority: %d\n", s->config.priority); + + printf("\tDRM RRR: Geom: %d %d %d %d\n", + s->config.geom.x, s->config.geom.y, + s->config.geom.w, s->config.geom.h); + + if (mode) + { + printf("\tDRM RRR: Found Valid Drm Mode\n"); + printf("\t\tDRM RRR: %dx%d\n", mode->width, mode->height); + } + else + printf("\tDRM RRR: No Valid Drm Mode Found\n"); + + if (s->config.rotation == 0) + orient = (1 << 0); + else if (s->config.rotation == 90) + orient = (1 << 1); + else if (s->config.rotation == 180) + orient = (1 << 2); + else if (s->config.rotation == 270) + orient = (1 << 3); + + ecore_drm_output_mode_set(out, mode, + s->config.geom.x, s->config.geom.y); + if (s->config.priority == top_priority) + ecore_drm_output_primary_set(out); + + if (s->config.enabled) + ecore_drm_output_enable(out); + else + ecore_drm_output_disable(out); + + printf("\tDRM RRR: Mode\n"); + printf("\t\tDRM RRR: Geom: %d %d\n", + s->config.mode.w, s->config.mode.h); + printf("\t\tDRM RRR: Refresh: %f\n", s->config.mode.refresh); + printf("\t\tDRM RRR: Preferred: %d\n", + s->config.mode.preferred); + + printf("\tDRM RRR: Rotation: %d\n", s->config.rotation); + + printf("\tDRM RRR: Relative Mode: %d\n", + s->config.relative.mode); + printf("\tDRM RRR: Relative To: %s\n", + s->config.relative.to); + printf("\tDRM RRR: Align: %f\n", s->config.relative.align); + } + } + } + } + + static void + _drm_dpms(int set) + { + Ecore_Drm_Device *dev; + Ecore_Drm_Output *out; + E_Randr2_Screen *s; + const Eina_List *l, *ll; + + EINA_LIST_FOREACH(ecore_drm_devices_get(), l, dev) + { + EINA_LIST_FOREACH(e_randr2->screens, ll, s) + { + out = ecore_drm_device_output_name_find(dev, s->info.name); + if (!out) continue; + + if ((!s->config.configured) || s->config.enabled) + ecore_drm_output_dpms_set(out, set); + } + } + } + + static E_Comp_Screen_Iface drmiface = + { + .available = _drm_randr_available, + .init = _drm_randr_stub, + .shutdown = _drm_randr_stub, + .create = _drm_randr_create, + .apply = _drm_randr_apply, + .dpms = _drm_dpms, + }; + + static void + _drm_read_pixels(E_Comp_Wl_Output *output, void *pixels) + { + Ecore_Drm_Device *dev; + Ecore_Drm_Fb *fb; + const Eina_List *drm_devs, *l; + int i = 0, bstride; + unsigned char *s, *d = pixels; + + drm_devs = ecore_drm_devices_get(); + EINA_LIST_FOREACH(drm_devs, l, dev) + { + fb = dev->next; + if (!fb) fb = dev->current; + if (fb) break; + } + + if (!fb) return; + + bstride = output->w * sizeof(int); + + for (i = output->y; i < output->y + output->h; i++) + { + s = fb->mmap; + s += (fb->stride * i) + (output->x * sizeof(int)); + memcpy(d, s, (output->w * sizeof(int))); + d += bstride; + } + } + + E_API void * e_modapi_init(E_Module *m) { ++<<<<<<< HEAD + E_Comp *comp; + int w = 0, h = 0, scr_w = 0, scr_h = 0; + const char *env_w, *env_h; + + printf("LOAD WL_DRM MODULE\n"); + + if (!(comp = e_comp)) + { + comp = e_comp_new(); + EINA_SAFETY_ON_NULL_RETURN_VAL(comp, NULL); + + comp->comp_type = E_PIXMAP_TYPE_WL; + } + + /* set gl available if we have ecore_evas support */ + if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_EGL) || + ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM)) + e_comp_gl_set(EINA_TRUE); + + env_w = getenv("E_SCREEN_WIDTH"); + if (env_w) + { + char buf[8]; + snprintf(buf, sizeof(buf), "%s", env_w); + scr_w = atoi(buf); + } + + env_h = getenv("E_SCREEN_HEIGHT"); + if (env_h) + { + char buf[8]; + snprintf(buf, sizeof(buf), "%s", env_h); + scr_h = atoi(buf); + } + + if (scr_w <= 0) scr_w = 1; + if (scr_h <= 0) scr_h = 1; + + DBG("GL available:%d config engine:%d screen size:%dx%d", + e_comp_gl_get(), e_comp_config_get()->engine, scr_w, scr_h); + + if ((e_comp_gl_get()) && + (e_comp_config_get()->engine == E_COMP_ENGINE_GL)) + { + comp->ee = ecore_evas_gl_drm_new(NULL, 0, 0, 0, scr_w, scr_h); + DBG("Create ecore_evas_gl_drm canvas:%p", comp->ee); + + if (!comp->ee) + e_comp_gl_set(EINA_FALSE); + else + { + Evas_GL *evasgl = NULL; + Evas_GL_API *glapi = NULL; + + evasgl = evas_gl_new(ecore_evas_get(comp->ee)); + if (evasgl) + { + glapi = evas_gl_api_get(evasgl); + if (!((glapi) && (glapi->evasglBindWaylandDisplay))) + { + e_comp_gl_set(EINA_FALSE); + ecore_evas_free(comp->ee); + comp->ee = NULL; + } + } + else + { + e_comp_gl_set(EINA_FALSE); + ecore_evas_free(comp->ee); + comp->ee = NULL; + } + evas_gl_free(evasgl); + } + } + + /* fallback to framebuffer drm (non-accel) */ + if (!comp->ee) + { + comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, scr_w, scr_h); + DBG("Create ecore_evas_drm canvas:%p", comp->ee); + } + + if (!comp->ee) ++======= + int w = 0, h = 0; + + printf("LOAD WL_DRM MODULE\n"); + + /* try to init ecore_drm */ + /* if (!ecore_drm_init()) */ + /* { */ + /* fprintf(stderr, "Could not initialize ecore_drm"); */ + /* return NULL; */ + /* } */ + + if (e_comp_config_get()->engine == E_COMP_ENGINE_GL) { - fprintf(stderr, "Could not create ecore_evas_drm canvas"); - return NULL; + e_comp->ee = ecore_evas_new("gl_drm", 0, 0, 1, 1, NULL); + e_comp_gl_set(!!e_comp->ee); } - /* get the current screen geometry */ - ecore_evas_screen_geometry_get(comp->ee, NULL, NULL, &w, &h); + /* fallback to framebuffer drm (non-accel) */ + if (!e_comp->ee) ++>>>>>>> upstream + { + if ((e_comp->ee = ecore_evas_new("drm", 0, 0, 1, 1, NULL))) + { + e_comp_gl_set(EINA_FALSE); + elm_config_accel_preference_set("none"); + elm_config_accel_preference_override_set(EINA_TRUE); + elm_config_all_flush(); + elm_config_save(); + } + else + { + fprintf(stderr, "Could not create ecore_evas_drm canvas"); + return NULL; + } + } + + ecore_evas_data_set(e_comp->ee, "comp", e_comp); ++<<<<<<< HEAD + /* resize the canvas */ + if (!((scr_w == w) && (scr_h == h))) + { + DBG("Change ecore_evas canvas size %dx%d -> %dx%d", scr_w, scr_h, w, h); + ecore_evas_resize(comp->ee, w, h); + } ++======= + /* get the current screen geometry */ + ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h); ++>>>>>>> upstream - /* TODO: hook ecore_evas_callback_resize_set */ - - if (!e_xinerama_fake_screens_exist()) - { - E_Screen *screen; - - screen = E_NEW(E_Screen, 1); - screen->escreen = screen->screen = 0; - screen->x = 0; - screen->y = 0; - screen->w = w; - screen->h = h; - e_xinerama_screens_set(eina_list_append(NULL, screen)); - } + ecore_evas_callback_resize_set(e_comp->ee, _e_mod_drm_cb_ee_resize); - comp->man = e_manager_new(ecore_evas_window_get(comp->ee), comp, w, h); - if (!e_comp_canvas_init(comp)) return NULL; - e_comp_canvas_fake_layers_init(comp); + e_comp->screen = &drmiface; - /* NB: This needs to be called AFTER the comp canvas has been setup */ if (!e_comp_wl_init()) return NULL; + if (!e_comp_canvas_init(w, h)) return NULL; + + e_comp_wl->screenshooter.read_pixels = _drm_read_pixels; + + ecore_evas_pointer_xy_get(e_comp->ee, &e_comp_wl->ptr.x, + &e_comp_wl->ptr.y); + evas_event_feed_mouse_in(e_comp->evas, 0, NULL); ++<<<<<<< HEAD + evas_event_feed_mouse_in(comp->evas, 0, NULL); + + /* comp->pointer = */ + /* e_pointer_window_new(ecore_evas_window_get(comp->ee), 1); */ + if ((comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE))) + { + comp->pointer->color = EINA_TRUE; + e_pointer_hide(comp->pointer); + } ++======= + e_comp_wl_input_pointer_enabled_set(EINA_TRUE); + e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); + e_comp_wl_input_touch_enabled_set(EINA_TRUE); + + /* comp->pointer = */ + /* e_pointer_window_new(ecore_evas_window_get(comp->ee), 1); */ + e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE); + e_comp->pointer->color = EINA_TRUE; ++>>>>>>> upstream /* FIXME: We need a way to trap for user changing the keymap inside of E * without the event coming from X11 */ @@@ -279,16 -743,15 +920,28 @@@ /* FIXME: This is just for testing at the moment.... * happens to jive with what drm does */ ++<<<<<<< HEAD + e_comp_wl_input_keymap_set(comp->wl_comp_data, "evdev", "pc105", "us"); + + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_ACTIVATE, + _e_mod_drm_cb_activate, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_OUTPUT, + _e_mod_drm_cb_output, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_ADD, + _e_mod_drm_cb_input_device_add, comp); + E_LIST_HANDLER_APPEND(event_handlers, ECORE_DRM_EVENT_INPUT_DEVICE_DEL, + _e_mod_drm_cb_input_device_del, comp); ++======= + e_comp_wl_input_keymap_set(NULL, NULL, NULL); + + activate_handler = + ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE, + _e_mod_drm_cb_activate, NULL); + + output_handler = + ecore_event_handler_add(ECORE_DRM_EVENT_OUTPUT, + _e_mod_drm_cb_output, NULL); ++>>>>>>> upstream return m; } @@@ -299,7 -762,11 +952,15 @@@ e_modapi_shutdown(E_Module *m EINA_UNUS /* shutdown ecore_drm */ /* ecore_drm_shutdown(); */ ++<<<<<<< HEAD + E_FREE_LIST(event_handlers, ecore_event_handler_del); ++======= + if (output_handler) ecore_event_handler_del(output_handler); + output_handler = NULL; + + if (activate_handler) ecore_event_handler_del(activate_handler); + activate_handler = NULL; ++>>>>>>> upstream return 1; } diff --cc src/modules/wl_x11/e_mod_main.c index bc34295,75c379f..24790c2 --- a/src/modules/wl_x11/e_mod_main.c +++ b/src/modules/wl_x11/e_mod_main.c @@@ -11,10 -11,9 +11,14 @@@ _cb_delete_request(Ecore_Evas *ee EINA_ ecore_main_loop_quit(); } ++<<<<<<< HEAD +static Eina_Bool +_cb_keymap_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED) ++======= + static Eina_Bool + _cb_keymap_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) ++>>>>>>> upstream { - E_Comp_Data *cdata; E_Config_XKB_Layout *ekbd; char *rules = NULL, *model = NULL, *layout = NULL; Ecore_X_Atom xkb = 0; @@@ -87,50 -73,37 +78,59 @@@ e_modapi_init(E_Module *m ERR("Could not create ecore_evas canvas"); return NULL; } + ecore_evas_callback_delete_request_set(e_comp->ee, _cb_delete_request); + ecore_evas_title_set(e_comp->ee, "Enlightenment: WL-X11"); + ecore_evas_name_class_set(e_comp->ee, "E", "compositor"); - ecore_evas_screen_geometry_get(comp->ee, NULL, NULL, &w, &h); - ecore_evas_resize(comp->ee, w, h); - - if (!e_xinerama_fake_screens_exist()) - { - screen = E_NEW(E_Screen, 1); - screen->escreen = screen->screen = 0; - screen->x = 0; - screen->y = 0; - screen->w = w; - screen->h = h; - e_xinerama_screens_set(eina_list_append(NULL, screen)); - } - - comp->man = e_manager_new(ecore_evas_window_get(comp->ee), comp, w, h); - if (!e_comp_canvas_init(comp)) return NULL; - e_comp_canvas_fake_layers_init(comp); + ecore_evas_screen_geometry_get(e_comp->ee, NULL, NULL, &w, &h); ++<<<<<<< HEAD + /* NB: This needs to be called AFTER comp_canvas has been setup as it + * makes reference to the comp->evas */ ++======= + e_comp_x_randr_screen_iface_set(); ++>>>>>>> upstream if (!e_comp_wl_init()) return NULL; + if (!e_comp_canvas_init(w, h)) return NULL; e_comp_wl_input_pointer_enabled_set(EINA_TRUE); e_comp_wl_input_keyboard_enabled_set(EINA_TRUE); e_comp_wl_input_touch_enabled_set(EINA_TRUE); ++<<<<<<< HEAD + /* comp->pointer = */ + /* e_pointer_window_new(ecore_evas_window_get(comp->ee), EINA_TRUE); */ + if ((comp->pointer = e_pointer_canvas_new(comp->ee, EINA_TRUE)) + comp->pointer->color = EINA_TRUE; ++======= + /* e_comp->pointer = */ + /* e_pointer_window_new(ecore_evas_window_get(e_comp->ee), EINA_TRUE); */ + e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE); + e_comp->pointer->color = EINA_TRUE; ++>>>>>>> upstream /* force a keymap update so compositor keyboard gets setup */ - _cb_keymap_changed(comp->wl_comp_data, 0, NULL); + _cb_keymap_changed(e_comp->wl_comp_data, 0, NULL); /* setup keymap_change event handler */ ++<<<<<<< HEAD + kbd_hdlr = + ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, + _cb_keymap_changed, comp->wl_comp_data); ++======= + kbd_hdlr = + ecore_event_handler_add(ECORE_X_EVENT_XKB_STATE_NOTIFY, + _cb_keymap_changed, e_comp->wl_comp_data); ++>>>>>>> upstream return m; } ++<<<<<<< HEAD +EAPI int ++======= + E_API int ++>>>>>>> upstream e_modapi_shutdown(E_Module *m EINA_UNUSED) { /* delete handler for keymap change */