ecore evas ews - deprecate/remove

it's broken. it doesnt render anything. input is broken. it isn't in
use so it doesnt justify fixing. no one has complained it's brokne
thus proof of it not in use, so proof that it's not needed, so do the
right thing and nuke it to save work

@feat
devs/bu5hm4n/tmp
Carsten Haitzler 2 years ago
parent 0e3a2e6ec7
commit db081f9648
  1. 269
      src/examples/ecore/ecore_evas_ews_example.c
  2. 1
      src/examples/ecore/meson.build
  3. 17
      src/lib/ecore_evas/Ecore_Evas.h
  4. 26
      src/lib/ecore_evas/ecore_evas.c
  5. 1
      src/lib/ecore_evas/ecore_evas_buffer.c
  6. 1400
      src/lib/ecore_evas/ecore_evas_ews.c
  7. 3
      src/lib/ecore_evas/ecore_evas_module.c
  8. 8
      src/lib/elementary/efl_ui_win.c
  9. 3
      src/lib/elementary/elm_config.c
  10. 1
      src/lib/elementary/elm_config.h
  11. 6
      src/lib/elementary/elm_main.c
  12. 18
      src/lib/elementary/elm_priv.h
  13. 1
      src/lib/elementary/elm_theme.c
  14. 1
      src/lib/elementary/elm_win.h
  15. 531
      src/lib/elementary/elu_ews_wm.c
  16. 1
      src/lib/elementary/meson.build
  17. 2
      src/modules/ecore_evas/meson.build

