From 54879ae205bc659fcd0fd1d0f78901260762c48e Mon Sep 17 00:00:00 2001 From: devilhorns Date: Tue, 27 Mar 2012 02:17:22 +0000 Subject: [PATCH] Ecore_Evas (wayland): - Add ecore_wl_sync to ecore_evas_wayland_* (needed for some compositors). - Implement ecore_evas_wayland_type_set (for setting window types). - Implement ecore_evas_wayland_pointer_set (for setting pointer hotspots). - Fix ecore_evas_alpha/transparent set. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@69645 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_evas/Ecore_Evas.h | 5 ++-- src/lib/ecore_evas/ecore_evas.c | 40 ++++++++++++++++++++++++++++ src/lib/ecore_evas/ecore_evas_wayland_egl.c | 7 +++-- src/lib/ecore_evas/ecore_evas_wayland_shm.c | 41 +++++++++++++++++++---------- 4 files changed, 75 insertions(+), 18 deletions(-) diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index a78824e..84f5345 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -878,8 +878,9 @@ EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, unsigned EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, int y, int w, int h, Eina_Bool frame); EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location); /* EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); */ -/* EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); */ -/* EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); */ +EAPI void ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y); +EAPI void ecore_evas_wayland_type_set(Ecore_Evas *ee, int type); +EAPI Ecore_Wl_Window *ecore_evas_wayland_window_get(const Ecore_Evas *ee); /** * @brief Create a new @c Ecore_Evas canvas bound to the Evas diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 6ecd609..aac1659 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -2846,10 +2846,50 @@ ecore_evas_wayland_resize(Ecore_Evas *ee, int location) } } +EAPI void +ecore_evas_wayland_type_set(Ecore_Evas *ee, int type) +{ + if (!ee) return; + ecore_wl_window_type_set(ee->engine.wl.win, type); +} + +EAPI Ecore_Wl_Window * +ecore_evas_wayland_window_get(const Ecore_Evas *ee) +{ + return ee->engine.wl.win; +} + +EAPI void +ecore_evas_wayland_pointer_set(Ecore_Evas *ee, int hot_x, int hot_y) +{ + Ecore_Wl_Window *win; + + win = ecore_evas_wayland_window_get(ee); + /* ecore_wl_window_pointer_set(win, ee->engine.wl.buffer, hot_x, hot_y); */ +} + #else EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__) { } + +EAPI void +ecore_evas_wayland_type_set(Ecore_Evas *ee __UNUSED__, int type __UNUSED__) +{ + +} + +EAPI Ecore_Wl_Window * +ecore_evas_wayland_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return NULL; +} + +EAPI void +ecore_evas_wayland_pointer_set(Ecore_Evas *ee __UNUSED__, int hot_x __UNUSED__, int hot_y __UNUSED__) +{ + +} #endif diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index e88fc35..c65fd8f 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -162,7 +162,7 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in Ecore_Wl_Window *p = NULL; Evas_Engine_Info_Wayland_Egl *einfo; Ecore_Evas *ee; - int method = 0; + int method = 0, count = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -172,11 +172,14 @@ ecore_evas_wayland_egl_new(const char *disp_name, unsigned int parent, int x, in return NULL; } - if (!ecore_wl_init(disp_name)) + count = ecore_wl_init(disp_name); + if (!count) { ERR("Failed to initialize Ecore_Wayland"); return NULL; } + else if (count >= 1) + ecore_wl_sync(); if (!(ee = calloc(1, sizeof(Ecore_Evas)))) { diff --git a/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/src/lib/ecore_evas/ecore_evas_wayland_shm.c index 4c7ee2d..2fca1a7 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_shm.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_shm.c @@ -2,7 +2,7 @@ # include "config.h" #endif -#define LOGFNS 1 +//#define LOGFNS 1 #ifdef LOGFNS # include @@ -163,7 +163,7 @@ ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, in Ecore_Wl_Window *p = NULL; Evas_Engine_Info_Wayland_Shm *einfo; Ecore_Evas *ee; - int method = 0; + int method = 0, count = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -173,11 +173,14 @@ ecore_evas_wayland_shm_new(const char *disp_name, unsigned int parent, int x, in return NULL; } - if (!ecore_wl_init(disp_name)) + count = ecore_wl_init(disp_name); + if (!count) { ERR("Failed to initialize Ecore_Wayland"); return NULL; } + else if (count >= 1) + ecore_wl_sync(); if (!(ee = calloc(1, sizeof(Ecore_Evas)))) { @@ -502,11 +505,14 @@ _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) /* damage buffer */ // wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h); - ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); - /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */ - /* ecore_wl_flush(); */ - - ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h); + if (ee->engine.wl.win) + { + ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, + 0, 0); + /* ecore_wl_window_damage(ee->engine.wl.win, 0, 0, ee->w, ee->h); */ + /* ecore_wl_flush(); */ + ecore_wl_window_update_size(ee->engine.wl.win, ee->w, ee->h); + } if (ee->func.fn_resize) ee->func.fn_resize(ee); } @@ -531,19 +537,22 @@ _ecore_evas_wl_show(Ecore_Evas *ee) } _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); + ecore_wl_flush(); + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + if (ee->engine.wl.win) + { + /* ecore_wl_window_show(ee->engine.wl.win); */ + ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); + } + if (ee->engine.wl.frame) { evas_object_show(ee->engine.wl.frame); evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); } - ecore_wl_flush(); - - if (ee->engine.wl.win) - ecore_wl_window_buffer_attach(ee->engine.wl.win, ee->engine.wl.buffer, 0, 0); - ee->visible = 1; if (ee->func.fn_show) ee->func.fn_show(ee); } @@ -738,6 +747,8 @@ _ecore_evas_wl_alpha_set(Ecore_Evas *ee, int alpha) if (!ee) return; if ((ee->alpha == alpha)) return; ee->alpha = alpha; + if (ee->engine.wl.win) + ecore_wl_window_transparent_set(ee->engine.wl.win, alpha); if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) { einfo->info.destination_alpha = alpha; @@ -757,6 +768,8 @@ _ecore_evas_wl_transparent_set(Ecore_Evas *ee, int transparent) if (!ee) return; if ((ee->transparent == transparent)) return; ee->transparent = transparent; + if (ee->engine.wl.win) + ecore_wl_window_transparent_set(ee->engine.wl.win, transparent); if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) { einfo->info.destination_alpha = transparent; @@ -872,7 +885,7 @@ _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest) if (dest) *dest = ret; ee->engine.wl.buffer = - wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format); + wl_shm_create_buffer(shm, fd, ee->w, ee->h, stride, format); close(fd); } -- 2.7.4