@ -1,269 +0,0 @@
/**
* Ecore example illustrating the ews of ecore evas usage.
*
* You'll need at least one Evas engine built for it (excluding the
* buffer one). See stdout/stderr for output.
*
* @verbatim
* gcc -o ecore_evas_ews_example ecore_evas_ews_example.c `pkg-config --libs --cflags ecore evas ecore-evas`
* @endverbatim
*/
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
static Eina_Bool
_wm_win_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
printf("WM: new window=%p\n", ee);
return EINA_TRUE;
}
static Eina_Bool
_wm_win_move(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
int x, y;
ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
printf("WM: window=%p moved to %d,%d\n", ee, x, y);
return EINA_TRUE;
}
static Eina_Bool
_wm_win_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
int w, h;
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
printf("WM: window=%p resized to %dx%d\n", ee, w, h);
return EINA_TRUE;
}
static Eina_Bool
_wm_win_show(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
printf("WM: show window=%p\n", ee);
return EINA_TRUE;
}
static void
optional_ews_window_manager_setup(void)
{
ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_ADD, _wm_win_add, NULL);
ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_MOVE, _wm_win_move, NULL);
ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_RESIZE, _wm_win_resize, NULL);
ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_SHOW, _wm_win_show, NULL);
/* one may use any known unique identifier, like an app function pointer */
ecore_evas_ews_manager_set(optional_ews_window_manager_setup);
}
static void
optional_ews_setup(void)
{
Evas_Object *bg;
Evas *e;
ecore_evas_ews_setup(0, 0, 800, 600); /* "screen" size */
e = ecore_evas_ews_evas_get(); /* forces "screen" to be allocated */
bg = evas_object_rectangle_add(e);
evas_object_color_set(bg, 128, 32, 32, 255);
ecore_evas_ews_background_set(bg);
}
static Eina_Bool
_stdin_cb(void *data EINA_UNUSED, Ecore_Fd_Handler *handler EINA_UNUSED)
{
const Eina_List *l;
Ecore_Evas *ee;
int c = getchar();
if (c == EOF)
{
ecore_main_loop_quit();
return EINA_FALSE;
}
switch (c) {
case 'h':
printf("hide all windows\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_hide(ee);
break;
case 's':
printf("show all windows\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_show(ee);
break;
case 'l':
printf("move all windows left\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
{
int x, y;
ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
ecore_evas_move(ee, x - 10, y);
}
break;
case 'r':
printf("move all windows right\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
{
int x, y;
ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
ecore_evas_move(ee, x + 10, y);
}
break;
case 't':
printf("move all windows top\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
{
int x, y;
ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
ecore_evas_move(ee, x, y - 10);
}
break;
case 'b':
printf("move all windows bottom\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
{
int x, y;
ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
ecore_evas_move(ee, x, y + 10);
}
break;
case 'S':
printf("make all windows smaller\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
{
int w, h;
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
ecore_evas_resize(ee, w - 10, h - 10);
}
break;
case 'B':
printf("make all windows bigger\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
{
int w, h;
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
ecore_evas_resize(ee, w + 10, h + 10);
}
break;
case 'm':
printf("make all windows unmaximized\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_maximized_set(ee, EINA_FALSE);
break;
case 'M':
printf("make all windows maximized\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_maximized_set(ee, EINA_TRUE);
break;
case 'i':
printf("make all windows uniconified\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_iconified_set(ee, EINA_FALSE);
break;
case 'I':
printf("make all windows iconified\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_iconified_set(ee, EINA_TRUE);
break;
case 'f':
printf("make all windows unfullscreen\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_fullscreen_set(ee, EINA_FALSE);
break;
case 'F':
printf("make all windows fullscreen\n");
EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee)
ecore_evas_fullscreen_set(ee, EINA_TRUE);
break;
case 'q':
printf("quit\n");
ecore_main_loop_quit();
break;
default:
if (!isspace(c))
printf("Unknown command: %c\n", c);
}
return ECORE_CALLBACK_RENEW;
}
static void
_on_delete(Ecore_Evas *ee)
{
free(ecore_evas_data_get(ee, "key"));
ecore_main_loop_quit();
}
int
main(void)
{
Ecore_Evas *ee;
Evas *canvas;
Evas_Object *bg;
if (ecore_evas_init() <= 0)
return 1;
optional_ews_setup();
optional_ews_window_manager_setup();
/* everything should look similar to ecore_evas_basic_example */
ee = ecore_evas_ews_new(0, 0, 200, 200);
ecore_evas_title_set(ee, "Ecore Evas EWS Example");
ecore_evas_show(ee);
ecore_evas_data_set(ee, "key", strdup("hello"));
ecore_evas_callback_delete_request_set(ee, _on_delete);
printf("Using %s engine!\n", ecore_evas_engine_name_get(ee));
canvas = ecore_evas_get(ee);
if (ecore_evas_ecore_evas_get(canvas) == ee)
printf("Everything is sane!\n");
bg = evas_object_rectangle_add(canvas);
evas_object_color_set(bg, 0, 0, 255, 255);
evas_object_resize(bg, 200, 200);
evas_object_show(bg);
ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
/* moving the window should move it in the screen */
ecore_evas_move(ee, 50, 50);
ecore_main_fd_handler_add(STDIN_FILENO,
ECORE_FD_READ | ECORE_FD_ERROR,
_stdin_cb,
NULL, NULL, NULL);
ecore_main_loop_begin();
ecore_evas_free(ee);
ecore_evas_shutdown();
return 0;
}

@ -73,7 +73,6 @@ examples = [
'ecore_evas_buffer_example_01',
'ecore_evas_buffer_example_02',
'ecore_evas_callbacks',
'ecore_evas_ews_example',
'ecore_evas_object_example',
'ecore_evas_window_sizes_example',
]

@ -97,7 +97,7 @@ extern "C" {
#define HAVE_ECORE_EVAS_COCOA 1
#define HAVE_ECORE_EVAS_SDL 1
//#define HAVE_ECORE_EVAS_WINCE 1
#define HAVE_ECORE_EVAS_EWS 1
//#define HAVE_ECORE_EVAS_EWS 1 /* @deprecated */
#define HAVE_ECORE_EVAS_PSL1GHT 1
#define HAVE_ECORE_EVAS_WAYLAND_SHM 1
#define HAVE_ECORE_EVAS_WAYLAND_EGL 1
@ -125,7 +125,7 @@ typedef enum _Ecore_Evas_Engine_Type
ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
ECORE_EVAS_ENGINE_OPENGL_SDL,
ECORE_EVAS_ENGINE_EWS,
ECORE_EVAS_ENGINE_EWS, /* @deprecated */
ECORE_EVAS_ENGINE_PSL1GHT,
ECORE_EVAS_ENGINE_WAYLAND_SHM,
ECORE_EVAS_ENGINE_WAYLAND_EGL,
@ -1788,6 +1788,7 @@ EAPI Ecore_Evas *ecore_evas_buffer_ecore_evas_parent_get(Ecore_Evas *ee);
* @see ecore_evas_ews_ecore_evas_get()
*
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
@ -1806,6 +1807,7 @@ EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
* @see ecore_evas_ews_manager_set()
* @see ecore_evas_ews_evas_get()
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
@ -1816,6 +1818,7 @@ EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
* @param ee The Ecore_Evas for which window will be deleted.
*
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee);
@ -3216,6 +3219,7 @@ EAPI void ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
* ecore_evas_ews_new().
*
* @since 1.1
* @deprecated - @since 1.26
* @{
*/
@ -3227,6 +3231,7 @@ EAPI void ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
* @return @c EINA_TRUE on success, @c EINA_FALSE if ews is already in use.
*
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options);
@ -3240,6 +3245,7 @@ EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options
* @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
*
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
@ -3253,6 +3259,7 @@ EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
*
* @see ecore_evas_ews_evas_get()
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
@ -3266,11 +3273,13 @@ EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
*
* @see ecore_evas_ews_ecore_evas_get()
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI Evas *ecore_evas_ews_evas_get(void);
/**
* @brief Gets the current background.
* @deprecated - @since 1.26
*/
EAPI Evas_Object *ecore_evas_ews_background_get(void);
@ -3284,6 +3293,7 @@ EAPI Evas_Object *ecore_evas_ews_background_get(void);
* rectangle.
*
* @note previous object will be deleted!
* @deprecated - @since 1.26
*/
EAPI void ecore_evas_ews_background_set(Evas_Object *o);
@ -3295,6 +3305,7 @@ EAPI void ecore_evas_ews_background_set(Evas_Object *o);
* @note Do not change the returned list or its contents.
*
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI const Eina_List *ecore_evas_ews_children_get(void);
@ -3309,6 +3320,7 @@ EAPI const Eina_List *ecore_evas_ews_children_get(void);
*
* @see ecore_evas_ews_manager_get()
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI void ecore_evas_ews_manager_set(const void *manager);
@ -3318,6 +3330,7 @@ EAPI void ecore_evas_ews_manager_set(const void *manager);
* @return the value set by ecore_evas_ews_manager_set()
*
* @since 1.1
* @deprecated - @since 1.26
*/
EAPI const void *ecore_evas_ews_manager_get(void);

@ -565,11 +565,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_EWS:
#ifdef BUILD_ECORE_EVAS_EWS
return EINA_TRUE;
#else
return EINA_FALSE;
#endif
case ECORE_EVAS_ENGINE_PSL1GHT:
return EINA_FALSE;
case ECORE_EVAS_ENGINE_WAYLAND_SHM:
@ -632,10 +628,6 @@ ecore_evas_init(void)
if (getenv("ECORE_EVAS_RENDER_NOSYNC")) _ecore_evas_render_sync = 0;
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
#ifdef BUILD_ECORE_EVAS_EWS
_ecore_evas_ews_events_init();
#endif
_ecore_evas_extn_init();
_ecore_evas_engine_init();
@ -680,10 +672,6 @@ ecore_evas_shutdown(void)
EINA_LOG_STATE_START,
EINA_LOG_STATE_SHUTDOWN);
#ifdef BUILD_ECORE_EVAS_EWS
_ecore_evas_ews_events_flush();
#endif
while (ecore_evases) _ecore_evas_free(ecore_evases);
if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
@ -694,9 +682,6 @@ ecore_evas_shutdown(void)
_ecore_evas_extn_shutdown();
#ifdef BUILD_ECORE_EVAS_EWS
while (_ecore_evas_ews_shutdown());
#endif
_ecore_evas_engine_shutdown();
eina_log_domain_unregister(_ecore_evas_log_dom);
@ -995,14 +980,6 @@ _ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int
return ecore_evas_buffer_new(w, h);
}
#ifdef BUILD_ECORE_EVAS_EWS
static Ecore_Evas *
_ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options EINA_UNUSED)
{
return ecore_evas_ews_new(x, y, w, h);
}
#endif
/* note: keep sorted by priority, highest first */
static const struct ecore_evas_engine _engines[] = {
/* unix */
@ -1022,9 +999,6 @@ static const struct ecore_evas_engine _engines[] = {
{"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
{"sdl", _ecore_evas_constructor_sdl},
{"buffer", _ecore_evas_constructor_buffer},
#ifdef BUILD_ECORE_EVAS_EWS
{"ews", _ecore_evas_constructor_ews},
#endif
{NULL, NULL}
};

@ -219,7 +219,6 @@ ecore_evas_buffer_render(Ecore_Evas *ee)
return r;
}
// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
static void
_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
{

File diff suppressed because it is too large Load Diff

@ -250,9 +250,6 @@ _ecore_evas_available_engines_get(void)
{
#ifdef BUILD_ECORE_EVAS_BUFFER
ADDENG("buffer");
#endif
#ifdef BUILD_ECORE_EVAS_EWS
ADDENG("ews");
#endif
}
else if (!strcmp(name, "cocoa"))

@ -5268,11 +5268,7 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U
default:
disp = getenv("ELM_DISPLAY");
if ((disp) && (!strcmp(disp, "ews")))
{
enginelist[p++] = ELM_EWS;
}
else if ((disp) && (!strcmp(disp, "buffer")))
if ((disp) && (!strcmp(disp, "buffer")))
{
enginelist[p++] = ELM_BUFFER;
}
@ -5534,8 +5530,6 @@ _elm_win_finalize_internal(Eo *obj, Efl_Ui_Win_Data *sd, const char *name, Efl_U
tmp_sd.ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
else if (!strcmp(enginelist[i], ELM_OPENGL_COCOA))
tmp_sd.ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
else if (!strcmp(enginelist[i], ELM_EWS))
tmp_sd.ee = ecore_evas_ews_new(0, 0, 1, 1);
else if (!strcmp(enginelist[i], ELM_SOFTWARE_FB))
tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
else if (!strcmp(enginelist[i], ELM_BUFFER))

@ -50,7 +50,6 @@ const char *_elm_engines[] = {
"sdl",
"opengl_sdl",
"buffer",
"ews",
"opengl_cocoa",
"wayland_shm",
"wayland_egl",
@ -2546,8 +2545,6 @@ _env_get(void)
eina_stringshare_replace(&_elm_config->engine, ELM_BUFFER);
else if ((!strncmp(s, "shot:", 5)))
eina_stringshare_replace(&_elm_config->engine, s);
else if ((!strcasecmp(s, "ews")))
eina_stringshare_replace(&_elm_config->engine, ELM_EWS);
else if ((!strcasecmp(s, "wayland_shm")) ||
(!strcasecmp(s, "wayland-shm")))
eina_stringshare_replace(&_elm_config->engine, ELM_WAYLAND_SHM);

@ -1190,7 +1190,6 @@ EAPI void elm_config_password_show_last_timeout_set(double password_show_la
* The following are the available engines:
* @li "fb" (Framebuffer)
* @li "buffer" (Pixel Memory Buffer)
* @li "ews" (Ecore + Evas Single Process Windowing System)
* @li NULL - no engine config
*
* @deprecated Please use elm_config_accel_preference_override_set() instead

@ -144,7 +144,6 @@ _elm_rescale(void)
{
edje_scale_set(_elm_config->scale);
_elm_win_rescale(NULL, EINA_FALSE);
_elm_ews_wm_rescale(NULL, EINA_FALSE);
}
static void *app_mainfunc = NULL;
@ -869,12 +868,8 @@ elm_quicklaunch_sub_init(int argc,
EINA_SAFETY_ON_FALSE_GOTO(ecore_con_init(), ql_sub_ecore_con);
EINA_SAFETY_ON_FALSE_GOTO(ecore_con_url_init(), ql_sub_ecore_con_url);
_elm_prefs_initted = _elm_prefs_init();
EINA_SAFETY_ON_FALSE_GOTO(_elm_ews_wm_init(), ql_sub_ews);;
}
return _elm_sub_init_count;
ql_sub_ews:
if (_elm_prefs_initted) _elm_prefs_shutdown();
ecore_con_url_shutdown();
ql_sub_ecore_con_url:
ecore_con_shutdown();
ql_sub_ecore_con:
@ -900,7 +895,6 @@ elm_quicklaunch_sub_shutdown(void)
ecore_shutdown_ex();
_elm_win_shutdown();
_elm_ews_wm_shutdown();
ecore_con_url_shutdown();
ecore_con_shutdown();
ecore_imf_shutdown();

@ -288,13 +288,12 @@ extern const char *_elm_engines[];
# define ELM_SOFTWARE_SDL (_elm_engines[4])
# define ELM_OPENGL_SDL (_elm_engines[5])
# define ELM_BUFFER (_elm_engines[6])
# define ELM_EWS (_elm_engines[7])
# define ELM_OPENGL_COCOA (_elm_engines[8])
# define ELM_WAYLAND_SHM (_elm_engines[9])
# define ELM_WAYLAND_EGL (_elm_engines[10])
# define ELM_DRM (_elm_engines[11])
# define ELM_SOFTWARE_DDRAW (_elm_engines[12])
# define ELM_GL_DRM (_elm_engines[13])
# define ELM_OPENGL_COCOA (_elm_engines[7])
# define ELM_WAYLAND_SHM (_elm_engines[8])
# define ELM_WAYLAND_EGL (_elm_engines[9])
# define ELM_DRM (_elm_engines[10])
# define ELM_SOFTWARE_DDRAW (_elm_engines[11])
# define ELM_GL_DRM (_elm_engines[12])
# define ELM_FONT_TOKEN_STYLE ":style="
@ -667,11 +666,6 @@ void _elm_prefs_data_init(void);
void _elm_prefs_data_shutdown(void);
/* init functions for dnd and cnp */
int _elm_ews_wm_init(void);
void _elm_ews_wm_shutdown(void);
void _elm_ews_wm_rescale(Elm_Theme *th,
Eina_Bool use_theme);
void _elm_win_shutdown(void);
void _elm_win_rescale(Elm_Theme *th,
Eina_Bool use_theme);

@ -867,7 +867,6 @@ elm_theme_flush(Elm_Theme *th)
if (th->cache_style_load_failed) eina_hash_free(th->cache_style_load_failed);
th->cache_style_load_failed = eina_hash_string_superfast_new(NULL);
_elm_win_rescale(th, EINA_TRUE);
_elm_ews_wm_rescale(th, EINA_TRUE);
if (th->referrers)
{
Eina_List *l;

@ -39,7 +39,6 @@
* GDI with software)
* @li "ddraw", "software-ddraw", "software_ddraw" (Windows WIN32 rendering via
* DirectDraw with software)
* @li "ews" (rendering to EWS - Ecore + Evas Single Process Windowing System)
* @li "gl-cocoa", "gl_cocoa", "opengl-cocoa", "opengl_cocoa" (OpenGL rendering in Cocoa)
* @li "wayland_shm" (Wayland client SHM rendering)
* @li "wayland_egl" (Wayland client OpenGL/EGL rendering)

@ -1,531 +0,0 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Elementary.h>
#include "elm_priv.h"
static Eina_Bool _ews_used = EINA_FALSE;
static Eina_List *_ews_ev_handlers = NULL;
static Eina_Hash *_ews_borders = NULL;
static Eina_Hash *_ews_borders_geo = NULL;
static Evas_Object *_ews_bg = NULL;
static Ecore_Animator *_ews_border_mover = NULL;
static Evas_Object *_ews_border_mover_obj = NULL;
static Evas_Point _ews_border_mover_off = {0, 0};
static void
_elm_ews_border_usable_screen_geometry_get(int *x, int *y, int *w, int *h)
{
Ecore_Evas *ee = ecore_evas_ews_ecore_evas_get();
ecore_evas_geometry_get(ee, NULL, NULL, w, h);
if (x) *x = 0;
if (y) *y = 0;
// TODO: when add a shelf for iconified, subtract its area here.
}
static void
_elm_ews_wm_border_del(void *data)
{
Evas_Object *deco = data;
evas_object_del(deco);
if (_ews_border_mover_obj == deco)
{
ELM_SAFE_FREE(_ews_border_mover, ecore_animator_del);
_ews_border_mover_obj = NULL;
}
}
static Evas_Object *
_elm_ews_wm_border_find(const Ecore_Evas *ee)
{
return eina_hash_find(_ews_borders, &ee);
}
static Eina_Rectangle *
_elm_ews_wm_border_geo_find(const Ecore_Evas *ee)
{
return eina_hash_find(_ews_borders_geo, &ee);
}
static void
_elm_ews_border_geo_apply(Ecore_Evas *ee, Evas_Object *o)
{
int x, y, w, h;
ecore_evas_geometry_get(ee, &x, &y, &w, &h);
evas_object_geometry_set(o, x, y, w, h);
}
static void
_elm_ews_border_focus_apply(Ecore_Evas *ee, Evas_Object *o)
{
const char *sig;
if (ecore_evas_focus_get(ee))
sig = "elm,state,focus,on";
else
sig = "elm,state,focus,off";
edje_object_signal_emit(o, sig, "elm");
}
static void
_elm_ews_border_stack_apply(Ecore_Evas *ee, Evas_Object *o)
{
Evas_Object *bs_o = ecore_evas_ews_backing_store_get(ee);
evas_object_stack_below(o, bs_o);
}
static void
_elm_ews_border_iconified_apply(Ecore_Evas *ee, Evas_Object *o)
{
const char *sig;
if (ecore_evas_iconified_get(ee))
sig = "elm,state,iconified,on";
else
sig = "elm,state,iconified,off";
edje_object_signal_emit(o, sig, "elm");
// TODO: add to some taskbar? and actually hide it?
DBG("EWS does not implement iconified yet");
}
static void
_elm_ews_border_maximized_apply(Ecore_Evas *ee, Evas_Object *o)
{
int x, y, w, h;
if (ecore_evas_maximized_get(ee))
{
Eina_Rectangle *r;
int ex, ey, ew, eh;
edje_object_signal_emit(o, "elm,state,maximized,on", "elm");
edje_object_message_signal_process(o);
ecore_evas_geometry_get(ee, &x, &y, &w, &h);
r = _elm_ews_wm_border_geo_find(ee);
if (!r)
{
r = malloc(sizeof(Eina_Rectangle));
eina_hash_add(_ews_borders_geo, &ee, r);
}
r->x = x;
r->y = y;
r->w = w;
r->h = h;
_elm_ews_border_usable_screen_geometry_get(&x, &y, &w, &h);
edje_object_parts_extends_calc(o, &ex, &ey, &ew, &eh);
x -= ex;
y -= ey;
w -= ew - r->w;
h -= eh - r->h;
}
else
{
Eina_Rectangle *r = _elm_ews_wm_border_geo_find(ee);
edje_object_signal_emit(o, "elm,state,maximized,off", "elm");
if (!r) ecore_evas_geometry_get(ee, &x, &y, &w, &h);
else
{
x = r->x;
y = r->y;
w = r->w;
h = r->h;
}
}
ecore_evas_move_resize(ee, x, y, w, h);
_elm_ews_border_geo_apply(ee, o);
}
static void
_elm_ews_border_layer_apply(Ecore_Evas *ee, Evas_Object *o)
{
Evas_Object *bs_o = ecore_evas_ews_backing_store_get(ee);
evas_object_layer_set(o, evas_object_layer_get(bs_o));
_elm_ews_border_stack_apply(ee, o);
}
static void
_elm_ews_border_fullscreen_apply(Ecore_Evas *ee, Evas_Object *o)
{
const char *sig;
if (ecore_evas_fullscreen_get(ee))
sig = "elm,state,fullscreen,on";
else
sig = "elm,state,fullscreen,off";
edje_object_signal_emit(o, sig, "elm");
_elm_ews_border_geo_apply(ee, o);
}
static void
_elm_ews_border_config_apply(Ecore_Evas *ee, Evas_Object *o, Elm_Theme *th)
{
const char *title, *name = NULL, *class = NULL, *style = NULL;
const char *sig;
if (ecore_evas_borderless_get(ee))
style = "borderless";
_elm_theme_set(th, o, "ews", "decoration", style ? style : "default", EINA_TRUE);
if (ecore_evas_shaped_get(ee) || ecore_evas_alpha_get(ee) ||
ecore_evas_transparent_get(ee))
sig = "elm,state,alpha,on";
else
sig = "elm,state,alpha,off";
edje_object_signal_emit(o, sig, "elm");
title = ecore_evas_title_get(ee);
ecore_evas_name_class_get(ee, &name, &class);
edje_object_part_text_escaped_set(o, "elm.text.title", title);
edje_object_part_text_escaped_set(o, "elm.text.name", name);
edje_object_part_text_escaped_set(o, "elm.text.class", class);
_elm_ews_border_geo_apply(ee, o);
_elm_ews_border_focus_apply(ee, o);
_elm_ews_border_stack_apply(ee, o);
_elm_ews_border_iconified_apply(ee, o);
_elm_ews_border_maximized_apply(ee, o);
_elm_ews_border_layer_apply(ee, o);
_elm_ews_border_fullscreen_apply(ee, o);
}
static Eina_Bool
_elm_ews_wm_border_theme_set(Ecore_Evas *ee, Evas_Object *o, Elm_Theme *th)
{
_elm_ews_border_config_apply(ee, o, th);
return EINA_TRUE;
}
static void
_elm_ews_border_sig_focus(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
ecore_evas_focus_set(ee, EINA_TRUE);
}
static void
_elm_ews_border_sig_iconify(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
ecore_evas_iconified_set(ee, EINA_TRUE);
}
static void
_elm_ews_border_sig_maximize(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
ecore_evas_maximized_set(ee, EINA_TRUE);
}
static void
_elm_ews_border_sig_fullscreen(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
ecore_evas_fullscreen_set(ee, EINA_TRUE);
}
static void
_elm_ews_border_sig_restore(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
ecore_evas_iconified_set(ee, EINA_FALSE);
ecore_evas_maximized_set(ee, EINA_FALSE);
ecore_evas_fullscreen_set(ee, EINA_FALSE);
}
static void
_elm_ews_border_sig_close(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
ecore_evas_ews_delete_request(ee);
}
static void
_elm_ews_border_sig_menu(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
// TODO: show some menu?
ERR("EWS does not implement menu yet");
(void)data;
}
static Eina_Bool
_elm_ews_border_mover(void *data)
{
Ecore_Evas *ee = data;
Evas_Object *o = _elm_ews_wm_border_find(ee);
int x, y;
evas_pointer_output_xy_get(ecore_evas_ews_evas_get(), &x, &y);
x -= _ews_border_mover_off.x;
y -= _ews_border_mover_off.y;
ecore_evas_move(ee, x, y);
evas_object_move(o, x, y);
return EINA_TRUE;
}
static void
_elm_ews_border_sig_move_start(void *data, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
Ecore_Evas *ee = data;
Evas_Object *bs_o = ecore_evas_ews_backing_store_get(ee);
int x, y, ox, oy;
ELM_SAFE_FREE(_ews_border_mover, ecore_animator_del);
evas_pointer_output_xy_get(evas_object_evas_get(bs_o), &x, &y);
evas_object_geometry_get(bs_o, &ox, &oy, NULL, NULL);
_ews_border_mover_off.x = x - ox;
_ews_border_mover_off.y = y - oy;
_ews_border_mover_obj = bs_o;
_ews_border_mover = ecore_evas_animator_add(bs_o, _elm_ews_border_mover, ee);
}
static void
_elm_ews_border_sig_move_stop(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, const char *sig EINA_UNUSED, const char *source EINA_UNUSED)
{
if (!_ews_border_mover) return;
ELM_SAFE_FREE(_ews_border_mover, ecore_animator_del);
_ews_border_mover_obj = NULL;
}
static Eina_Bool
_elm_ews_wm_add_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = edje_object_add(ecore_evas_ews_evas_get());
Evas_Coord x, y, w, h, sw, sh;
edje_object_signal_callback_add
(o, "elm,action,focus", "elm", _elm_ews_border_sig_focus, ee);
edje_object_signal_callback_add
(o, "elm,action,iconify", "elm", _elm_ews_border_sig_iconify, ee);
edje_object_signal_callback_add
(o, "elm,action,maximize", "elm", _elm_ews_border_sig_maximize, ee);
edje_object_signal_callback_add
(o, "elm,action,fullscreen", "elm", _elm_ews_border_sig_fullscreen, ee);
edje_object_signal_callback_add
(o, "elm,action,restore", "elm", _elm_ews_border_sig_restore, ee);
edje_object_signal_callback_add
(o, "elm,action,close", "elm", _elm_ews_border_sig_close, ee);
edje_object_signal_callback_add
(o, "elm,action,menu", "elm", _elm_ews_border_sig_menu, ee);
edje_object_signal_callback_add
(o, "elm,action,move,start", "elm", _elm_ews_border_sig_move_start, ee);
edje_object_signal_callback_add
(o, "elm,action,move,stop", "elm", _elm_ews_border_sig_move_stop, ee);
eina_hash_add(_ews_borders, &ee, o);
_elm_ews_wm_border_theme_set(ee, o, NULL);
ecore_evas_screen_geometry_get(ee, NULL, NULL, &sw, &sh);
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
x = (sw - w) / 2;
y = (sh - h) / 2;
ecore_evas_move(ee, x, y);
ecore_evas_focus_set(ee, EINA_TRUE);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_del_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
eina_hash_del(_ews_borders, &ee, NULL);
eina_hash_del(_ews_borders_geo, &ee, NULL);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_geo_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_geo_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_show_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
evas_object_show(o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_hide_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
evas_object_hide(o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_focus_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_focus_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_stack_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_stack_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_iconified_change_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_iconified_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_maximized_change_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_maximized_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_layer_change_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_layer_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_fullscreen_change_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_fullscreen_apply(ee, o);
return EINA_TRUE;
}
static Eina_Bool
_elm_ews_wm_config_change_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event_info)
{
Ecore_Evas *ee = event_info;
Evas_Object *o = _elm_ews_wm_border_find(ee);
_elm_ews_border_config_apply(ee, o, NULL);
return EINA_TRUE;
}
void
_elm_ews_wm_rescale(Elm_Theme *th, Eina_Bool use_theme)
{
Eina_Iterator *it;
Eina_Hash_Tuple *tp = NULL;
if (!_ews_borders) return;
it = eina_hash_iterator_tuple_new(_ews_borders);
if (!use_theme)
{
EINA_ITERATOR_FOREACH(it, tp)
_elm_ews_wm_border_theme_set(*(void**)tp->key, tp->data, NULL);
if (_ews_bg)
_elm_theme_set(NULL, _ews_bg, "ews", "background", "default", EINA_TRUE);
}
else
{
EINA_ITERATOR_FOREACH(it, tp)
_elm_ews_wm_border_theme_set(*(void**)tp->key, tp->data, th);
if (_ews_bg)
_elm_theme_set(th, _ews_bg, "ews", "background", "default", EINA_TRUE);
}
eina_iterator_free(it);
}
int
_elm_ews_wm_init(void)
{
Evas *e;
Evas_Object *o;
if ((!_elm_config->engine) || (!(!strcmp(_elm_config->engine, ELM_EWS))))
{
_ews_used = EINA_FALSE;
return EINA_TRUE;
}
e = ecore_evas_ews_evas_get();
if (!e) return EINA_FALSE;
o = edje_object_add(e);
if (!o) return EINA_FALSE;
if (_elm_theme_set(NULL, o, "ews", "background", "default", EINA_TRUE) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
{
ERR("Could not set background theme, fallback to rectangle");
evas_object_del(o);
_ews_bg = o = NULL;
}
else
_ews_bg = o;
ecore_evas_ews_background_set(o);
#define ADD_EH(ev, cb) \
_ews_ev_handlers = eina_list_append \
(_ews_ev_handlers, ecore_event_handler_add(ev, cb, NULL))
ADD_EH(ECORE_EVAS_EWS_EVENT_ADD, _elm_ews_wm_add_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_DEL, _elm_ews_wm_del_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_RESIZE, _elm_ews_wm_geo_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_MOVE, _elm_ews_wm_geo_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_SHOW, _elm_ews_wm_show_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_HIDE, _elm_ews_wm_hide_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_FOCUS, _elm_ews_wm_focus_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_UNFOCUS, _elm_ews_wm_focus_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_RAISE, _elm_ews_wm_stack_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_LOWER, _elm_ews_wm_stack_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE, _elm_ews_wm_iconified_change_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE, _elm_ews_wm_maximized_change_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_LAYER_CHANGE, _elm_ews_wm_layer_change_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE, _elm_ews_wm_fullscreen_change_cb);
ADD_EH(ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE, _elm_ews_wm_config_change_cb);
#undef ADD_EH
if (!_ews_borders)
_ews_borders = eina_hash_pointer_new(_elm_ews_wm_border_del);
if (!_ews_borders_geo)
_ews_borders_geo = eina_hash_pointer_new(free);
_ews_used = EINA_TRUE;
return EINA_TRUE;
}
void
_elm_ews_wm_shutdown(void)
{
Ecore_Event_Handler *eh;
ELM_SAFE_FREE(_ews_border_mover, ecore_animator_del);
_ews_border_mover_obj = NULL;
EINA_LIST_FREE(_ews_ev_handlers, eh) ecore_event_handler_del(eh);
ELM_SAFE_FREE(_ews_borders, eina_hash_free);
ELM_SAFE_FREE(_ews_borders_geo, ecore_animator_del);
_ews_bg = NULL;
}

@ -858,7 +858,6 @@ elementary_src = files([
'els_box.c',
'els_cursor.c',
'els_tooltip.c',
'elu_ews_wm.c',
'efl_ui_container_layout.c',
'efl_ui_container_layout.h',
'efl_ui_box.c',

@ -44,5 +44,3 @@ if get_option('vnc-server')
subdir(join_paths('vnc_server'))
endif
config_h.set('BUILD_ECORE_EVAS_EWS', '1')

Loading…
Cancel
Save