From: Jinkun Jang Date: Fri, 15 Mar 2013 16:19:08 +0000 (+0900) Subject: merge with master X-Git-Tag: accepted/tizen_2.1/20130425.024948~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1eb59fe8bf75517bfbe9958959a5d6467ca7c494;p=profile%2Fmobile%2Fecore.git merge with master --- diff --git a/AUTHORS b/AUTHORS index ff9f752..e360d24 100644 --- a/AUTHORS +++ b/AUTHORS @@ -55,3 +55,6 @@ Vikram Narayanan Seong-ho Cho (DarkCircle) Patryk Kaczmarek Daniel Willmann +Michal Pakula vel Rutka +Alexey Yakovenko +Robert David diff --git a/ChangeLog b/ChangeLog index d9f5d9b..61678ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -995,3 +995,78 @@ * Wayland SHM now features a mechanism to synchronize rendering with the compositor, removing tearing effect in animations when using that engine. + +2012-10-10 Michal Pakula vel Rutka + + * Fix: Send ECORE_X_EVENT_SELECTION_NOTIFY even if there is no data. + +2012-11-23 Sebastian Dransfeld + + * Correctly define alloca + * Minor build fixes for solaris + +2012-11-27 Alexey Yakovenko + + * Fix ecore_evas_sdl window resize bug. + +2012-12-05 Robert David + + * Fix Ecore_Evas_Extn on Solaris 11. + +2012-12-07 Cedric Bail + + * Don't leak fd on exec. + +2012-12-07 Luis Felipe Strano Moraes + + * 1.7.3 release + +2012-12-09 Cedric Bail + + * Fix build without IPv6. + +2012-12-12 Daniel Willmann + + * Fix possible memory corruption in xrandr EDID functions. + +2012-12-12 Nicolas Aguirre + + * Fix build on win32 + +2012-12-17 Vincent Torri + + * Add XML output to doc + * Add installation rule for doc + +2012-12-19 Luis Felip Strano Moraes + + * Backport 81304 which fixes memory errors on ecore_evas_extn + +2012-12-19 Christopher Michael + + * Fix XCB compile with screensaver support + +2012-12-20 Carsten Haitzler (The Rasterman) + + * Fixed 24bpp ximage convert back from 24bpp to 32bpp in + ecore-x. Only shows itself in qemu/kvm. + + +2012-12-21 Luis Felipe Strano Moraes + + * 1.7.4 release + +2013-01-03 Carsten Haitzler (The Rasterman) + + * Fixed ecore_con case where freeing server double-frees clients + + +2013-01-04 Luis Felipe Strano Moraes + + * 1.7.5 release + +2013-01-13 Boris Faure (billiob) + + * Fixed condition based on uninitialized value in ecore_x_selection + (both xlib and xcb). + * Fixed a leaked when no selection converter matches. diff --git a/NEWS b/NEWS index f08395d..d2f18ec 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Ecore 1.8.0 -Changes since Ecore 1.7.0: + +Ecore 1.7.99 + +Changes since Ecore 1.7.98: -------------------------- Additions: @@ -35,10 +38,69 @@ Fixes: - ecore_x_randr to actually return crtcs properly. - ecore_x_randr to actually return crtcs possible outputs properly. - ecore_x_randr to actually return crtcs outputs properly. + * send ECORE_X_EVENT_SELECTION_NOTIFY even if there is no data. Improvements: -Ecore 1.7.0 + +Ecore 1.7.5 + +Changes since Ecore 1.7.4: +-------------------------- + +Fixes: + * Fix ecore_con case where freeing server double-frees clients + +Ecore 1.7.4 + +Changes since Ecore 1.7.3: +-------------------------- + +Fixes: + * Fix XCB compile with screensaver support + * Fix build without IPv6. + * Fix possible memory corruption in xrandr EDID functions. + * Backport 81304, which fixes memory errors in ecore_evas_extn + * Fix big rendering/conversion problem in kvm/qemu 24bpp. + +Ecore 1.7.3 + +Changes since Ecore 1.7.2: +-------------------------- + +Fixes: + * Fix small leak in Ecore Wayland. + * Fix Ecore_Evas_SDL resize bug. + * Fix Ecore_Evas_Extn build on Solaris 11. + * Fix Wayland support to latest API. + * Don't leak fd on exec. + +Ecore 1.7.2 + +Changes since Ecore 1.7.1: +-------------------------- + +No Changes, just updating to keep in sync with last release. + +Changes since Ecore 1.7.0 +-------------------------- + +Fixes: + * ecore_con_ssl: fix crash on failure with privkeys and certificate. + * ecore_con_ssl: fix ssl connections. + * ecore_con: fix race condition with event from disconnected clients. + * ecore_con_url: properly reschedule call to curl. + * ecore_evas: rotation handling on some driver implementations + * ecore_file: ecore_file_escape_name() escape taba nd newline right. + * ecore_x_image_is_argb32_get() returns correctly given endianness. + * ecore_x: fix ecore_x_randr. + * ecore_x: send ECORE_X_EVENT_SELECTION_NOTIFY even if there is no data. + * ecore_imf: ibus module potential segv fixed. + * ecore: ecore_thread_feedback() memory allocation and corruption fixed. + * ecore_wayland: + - Update to work with latest wayland (0.99) from git. + - Fix leak of struct wl_registry + * ecore_evas: fix Ecore_Evas_Extn build on Solaris 11. Changes since Ecore 1.2.0: -------------------------- @@ -75,6 +137,7 @@ Fixes: * ecore_x - Fix unitialized Ecore_X_Atom use. + * send ECORE_X_EVENT_SELECTION_NOTIFY even if there is no data. Ecore 1.2.0 diff --git a/configure.ac b/configure.ac index 2a6c8d7..4514600 100644 --- a/configure.ac +++ b/configure.ac @@ -560,7 +560,7 @@ requirements_ecore_input_evas="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_eco requirements_ecore_ipc="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_ipc}" requirements_ecore_cocoa="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_cocoa}" requirements_ecore_sdl="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_sdl}" -requirements_ecore_psl1ght="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_sdl}" +requirements_ecore_psl1ght="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_psl1ght}" requirements_ecore_win32="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_win32}" requirements_ecore_wince="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_wince}" requirements_ecore_x="ecore >= 1.6.99 eina >= 1.6.99 ${requirements_ecore_x}" @@ -1737,7 +1737,7 @@ ECORE_CHECK_MODULE([directfb], [${want_ecore_directfb}], [DirectFB], [${have_dir # ecore_wince ECORE_CHECK_MODULE([wince], [${want_ecore_wince}], [WinCE], [${have_ecore_input}], - [requirements_ecore_win32="ecore-input >= 1.6.99 ${requirements_ecore_win32}"]) + [requirements_ecore_wince="ecore-input >= 1.6.99 ${requirements_ecore_wince}"]) ## Ecore Evas diff --git a/packaging/ecore.spec b/packaging/ecore.spec index f53f848..24f28a1 100644 --- a/packaging/ecore.spec +++ b/packaging/ecore.spec @@ -1,7 +1,7 @@ Name: ecore Summary: Enlightened Core X interface library -Version: 1.7.1+svn.77580+build01r01 -Release: 1 +Version: 1.7.1+svn.77580+build07r01 +Release: 2 Group: System/Libraries License: BSD URL: http://www.enlightenment.org diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am index 00ea91d..89ec6d9 100644 --- a/src/examples/Makefile.am +++ b/src/examples/Makefile.am @@ -55,6 +55,8 @@ SRCS = \ ecore_evas_basics_example.c \ ecore_evas_buffer_example_01.c \ ecore_evas_buffer_example_02.c \ + ecore_evas_extn_socket_example.c \ + ecore_evas_extn_plug_example.c \ ecore_evas_ews_example.c \ ecore_exe_example.c \ ecore_exe_example_child.c @@ -95,6 +97,8 @@ examples_PROGRAMS += \ ecore_evas_basics_example \ ecore_evas_buffer_example_01 \ ecore_evas_buffer_example_02 \ + ecore_evas_extn_socket_example \ + ecore_evas_extn_plug_example \ ecore_evas_ews_example \ ecore_client_bench \ ecore_server_bench \ @@ -111,6 +115,8 @@ ecore_con_client_simple_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/li ecore_evas_window_sizes_example_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la ecore_evas_buffer_example_01_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la ecore_evas_buffer_example_02_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_evas_extn_socket_example_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_evas_extn_plug_example_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la ecore_client_bench_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la ecore_server_bench_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la diff --git a/src/examples/ecore_evas_extn_plug_example.c b/src/examples/ecore_evas_extn_plug_example.c new file mode 100644 index 0000000..cee919e --- /dev/null +++ b/src/examples/ecore_evas_extn_plug_example.c @@ -0,0 +1,226 @@ +/** + * Ecore example illustrating the basics of ecore evas extn socket usage. + * + * You'll need at least one Evas engine built for it (excluding the + * buffer one). See stdout/stderr for output. + * You can check functions of ecore extn socket if you use ecore extn plug together. + * + * @verbatim + * gcc -o ecore_evas_extn_socket_example ecore_evas_extn_socket_example.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#else +#define EINA_UNUSED +#endif + +#include +#include +#include +// procotol version - change this as needed +#define MSG_DOMAIN_CONTROL_OBJECT 0x1004 +#define MSG_ID_BG_COLOR 0x1005 +#define MSG_ID_TEXT 0x1006 + +typedef struct _Msg_Color Msg_Color; + +struct _Msg_Color +{ + int r; + int g; + int b; + int a; +}; + +static void +_on_delete(Ecore_Evas *ee) +{ + Msg_Color *color = NULL; + + color = ecore_evas_data_get(ee, "color"); + if (color) free(color); + ecore_main_loop_quit(); +} + +static void +_button_1_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Ecore_Evas *ee; + Msg_Color *color = NULL; + int r = 0, g = 0, b = 0, a = 0; + + ee = data; + color = ecore_evas_data_get(ee, "color"); + + printf("Plug's button pressed\n"); + if (!color) + { + color = malloc(sizeof(Msg_Color)); + r = 255; + g = 0; + b = 0; + a = 255; + ecore_evas_data_set(ee, "color", color); + } + else + { + r = ((color->r) + 100) % 255; + g = ((color->g) + 100) % 255; + b = ((color->b) + 100) % 255; + a = color->a; + } + printf("Send color info (%x,%x,%x,%x)\n", r, g, b, a); + + color->r = r; + color->g = g; + color->b = b; + color->a = a; + + ecore_evas_msg_parent_send(ee, MSG_DOMAIN_CONTROL_OBJECT, MSG_ID_BG_COLOR, color, sizeof(Msg_Color)); +} + +static void +_ecore_evas_msg_handle(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + if (!data) return; + printf("Receive msg from server msg_domain=%x msg_id=%x size=%d\n", msg_domain, msg_id, size); + + if (msg_domain == MSG_DOMAIN_CONTROL_OBJECT) + { + if (msg_id == MSG_ID_TEXT) + { + Evas_Object *text = NULL; + char *txt = data; + int len = 0; + len = strlen(txt); + printf("data len= (%d).\n", len); + + text = ecore_evas_data_get(ee, "text"); + if (text && (size == strlen(txt))) + { + printf("Receive msg is text (%s).\n", txt); + evas_object_text_text_set(text, txt); + } + } + } +} + +int +main(void) +{ + Ecore_Evas *ee, *ee_plug; + Evas *canvas; + Evas_Object *bg, *button1, *text, *noti_text; + Evas_Object *plug; + int w, h; + int x1, x2, y; //for button position + int plug_x, plug_y, plug_w = 0, plug_h = 0; //for button position + + if (ecore_evas_init() <= 0) + return 1; + + w = 480; + h = 500; + x1 = 20; + x2 = 170; + y = 100; + plug_x = 10; + plug_y = y + (h / 4) + 20; + plug_w = 460; + plug_h = 200; + + ee = ecore_evas_new(NULL, 0, 0, w, h, NULL); + ecore_evas_title_set(ee, "Ecore Evas Extn Plug Example"); + ecore_evas_show(ee); + + ecore_evas_callback_delete_request_set(ee, _on_delete); + + printf("Using %s engine! ee=%p\n", ecore_evas_engine_name_get(ee), ee); + + //create ecore evas to show info + 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, 255, 0, 255, 255); + evas_object_resize(bg, w, h); + evas_object_show(bg); + + //button to change socket's bg + button1 = evas_object_rectangle_add(canvas); + evas_object_color_set(button1, 0, 255, 255, 255); + evas_object_resize(button1, w/4, 100); + evas_object_move(button1, x1, y); + evas_object_show(button1); + + text = evas_object_text_add(canvas); + evas_object_color_set(text, 0, 0, 0, 255); + evas_object_text_style_set(text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(text, "Sans", 15); + evas_object_text_text_set(text, "Chagne bg!!"); + evas_object_move(text, x1 + 5, y + 10); + evas_object_show(text); + + + //button to send msg1 to socket + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 0, 255, 255, 255); + evas_object_resize(bg, w/2, 100); + evas_object_move(bg, x2, y); + evas_object_show(bg); + text = evas_object_text_add(canvas); + evas_object_color_set(text, 0, 0, 0, 255); + evas_object_text_style_set(text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(text, "Sans", 15); + evas_object_text_text_set(text, "No Message from server!!"); + evas_object_move(text, x2 + 5, y + 10); + evas_object_show(text); + + //text to noti plug area + noti_text = evas_object_text_add(canvas); + evas_object_color_set(noti_text, 0, 0, 0, 255); + evas_object_text_style_set(noti_text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(noti_text, "Sans", 15); + evas_object_text_text_set(noti_text, "Below is the plug area!!"); + evas_object_move(noti_text, x1, plug_y - 25); + evas_object_show(noti_text); + + //create ecore evas extn plug(image object) show socket area + plug = ecore_evas_extn_plug_new(ee); + ecore_evas_data_set(ee, "plug", plug); + if (!plug) + { + printf("Fail to create ecore extn plug!\n"); + return 0; + } + + ee_plug = ecore_evas_object_ecore_evas_get(plug); + ecore_evas_data_set(ee_plug, "text", text); + + if(!ecore_evas_extn_plug_connect(plug, "socket_exam_service", 0, EINA_FALSE)) + { + printf("Fail to connect socket_exam_service!\n"); + return 0; + } + + evas_object_event_callback_add(button1, EVAS_CALLBACK_MOUSE_UP, _button_1_up, ee_plug); + //callback to deal with extn socket message + ecore_evas_callback_msg_handle_set(ee_plug, _ecore_evas_msg_handle); + + ecore_evas_data_set(ee_plug, "text", text); + + evas_object_resize(plug, plug_w, plug_h); + evas_object_move(plug, plug_x, plug_y); + evas_object_show(plug); + + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; +} + diff --git a/src/examples/ecore_evas_extn_socket_example.c b/src/examples/ecore_evas_extn_socket_example.c new file mode 100644 index 0000000..5697c57 --- /dev/null +++ b/src/examples/ecore_evas_extn_socket_example.c @@ -0,0 +1,202 @@ +/** + * Ecore example illustrating the basics of ecore evas extn socket usage. + * + * You'll need at least one Evas engine built for it (excluding the + * buffer one). See stdout/stderr for output. + * You can check functions of ecore extn socket if you use ecore extn plug together. + * + * @verbatim + * gcc -o ecore_evas_extn_socket_example ecore_evas_extn_socket_example.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#else +#define EINA_UNUSED +#endif + +#include +#include +#include + +// procotol version - change this as needed +#define MSG_DOMAIN_CONTROL_OBJECT 0x1004 +#define MSG_ID_BG_COLOR 0x1005 +#define MSG_ID_TEXT 0x1006 +static int num = 0; +typedef struct _Msg_Color Msg_Color; + +struct _Msg_Color +{ + int r; + int g; + int b; + int a; +}; + +static void +_on_delete(Ecore_Evas *ee) +{ + Ecore_Evas *ee_socket = NULL; + char *text = NULL; + ee_socket = ecore_evas_data_get(ee, "sock"); + if (ee_socket) + { + text = ecore_evas_data_get(ee_socket, "text"); + if (text) free(text); + } + ecore_main_loop_quit(); +} + +static void +_ecore_evas_msg_parent_handle(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + printf("Receive msg from clien msg_domain=%x msg_id=%x size=%d\n", msg_domain, msg_id, size); + if (!data) return; + + if (msg_domain == MSG_DOMAIN_CONTROL_OBJECT) + { + if (msg_id == MSG_ID_BG_COLOR) + { + Evas_Object *bg = NULL; + Msg_Color *color = NULL; + int r = 0, g = 0, b = 0, a = 0; + + bg = ecore_evas_data_get(ee, "bg"); + if (bg && (size == sizeof(Msg_Color))) + { + color = data; + r = color->r; + g = color->g; + b = color->b; + a = color->a; + printf("Receive msg is color r=%x g=%x b=%x a=%x\n", r, g, b, a); + evas_object_color_set(bg, color->r, color->g, color->b, color->a); + } + } + } +} + +static void +_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Ecore_Evas *ee = data; + size_t len = 0; + char *buf = NULL;; + + num++; + + if (!ee) return; + buf = ecore_evas_data_get(ee, "text"); + if (!buf) free(buf); + + buf = (char *)malloc(40); + memset(buf, 0, 40); + sprintf(buf, "Hello. I'm server!! number=%d!!", num); + len = strlen(buf); + ecore_evas_data_set(ee, "text", buf); + + printf("ecore extn socket txt = \"%s\" len=%d.", buf, len); + ecore_evas_msg_send(ee, MSG_DOMAIN_CONTROL_OBJECT, MSG_ID_TEXT, buf, len); +} + +int +main(void) +{ + Ecore_Evas *ee; + Ecore_Evas *ee_socket = NULL; + Evas *canvas; + Evas_Object *bg, *text; + Evas_Object *sock_bg; + int w, h; + int socket_w, socket_h; + + if (ecore_evas_init() <= 0) + return 1; + + w = 480; + h = 200; + + ee = ecore_evas_new(NULL, 0, 0, w, h, NULL); + ecore_evas_title_set(ee, "Ecore Evas Extn Socket Example"); + ecore_evas_show(ee); + + ecore_evas_callback_delete_request_set(ee, _on_delete); + + printf("Using %s engine! ee=%p\n", ecore_evas_engine_name_get(ee), ee); + + //create ecore evas to show info + 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, 255, 255, 0, 255); + evas_object_resize(bg, w, h); + evas_object_show(bg); + + text = evas_object_text_add(canvas); + evas_object_color_set(text, 0, 0, 0, 255); + evas_object_text_style_set(text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(text, "Sans", 15); + evas_object_text_text_set(text, "1. Run ecore_evas_extn_plug_examples!!"); + evas_object_move(text, 40, 30); + evas_object_show(text); + + text = evas_object_text_add(canvas); + evas_object_color_set(text, 0, 0, 0, 255); + evas_object_text_style_set(text, EVAS_TEXT_STYLE_PLAIN); + evas_object_text_font_set(text, "Sans", 15); + evas_object_text_text_set(text, "2. Press green rect to send msg to clients!!"); + evas_object_move(text, 40, 60); + evas_object_show(text); + + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 0, 255, 0, 255); + evas_object_resize(bg, w/4, h/4); + evas_object_move(bg, w/4, h/2); + evas_object_show(bg); + + //create ecore evas extn socket + socket_w = 460; + socket_h = 250; + + ee_socket = ecore_evas_extn_socket_new(1, 1); + ecore_evas_data_set(ee, "sock", ee_socket); + + if (!ee_socket) + { + printf("Fail to create ecore extn socket!\n"); + return 0; + } + + if(!ecore_evas_extn_socket_listen(ee_socket, "socket_exam_service", 0, EINA_FALSE)) + { + printf("Fail to listen socket_exam_service!\n"); + return 0; + } + ecore_evas_resize(ee_socket, socket_w, socket_h); + ecore_evas_show(ee_socket); + + //callback to deal with cient extn's message + ecore_evas_callback_msg_parent_handle_set(ee_socket, _ecore_evas_msg_parent_handle); + //_mouse_up is function to send msg to client extn plug + evas_object_event_callback_add(bg, EVAS_CALLBACK_MOUSE_UP, _mouse_up, ee_socket); + + canvas = ecore_evas_get(ee_socket); + + sock_bg = evas_object_rectangle_add(canvas); + evas_object_color_set(sock_bg, 0, 0, 255, 255); + evas_object_resize(sock_bg, socket_w, socket_h); + evas_object_move(sock_bg, 0, 0); + evas_object_show(sock_bg); + ecore_evas_data_set(ee_socket, "bg", sock_bg); + + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; +} diff --git a/src/lib/ecore/ecore_alloc.c b/src/lib/ecore/ecore_alloc.c index 58aa131..34f723f 100644 --- a/src/lib/ecore/ecore_alloc.c +++ b/src/lib/ecore/ecore_alloc.c @@ -2,6 +2,32 @@ # include "config.h" #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include diff --git a/src/lib/ecore/ecore_exe.c b/src/lib/ecore/ecore_exe.c index 7cc4b0f..5b20edf 100644 --- a/src/lib/ecore/ecore_exe.c +++ b/src/lib/ecore/ecore_exe.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include diff --git a/src/lib/ecore/ecore_getopt.c b/src/lib/ecore/ecore_getopt.c index 64f5f9c..377d310 100644 --- a/src/lib/ecore/ecore_getopt.c +++ b/src/lib/ecore/ecore_getopt.c @@ -2,21 +2,30 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif #ifdef HAVE_ALLOCA_H # include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#elif defined _MSC_VER -# include -# define alloca _alloca -#else -# include -# ifdef __cplusplus +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus extern "C" +# endif +void *alloca (size_t); # endif -void *alloca(size_t); #endif #include diff --git a/src/lib/ecore_con/dns.c b/src/lib/ecore_con/dns.c index b92a315..b8e3c53 100644 --- a/src/lib/ecore_con/dns.c +++ b/src/lib/ecore_con/dns.c @@ -27,6 +27,32 @@ # include "config.h" #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #if !defined(__FreeBSD__) #ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c index ab57378..27657de 100644 --- a/src/lib/ecore_con/ecore_con.c +++ b/src/lib/ecore_con/ecore_con.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include diff --git a/src/lib/ecore_con/ecore_con_alloc.c b/src/lib/ecore_con/ecore_con_alloc.c index 324d47d..5fb248f 100644 --- a/src/lib/ecore_con/ecore_con_alloc.c +++ b/src/lib/ecore_con/ecore_con_alloc.c @@ -2,6 +2,32 @@ # include "config.h" #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "Ecore.h" #include "ecore_private.h" #include "Ecore_Con.h" diff --git a/src/lib/ecore_con/ecore_con_info.c b/src/lib/ecore_con/ecore_con_info.c index f51eb26..4526c08 100644 --- a/src/lib/ecore_con/ecore_con_info.c +++ b/src/lib/ecore_con/ecore_con_info.c @@ -9,26 +9,36 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif #ifdef HAVE_ALLOCA_H # include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#elif defined _MSC_VER -# include -# define alloca _alloca -#else -# include -# ifdef __cplusplus +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus extern "C" +# endif +void *alloca (size_t); # endif -void *alloca(size_t); #endif #include #include #include +#include #include #ifdef __OpenBSD__ # include diff --git a/src/lib/ecore_con/ecore_con_local_win32.c b/src/lib/ecore_con/ecore_con_local_win32.c index 2b7e5c5..9fa499a 100644 --- a/src/lib/ecore_con/ecore_con_local_win32.c +++ b/src/lib/ecore_con/ecore_con_local_win32.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include diff --git a/src/lib/ecore_con/ecore_con_socks.c b/src/lib/ecore_con/ecore_con_socks.c index e609a6a..b4cca31 100644 --- a/src/lib/ecore_con/ecore_con_socks.c +++ b/src/lib/ecore_con/ecore_con_socks.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include diff --git a/src/lib/ecore_con/ecore_con_ssl.c b/src/lib/ecore_con/ecore_con_ssl.c index 1027dbb..20fafcc 100644 --- a/src/lib/ecore_con/ecore_con_ssl.c +++ b/src/lib/ecore_con/ecore_con_ssl.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #if USE_GNUTLS # include # include diff --git a/src/lib/ecore_config/ecore_config.c b/src/lib/ecore_config/ecore_config.c index e81538e..bb35700 100644 --- a/src/lib/ecore_config/ecore_config.c +++ b/src/lib/ecore_config/ecore_config.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index 8a93180..dd6e55b 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -681,6 +681,76 @@ EAPI void ecore_evas_profiles_set(Ecore_Evas *ee, const char **profiles, * @since 1.7.0 */ EAPI const char *ecore_evas_profile_get(const Ecore_Evas *ee); + +EAPI Eina_Bool ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee); +EAPI int ecore_evas_wm_rotation_get(const Ecore_Evas *ee); +/** + * @brief Send message to parent ecore + * + * @param ee The Ecore_Evas to set + * @param msg_domain The domain of message + * @param msg_id The id of message + * @param data The data of message + * @param size The size of message data + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.8.0 + * + * @see ecore_evas_msg_send() + * @see ecore_evas_callback_msg_parent_handle_set() + * @see eecore_evas_callback_msg_handle_set() + * + * This is a list of examples of these functions: + * @li @ref ecore_evas_extn_socket_example + * @li @ref ecore_evas_extn_plug_example + */ +EAPI void ecore_evas_msg_parent_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size); +/** + * @brief Send message to child ecore + * + * @param ee The Ecore_Evas to set + * @param msg_domain The domain of message + * @param msg_id The id of message + * @param data The data of message + * @param size The size of message data + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.8.0 + * + * @see ecore_evas_msg_parent_send() + * @see ecore_evas_callback_msg_parent_handle_set() + * @see eecore_evas_callback_msg_handle_set() + */ +EAPI void ecore_evas_msg_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size); +/** + * Set a callback for parent Ecore_Evas message. + * + * @param ee The Ecore_Evas to set callbacks on + * @param func_parent_handle The handle to be called when message arive. + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.8.0 + * + * @see ecore_evas_msg_parent_send() + * @see ecore_evas_msg_send() + * @see eecore_evas_callback_msg_handle_set() + */ +EAPI void ecore_evas_callback_msg_parent_handle_set(Ecore_Evas *ee, void (*func_parent_handle)(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size)); +/** + * Set a callback for child Ecore_Evas message. + * + * @param ee The Ecore_Evas to set callbacks on + * @param func_handle The handle to be called when message arive + * + * @warning Support for this depends on the underlying windowing system. + * @since 1.8.0 + * + * @see ecore_evas_msg_parent_send() + * @see ecore_evas_msg_send() + * @see ecore_evas_callback_msg_parent_handle_set() + */ +EAPI void ecore_evas_callback_msg_handle_set(Ecore_Evas *ee, void (*func_handle)(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size)); + /** * @brief Move an Ecore_Evas. * diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index 541c51b..2bb9235 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -893,6 +893,7 @@ ecore_evas_ecore_evas_get(const Evas *e) EAPI void ecore_evas_free(Ecore_Evas *ee) { + if (!ee) return; if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) { ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, @@ -1960,6 +1961,30 @@ ecore_evas_profile_get(const Ecore_Evas *ee) return ee->prop.profile; } +EAPI Eina_Bool +ecore_evas_wm_rotation_supported_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_wm_rotation_supported_get"); + return EINA_FALSE; + } + return ee->prop.wm_rot.supported; +} + +EAPI int +ecore_evas_wm_rotation_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_wm_rotation_get"); + return 0; + } + return ee->prop.wm_rot.angle; +} + EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) { @@ -2282,6 +2307,60 @@ ecore_evas_manual_render(Ecore_Evas *ee) } EAPI void +ecore_evas_msg_parent_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_msg_parent_send"); + return; + } + DBG("Msg(to parent): ee=%p msg_domain=%d msg_id=%d size=%d", ee, msg_domain, msg_id, size); + IFC(ee, fn_msg_parent_send) (ee, msg_domain, msg_id, data, size); + IFE; +} + +EAPI void +ecore_evas_msg_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_msg_send"); + return; + } + DBG("Msg: ee=%p msg_domain=%d msg_id=%d size=%d", ee, msg_domain, msg_id, size); + IFC(ee, fn_msg_send) (ee, msg_domain, msg_id, data, size); + IFE; +} + +EAPI void +ecore_evas_callback_msg_parent_handle_set(Ecore_Evas *ee, void (*func_parent_handle)(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_msg_parent_handle"); + return; + } + DBG("Msg Parent handle: ee=%p", ee); + ee->func.fn_msg_parent_handle = func_parent_handle; +} + +EAPI void +ecore_evas_callback_msg_handle_set(Ecore_Evas *ee, void (*func_handle)(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_msg_handle"); + return; + } + DBG("Msg handle: ee=%p", ee); + ee->func.fn_msg_handle = func_handle; +} + +EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync) { if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c index 77ee8c1..7a5bed3 100644 --- a/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/src/lib/ecore_evas/ecore_evas_buffer.c @@ -467,6 +467,42 @@ _ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha) } } +static void +_ecore_evas_buffer_msg_parent_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + Ecore_Evas *parent_ee = NULL; + parent_ee = ecore_evas_data_get(ee, "parent"); + + if (parent_ee) + { + if (parent_ee->func.fn_msg_parent_handle) + parent_ee ->func.fn_msg_parent_handle(parent_ee, msg_domain, msg_id, data, size); + } + else + { + if (ee->func.fn_msg_parent_handle) + ee ->func.fn_msg_parent_handle(ee, msg_domain, msg_id, data, size); + } +} + +static void +_ecore_evas_buffer_msg_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + Ecore_Evas *child_ee = NULL; + child_ee = ecore_evas_data_get(ee, "child"); + + if (!child_ee) + { + if (child_ee->func.fn_msg_handle) + child_ee->func.fn_msg_handle(child_ee, msg_domain, msg_id, data, size); + } + else + { + if (ee->func.fn_msg_handle) + ee->func.fn_msg_handle(ee, msg_domain, msg_id, data, size); + } +} + static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = { _ecore_evas_buffer_free, @@ -526,7 +562,9 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = _ecore_evas_buffer_render, NULL, // screen_geometry_get - NULL // screen_dpi_get + NULL, // screen_dpi_get + _ecore_evas_buffer_msg_parent_send, + _ecore_evas_buffer_msg_send }; #endif diff --git a/src/lib/ecore_evas/ecore_evas_cocoa.c b/src/lib/ecore_evas/ecore_evas_cocoa.c index 96ea1d4..62f9c2d 100644 --- a/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -474,7 +474,9 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = NULL, // render NULL, - NULL // screen_dpi_get + NULL, // screen_dpi_get + NULL, + NULL // msg_send }; #endif diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c index d6969cf..db2204e 100644 --- a/src/lib/ecore_evas/ecore_evas_ews.c +++ b/src/lib/ecore_evas/ecore_evas_ews.c @@ -694,7 +694,9 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = _ecore_evas_ews_render, _ecore_evas_ews_screen_geometry_get, - NULL // screen_dpi_get + NULL, // screen_dpi_get + NULL, + NULL // msg_send }; void diff --git a/src/lib/ecore_evas/ecore_evas_extn.c b/src/lib/ecore_evas/ecore_evas_extn.c index 6113539..317c576 100644 --- a/src/lib/ecore_evas/ecore_evas_extn.c +++ b/src/lib/ecore_evas/ecore_evas_extn.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include @@ -176,7 +202,9 @@ enum // opcodes OP_EV_MULTI_MOVE, OP_EV_KEY_UP, OP_EV_KEY_DOWN, - OP_EV_HOLD + OP_EV_HOLD, + OP_MSG_PARENT, + OP_MSG }; enum @@ -418,7 +446,7 @@ _ecore_evas_socket_lock(Ecore_Evas *ee) if (extn->file.have_lock) return; extn->file.have_lock = EINA_TRUE; if (_ecore_evas_lock_other_have(ee)) return; - flock(extn->file.lockfd, LOCK_EX); + lockf(extn->file.lockfd, F_LOCK, 0); extn->file.have_real_lock = EINA_TRUE; } @@ -433,7 +461,7 @@ _ecore_evas_socket_unlock(Ecore_Evas *ee) if (!extn->file.have_lock) return; extn->file.have_lock = EINA_FALSE; if (!extn->file.have_real_lock) return; - flock(extn->file.lockfd, LOCK_UN); + lockf(extn->file.lockfd, F_ULOCK, 0); } static void @@ -454,7 +482,7 @@ static void _ecore_evas_extn_plug_image_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Ecore_Evas *ee = data; - if (ee) ecore_evas_free(ee); + ecore_evas_free(ee); } static void @@ -505,6 +533,7 @@ _ecore_evas_extn_free(Ecore_Evas *ee) if (extn) { Ecore_Event_Handler *hdl; + Ipc_Data_Update *ipc; if (extn->file.have_lock) _ecore_evas_socket_unlock(ee); @@ -533,6 +562,9 @@ _ecore_evas_extn_free(Ecore_Evas *ee) shmfile_close(extn->file.shmfile); } + EINA_LIST_FREE(extn->file.updates, ipc) + free(ipc); + EINA_LIST_FREE(extn->ipc.handlers, hdl) ecore_event_handler_del(hdl); free(extn); @@ -565,12 +597,13 @@ _ecore_evas_extn_free(Ecore_Evas *ee) EVAS_CALLBACK_CANVAS_OBJECT_RENDER_POST, _ecore_evas_extn_plug_targer_render_post, ee); - evas_object_del(ee->engine.buffer.image); ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); if (ee2) { ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); } + evas_object_del(ee->engine.buffer.image); + ee->engine.buffer.image = NULL; } extn_ee_list = eina_list_remove(extn_ee_list, ee); } @@ -673,6 +706,7 @@ _ecore_evas_extn_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __ if (extn->ipc.server) { Ipc_Data_Ev_Mouse_In ipc; + memset(&ipc, 0, sizeof(ipc)); ipc.timestamp = ev->timestamp; ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); @@ -693,6 +727,7 @@ _ecore_evas_extn_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj _ if (extn->ipc.server) { Ipc_Data_Ev_Mouse_Out ipc; + memset(&ipc, 0, sizeof(ipc)); ipc.timestamp = ev->timestamp; ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); @@ -715,6 +750,7 @@ _ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj /* We have send mouse move event before mouse down event */ { Ipc_Data_Ev_Mouse_Move ipc_move; + memset(&ipc_move, 0, sizeof(ipc_move)); Evas_Coord x, y; x = ev->canvas.x; @@ -729,6 +765,7 @@ _ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj } { Ipc_Data_Ev_Mouse_Down ipc; + memset(&ipc, 0, sizeof(ipc)); ipc.b = ev->button; ipc.flags = ev->flags; ipc.timestamp = ev->timestamp; @@ -751,6 +788,7 @@ _ecore_evas_extn_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __ if (extn->ipc.server) { Ipc_Data_Ev_Mouse_Up ipc; + memset(&ipc, 0, sizeof(ipc)); ipc.b = ev->button; ipc.flags = ev->flags; @@ -773,6 +811,7 @@ _ecore_evas_extn_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj if (extn->ipc.server) { Ipc_Data_Ev_Mouse_Move ipc; + memset(&ipc, 0, sizeof(ipc)); Evas_Coord x, y; x = ev->cur.canvas.x; @@ -799,6 +838,7 @@ _ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj if (extn->ipc.server) { Ipc_Data_Ev_Mouse_Wheel ipc; + memset(&ipc, 0, sizeof(ipc)); ipc.direction = ev->direction; ipc.z = ev->z; @@ -821,6 +861,7 @@ _ecore_evas_extn_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj if (extn->ipc.server) { Ipc_Data_Ev_Multi_Down ipc; + memset(&ipc, 0, sizeof(ipc)); Evas_Coord x, y; ipc.d = ev->device; @@ -857,6 +898,7 @@ _ecore_evas_extn_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __ if (extn->ipc.server) { Ipc_Data_Ev_Multi_Up ipc; + memset(&ipc, 0, sizeof(ipc)); Evas_Coord x, y; ipc.d = ev->device; @@ -892,6 +934,7 @@ _ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj if (extn->ipc.server) { Ipc_Data_Ev_Multi_Move ipc; + memset(&ipc, 0, sizeof(ipc)); Evas_Coord x, y; ipc.d = ev->device; @@ -915,15 +958,6 @@ _ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj } static void -_ecore_evas_extn_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) -{ - Ecore_Evas *ee; - - ee = data; - if (ee->driver) _ecore_evas_free(ee); -} - -static void _ecore_evas_extn_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Ecore_Evas *ee = data; @@ -1047,6 +1081,7 @@ _ecore_evas_extn_cb_hold(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (extn->ipc.server) { Ipc_Data_Ev_Hold ipc; + memset(&ipc, 0, sizeof(ipc)); ipc.hold = ev->hold; ipc.timestamp = ev->timestamp; @@ -1111,6 +1146,20 @@ _ecore_evas_extn_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0); } +static void +_ecore_evas_extn_plug_msg_parent_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + Extn *extn; + + extn = ee->engine.buffer.data; + if (!extn) return; + if (!extn->ipc.server) return; + + //ref = msg_domain + //ref_to = msg_id + ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_MSG, msg_domain, msg_id, 0, data, size); +} + static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = { _ecore_evas_extn_free, @@ -1169,7 +1218,9 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = NULL, // render NULL, // screen_geometry_get - NULL // screen_dpi_get + NULL, // screen_dpi_get + _ecore_evas_extn_plug_msg_parent_send, + NULL // msg_send }; static Eina_Bool @@ -1256,6 +1307,7 @@ _ipc_server_data(void *data, int type __UNUSED__, void *event) evas_object_image_data_update_add(ee->engine.buffer.image, ipc->x, ipc->y, ipc->w, ipc->h); + free(ipc); } } break; @@ -1338,6 +1390,18 @@ _ipc_server_data(void *data, int type __UNUSED__, void *event) _ecore_evas_resize(ee, ipc->w, ipc->h); } break; + case OP_MSG_PARENT: + if ((e->data) && (e->size > 0)) + { + //ref = msg_domain + //ref_to = msg_id + if (ee->func.fn_msg_handle) + { + INF("Message handle: ref=%d to=%d size=%d", e->ref, e->ref_to, e->size); + ee->func.fn_msg_handle(ee, e->ref, e->ref_to, e->data, e->size); + } + } + break; default: break; } @@ -1432,9 +1496,6 @@ ecore_evas_extn_plug_new(Ecore_Evas *ee_target) EVAS_CALLBACK_MULTI_MOVE, _ecore_evas_extn_cb_multi_move, ee); evas_object_event_callback_add(ee->engine.buffer.image, - EVAS_CALLBACK_FREE, - _ecore_evas_extn_cb_free, ee); - evas_object_event_callback_add(ee->engine.buffer.image, EVAS_CALLBACK_KEY_DOWN, _ecore_evas_extn_cb_key_down, ee); evas_object_event_callback_add(ee->engine.buffer.image, @@ -1976,6 +2037,18 @@ _ipc_client_data(void *data, int type __UNUSED__, void *event) evas_event_default_flags_set(ee->evas, flags); } break; + case OP_MSG: + if ((e->data) && (e->size > 0)) + { + //ref = msg_domain + //ref_to = msg_id + if (ee->func.fn_msg_parent_handle) + { + INF("Message parent handle: ref=%d to=%d size=%d", e->ref, e->ref_to, e->size); + ee->func.fn_msg_parent_handle(ee, e->ref, e->ref_to, e->data, e->size); + } + } + break; default: break; } @@ -2015,6 +2088,24 @@ _ecore_evas_extn_socket_alpha_set(Ecore_Evas *ee, int alpha) } } +static void +_ecore_evas_extn_socket_msg_send(Ecore_Evas *ee, int msg_domain, int msg_id, void *data, int size) +{ + Extn *extn; + Eina_List *l; + Ecore_Ipc_Client *client; + + extn = ee->engine.buffer.data; + if (extn) + { + EINA_LIST_FOREACH(extn->ipc.clients, l, client) + ecore_ipc_client_send(client, MAJOR, OP_MSG_PARENT, + msg_domain, msg_id, 0, + data, + size); + } +} + static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = { _ecore_evas_extn_free, @@ -2075,6 +2166,8 @@ static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = _ecore_evas_extn_socket_render, // render NULL, // screen_geometry_get NULL, // screen_dpi_get + NULL, + _ecore_evas_extn_socket_msg_send }; #endif diff --git a/src/lib/ecore_evas/ecore_evas_fb.c b/src/lib/ecore_evas/ecore_evas_fb.c index a8200a9..259297d 100644 --- a/src/lib/ecore_evas/ecore_evas_fb.c +++ b/src/lib/ecore_evas/ecore_evas_fb.c @@ -562,7 +562,9 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func = NULL, // render NULL, // screen_geometry_get - NULL // screen_dpi_get + NULL, // screen_dpi_get + NULL, + NULL // msg_send }; #endif diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index 664748c..aa74009 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -191,6 +191,8 @@ struct _Ecore_Evas_Engine_Func int (*fn_render) (Ecore_Evas *ee); void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); void (*fn_screen_dpi_get) (const Ecore_Evas *ee, int *xdpi, int *ydpi); + void (*fn_msg_parent_send) (Ecore_Evas *ee, int maj, int min, void *data, int size); + void (*fn_msg_send) (Ecore_Evas *ee, int maj, int min, void *data, int size); }; struct _Ecore_Evas_Engine @@ -223,6 +225,13 @@ struct _Ecore_Evas_Engine unsigned char netwm_sync_set : 1; unsigned char configure_coming : 1; struct { + unsigned char supported: 1; + unsigned char prepare : 1; + unsigned char request : 1; + unsigned char done : 1; + unsigned char configure_coming : 1; + } wm_rot; + struct { unsigned char modal : 1; unsigned char sticky : 1; unsigned char maximized_v : 1; @@ -336,6 +345,12 @@ struct _Ecore_Evas char *clas; char *profile; struct { + Eina_Bool supported; + int angle; + Eina_Bool win_resize; + int w, h; + } wm_rot; + struct { int w, h; } min, max, @@ -388,6 +403,8 @@ struct _Ecore_Evas void (*fn_post_render) (Ecore_Evas *ee); void (*fn_pre_free) (Ecore_Evas *ee); void (*fn_state_change) (Ecore_Evas *ee); + void (*fn_msg_parent_handle) (Ecore_Evas *ee, int maj, int min, void *data, int size); + void (*fn_msg_handle) (Ecore_Evas *ee, int maj, int min, void *data, int size); } func; Ecore_Evas_Engine engine; diff --git a/src/lib/ecore_evas/ecore_evas_psl1ght.c b/src/lib/ecore_evas/ecore_evas_psl1ght.c index 98d570e..f2740f1 100644 --- a/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ b/src/lib/ecore_evas/ecore_evas_psl1ght.c @@ -406,7 +406,9 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = NULL, // render _ecore_evas_screen_geometry_get, // screen_geometry_get - NULL // screen_dpi_get + NULL, // screen_dpi_get + NULL, + NULL //msg_send }; EAPI Ecore_Evas * diff --git a/src/lib/ecore_evas/ecore_evas_sdl.c b/src/lib/ecore_evas/ecore_evas_sdl.c index da1ddbd..154e07d 100644 --- a/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/src/lib/ecore_evas/ecore_evas_sdl.c @@ -135,6 +135,8 @@ _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, v ee->w = e->w; ee->h = e->h; + ee->req.w = e->w; + ee->req.h = e->h; evas_output_size_set(ee->evas, e->w, e->h); evas_output_viewport_set(ee->evas, 0, 0, e->w, e->h); @@ -274,6 +276,8 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h) int rmethod; if ((w == ee->w) && (h == ee->h)) return; + ee->req.w = w; + ee->req.h = h; ee->w = w; ee->h = h; @@ -324,6 +328,8 @@ static void _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) { if ((w == ee->w) && (h == ee->h)) return; + ee->req.w = w; + ee->req.h = h; ee->w = w; ee->h = h; @@ -442,7 +448,9 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = NULL, // render NULL, // screen_geometry_get - NULL // screen_dpi_get + NULL, // screen_dpi_get + NULL, + NULL // msg_send }; static Ecore_Evas* @@ -466,6 +474,8 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu if (w < 1) w = 1; if (h < 1) h = 1; ee->visible = 1; + ee->req.w = w; + ee->req.h = h; ee->w = w; ee->h = h; diff --git a/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/src/lib/ecore_evas/ecore_evas_wayland_egl.c index 545c295..8b36be7 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_egl.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_egl.c @@ -2,6 +2,32 @@ # include "config.h" #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + //#define LOGFNS 1 #ifdef LOGFNS @@ -93,7 +119,9 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = NULL, // focus skip set _ecore_evas_wl_common_render, _ecore_evas_wl_common_screen_geometry_get, - _ecore_evas_wl_common_screen_dpi_get + _ecore_evas_wl_common_screen_dpi_get, + NULL, + NULL // msg_send }; /* external variables */ diff --git a/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/src/lib/ecore_evas/ecore_evas_wayland_shm.c index d2bc08a..faf24f1 100644 --- a/src/lib/ecore_evas/ecore_evas_wayland_shm.c +++ b/src/lib/ecore_evas/ecore_evas_wayland_shm.c @@ -2,6 +2,32 @@ # include "config.h" #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + //#define LOGFNS 1 #ifdef LOGFNS diff --git a/src/lib/ecore_evas/ecore_evas_win32.c b/src/lib/ecore_evas/ecore_evas_win32.c index 59d6ed8..f480b6e 100644 --- a/src/lib/ecore_evas/ecore_evas_win32.c +++ b/src/lib/ecore_evas/ecore_evas_win32.c @@ -1121,7 +1121,9 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func = NULL, // render NULL, // screen_geometry_get - _ecore_evas_win32_screen_dpi_get + _ecore_evas_win32_screen_dpi_get, + NULL, + NULL // msg_send }; #endif /* BUILD_ECORE_EVAS_WIN32 */ diff --git a/src/lib/ecore_evas/ecore_evas_x.c b/src/lib/ecore_evas/ecore_evas_x.c index ced4c2b..d491917 100644 --- a/src/lib/ecore_evas/ecore_evas_x.c +++ b/src/lib/ecore_evas/ecore_evas_x.c @@ -19,6 +19,8 @@ static Ecore_Event_Handler *ecore_evas_event_handlers[13]; static int leader_ref = 0; static Ecore_X_Window leader_win = 0; +static void _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize); + static void _ecore_evas_x_hints_update(Ecore_Evas *ee) { @@ -97,6 +99,12 @@ _ecore_evas_x_protocols_set(Ecore_Evas *ee) ecore_x_window_prop_card32_set(ee->prop.window, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, &tmp, 1); + + // set property on window to say "I talk the deiconify approve protcol" + tmp = 1; + ecore_x_window_prop_card32_set(ee->prop.window, + ECORE_X_ATOM_E_DEICONIFY_APPROVE, + &tmp, 1); } static void @@ -133,6 +141,15 @@ _ecore_evas_x_sync_clear(Ecore_Evas *ee) ee->engine.x.sync_counter = 0; } +static void +_ecore_evas_x_wm_rotation_protocol_set(Ecore_Evas *ee) +{ + if (ecore_x_e_window_rotation_supported_get(ee->engine.x.win_root)) + ee->prop.wm_rot.supported = 1; + else + ee->prop.wm_rot.supported = 0; +} + # ifdef BUILD_ECORE_EVAS_OPENGL_X11 static Ecore_X_Window _ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, int w, int h, int override, int argb, const int *opt) @@ -807,6 +824,76 @@ _ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, v ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3]; ee->engine.x.netwm_sync_set = 1; } + else if (e->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE) + { + ee = ecore_event_window_match(e->data.l[0]); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->data.l[0] != (long)ee->prop.window) + return ECORE_CALLBACK_PASS_ON; + if (ee->prop.wm_rot.supported) + { + ee->prop.wm_rot.angle = (int)e->data.l[1]; + ee->prop.wm_rot.win_resize = (int)e->data.l[2]; + ee->prop.wm_rot.w = (int)e->data.l[3]; + ee->prop.wm_rot.h = (int)e->data.l[4]; + if (ee->prop.wm_rot.win_resize) + ee->engine.x.wm_rot.configure_coming = 1; + ee->engine.x.wm_rot.prepare = 1; + ee->engine.x.wm_rot.request = 0; + ee->engine.x.wm_rot.done = 0; + } + } + else if (e->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST) + { + ee = ecore_event_window_match(e->data.l[0]); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->data.l[0] != (long)ee->prop.window) + return ECORE_CALLBACK_PASS_ON; + if (ee->prop.wm_rot.supported) + { + ee->engine.x.wm_rot.prepare = 0; + ee->engine.x.wm_rot.request = 1; + ee->engine.x.wm_rot.done = 0; + if (ee->prop.wm_rot.win_resize) + { + if ((ee->w == ee->prop.wm_rot.w) && + (ee->h == ee->prop.wm_rot.h)) + { + ee->engine.x.wm_rot.configure_coming = 0; + } + } + if (!ee->engine.x.wm_rot.configure_coming) + { + if (ee->prop.wm_rot.angle == ee->rotation) + { + if (ee->func.fn_state_change) ee->func.fn_state_change(ee); + ee->engine.x.wm_rot.request = 0; + ee->engine.x.wm_rot.done = 1; + } + } + } + } + else if (e->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL) + { + ///TODO after access structure determined + // if (ee->func.fn_msg_handle) + // ee->func.fn_msg_handle(ee, msg_domain, msg_id, data, size); + } + else if (e->message_type == ECORE_X_ATOM_E_DEICONIFY_APPROVE) + { + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->data.l[1] != 0) //wm sends request message using value 0 + return ECORE_CALLBACK_PASS_ON; + + if (ecore_evas_manual_render_get(ee)) + ecore_evas_manual_render(ee); + //client sends reply message using value 1 + ecore_x_client_message32_send(e->win, ECORE_X_ATOM_E_DEICONIFY_APPROVE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + e->win, 1, + 0, 0, 0); + } return ECORE_CALLBACK_PASS_ON; } @@ -1105,6 +1192,30 @@ _ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, ee->expecting_resize.h = 0; } if (ee->func.fn_resize) ee->func.fn_resize(ee); + + if (ee->prop.wm_rot.supported) + { + if (ee->engine.x.wm_rot.prepare) + { + if ((ee->prop.wm_rot.w == e->w) && + (ee->prop.wm_rot.h == e->h)) + { + ee->engine.x.wm_rot.configure_coming = 0; + } + } + else if (ee->engine.x.wm_rot.request) + { + if ((ee->engine.x.wm_rot.configure_coming) && + (ee->prop.wm_rot.w == e->w) && + (ee->prop.wm_rot.h == e->h)) + { + ee->engine.x.wm_rot.configure_coming = 0; + _ecore_evas_x_rotation_set(ee, + ee->prop.wm_rot.angle, + EINA_TRUE); + } + } + } } return ECORE_CALLBACK_PASS_ON; } @@ -1703,40 +1814,40 @@ _ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, } } -#define _USE_WIN_ROT_EFFECT 1 - -#if _USE_WIN_ROT_EFFECT -static void _ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__); - -typedef struct _Ecore_Evas_X_Rotation_Effect Ecore_Evas_X_Rotation_Effect; -struct _Ecore_Evas_X_Rotation_Effect -{ - Eina_Bool wait_for_comp_reply; -}; - -static Ecore_Evas_X_Rotation_Effect _rot_effect = -{ - EINA_FALSE -}; - -static void -_ecore_evas_x_rotation_effect_setup(void) +static Eina_Bool +_ecore_evas_x_wm_rotation_check(Ecore_Evas *ee) { - _rot_effect.wait_for_comp_reply = EINA_TRUE; + if (ee->prop.wm_rot.supported) + { + if (ee->engine.x.wm_rot.request) + { + if (ee->prop.wm_rot.win_resize) + { + if (!((ee->w == ee->prop.wm_rot.w) && (ee->h == ee->prop.wm_rot.h))) + { + return EINA_FALSE; + } + else + ee->engine.x.wm_rot.configure_coming = 0; + } + } + } + return EINA_TRUE; } -#endif /* end of _USE_WIN_ROT_EFFECT */ static void _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) { + Eina_Bool ch_prop = EINA_FALSE; + if (ee->rotation == rotation) return; if (!strcmp(ee->driver, "xrender_x11")) return; -#if _USE_WIN_ROT_EFFECT - int angles[2]; - angles[0] = rotation; - angles[1] = ee->rotation; -#endif /* end of _USE_WIN_ROT_EFFECT */ + if (ee->prop.wm_rot.supported) + { + if (!_ecore_evas_x_wm_rotation_check(ee)) return; + if (!resize) resize = 1; + } if (!strcmp(ee->driver, "opengl_x11")) { @@ -1748,15 +1859,7 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); -# if _USE_WIN_ROT_EFFECT - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &angles, 2); -# else - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &rotation, 1); -# endif + ch_prop = EINA_TRUE; #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ } else if (!strcmp(ee->driver, "software_x11")) @@ -1769,15 +1872,7 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); -# if _USE_WIN_ROT_EFFECT - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &angles, 2); -# else - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &rotation, 1); -# endif + ch_prop = EINA_TRUE; #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ } else if (!strcmp(ee->driver, "software_16_x11")) @@ -1790,15 +1885,7 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); -# if _USE_WIN_ROT_EFFECT - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &angles, 2); -# else - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &rotation, 1); -# endif + ch_prop = EINA_TRUE; #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ } else if (!strcmp(ee->driver, "software_8_x11")) @@ -1811,29 +1898,26 @@ _ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) einfo->info.rotation = rotation; _ecore_evas_x_rotation_set_internal(ee, rotation, resize, (Evas_Engine_Info *)einfo); -# if _USE_WIN_ROT_EFFECT - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &angles, 2); -# else - ecore_x_window_prop_property_set(ee->prop.window, - ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, - ECORE_X_ATOM_CARDINAL, 32, &rotation, 1); -# endif + ch_prop = EINA_TRUE; #endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ } -#if _USE_WIN_ROT_EFFECT - if ((ee->visible) && - ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) && - (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) && - (ee->engine.x.sync_counter) && - (ee->engine.x.sync_val > 0)) + if (ch_prop) { - _ecore_evas_x_rotation_effect_setup(); - _ecore_evas_x_flush_pre(ee, NULL, NULL); + if (ee->prop.wm_rot.supported) + { + if (ee->engine.x.wm_rot.request) + { + if (ee->func.fn_state_change) ee->func.fn_state_change(ee); + ee->engine.x.wm_rot.request = 0; + ee->engine.x.wm_rot.done = 1; + } + } + int angles[2] = { rotation, rotation }; + ecore_x_window_prop_property_set(ee->prop.window, + ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE, + ECORE_X_ATOM_CARDINAL, 32, &angles, 2); } -#endif /* end of _USE_WIN_ROT_EFFECT */ } static void @@ -2053,6 +2137,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); _ecore_evas_x_size_pos_hints_update(ee); #endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ @@ -2173,6 +2258,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); _ecore_evas_x_size_pos_hints_update(ee); #endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ @@ -2256,6 +2342,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); _ecore_evas_x_size_pos_hints_update(ee); #endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ @@ -2339,6 +2426,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) _ecore_evas_x_group_leader_update(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); _ecore_evas_x_size_pos_hints_update(ee); @@ -3111,7 +3199,9 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func = NULL, // render _ecore_evas_x_screen_geometry_get, - _ecore_evas_x_screen_dpi_get + _ecore_evas_x_screen_dpi_get, + NULL, + NULL //fn_msg_send }; #endif /* BUILD_ECORE_EVAS_X11 */ @@ -3170,6 +3260,17 @@ _ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUS ee->engine.x.netwm_sync_val_lo); ee->engine.x.netwm_sync_set = 0; } + if ((ee->prop.wm_rot.supported) && + (ee->engine.x.wm_rot.done)) + { + ecore_x_e_window_rotation_change_done_send(ee->engine.x.win_root, + ee->prop.window, + ee->rotation, + ee->w, + ee->h); + ee->engine.x.wm_rot.done = 0; + } + } #endif @@ -3351,6 +3452,7 @@ ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); ee->engine.func->fn_render = _ecore_evas_x_render; @@ -3600,6 +3702,7 @@ ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); ee->engine.func->fn_render = _ecore_evas_x_render; @@ -3915,6 +4018,7 @@ ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); ee->engine.func->fn_render = _ecore_evas_x_render; @@ -4245,6 +4349,7 @@ ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, _ecore_evas_x_group_leader_set(ee); ecore_x_window_defaults_set(ee->prop.window); _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_wm_rotation_protocol_set(ee); _ecore_evas_x_sync_set(ee); ee->engine.func->fn_render = _ecore_evas_x_render; diff --git a/src/lib/ecore_fb/ecore_fb_vt.c b/src/lib/ecore_fb/ecore_fb_vt.c index 09e3f37..0e05893 100644 --- a/src/lib/ecore_fb/ecore_fb_vt.c +++ b/src/lib/ecore_fb/ecore_fb_vt.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "Ecore_Fb.h" #include "ecore_fb_private.h" diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index c59bf80..246e586 100644 --- a/src/lib/ecore_file/ecore_file.c +++ b/src/lib/ecore_file/ecore_file.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include diff --git a/src/lib/ecore_file/ecore_file_monitor.c b/src/lib/ecore_file/ecore_file_monitor.c index 8b07589..e7c1d1d 100644 --- a/src/lib/ecore_file/ecore_file_monitor.c +++ b/src/lib/ecore_file/ecore_file_monitor.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_file_private.h" typedef enum { diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c index 30226d3..3e2392a 100644 --- a/src/lib/ecore_file/ecore_file_monitor_inotify.c +++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "ecore_file_private.h" @@ -62,11 +63,20 @@ int ecore_file_monitor_inotify_init(void) { int fd; +#ifdef HAVE_EXECVP + int flags; +#endif fd = inotify_init(); if (fd < 0) return 0; +#ifdef HAVE_EXECVP + flags = fcntl(fd, F_GETFD); + flags |= FD_CLOEXEC; + fcntl(fd, F_SETFD, flags); +#endif + _fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler, NULL, NULL, NULL); if (!_fdh) diff --git a/src/lib/ecore_file/ecore_file_path.c b/src/lib/ecore_file/ecore_file_path.c index 3c06e9b..c1c54b7 100644 --- a/src/lib/ecore_file/ecore_file_path.c +++ b/src/lib/ecore_file/ecore_file_path.c @@ -2,22 +2,30 @@ # include #endif -#undef alloca +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif #ifdef HAVE_ALLOCA_H # include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#elif defined _MSC_VER -# include -# define alloca _alloca -#else -# include -# ifdef __cplusplus +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus extern "C" -# endif +# endif void *alloca (size_t); +# endif #endif #include diff --git a/src/lib/ecore_imf/Ecore_IMF.h b/src/lib/ecore_imf/Ecore_IMF.h index 641ece7..3bca101 100644 --- a/src/lib/ecore_imf/Ecore_IMF.h +++ b/src/lib/ecore_imf/Ecore_IMF.h @@ -34,6 +34,31 @@ extern "C" { #endif /** + * @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions + * @ingroup Ecore_IMF_Lib_Group + * + * Functions that operate on Ecore Input Method Context objects. + + * Ecore Input Method Context Function defines the interface for EFL input methods. + * An input method is used by EFL text input widgets like elm_entry + * (based on edje_entry) to map from key events to Unicode character strings. + * + * The default input method can be set through setting the ECORE_IMF_MODULE environment variable. + * eg) export ECORE_IMF_MODULE=xim (or scim or ibus) + * + * An input method may consume multiple key events in sequence and finally output the composed result. + * This is called preediting, and an input method may provide feedback about + * this process by displaying the intermediate composition states as preedit text. + * + * Immodule is plugin to connect your application and input method framework such as SCIM, ibus, and so on.@n + * ecore_imf_init() should be called to initialize and load immodule.@n + * ecore_imf_shutdown() is used for shutdowning and unloading immodule. + * + * An example of usage of these functions can be found at: + * @li @ref ecore_imf_example_c + */ + +/** * @addtogroup Ecore_IMF_Context_Group * * @{ @@ -237,7 +262,7 @@ typedef enum ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */ ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID, /**< Never use this */ ECORE_IMF_INPUT_PANEL_LAYOUT_HEX, /**< Hexadecimal layout @since 1.2 */ - ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout including esc, alt, ctrl key, so on (no auto-correct, no auto-capitalization) @since 1.2 */ + ECORE_IMF_INPUT_PANEL_LAYOUT_TERMINAL, /**< Command-line terminal layout including ESC, Alt, Ctrl key, so on (no auto-correct, no auto-capitalization) @since 1.2 */ ECORE_IMF_INPUT_PANEL_LAYOUT_PASSWORD /**< Like normal, but no auto-correct, no auto-capitalization etc. @since 1.2 */ } Ecore_IMF_Input_Panel_Layout; @@ -484,81 +509,964 @@ struct _Ecore_IMF_Context_Info * @} */ +/** + * Initialises the Ecore_IMF library. + * @return Number of times the library has been initialised without being + * shut down. + * @ingroup Ecore_IMF_Lib_Group + */ EAPI int ecore_imf_init(void); + +/** + * Shuts down the Ecore_IMF library. + * @return Number of times the library has been initialised without being + * shut down. + * @ingroup Ecore_IMF_Lib_Group + */ EAPI int ecore_imf_shutdown(void); EAPI void ecore_imf_module_register(const Ecore_IMF_Context_Info *info, Ecore_IMF_Context *(*imf_module_create)(void), Ecore_IMF_Context *(*imf_module_exit)(void)); +EAPI Eina_Bool ecore_imf_input_panel_hide(void); + +/** + * Get the list of the available Input Method Context ids. + * + * Note that the caller is responsible for freeing the Eina_List + * when finished with it. There is no need to finish the list strings. + * + * @return Return an Eina_List of strings; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ EAPI Eina_List *ecore_imf_context_available_ids_get(void); EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type); + +/** + * Get the id of the default Input Method Context. + * The id may to used to create a new instance of an Input Method + * Context object. + * + * @return Return a string containing the id of the default Input + * Method Context; on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ EAPI const char *ecore_imf_context_default_id_get(void); EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type); + +/** + * Retrieve the info for the Input Method Context with @p id. + * + * @param id The Input Method Context id to query for. + * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * + * const char *ctx_id; + * const Ecore_IMF_Context_Info *ctx_info; + * Ecore_IMF_Context *imf_context; + * ctx_id = ecore_imf_context_default_id_get(); + * if (ctx_id) + * { + * ctx_info = ecore_imf_context_info_by_id_get(ctx_id); + * if (!ctx_info->canvas_type || + * strcmp(ctx_info->canvas_type, "evas") == 0) + * { + * imf_context = ecore_imf_context_add(ctx_id); + * } + * else + * { + * ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); + * if (ctx_id) + * { + * imf_context = ecore_imf_context_add(ctx_id); + * } + * } + * } + * @endcode + */ EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id); +/** + * Create a new Input Method Context defined by the given id. + * + * @param id The Input Method Context id. + * @return A newly allocated Input Method Context; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ EAPI Ecore_IMF_Context *ecore_imf_context_add(const char *id); + +/** + * Retrieve the info for the given Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return a #Ecore_IMF_Context_Info for the given Input Method Context; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_get(Ecore_IMF_Context *ctx); + +/** + * Delete the given Input Method Context and free its memory. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx); + +/** + * Set the client window for the Input Method Context; this is the + * Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc. + * This window is used in order to correctly position status windows, and may + * also be used for purposes internal to the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param window The client window. This may be @c NULL to indicate + * that the previous client window no longer exists. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window); + +/** + * Get the client window of the Input Method Context + * + * See @ref ecore_imf_context_client_window_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the client window. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void *ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx); + +/** + * Set the client canvas for the Input Method Context; this is the + * canvas in which the input appears. + * The canvas type can be determined by using the context canvas type. + * Actually only canvas with type "evas" (Evas *) is supported. + * This canvas may be used in order to correctly position status windows, and may + * also be used for purposes internal to the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param canvas The client canvas. This may be @c NULL to indicate + * that the previous client canvas no longer exists. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas); + +/** + * Get the client canvas of the Input Method Context. + * + * See @ref ecore_imf_context_client_canvas_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the client canvas. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void *ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx); + +/** + * Ask the Input Method Context to show itself. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx); + +/** + * Ask the Input Method Context to hide itself. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx); + +/** + * Retrieve the current preedit string and cursor position + * for the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param str Location to store the retrieved string. The + * string retrieved must be freed with free(). + * @param cursor_pos Location to store position of cursor (in characters) + * within the preedit string. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos); + +/** + * Retrieve the current preedit string, attributes and + * cursor position for the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param str Location to store the retrieved string. The + * string retrieved must be freed with free(). + * @param attrs an Eina_List of attributes + * @param cursor_pos Location to store position of cursor (in characters) + * within the preedit string. + * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * char *preedit_string; + * int cursor_pos; + * Eina_List *attrs = NULL, *l = NULL; + * Ecore_IMF_Preedit_Attr *attr; + * + * ecore_imf_context_preedit_string_with_attributes_get(imf_context, + * &preedit_string, + * &attrs, &cursor_pos); + * if (!preedit_string) return; + * + * if (strlen(preedit_string) > 0) + * { + * if (attrs) + * { + * EINA_LIST_FOREACH(attrs, l, attr) + * { + * if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) + * { + * // Something to do + * } + * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2) + * { + * // Something to do + * } + * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3) + * { + * // Something to do + * } + * } + * } + * } + * + * // delete attribute list + * EINA_LIST_FREE(attrs, attr) free(attr); + * + * free(preedit_string); + * @endcode + * @since 1.1.0 + */ EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos); + +/** + * Notify the Input Method Context that the widget to which its + * correspond has gained focus. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source) + * { + * Ecore_IMF_Context *imf_context = data; + * ecore_imf_context_focus_in(imf_context); + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _focus_in_cb, imf_context); + * @endcode + */ EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx); + +/** + * Notify the Input Method Context that the widget to which its + * correspond has lost focus. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source) + * { + * Ecore_IMF_Context *imf_context = data; + * ecore_imf_context_reset(imf_context); + * ecore_imf_context_focus_out(imf_context); + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed); + * @endcode + */ EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx); + +/** + * Notify the Input Method Context that a change such as a + * change in cursor position has been made. This will typically + * cause the Input Method Context to clear the preedit state or commit the preedit string. + * + * The operation of ecore_imf_context_reset() depends on the specific characteristics of + * each language. For example, the preedit string is cleared in the Chinese and Japanese Input Method Engine. + * However, The preedit string is committed and then cleared in the Korean Input Method Engine. + * + * This function should be called in case of the focus-out and mouse down event callback function. + * In addition, it should be called before inserting some text. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source) + * { + * Ecore_IMF_Context *imf_context = data; + * ecore_imf_context_reset(imf_context); + * ecore_imf_context_focus_out(imf_context); + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, imf_context); + * @endcode + */ EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx); + +/** + * Notify the Input Method Context that a change in the cursor + * position has been made. + * + * This function should be called when cursor position is changed or mouse up event is generated. + * Some input methods that do a heavy job using this event can give a critical performance latency problem. + * For better typing performance, we suggest that the cursor position change events need to be occurred + * only if the cursor position is on a confirmed status not on moving status. + * + * @param ctx An #Ecore_IMF_Context. + * @param cursor_pos New cursor position in characters. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos); + +/** + * Notify the Input Method Context that a change in the cursor + * location has been made. The location is relative to the canvas. + * The cursor location can be used to determine the position of + * candidate word window in the immodule. + * + * @param ctx An #Ecore_IMF_Context. + * @param x cursor x position. + * @param y cursor y position. + * @param w cursor width. + * @param h cursor height. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h); + +/** + * Set whether the IM context should use the preedit string + * to display feedback. If @c use_preedit is @c EINA_FALSE (default + * is @c EINA_TRUE), then the IM context may use some other method to display + * feedback, such as displaying it in a child of the root window. + * + * @param ctx An #Ecore_IMF_Context. + * @param use_preedit Whether the IM context should use the preedit string. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit); + +/** + * Set the callback to be used on surrounding_get request. + * + * This callback will be called when the Input Method Context + * module requests the surrounding context. + * + * @param ctx An #Ecore_IMF_Context. + * @param func The callback to be called. + * @param data The data pointer to be passed to @p func + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data); + +/** + * Set the input mode used by the Ecore Input Context. + * + * The input mode can be one of the input modes defined in + * Ecore_IMF_Input_Mode. The default input mode is + * ECORE_IMF_INPUT_MODE_FULL. + * + * @param ctx An #Ecore_IMF_Context. + * @param input_mode The input mode to be used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + */ EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); + +/** + * Get the input mode being used by the Ecore Input Context. + * + * See @ref ecore_imf_context_input_mode_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return The input mode being used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + */ EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx); + +/** + * Allow an Ecore Input Context to internally handle an event. + * If this function returns @c EINA_TRUE, then no further processing + * should be done for this event. + * + * Input methods must be able to accept all types of events (simply + * returning @c EINA_FALSE if the event was not handled), but there is no + * obligation of any events to be submitted to this function. + * + * @param ctx An #Ecore_IMF_Context. + * @param type The type of event defined by #Ecore_IMF_Event_Type. + * @param event The event itself. + * @return @c EINA_TRUE if the event was handled; otherwise @c EINA_FALSE. + * @ingroup Ecore_IMF_Context_Group + * + * Example + * @code + * static void + * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) + * { + * Evas_Event_Key_Down *ev = event_info; + * if (!ev->keyname) return; + * + * if (imf_context) + * { + * Ecore_IMF_Event_Key_Down ecore_ev; + * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); + * if (ecore_imf_context_filter_event(imf_context, + * ECORE_IMF_EVENT_KEY_DOWN, + * (Ecore_IMF_Event *)&ecore_ev)) + * return; + * } + * } + * + * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data); + * @endcode + */ EAPI Eina_Bool ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event); /* plugin specific functions */ + +/** + * @defgroup Ecore_IMF_Context_Module_Group Ecore Input Method Context Module Functions + * @ingroup Ecore_IMF_Lib_Group + * + * Functions that should be used by Ecore Input Method Context modules. + */ + +/** + * Creates a new Input Method Context with klass specified by @p ctxc. + * + * This method should be used by modules implementing the Input + * Method Context interface. + * + * @param ctxc An #Ecore_IMF_Context_Class. + * @return A new #Ecore_IMF_Context; on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI Ecore_IMF_Context *ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc); + +/** + * Set the Input Method Context specific data. + * + * Note that this method should be used by modules to set + * the Input Method Context specific data and it's not meant to + * be used by applications to store application specific data. + * + * @param ctx An #Ecore_IMF_Context. + * @param data The Input Method Context specific data. + * @return A new #Ecore_IMF_Context; on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data); + +/** + * Get the Input Method Context specific data. + * + * See @ref ecore_imf_context_data_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return The Input Method Context specific data. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx); + +/** + * Retrieve context around insertion point. + * Input methods typically want context in order to constrain input text based on existing text; + * this is important for languages such as Thai where only some sequences of characters are allowed. + * In addition, the text around the insertion point can be used for supporting autocapital feature. + * + * This function is implemented by calling the + * Ecore_IMF_Context::retrieve_surrounding_func ( + * set using #ecore_imf_context_retrieve_surrounding_callback_set). + * + * There is no obligation for a widget to respond to the + * retrieve_surrounding_func, so input methods must be prepared + * to function without context. + * + * @param ctx An #Ecore_IMF_Context. + * @param text Location to store a UTF-8 encoded string of text + * holding context around the insertion point. + * If the function returns @c EINA_TRUE, then you must free + * the result stored in this location with free(). + * @param cursor_pos Location to store the position in characters of + * the insertion cursor within @p text. + * @return @c EINA_TRUE if surrounding text was provided; otherwise + * @c EINA_FALSE. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI Eina_Bool ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos); + +/** + * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue. + * + * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts. + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx); + +/** + * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue. + * + * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled. + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx); + +/** + * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue. + * + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx); + +/** + * Adds ECORE_IMF_EVENT_COMMIT to the event queue. + * + * It's asynchronous method to put event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * + * @param ctx An #Ecore_IMF_Context. + * @param str The committed string. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str); + +/** + * Adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. + * + * Asks the widget that the input context is attached to to delete characters around the cursor position + * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. + * Note that offset and n_chars are in characters not in bytes. + * + * It's asynchronous method to put ECORE_IMF_EVENT_DELETE_SURROUNDING event to the event queue. + * ecore_imf_context_event_callback_call() can be used as synchronous method. + * + * @param ctx An #Ecore_IMF_Context. + * @param offset The start offset of surrounding to be deleted. + * @param n_chars The number of characters to be deleted. + * @ingroup Ecore_IMF_Context_Module_Group + */ EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars); + +/** + * Add (register) a callback function to a given context event. + * + * This function adds a function callback to the context @p ctx when the + * event of type @p type occurs on it. The function pointer is @p + * func. + * + * The event type @p type to trigger the function may be one of + * #ECORE_IMF_CALLBACK_PREEDIT_START, #ECORE_IMF_CALLBACK_PREEDIT_END, + * #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT and + * #ECORE_IMF_CALLBACK_DELETE_SURROUNDING. + * + * @param ctx Ecore_IMF_Context to attach a callback to. + * @param type The type of event that will trigger the callback + * @param func The (callback) function to be called when the event is + * triggered + * @param data The data pointer to be passed to @p func + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + * + * Example + * @code + * static void + * _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info) + * { + * char *commit_str = event_info; + * // something to do + * } + * + * ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data); + * @endcode + */ EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data); + +/** + * Delete (unregister) a callback function registered to a given + * context event. + * + * This function removes a function callback from the context @p ctx when the + * event of type @p type occurs on it. The function pointer is @p + * func. + * + * @see ecore_imf_context_event_callback_add() for more details + * + * @param ctx Ecore_IMF_Context to remove a callback from. + * @param type The type of event that was triggering the callback + * @param func The (callback) function that was to be called when the event was triggered + * @return the data pointer + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI void *ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func); + +/** + * Call a given callback on the context @p ctx. + * + * ecore_imf_context_preedit_start_event_add(), ecore_imf_context_preedit_end_event_add(), + * ecore_imf_context_preedit_changed_event_add(), ecore_imf_context_commit_event_add() and + * ecore_imf_context_delete_surrounding_event_add() APIs are asynchronous + * because those API adds each event to the event queue. + * + * This API provides the way to call each callback function immediately. + * + * @param ctx Ecore_IMF_Context. + * @param type The type of event that will trigger the callback + * @param event_info The pointer to event specific struct or information to + * pass to the callback functions registered on this event + * @ingroup Ecore_IMF_Context_Module_Group + * @since 1.2.0 + */ EAPI void ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info); + +/** + * Set whether the IM context should allow to use the text prediction. + * If @p prediction is @c EINA_FALSE (default is @c EINA_TRUE), then the IM + * context will not display the text prediction window. + * + * @param ctx An #Ecore_IMF_Context. + * @param prediction Whether the IM context should allow to use the text prediction. + * @note Default value is EINA_TRUE. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction); + +/** + * Get whether the IM context should allow to use the text prediction. + * + * @param ctx An #Ecore_IMF_Context. + * @return @c EINA_TRUE if it allows to use the text prediction, otherwise + * @c EINA_FALSE. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx); + +/** + * Set the autocapitalization type on the immodule. + * + * @param ctx An #Ecore_IMF_Context. + * @param autocapital_type the autocapitalization type. + * @note Default type is ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type); + +/** + * Get the autocapitalization type. + * + * @param ctx An #Ecore_IMF_Context. + * @return The autocapital type being used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI Ecore_IMF_Autocapital_Type ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx); +/** + * Ask the Input Method Context to show the control panel of using Input Method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx); + +/** + * Ask the Input Method Context to hide the control panel of using Input Method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx); +/** + * Ask the Input Method Context to show the input panel (virtual keyboard). + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx); + +/** + * Ask the Input Method Context to hide the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx); + +/** + * Set the layout of the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param layout see #Ecore_IMF_Input_Panel_Layout + * @note Default layout type is ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout); + +/** + * Get the layout of the current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @return layout see #Ecore_IMF_Input_Panel_Layout + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx); + +/** + * Set the language of the input panel. + * This API can be used when you want to show the English keyboard. + * + * @param ctx An #Ecore_IMF_Context. + * @param lang the language to be set to the input panel. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); + +/** + * Get the language of the input panel. + * + * See @ref ecore_imf_context_input_panel_language_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return Ecore_IMF_Input_Panel_Lang + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx); + +/** + * Set whether the Input Method Context should request to show the input panel automatically + * when the widget has focus. + * + * @param ctx An #Ecore_IMF_Context. + * @param enabled If true, the input panel will be shown when the widget is clicked or has focus. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable); + +/** + * Get whether the Input Method Context requests to show the input panel automatically. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the attribute to show the input panel automatically + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx); + +/** + * Set the input panel-specific data to deliver to the input panel. + * This API is used by applications to deliver specific data to the input panel. + * The data format MUST be negotiated by both application and the input panel. + * The size and format of data are defined by the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param data The specific data to be set to the input panel. + * @param len the length of data, in bytes, to send to the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len); + +/** + * Get the specific data of the current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param data The specific data to be got from the input panel + * @param len The length of data + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len); + +/** + * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel. + * + * An input panel displays the string or icon associated with this type + * + * @param ctx An #Ecore_IMF_Context. + * @param return_key_type The type of "return" key on the input panel + * @note Default type is ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI void ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type); + +/** + * Get the "return" key type. + * + * @see ecore_imf_context_input_panel_return_key_type_set() for more details + * + * @param ctx An #Ecore_IMF_Context. + * @return The type of "return" key on the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI Ecore_IMF_Input_Panel_Return_Key_Type ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx); + +/** + * Set the return key on the input panel to be disabled. + * + * @param ctx An #Ecore_IMF_Context. + * @param disabled The state + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI void ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled); + +/** + * Get whether the return key on the input panel should be disabled or not. + * + * @param ctx An #Ecore_IMF_Context. + * @return @c EINA_TRUE if it should be disabled. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx); + +/** + * Set the caps lock mode on the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param mode Turn on caps lock on the input panel if @c EINA_TRUE. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI void ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode); + +/** + * Get the caps lock mode on the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @return @c EINA_TRUE if the caps lock is turned on. + * @ingroup Ecore_IMF_Context_Group + * @since 1.2.0 + */ EAPI Eina_Bool ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx); + +/** + * Get the position of the current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param x top-left x co-ordinate of the input panel + * @param y top-left y co-ordinate of the input panel + * @param w width of the input panel + * @param h height of the input panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.3 + */ EAPI void ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); + +/** + * Get state of current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @return The state of input panel. + * @ingroup Ecore_IMF_Context_Group + * @since 1.3 + */ EAPI Ecore_IMF_Input_Panel_State ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx); + +/** + * Register a callback function which will be called if there is change in input panel state,language,mode etc. + * In order to deregister the callback function + * Use @ref ecore_imf_context_input_panel_event_callback_del. + * + * @param ctx An #Ecore_IMF_Context + * @param type event type + * @param func the callback function + * @param data application-input panel specific data. + * @ingroup Ecore_IMF_Context_Group + * @since 1.3 + */ EAPI void ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value), const void *data); + +/** + * Unregister a callback function which will be called if there is change in input panel state, language, mode etc. + * + * @param ctx An #Ecore_IMF_Context. + * @param type An #Ecore_IMF_Input_Panel_Event. + * @param func the callback function + * @ingroup Ecore_IMF_Context_Group + * @since 1.3 + */ EAPI void ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value)); + +EAPI void ecore_imf_context_input_panel_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, int value); + +EAPI void ecore_imf_context_input_panel_event_callback_clear(Ecore_IMF_Context *ctx); + +/** + * Get the current language locale of the input panel. + * + * ex) fr_FR + * + * @param ctx An #Ecore_IMF_Context. + * @param lang Location to store the retrieved language string. The + * string retrieved must be freed with free(). + * @ingroup Ecore_IMF_Context_Group + * @since 1.3 + */ EAPI void ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char **lang); + +/** + * Get the geometry information of the candidate panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param x top-left x co-ordinate of the candidate panel + * @param y top-left y co-ordinate of the candidate panel + * @param w width of the candidate panel + * @param h height of the candidate panel + * @ingroup Ecore_IMF_Context_Group + * @since 1.3 + */ EAPI void ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h); /* The following entry points must be exported by each input method module diff --git a/src/lib/ecore_imf/ecore_imf.c b/src/lib/ecore_imf/ecore_imf.c index 7cf8a4a..0f5b75f 100644 --- a/src/lib/ecore_imf/ecore_imf.c +++ b/src/lib/ecore_imf/ecore_imf.c @@ -16,20 +16,8 @@ EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0; int _ecore_imf_log_dom = -1; static int _ecore_imf_init_count = 0; +extern Ecore_IMF_Context *show_req_ctx; -/** - * @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions - * - * Utility functions that set up and shut down the Ecore Input Method - * library. - */ - -/** - * Initialises the Ecore_IMF library. - * @return Number of times the library has been initialised without being - * shut down. - * @ingroup Ecore_IMF_Lib_Group - */ EAPI int ecore_imf_init(void) { @@ -55,12 +43,6 @@ ecore_imf_init(void) return _ecore_imf_init_count; } -/** - * Shuts down the Ecore_IMF library. - * @return Number of times the library has been initialised without being - * shut down. - * @ingroup Ecore_IMF_Lib_Group - */ EAPI int ecore_imf_shutdown(void) { @@ -71,3 +53,18 @@ ecore_imf_shutdown(void) ecore_shutdown(); return _ecore_imf_init_count; } + +EAPI Eina_Bool +ecore_imf_input_panel_hide(void) +{ + if (show_req_ctx) + { + if (ecore_imf_context_input_panel_state_get(show_req_ctx) != ECORE_IMF_INPUT_PANEL_STATE_HIDE) + { + ecore_imf_context_input_panel_hide(show_req_ctx); + return EINA_TRUE; + } + } + + return EINA_FALSE; +} diff --git a/src/lib/ecore_imf/ecore_imf_context.c b/src/lib/ecore_imf/ecore_imf_context.c index d9aeca9..e77a6ef 100644 --- a/src/lib/ecore_imf/ecore_imf_context.c +++ b/src/lib/ecore_imf/ecore_imf_context.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include @@ -12,39 +38,8 @@ #include "Ecore_IMF.h" #include "ecore_imf_private.h" -/** - * @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions - * - * Functions that operate on Ecore Input Method Context objects. - - * Ecore Input Method Context Function defines the interface for EFL input methods. - * An input method is used by EFL text input widgets like elm_entry - * (based on edje_entry) to map from key events to Unicode character strings. - * - * The default input method can be set through setting the ECORE_IMF_MODULE environment variable. - * - * An input method may consume multiple key events in sequence and finally output the composed result. - * This is called preediting, and an input method may provide feedback about - * this process by displaying the intermediate composition states as preedit text. - * - * Immodule is plugin to connect your application and input method framework such as SCIM, ibus, and so on.@n - * ecore_imf_init() should be called to initialize and load immodule.@n - * ecore_imf_shutdown() is used for shutdowning and unloading immodule. - * - * An example of usage of these functions can be found at: - * @li @ref ecore_imf_example_c - */ +Ecore_IMF_Context *show_req_ctx = NULL; -/** - * Get the list of the available Input Method Context ids. - * - * Note that the caller is responsible for freeing the Eina_List - * when finished with it. There is no need to finish the list strings. - * - * @return Return an Eina_List of strings; - * on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Group - */ EAPI Eina_List * ecore_imf_context_available_ids_get(void) { @@ -80,15 +75,6 @@ _ecore_imf_context_match_locale(const char *locale, const char *against, int aga return 0; } -/** - * Get the id of the default Input Method Context. - * The id may to used to create a new instance of an Input Method - * Context object. - * - * @return Return a string containing the id of the default Input - * Method Context; on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Group - */ EAPI const char * ecore_imf_context_default_id_get(void) { @@ -153,40 +139,6 @@ ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) return id; } -/** - * Retrieve the info for the Input Method Context with @p id. - * - * @param id The Input Method Context id to query for. - * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id; - * on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Group - * - * Example - * @code - * - * const char *ctx_id; - * const Ecore_IMF_Context_Info *ctx_info; - * Ecore_IMF_Context *imf_context; - * ctx_id = ecore_imf_context_default_id_get(); - * if (ctx_id) - * { - * ctx_info = ecore_imf_context_info_by_id_get(ctx_id); - * if (!ctx_info->canvas_type || - * strcmp(ctx_info->canvas_type, "evas") == 0) - * { - * imf_context = ecore_imf_context_add(ctx_id); - * } - * else - * { - * ctx_id = ecore_imf_context_default_id_by_canvas_type_get("evas"); - * if (ctx_id) - * { - * imf_context = ecore_imf_context_add(ctx_id); - * } - * } - * } - * @endcode - */ EAPI const Ecore_IMF_Context_Info * ecore_imf_context_info_by_id_get(const char *id) { @@ -198,14 +150,6 @@ ecore_imf_context_info_by_id_get(const char *id) return module->info; } -/** - * Create a new Input Method Context defined by the given id. - * - * @param id The Input Method Context id. - * @return A newly allocated Input Method Context; - * on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Group - */ EAPI Ecore_IMF_Context * ecore_imf_context_add(const char *id) { @@ -241,14 +185,6 @@ ecore_imf_context_add(const char *id) return ctx; } -/** - * Retrieve the info for the given Input Method Context. - * - * @param ctx An #Ecore_IMF_Context. - * @return Return a #Ecore_IMF_Context_Info for the given Input Method Context; - * on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Group - */ EAPI const Ecore_IMF_Context_Info * ecore_imf_context_info_get(Ecore_IMF_Context *ctx) { @@ -261,12 +197,6 @@ ecore_imf_context_info_get(Ecore_IMF_Context *ctx) return ctx->module->info; } -/** - * Delete the given Input Method Context and free its memory. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx) { @@ -286,21 +216,16 @@ ecore_imf_context_del(Ecore_IMF_Context *ctx) free(fn); } + if (ctx->input_panel_callbacks) + { + EINA_LIST_FREE(ctx->input_panel_callbacks, fn) + free(fn); + } + ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); free(ctx); } -/** - * Set the client window for the Input Method Context; this is the - * Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc. - * This window is used in order to correctly position status windows, and may - * also be used for purposes internal to the Input Method Context. - * - * @param ctx An #Ecore_IMF_Context. - * @param window The client window. This may be @c NULL to indicate - * that the previous client window no longer exists. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window) { @@ -314,16 +239,6 @@ ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window) ctx->window = window; } -/** - * Get the client window of the Input Method Context - * - * See @ref ecore_imf_context_client_window_set for more details. - * - * @param ctx An #Ecore_IMF_Context. - * @return Return the client window. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void * ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx) { @@ -336,19 +251,6 @@ ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx) return ctx->window; } -/** - * Set the client canvas for the Input Method Context; this is the - * canvas in which the input appears. - * The canvas type can be determined by using the context canvas type. - * Actually only canvas with type "evas" (Evas *) is supported. - * This canvas may be used in order to correctly position status windows, and may - * also be used for purposes internal to the Input Method Context. - * - * @param ctx An #Ecore_IMF_Context. - * @param canvas The client canvas. This may be @c NULL to indicate - * that the previous client canvas no longer exists. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) { @@ -362,16 +264,6 @@ ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) ctx->client_canvas = canvas; } -/** - * Get the client canvas of the Input Method Context. - * - * See @ref ecore_imf_context_client_canvas_set for more details. - * - * @param ctx An #Ecore_IMF_Context. - * @return Return the client canvas. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void * ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx) { @@ -384,12 +276,6 @@ ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx) return ctx->client_canvas; } -/** - * Ask the Input Method Context to show itself. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx) { @@ -399,15 +285,11 @@ ecore_imf_context_show(Ecore_IMF_Context *ctx) "ecore_imf_context_show"); return; } + + show_req_ctx = ctx; if (ctx->klass->show) ctx->klass->show(ctx); } -/** - * Ask the Input Method Context to hide itself. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx) { @@ -417,20 +299,10 @@ ecore_imf_context_hide(Ecore_IMF_Context *ctx) "ecore_imf_context_hide"); return; } + if (ctx->klass->hide) ctx->klass->hide(ctx); } -/** - * Retrieve the current preedit string and cursor position - * for the Input Method Context. - * - * @param ctx An #Ecore_IMF_Context. - * @param str Location to store the retrieved string. The - * string retrieved must be freed with free(). - * @param cursor_pos Location to store position of cursor (in characters) - * within the preedit string. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos) { @@ -449,59 +321,6 @@ ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cu } } -/** - * Retrieve the current preedit string, attributes and - * cursor position for the Input Method Context. - * - * @param ctx An #Ecore_IMF_Context. - * @param str Location to store the retrieved string. The - * string retrieved must be freed with free(). - * @param attrs an Eina_List of attributes - * @param cursor_pos Location to store position of cursor (in characters) - * within the preedit string. - * @ingroup Ecore_IMF_Context_Group - * - * Example - * @code - * char *preedit_string; - * int cursor_pos; - * Eina_List *attrs = NULL, *l = NULL; - * Ecore_IMF_Preedit_Attr *attr; - * - * ecore_imf_context_preedit_string_with_attributes_get(imf_context, - * &preedit_string, - * &attrs, &cursor_pos); - * if (!preedit_string) return; - * - * if (strlen(preedit_string) > 0) - * { - * if (attrs) - * { - * EINA_LIST_FOREACH(attrs, l, attr) - * { - * if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB1) - * { - * // Something to do - * } - * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB2) - * { - * // Something to do - * } - * else if (attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3) - * { - * // Something to do - * } - * } - * } - * } - * - * // delete attribute list - * EINA_LIST_FREE(attrs, attr) free(attr); - * - * free(preedit_string); - * @endcode - * @since 1.1.0 - */ EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos) { @@ -521,25 +340,6 @@ ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, cha } } -/** - * Notify the Input Method Context that the widget to which its - * correspond has gained focus. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * - * Example - * @code - * static void - * _focus_in_cb(void *data, Evas_Object *o, const char *emission, const char *source) - * { - * ecore_imf_context_reset(imf_context); - * ecore_imf_context_focus_in(imf_context); - * } - * - * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_IN, _focus_in_cb, ed); - * @endcode - */ EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) { @@ -552,25 +352,6 @@ ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) if (ctx->klass->focus_in) ctx->klass->focus_in(ctx); } -/** - * Notify the Input Method Context that the widget to which its - * correspond has lost focus. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * - * Example - * @code - * static void - * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source) - * { - * ecore_imf_context_reset(imf_context); - * ecore_imf_context_focus_out(imf_context); - * } - * - * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed); - * @endcode - */ EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) { @@ -583,26 +364,6 @@ ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) if (ctx->klass->focus_out) ctx->klass->focus_out(ctx); } -/** - * Notify the Input Method Context that a change such as a - * change in cursor position has been made. This will typically - * cause the Input Method Context to clear the preedit state. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * - * Example - * @code - * static void - * _focus_out_cb(void *data, Evas_Object *o, const char *emission, const char *source) - * { - * ecore_imf_context_reset(imf_context); - * ecore_imf_context_focus_out(imf_context); - * } - * - * evas_object_event_callback_add(obj, EVAS_CALLBACK_FOCUS_OUT, _focus_out_cb, ed); - * @endcode - */ EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx) { @@ -615,14 +376,6 @@ ecore_imf_context_reset(Ecore_IMF_Context *ctx) if (ctx->klass->reset) ctx->klass->reset(ctx); } -/** - * Notify the Input Method Context that a change in the cursor - * position has been made. - * - * @param ctx An #Ecore_IMF_Context. - * @param cursor_pos New cursor position in characters. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) { @@ -635,20 +388,6 @@ ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos); } -/** - * Notify the Input Method Context that a change in the cursor - * location has been made. The location is relative to the canvas. - * The cursor location can be used to determine the position of - * candidate word window in the immodule. - * - * @param ctx An #Ecore_IMF_Context. - * @param x cursor x position. - * @param y cursor y position. - * @param w cursor width. - * @param h cursor height. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h) { @@ -661,16 +400,6 @@ ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h); } -/** - * Set whether the IM context should use the preedit string - * to display feedback. If @c use_preedit is @c EINA_FALSE (default - * is @c EINA_TRUE), then the IM context may use some other method to display - * feedback, such as displaying it in a child of the root window. - * - * @param ctx An #Ecore_IMF_Context. - * @param use_preedit Whether the IM context should use the preedit string. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit) { @@ -683,17 +412,6 @@ ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit) if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit); } -/** - * Set whether the IM context should allow to use the text prediction. - * If @p prediction is @c EINA_FALSE (default is @c EINA_TRUE), then the IM - * context will not display the text prediction window. - * - * @param ctx An #Ecore_IMF_Context. - * @param prediction Whether the IM context should allow to use the text prediction. - * @note Default value is EINA_TRUE. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction) { @@ -710,15 +428,6 @@ ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool predict ctx->klass->prediction_allow_set(ctx, prediction); } -/** - * Get whether the IM context should allow to use the text prediction. - * - * @param ctx An #Ecore_IMF_Context. - * @return @c EINA_TRUE if it allows to use the text prediction, otherwise - * @c EINA_FALSE. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx) { @@ -732,15 +441,6 @@ ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx) return ctx->allow_prediction; } -/** - * Set the autocapitalization type on the immodule. - * - * @param ctx An #Ecore_IMF_Context. - * @param autocapital_type the autocapitalization type. - * @note Default type is ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type) { @@ -756,14 +456,6 @@ ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocap if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type); } -/** - * Get the autocapitalization type. - * - * @param ctx An #Ecore_IMF_Context. - * @return The autocapital type being used by @p ctx. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI Ecore_IMF_Autocapital_Type ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx) { @@ -777,17 +469,6 @@ ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx) return ctx->autocapital_type; } -/** - * Set the callback to be used on surrounding_get request. - * - * This callback will be called when the Input Method Context - * module requests the surrounding context. - * - * @param ctx An #Ecore_IMF_Context. - * @param func The callback to be called. - * @param data The data pointer to be passed to @p func - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data) { @@ -802,17 +483,6 @@ ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina ctx->retrieve_surrounding_data = (void *) data; } -/** - * Set the input mode used by the Ecore Input Context. - * - * The input mode can be one of the input modes defined in - * Ecore_IMF_Input_Mode. The default input mode is - * ECORE_IMF_INPUT_MODE_FULL. - * - * @param ctx An #Ecore_IMF_Context. - * @param input_mode The input mode to be used by @p ctx. - * @ingroup Ecore_IMF_Context_Group - */ EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) { @@ -826,15 +496,6 @@ ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode in ctx->input_mode = input_mode; } -/** - * Get the input mode being used by the Ecore Input Context. - * - * See @ref ecore_imf_context_input_mode_set for more details. - * - * @param ctx An #Ecore_IMF_Context. - * @return The input mode being used by @p ctx. - * @ingroup Ecore_IMF_Context_Group - */ EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx) { @@ -847,43 +508,6 @@ ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx) return ctx->input_mode; } -/** - * Allow an Ecore Input Context to internally handle an event. - * If this function returns @c EINA_TRUE, then no further processing - * should be done for this event. - * - * Input methods must be able to accept all types of events (simply - * returning @c EINA_FALSE if the event was not handled), but there is no - * obligation of any events to be submitted to this function. - * - * @param ctx An #Ecore_IMF_Context. - * @param type The type of event defined by #Ecore_IMF_Event_Type. - * @param event The event itself. - * @return @c EINA_TRUE if the event was handled; otherwise @c EINA_FALSE. - * @ingroup Ecore_IMF_Context_Group - * - * Example - * @code - * static void - * _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) - * { - * Evas_Event_Key_Down *ev = event_info; - * if (!ev->keyname) return; - * - * if (imf_context) - * { - * Ecore_IMF_Event_Key_Down ecore_ev; - * ecore_imf_evas_event_key_down_wrap(ev, &ecore_ev); - * if (ecore_imf_context_filter_event(imf_context, - * ECORE_IMF_EVENT_KEY_DOWN, - * (Ecore_IMF_Event *)&ecore_ev)) - * return; - * } - * } - * - * evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, data); - * @endcode - */ EAPI Eina_Bool ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) { @@ -897,22 +521,6 @@ ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type return EINA_FALSE; } -/** - * @defgroup Ecore_IMF_Context_Module_Group Ecore Input Method Context Module Functions - * - * Functions that should be used by Ecore Input Method Context modules. - */ - -/** - * Creates a new Input Method Context with klass specified by @p ctxc. - * - * This method should be used by modules implementing the Input - * Method Context interface. - * - * @param ctxc An #Ecore_IMF_Context_Class. - * @return A new #Ecore_IMF_Context; on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI Ecore_IMF_Context * ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc) { @@ -929,18 +537,6 @@ ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc) return ctx; } -/** - * Set the Input Method Context specific data. - * - * Note that this method should be used by modules to set - * the Input Method Context specific data and it's not meant to - * be used by applications to store application specific data. - * - * @param ctx An #Ecore_IMF_Context. - * @param data The Input Method Context specific data. - * @return A new #Ecore_IMF_Context; on failure it returns NULL. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data) { @@ -953,15 +549,6 @@ ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data) ctx->data = data; } -/** - * Get the Input Method Context specific data. - * - * See @ref ecore_imf_context_data_set for more details. - * - * @param ctx An #Ecore_IMF_Context. - * @return The Input Method Context specific data. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx) { if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) @@ -973,31 +560,6 @@ EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx) return ctx->data; } -/** - * Retrieve context around insertion point. - * Input methods typically want context in order to constrain input text based on existing text; - * this is important for languages such as Thai where only some sequences of characters are allowed. - * In addition, the text around the insertion point can be used for supporting autocapital feature. - * - * This function is implemented by calling the - * Ecore_IMF_Context::retrieve_surrounding_func ( - * set using #ecore_imf_context_retrieve_surrounding_callback_set). - * - * There is no obligation for a widget to respond to the - * retrieve_surrounding_func, so input methods must be prepared - * to function without context. - * - * @param ctx An #Ecore_IMF_Context. - * @param text Location to store a UTF-8 encoded string of text - * holding context around the insertion point. - * If the function returns @c EINA_TRUE, then you must free - * the result stored in this location with free(). - * @param cursor_pos Location to store the position in characters of - * the insertion cursor within @p text. - * @return @c EINA_TRUE if surrounding text was provided; otherwise - * @c EINA_FALSE. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI Eina_Bool ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos) { @@ -1028,16 +590,6 @@ _ecore_imf_event_free_preedit(void *data __UNUSED__, void *event) free(event); } -/** - * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue. - * - * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts. - * It's asynchronous method to put event to the event queue. - * ecore_imf_context_event_callback_call() can be used as synchronous method. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx) { @@ -1056,16 +608,6 @@ ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx) ev, _ecore_imf_event_free_preedit, NULL); } -/** - * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue. - * - * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled. - * It's asynchronous method to put event to the event queue. - * ecore_imf_context_event_callback_call() can be used as synchronous method. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx) { @@ -1084,15 +626,6 @@ ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx) ev, _ecore_imf_event_free_preedit, NULL); } -/** - * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue. - * - * It's asynchronous method to put event to the event queue. - * ecore_imf_context_event_callback_call() can be used as synchronous method. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx) { @@ -1121,16 +654,6 @@ _ecore_imf_event_free_commit(void *data __UNUSED__, void *event) free(ev); } -/** - * Adds ECORE_IMF_EVENT_COMMIT to the event queue. - * - * It's asynchronous method to put event to the event queue. - * ecore_imf_context_event_callback_call() can be used as synchronous method. - * - * @param ctx An #Ecore_IMF_Context. - * @param str The committed string. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str) { @@ -1148,7 +671,6 @@ ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str) ev->str = str ? strdup(str) : NULL; ecore_event_add(ECORE_IMF_EVENT_COMMIT, ev, _ecore_imf_event_free_commit, NULL); - } static void @@ -1157,21 +679,6 @@ _ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event) free(event); } -/** - * Adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. - * - * Asks the widget that the input context is attached to to delete characters around the cursor position - * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. - * Note that offset and n_chars are in characters not in bytes. - * - * It's asynchronous method to put ECORE_IMF_EVENT_DELETE_SURROUNDING event to the event queue. - * ecore_imf_context_event_callback_call() can be used as synchronous method. - * - * @param ctx An #Ecore_IMF_Context. - * @param offset The start offset of surrounding to be deleted. - * @param n_chars The number of characters to be deleted. - * @ingroup Ecore_IMF_Context_Module_Group - */ EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars) { @@ -1192,38 +699,6 @@ ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offse ev, _ecore_imf_event_free_delete_surrounding, NULL); } -/** - * Add (register) a callback function to a given context event. - * - * This function adds a function callback to the context @p ctx when the - * event of type @p type occurs on it. The function pointer is @p - * func. - * - * The event type @p type to trigger the function may be one of - * #ECORE_IMF_CALLBACK_PREEDIT_START, #ECORE_IMF_CALLBACK_PREEDIT_END, - * #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT and - * #ECORE_IMF_CALLBACK_DELETE_SURROUNDING. - * - * @param ctx Ecore_IMF_Context to attach a callback to. - * @param type The type of event that will trigger the callback - * @param func The (callback) function to be called when the event is - * triggered - * @param data The data pointer to be passed to @p func - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - * - * Example - * @code - * static void - * _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info) - * { - * char *commit_str = event_info; - * // something to do - * } - * - * ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data); - * @endcode - */ EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data) { @@ -1248,23 +723,6 @@ ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_ ctx->callbacks = eina_list_append(ctx->callbacks, fn); } -/** - * Delete (unregister) a callback function registered to a given - * context event. - * - * This function removes a function callback from the context @p ctx when the - * event of type @p type occurs on it. The function pointer is @p - * func. - * - * @see ecore_imf_context_event_callback_add() for more details - * - * @param ctx Ecore_IMF_Context to remove a callback from. - * @param type The type of event that was triggering the callback - * @param func The (callback) function that was to be called when the event was triggered - * @return the data pointer - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI void * ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func) { @@ -1295,23 +753,6 @@ ecore_imf_context_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_ return NULL; } -/** - * Call a given callback on the context @p ctx. - * - * ecore_imf_context_preedit_start_event_add(), ecore_imf_context_preedit_end_event_add(), - * ecore_imf_context_preedit_changed_event_add(), ecore_imf_context_commit_event_add() and - * ecore_imf_context_delete_surrounding_event_add() APIs are asynchronous - * because those API adds each event to the event queue. - * - * This API provides the way to call each callback function immediately. - * - * @param ctx Ecore_IMF_Context. - * @param type The type of event that will trigger the callback - * @param event_info The pointer to event specific struct or information to - * pass to the callback functions registered on this event - * @ingroup Ecore_IMF_Context_Module_Group - * @since 1.2.0 - */ EAPI void ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, void *event_info) { @@ -1332,13 +773,6 @@ ecore_imf_context_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Callback } } -/** - * Ask the Input Method Context to show the control panel of using Input Method. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx) { @@ -1352,13 +786,6 @@ ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx) if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx); } -/** - * Ask the Input Method Context to hide the control panel of using Input Method. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx) { @@ -1372,13 +799,6 @@ ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx) if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx); } -/** - * Ask the Input Method Context to show the input panel (virtual keyboard). - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx) { @@ -1389,16 +809,10 @@ ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx) return; } + show_req_ctx = ctx; if (ctx->klass->show) ctx->klass->show(ctx); } -/** - * Ask the Input Method Context to hide the input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) { @@ -1412,15 +826,6 @@ ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) if (ctx->klass->hide) ctx->klass->hide(ctx); } -/** - * Set the layout of the input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @param layout see #Ecore_IMF_Input_Panel_Layout - * @note Default layout type is ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout) { @@ -1437,14 +842,6 @@ ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input ctx->input_panel_layout = layout; } -/** - * Get the layout of the current active input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @return layout see #Ecore_IMF_Input_Panel_Layout - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx) { @@ -1461,15 +858,6 @@ ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx) return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; } -/** - * Set the language of the input panel. - * This API can be used when you want to show the English keyboard. - * - * @param ctx An #Ecore_IMF_Context. - * @param lang the language to be set to the input panel. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang) { @@ -1484,16 +872,6 @@ ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Inp ctx->input_panel_lang = lang; } -/** - * Get the language of the input panel. - * - * See @ref ecore_imf_context_input_panel_language_set for more details. - * - * @param ctx An #Ecore_IMF_Context. - * @return Ecore_IMF_Input_Panel_Lang - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx) { @@ -1507,15 +885,6 @@ ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx) return ctx->input_panel_lang; } -/** - * Set whether the Input Method Context should request to show the input panel automatically - * when the widget has focus. - * - * @param ctx An #Ecore_IMF_Context. - * @param enabled If true, the input panel will be shown when the widget is clicked or has focus. - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enabled) @@ -1530,14 +899,6 @@ ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, ctx->input_panel_enabled = enabled; } -/** - * Get whether the Input Method Context requests to show the input panel automatically. - * - * @param ctx An #Ecore_IMF_Context. - * @return Return the attribute to show the input panel automatically - * @ingroup Ecore_IMF_Context_Group - * @since 1.1.0 - */ EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx) { @@ -1551,18 +912,6 @@ ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx) return ctx->input_panel_enabled; } -/** - * Set the input panel-specific data to deliver to the input panel. - * This API is used by applications to deliver specific data to the input panel. - * The data format MUST be negotiated by both application and the input panel. - * The size and format of data are defined by the input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @param data The specific data to be set to the input panel. - * @param len the length of data, in bytes, to send to the input panel - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI void ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *data, int len) { @@ -1579,15 +928,6 @@ ecore_imf_context_input_panel_imdata_set(Ecore_IMF_Context *ctx, const void *dat ctx->klass->input_panel_imdata_set(ctx, data, len); } -/** - * Get the specific data of the current active input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @param data The specific data to be got from the input panel - * @param len The length of data - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI void ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int *len) { @@ -1604,17 +944,6 @@ ecore_imf_context_input_panel_imdata_get(Ecore_IMF_Context *ctx, void *data, int ctx->klass->input_panel_imdata_get(ctx, data, len); } -/** - * Set the "return" key type. This type is used to set string or icon on the "return" key of the input panel. - * - * An input panel displays the string or icon associated with this type - * - * @param ctx An #Ecore_IMF_Context. - * @param return_key_type The type of "return" key on the input panel - * @note Default type is ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DEFAULT. - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI void ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Return_Key_Type return_key_type) { @@ -1629,16 +958,6 @@ ecore_imf_context_input_panel_return_key_type_set(Ecore_IMF_Context *ctx, Ecore_ if (ctx->klass->input_panel_return_key_type_set) ctx->klass->input_panel_return_key_type_set(ctx, return_key_type); } -/** - * Get the "return" key type. - * - * @see ecore_imf_context_input_panel_return_key_type_set() for more details - * - * @param ctx An #Ecore_IMF_Context. - * @return The type of "return" key on the input panel - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI Ecore_IMF_Input_Panel_Return_Key_Type ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx) { @@ -1652,14 +971,6 @@ ecore_imf_context_input_panel_return_key_type_get(Ecore_IMF_Context *ctx) return ctx->input_panel_return_key_type; } -/** - * Set the return key on the input panel to be disabled. - * - * @param ctx An #Ecore_IMF_Context. - * @param disabled The state - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI void ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Eina_Bool disabled) { @@ -1674,14 +985,6 @@ ecore_imf_context_input_panel_return_key_disabled_set(Ecore_IMF_Context *ctx, Ei if (ctx->klass->input_panel_return_key_disabled_set) ctx->klass->input_panel_return_key_disabled_set(ctx, disabled); } -/** - * Get whether the return key on the input panel should be disabled or not. - * - * @param ctx An #Ecore_IMF_Context. - * @return @c EINA_TRUE if it should be disabled. - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI Eina_Bool ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx) { @@ -1695,14 +998,6 @@ ecore_imf_context_input_panel_return_key_disabled_get(Ecore_IMF_Context *ctx) return ctx->input_panel_return_key_disabled; } -/** - * Set the caps lock mode on the input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @param mode Turn on caps lock on the input panel if @c EINA_TRUE. - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI void ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bool mode) { @@ -1719,14 +1014,6 @@ ecore_imf_context_input_panel_caps_lock_mode_set(Ecore_IMF_Context *ctx, Eina_Bo ctx->input_panel_caps_lock_mode = mode; } -/** - * Get the caps lock mode on the input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @return @c EINA_TRUE if the caps lock is turned on. - * @ingroup Ecore_IMF_Context_Group - * @since 1.2.0 - */ EAPI Eina_Bool ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx) { @@ -1740,17 +1027,6 @@ ecore_imf_context_input_panel_caps_lock_mode_get(Ecore_IMF_Context *ctx) return ctx->input_panel_caps_lock_mode; } -/** - * Get the position of the current active input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @param x top-left x co-ordinate of the input panel - * @param y top-left y co-ordinate of the input panel - * @param w width of the input panel - * @param h height of the input panel - * @ingroup Ecore_IMF_Context_Group - * @since 1.3 - */ EAPI void ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h) { @@ -1765,14 +1041,6 @@ ecore_imf_context_input_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int * ctx->klass->input_panel_geometry_get(ctx, x, y, w, h); } -/** - * Get state of current active input panel. - * - * @param ctx An #Ecore_IMF_Context. - * @return The state of input panel. - * @ingroup Ecore_IMF_Context_Group - * @since 1.3 - */ EAPI Ecore_IMF_Input_Panel_State ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx) { @@ -1790,24 +1058,14 @@ ecore_imf_context_input_panel_state_get(Ecore_IMF_Context *ctx) return state; } -/** - * Register a callback function which will be called if there is change in input panel state,language,mode etc. - * In order to deregister the callback function - * Use @ref ecore_imf_context_input_panel_event_callback_del. - * - * @param ctx An #Ecore_IMF_Context - * @param type event type - * @param func the callback function - * @param data application-input panel specific data. - * @ingroup Ecore_IMF_Context_Group - * @since 1.3 - */ EAPI void ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value), const void *data) { + Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, @@ -1815,24 +1073,27 @@ ecore_imf_context_input_panel_event_callback_add(Ecore_IMF_Context *ctx, return; } - if (ctx->klass->input_panel_event_callback_add) - ctx->klass->input_panel_event_callback_add(ctx, type, func, (void *)data); + if (!func) return; + + fn = calloc(1, sizeof (Ecore_IMF_Input_Panel_Callback_Node)); + if (!fn) return; + + fn->func = func; + fn->data = data; + fn->type = type; + + ctx->input_panel_callbacks = eina_list_append(ctx->input_panel_callbacks, fn); } -/** - * Unregister a callback function which will be called if there is change in input panel state, language, mode etc. - * - * @param ctx An #Ecore_IMF_Context. - * @param type An #Ecore_IMF_Input_Panel_Event. - * @param func the callback function - * @ingroup Ecore_IMF_Context_Group - * @since 1.3 - */ EAPI void ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, void (*func) (void *data, Ecore_IMF_Context *ctx, int value)) { + Eina_List *l = NULL; + Eina_List *l_next = NULL; + Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) { ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, @@ -1840,21 +1101,70 @@ ecore_imf_context_input_panel_event_callback_del(Ecore_IMF_Context *ctx, return; } - if (ctx->klass->input_panel_event_callback_del) - ctx->klass->input_panel_event_callback_del(ctx, type, func); + if (!func) return; + if (!ctx->input_panel_callbacks) return; + + EINA_LIST_FOREACH_SAFE(ctx->input_panel_callbacks, l, l_next, fn) + { + if ((fn) && (fn->func == func) && (fn->type == type)) + { + free(fn); + ctx->input_panel_callbacks = eina_list_remove_list(ctx->input_panel_callbacks, l); + return; + } + } +} + +EAPI void +ecore_imf_context_input_panel_event_callback_call(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Event type, int value) +{ + Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; + Eina_List *l = NULL; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_event_callback_call"); + return; + } + + EINA_LIST_FOREACH(ctx->input_panel_callbacks, l, fn) + { + if ((fn) && (fn->type == type) && (fn->func)) + { + fn->func(fn->data, ctx, value); + if (type == ECORE_IMF_INPUT_PANEL_STATE_HIDE && show_req_ctx == ctx) + show_req_ctx = NULL; + } + } +} + +EAPI void +ecore_imf_context_input_panel_event_callback_clear(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Input_Panel_Callback_Node *fn = NULL; + Eina_List *l = NULL; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_event_callback_clear"); + return; + } + + for (l = ctx->input_panel_callbacks; l;) + { + fn = (Ecore_IMF_Input_Panel_Callback_Node *)l->data; + + if (fn) + { + ctx->input_panel_callbacks = eina_list_remove(ctx->input_panel_callbacks, fn); + free (fn); + } + l = l->next; + } } -/** - * Get the current language locale of the input panel. - * - * ex) fr_FR - * - * @param ctx An #Ecore_IMF_Context. - * @param lang Location to store the retrieved language string. The - * string retrieved must be freed with free(). - * @ingroup Ecore_IMF_Context_Group - * @since 1.3 - */ EAPI void ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char **lang) { @@ -1873,17 +1183,6 @@ ecore_imf_context_input_panel_language_locale_get(Ecore_IMF_Context *ctx, char * } } -/** - * Get the geometry information of the candidate panel. - * - * @param ctx An #Ecore_IMF_Context. - * @param x top-left x co-ordinate of the candidate panel - * @param y top-left y co-ordinate of the candidate panel - * @param w width of the candidate panel - * @param h height of the candidate panel - * @ingroup Ecore_IMF_Context_Group - * @since 1.3 - */ EAPI void ecore_imf_context_candidate_panel_geometry_get(Ecore_IMF_Context *ctx, int *x, int *y, int *w, int *h) { diff --git a/src/lib/ecore_imf/ecore_imf_private.h b/src/lib/ecore_imf/ecore_imf_private.h index b4ff0f2..59ceddb 100644 --- a/src/lib/ecore_imf/ecore_imf_private.h +++ b/src/lib/ecore_imf/ecore_imf_private.h @@ -36,6 +36,7 @@ extern int _ecore_imf_log_dom; typedef struct _Ecore_IMF_Module Ecore_IMF_Module; typedef struct _Ecore_IMF_Func_Node Ecore_IMF_Func_Node; +typedef struct _Ecore_IMF_Input_Panel_Callback_Node Ecore_IMF_Input_Panel_Callback_Node; struct _Ecore_IMF_Context { @@ -49,6 +50,7 @@ struct _Ecore_IMF_Context Eina_Bool (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos); void *retrieve_surrounding_data; Eina_List *callbacks; + Eina_List *input_panel_callbacks; Ecore_IMF_Autocapital_Type autocapital_type; Ecore_IMF_Input_Panel_Layout input_panel_layout; Ecore_IMF_Input_Panel_Lang input_panel_lang; @@ -73,6 +75,13 @@ struct _Ecore_IMF_Func_Node Ecore_IMF_Callback_Type type; }; +struct _Ecore_IMF_Input_Panel_Callback_Node +{ + void (*func) (); + const void *data; + Ecore_IMF_Input_Panel_Event type; +}; + void ecore_imf_module_init(void); void ecore_imf_module_shutdown(void); Eina_List *ecore_imf_module_available_get(void); diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index 8ac41aa..cdb0e06 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c @@ -25,10 +25,183 @@ struct _Ecore_Input_Window int ignore_event; }; +typedef enum _Ecore_Input_State { + ECORE_INPUT_NONE = 0, + ECORE_INPUT_DOWN, + ECORE_INPUT_MOVE, + ECORE_INPUT_UP +} Ecore_Input_State; + +typedef struct _Ecore_Input_Last Ecore_Event_Last; +struct _Ecore_Input_Last +{ + Ecore_Event_Mouse_Button *ev; + Ecore_Timer *timer; + + unsigned int buttons; + Ecore_Input_State state; + + Eina_Bool faked : 1; +}; + static int _ecore_event_evas_init_count = 0; static Ecore_Event_Handler *ecore_event_evas_handlers[8]; static Eina_Hash *_window_hash = NULL; +static Eina_List *_last_events = NULL; +static double _last_events_timeout = 0.5; +static Eina_Bool _last_events_enable = EINA_FALSE; + +static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, + Ecore_Event_Press press, + Eina_Bool faked); + +static Ecore_Event_Last * +_ecore_event_evas_lookup(unsigned int buttons) +{ + Ecore_Event_Last *eel; + Eina_List *l; + + EINA_LIST_FOREACH(_last_events, l, eel) + if (eel->buttons == buttons) + return eel; + + eel = malloc(sizeof (Ecore_Event_Last)); + if (!eel) return NULL; + + eel->timer = NULL; + eel->ev = NULL; + eel->buttons = buttons; + eel->state = ECORE_INPUT_NONE; + eel->faked = EINA_FALSE; + + _last_events = eina_list_append(_last_events, eel); + return eel; +} + +static Eina_Bool +_ecore_event_evas_push_fake(void *data) +{ + Ecore_Event_Last *eel = data; + + switch (eel->state) + { + case ECORE_INPUT_NONE: + case ECORE_INPUT_UP: + /* should not happen */ + break; + case ECORE_INPUT_DOWN: + /* use the saved Ecore_Event */ + /* No up event since timeout started ... */ + case ECORE_INPUT_MOVE: + /* No up event since timeout started ... */ + _ecore_event_evas_mouse_button(eel->ev, ECORE_UP, EINA_TRUE); + eel->faked = EINA_TRUE; + break; + } + + free(eel->ev); + eel->ev = NULL; + eel->timer = NULL; + return EINA_FALSE; +} + +static void +_ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press) +{ + Ecore_Event_Last *eel; + + if (!_last_events_enable) return ; + + eel = _ecore_event_evas_lookup(e->buttons); + if (!eel) return ; + + switch (eel->state) + { + case ECORE_INPUT_NONE: + goto fine; + case ECORE_INPUT_DOWN: + if (press == ECORE_UP) + goto fine; + + /* press == ECORE_DOWN => emit a faked UP then */ + _ecore_event_evas_mouse_button(e, ECORE_UP, EINA_TRUE); + break; + case ECORE_INPUT_MOVE: + if (press == ECORE_UP) + goto fine; + + /* FIXME: handle fake button up and push for more delay here */ + + /* press == ECORE_DOWN */ + _ecore_event_evas_mouse_button(e, ECORE_DOWN, EINA_TRUE); + break; + case ECORE_INPUT_UP: + if (press == ECORE_DOWN) + goto fine; + + /* press == ECORE_UP */ + _ecore_event_evas_mouse_button(e, ECORE_UP, EINA_TRUE); + break; + } + + fine: + eel->state = (press == ECORE_DOWN) ? ECORE_INPUT_DOWN : ECORE_INPUT_UP; + if (_last_events_timeout) + { + if (eel->timer) ecore_timer_del(eel->timer); + eel->timer = NULL; + if (press == ECORE_DOWN) + { + /* Save the Ecore_Event somehow */ + if (!eel->ev) eel->ev = malloc(sizeof (Ecore_Event_Mouse_Button)); + if (!eel->ev) return ; + memcpy(eel->ev, e, sizeof (Ecore_Event_Mouse_Button)); + eel->timer = ecore_timer_add(_last_events_timeout, _ecore_event_evas_push_fake, eel); + } + else + { + free(eel->ev); + eel->ev = NULL; + } + } +} + +static void +_ecore_event_evas_push_mouse_move(Ecore_Event_Mouse_Move *e) +{ + Ecore_Event_Last *eel; + Eina_List *l; + + if (!_last_events_enable) return ; + + EINA_LIST_FOREACH(_last_events, l, eel) + switch (eel->state) + { + case ECORE_INPUT_NONE: + case ECORE_INPUT_UP: + /* none or up and moving, sounds fine to me */ + break; + case ECORE_INPUT_DOWN: + case ECORE_INPUT_MOVE: + /* Down and moving, let's see */ + if (eel->ev) + { + /* Add some delay to the timer */ + ecore_timer_reset(eel->timer); + /* Update position */ + eel->ev->x = e->x; + eel->ev->y = e->y; + eel->ev->root.x = e->root.x; + eel->ev->root.y = e->root.y; + eel->state = ECORE_INPUT_MOVE; + break; + } + /* FIXME: Timer did expire, do something maybe */ + break; + } +} + EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers) { @@ -163,7 +336,7 @@ _ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press) } static Eina_Bool -_ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press) +_ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press, Eina_Bool faked) { Ecore_Input_Window *lookup; Evas_Button_Flags flags = EVAS_BUTTON_NONE; @@ -174,6 +347,7 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; if (e->multi.device == 0) { + if (!faked) _ecore_event_evas_push_mouse_button(e, press); ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); if (press == ECORE_DOWN) evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, @@ -233,6 +407,7 @@ ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *ev if (!lookup) return ECORE_CALLBACK_PASS_ON; if (e->multi.device == 0) { + _ecore_event_evas_push_mouse_move(e); ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); if (lookup->move_mouse) lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp); @@ -262,13 +437,13 @@ ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *ev EAPI Eina_Bool ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) { - return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_DOWN); + return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_DOWN, EINA_FALSE); } EAPI Eina_Bool ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) { - return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_UP); + return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_UP, EINA_FALSE); } static Eina_Bool @@ -384,6 +559,17 @@ ecore_event_evas_init(void) _window_hash = eina_hash_pointer_new(free); + if (getenv("ECORE_INPUT_FIX")) + { + const char *tmp; + + _last_events_enable = EINA_TRUE; + + tmp = getenv("ECORE_INPUT_TIMEOUT_FIX"); + if (tmp) + _last_events_timeout = ((double) atoi(tmp)) / 60; + } + return _ecore_event_evas_init_count; shutdown_ecore: diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index 0480001..58e170d 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #ifdef HAVE_NETINET_IN_H diff --git a/src/lib/ecore_sdl/ecore_sdl.c b/src/lib/ecore_sdl/ecore_sdl.c index 3f28216..452300d 100644 --- a/src/lib/ecore_sdl/ecore_sdl.c +++ b/src/lib/ecore_sdl/ecore_sdl.c @@ -4,15 +4,13 @@ #include -#include "Eina.h" +#include +#include +#include +#include #include "Ecore_Sdl.h" -#include "Ecore_Input.h" -#include "Ecore.h" -#include "ecore_sdl_private.h" -#include "ecore_private.h" #include "Ecore_Sdl_Keys.h" - -#include +#include "ecore_sdl_private.h" int _ecore_sdl_log_dom = -1; diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c index 3bb05e7..1902808 100644 --- a/src/lib/ecore_wayland/ecore_wl.c +++ b/src/lib/ecore_wayland/ecore_wl.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include "ecore_wl_private.h" diff --git a/src/lib/ecore_wayland/ecore_wl_output.c b/src/lib/ecore_wayland/ecore_wl_output.c index 5e6c38d..50057df 100644 --- a/src/lib/ecore_wayland/ecore_wl_output.c +++ b/src/lib/ecore_wayland/ecore_wl_output.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_wl_private.h" /* local function prototypes */ diff --git a/src/lib/ecore_wayland/ecore_wl_window.c b/src/lib/ecore_wayland/ecore_wl_window.c index 76524ac..94b5628 100644 --- a/src/lib/ecore_wayland/ecore_wl_window.c +++ b/src/lib/ecore_wayland/ecore_wl_window.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_wl_private.h" /* local function prototypes */ diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c index 36f8a86..4938b5b 100644 --- a/src/lib/ecore_win32/ecore_win32_window.c +++ b/src/lib/ecore_win32/ecore_win32_window.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include /* for printf */ diff --git a/src/lib/ecore_wince/ecore_wince_window.c b/src/lib/ecore_wince/ecore_wince_window.c index 49a6312..5a550da 100644 --- a/src/lib/ecore_wince/ecore_wince_window.c +++ b/src/lib/ecore_wince/ecore_wince_window.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN diff --git a/src/lib/ecore_x/Ecore_X.h b/src/lib/ecore_x/Ecore_X.h index b3fc0fa..386122c 100644 --- a/src/lib/ecore_x/Ecore_X.h +++ b/src/lib/ecore_x/Ecore_X.h @@ -542,6 +542,7 @@ struct _Ecore_X_Event_Window_Hide Ecore_X_Window win; Ecore_X_Window event_win; Ecore_X_Time time; + Eina_Bool send_event : 1; }; struct _Ecore_X_Event_Window_Show @@ -1233,6 +1234,13 @@ typedef enum _Ecore_X_Illume_Indicator_Opacity_Mode ECORE_X_ILLUME_INDICATOR_TRANSPARENT } Ecore_X_Illume_Indicator_Opacity_Mode; +typedef enum _Ecore_X_Illume_Indicator_Type_Mode +{ + ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN = 0, + ECORE_X_ILLUME_INDICATOR_TYPE_1, + ECORE_X_ILLUME_INDICATOR_TYPE_2 +} Ecore_X_Illume_Indicator_Type_Mode; + typedef enum _Ecore_X_Illume_Window_State { ECORE_X_ILLUME_WINDOW_STATE_NORMAL = 0, @@ -1687,6 +1695,24 @@ EAPI void ecore_x_e_window_profile_set(Ecore_X_Windo EAPI void ecore_x_e_window_profile_list_set(Ecore_X_Window win, const char **profiles, unsigned int num_profiles); EAPI Eina_Bool ecore_x_e_window_profile_list_get(Ecore_X_Window win, const char ***profiles, int *ret_num); +EAPI void ecore_x_e_window_rotation_supported_set(Ecore_X_Window root, Eina_Bool enabled); +EAPI Eina_Bool ecore_x_e_window_rotation_supported_get(Ecore_X_Window root); +EAPI void ecore_x_e_window_available_rotations_set(Ecore_X_Window win, const int *rots, unsigned int count); +EAPI Eina_Bool ecore_x_e_window_available_rotations_get(Ecore_X_Window win, int **rots, unsigned int *count); +EAPI void ecore_x_e_window_preferred_rotation_set(Ecore_X_Window win, const int rot); +EAPI Eina_Bool ecore_x_e_window_preferred_rotation_get(Ecore_X_Window win, int *rot); +EAPI void ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win, int rot, Eina_Bool resize, int w, int h); +EAPI void ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root, Ecore_X_Window win, int rot); +EAPI void ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win, int rot); +EAPI void ecore_x_e_window_rotation_change_done_send(Ecore_X_Window root, Ecore_X_Window win, int rot, int w, int h); +EAPI void ecore_x_e_window_rotation_geometry_set(Ecore_X_Window win, int rot, int x, int y, int w, int h); +EAPI Eina_Bool ecore_x_e_window_rotation_geometry_get(Ecore_X_Window win, int rot, int *x, int *y, int *w, int *h); +EAPI void ecore_x_e_virtual_keyboard_control_window_set(Ecore_X_Window root, Ecore_X_Window win, unsigned int zone, Eina_Bool set); +EAPI void ecore_x_e_virtual_keyboard_on_prepare_request_send(Ecore_X_Window win); +EAPI void ecore_x_e_virtual_keyboard_on_prepare_done_send(Ecore_X_Window root, Ecore_X_Window win); +EAPI void ecore_x_e_virtual_keyboard_off_prepare_request_send(Ecore_X_Window win); +EAPI void ecore_x_e_virtual_keyboard_off_prepare_done_send(Ecore_X_Window root, Ecore_X_Window win); + EAPI Ecore_X_Sync_Alarm ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter); EAPI Eina_Bool ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm); EAPI Eina_Bool ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, unsigned int *val); @@ -2385,11 +2411,13 @@ EAPI Ecore_X_Illume_Indicator_State ecore_x_e_illume_indicator_state_get( EAPI void ecore_x_e_illume_indicator_state_send(Ecore_X_Window win, Ecore_X_Illume_Indicator_State state); EAPI void ecore_x_e_illume_indicator_opacity_set(Ecore_X_Window win, Ecore_X_Illume_Indicator_Opacity_Mode mode); - EAPI Ecore_X_Illume_Indicator_Opacity_Mode ecore_x_e_illume_indicator_opacity_get(Ecore_X_Window win); - EAPI void ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, Ecore_X_Illume_Indicator_Opacity_Mode mode); +EAPI void ecore_x_e_illume_indicator_type_set(Ecore_X_Window win, Ecore_X_Illume_Indicator_Type_Mode mode); +EAPI Ecore_X_Illume_Indicator_Type_Mode ecore_x_e_illume_indicator_type_get(Ecore_X_Window win); +EAPI void ecore_x_e_illume_indicator_type_send(Ecore_X_Window win, Ecore_X_Illume_Indicator_Type_Mode mode); + EAPI void ecore_x_e_illume_window_state_set(Ecore_X_Window win, Ecore_X_Illume_Window_State state); diff --git a/src/lib/ecore_x/Ecore_X_Atoms.h b/src/lib/ecore_x/Ecore_X_Atoms.h index ca6351d..d4fe513 100644 --- a/src/lib/ecore_x/Ecore_X_Atoms.h +++ b/src/lib/ecore_x/Ecore_X_Atoms.h @@ -245,6 +245,9 @@ EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE; EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE; @@ -289,4 +292,25 @@ EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SLIDING_WIN_GEOMETRY; /* for SDB(Samsung Debug Bridge) */ EAPI extern Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_CONNECT; EAPI extern Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT; + +/* E window rotation extension */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_REQUEST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_REQUEST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE; + +/* for deiconify approve protcol */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_DEICONIFY_APPROVE; #endif /* _ECORE_X_ATOMS_H */ diff --git a/src/lib/ecore_x/ecore_x_atoms_decl.h b/src/lib/ecore_x/ecore_x_atoms_decl.h index df1f1a7..e38f937 100644 --- a/src/lib/ecore_x/ecore_x_atoms_decl.h +++ b/src/lib/ecore_x/ecore_x_atoms_decl.h @@ -271,6 +271,9 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPACITY_MODE = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE= 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1 = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2 = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE = 0; @@ -318,6 +321,27 @@ EAPI Ecore_X_Atom ECORE_X_ATOM_SDB_SERVER_DISCONNECT = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_PROFILE = 0; EAPI Ecore_X_Atom ECORE_X_ATOM_E_PROFILE_LIST = 0; +/* E window rotation extension */ +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_REQUEST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_REQUEST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE = 0; + +/* for deiconify approve protcol */ +EAPI Ecore_X_Atom ECORE_X_ATOM_E_DEICONIFY_APPROVE = 0; + typedef struct _Atom_Item Atom_Item; struct _Atom_Item @@ -567,6 +591,9 @@ const Atom_Item atom_items[] = { "_E_ILLUME_INDICATOR_OPAQUE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_OPAQUE }, { "_E_ILLUME_INDICATOR_TRANSLUCENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSLUCENT }, { "_E_ILLUME_INDICATOR_TRANSPARENT", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TRANSPARENT }, + { "_E_ILLUME_INDICATOR_TYPE", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE }, + { "_E_ILLUME_INDICATOR_TYPE_0", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1 }, + { "_E_ILLUME_INDICATOR_TYPE_1", &ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2 }, { "_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLES", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_AVAILABLE_ANGLE }, { "_E_ILLUME_ROTATE_WINDOW_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE }, { "_E_ILLUME_ROTATE_ROOT_ANGLE", &ECORE_X_ATOM_E_ILLUME_ROTATE_ROOT_ANGLE }, @@ -600,7 +627,24 @@ const Atom_Item atom_items[] = { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION }, { "_E_PROFILE", &ECORE_X_ATOM_E_PROFILE }, - { "_E_PROFILE_LIST", &ECORE_X_ATOM_E_PROFILE_LIST } + { "_E_PROFILE_LIST", &ECORE_X_ATOM_E_PROFILE_LIST }, + + { "_E_WINDOW_ROTATION_SUPPORTED", &ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED }, + { "_E_WINDOW_ROTATION_AVAILABLE_LIST", &ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST }, + { "_E_WINDOW_ROTATION_PREFERRED_MODE", &ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE }, + { "_E_WINDOW_ROTATION_CHANGE_PREPARE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE }, + { "_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE }, + { "_E_WINDOW_ROTATION_CHANGE_REQUEST", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST }, + { "_E_WINDOW_ROTATION_CHANGE_DONE", &ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE }, + { "_E_WINDOW_ROTATION_0_GEOMETRY", &ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY }, + { "_E_WINDOW_ROTATION_90_GEOMETRY", &ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY }, + { "_E_WINDOW_ROTATION_180_GEOMETRY", &ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY }, + { "_E_WINDOW_ROTATION_270_GEOMETRY", &ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY }, + { "_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW }, + { "_E_VIRTUAL_KEYBOARD_ON_PREPARE_REQUEST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_REQUEST }, + { "_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE }, + { "_E_VIRTUAL_KEYBOARD_OFF_PREPARE_REQUEST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_REQUEST }, + { "_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE } /* SLP additions after the comma */ , @@ -610,6 +654,8 @@ const Atom_Item atom_items[] = /* for SDB(Samsung Debug Bridge) */ { "_SDB_SERVER_CONNECT", &ECORE_X_ATOM_SDB_SERVER_CONNECT }, - { "_SDB_SERVER_DISCONNECT", &ECORE_X_ATOM_SDB_SERVER_DISCONNECT } + { "_SDB_SERVER_DISCONNECT", &ECORE_X_ATOM_SDB_SERVER_DISCONNECT }, + + { "_E_DEICONIFY_APPROVE", &ECORE_X_ATOM_E_DEICONIFY_APPROVE } }; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_e.c b/src/lib/ecore_x/xcb/ecore_xcb_e.c index 82d94b6..0a002d3 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_e.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_e.c @@ -1,3 +1,33 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_xcb_private.h" /* local function prototypes */ @@ -863,7 +893,7 @@ _ecore_xcb_e_clipboard_state_get(Ecore_X_Atom atom) if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF) return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF; - return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; + return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN; } EAPI void @@ -1520,6 +1550,74 @@ ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, } static Ecore_X_Atom +_ecore_x_e_indicator_type_atom_get(Ecore_X_Illume_Indicator_Type_Mode mode) +{ + switch (mode) + { + case ECORE_X_ILLUME_INDICATOR_TYPE_1: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1; + + case ECORE_X_ILLUME_INDICATOR_TYPE_2: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Indicator_Type_Mode +_ecore_x_e_indicator_type_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1) + return ECORE_X_ILLUME_INDICATOR_TYPE_1; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2) + return ECORE_X_ILLUME_INDICATOR_TYPE_2; + + return ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_indicator_type_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Type_Mode mode) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_indicator_type_atom_get(mode); + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Indicator_Type_Mode +ecore_x_e_illume_indicator_type_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, + &atom, 1)) + return ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN; + + return _ecore_x_e_indicator_type_get(atom); +} + +EAPI void +ecore_x_e_illume_indicator_type_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Type_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_indicator_type_atom_get(mode), + 0, 0, 0, 0); +} + +static Ecore_X_Atom _ecore_x_e_illume_window_state_atom_get(Ecore_X_Illume_Window_State state) { switch (state) diff --git a/src/lib/ecore_x/xcb/ecore_xcb_events.c b/src/lib/ecore_x/xcb/ecore_xcb_events.c index 1763397..2a194e4 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_events.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_events.c @@ -1035,6 +1035,8 @@ _ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event) e->win = ev->window; e->event_win = ev->event; e->time = _ecore_xcb_event_last_time; + /* send_event is bit 7 (0x80) of response_type */ + e->send_event = ((ev->response_type & 0x80) ? 1 : 0); ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); } @@ -1356,13 +1358,9 @@ _ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event) } } else - { - format = - ecore_x_window_prop_property_get(ev->requestor, ev->property, - XCB_GET_PROPERTY_TYPE_ANY, 8, - &data, &num); - if (!format) return; - } + format = ecore_x_window_prop_property_get(ev->requestor, ev->property, + XCB_GET_PROPERTY_TYPE_ANY, 8, + &data, &num); e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); if (!e) return; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_image.c b/src/lib/ecore_x/xcb/ecore_xcb_image.c index 8e22110..b094b73 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_image.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_image.c @@ -1,3 +1,33 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_xcb_private.h" #include #include @@ -249,8 +279,10 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im) if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) && - (im->depth >= 24) && (vis->red_mask == 0xff0000) && - (vis->green_mask == 0x00ff00) && (vis->blue_mask == 0x0000ff)) + (im->bpp == 4) && + (vis->red_mask == 0xff0000) && + (vis->green_mask == 0x00ff00) && + (vis->blue_mask == 0x0000ff)) { #ifdef WORDS_BIGENDIAN if (im->xim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST) return EINA_TRUE; @@ -287,6 +319,8 @@ ecore_x_image_to_argb_convert(void *src, rgb565, bgr565, rgbx555, + rgb888, + bgr888, argbx888, abgrx888, rgba888x, @@ -346,40 +380,56 @@ ecore_x_image_to_argb_convert(void *src, else if ((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) { - if ((vis->red_mask == 0x00ff0000) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x000000ff)) - mode = argbx888; - else if ((vis->red_mask == 0x000000ff) && + if (sbpp == 24) + { + if ((vis->red_mask == 0x00ff0000) && (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x00ff0000)) - mode = abgrx888; - else if ((vis->red_mask == 0xff000000) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0x0000ff00)) - mode = rgba888x; - else if ((vis->red_mask == 0x0000ff00) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0xff000000)) - mode = bgra888x; - else if ((vis->red_mask == 0x0003f000) && - (vis->green_mask == 0x00000fc0) && - (vis->blue_mask == 0x0000003f)) - mode = argbx666; - else if ((vis->red_mask == 0x0000f800) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgb565; - else if ((vis->red_mask == 0x0000001f) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000f800)) - mode = bgr565; - else if ((vis->red_mask == 0x00007c00) && - (vis->green_mask == 0x000003e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgbx555; + (vis->blue_mask == 0x000000ff)) + mode = rgb888; + else if ((vis->red_mask == 0x000000ff) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x00ff0000)) + mode = bgr888; + else + return EINA_FALSE; + } else - return EINA_FALSE; + { + if ((vis->red_mask == 0x00ff0000) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x000000ff)) + mode = argbx888; + else if ((vis->red_mask == 0x000000ff) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x00ff0000)) + mode = abgrx888; + else if ((vis->red_mask == 0xff000000) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0x0000ff00)) + mode = rgba888x; + else if ((vis->red_mask == 0x0000ff00) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0xff000000)) + mode = bgra888x; + else if ((vis->red_mask == 0x0003f000) && + (vis->green_mask == 0x00000fc0) && + (vis->blue_mask == 0x0000003f)) + mode = argbx666; + else if ((vis->red_mask == 0x0000f800) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgb565; + else if ((vis->red_mask == 0x0000001f) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000f800)) + mode = bgr565; + else if ((vis->red_mask == 0x00007c00) && + (vis->green_mask == 0x000003e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgbx555; + else + return EINA_FALSE; + } } for (row = 0; row < h; row++) { @@ -461,6 +511,29 @@ ecore_x_image_to_argb_convert(void *src, break; case 24: + s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + (x * (sbpp / 8)); + switch (mode) + { + case rgb888: + while (dp < de) + { + *dp = 0xff000000 | (s8[2] << 16) | (s8[1] << 8) | s8[0]; + s8 += 3; dp++; + } + break; + case bgr888: + while (dp < de) + { + *dp = 0xff000000 | (s8[0] << 16) | (s8[1] << 8) | s8[2]; + s8 += 3; dp++; + } + break; + default: + return EINA_FALSE; + break; + } + break; + case 32: s32 = ((unsigned int *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; @@ -523,7 +596,6 @@ ecore_x_image_to_argb_convert(void *src, break; } break; - break; default: return EINA_FALSE; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c index a96b047..cc7d6a4 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c @@ -2761,12 +2761,11 @@ ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_leng edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; name = - malloc(sizeof(char) * - _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + malloc(_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX + 1); if (!name) return NULL; strncpy(name, edid_name, - (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; for (p = name; *p; p++) if ((*p < ' ') || (*p > '~')) *p = 0; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c b/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c index 9b74c67..6106450 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c @@ -347,7 +347,7 @@ ecore_x_screensaver_custom_blanking_enable(void) (_ecore_xcb_conn, ((xcb_screen_t *)_ecore_xcb_screen)->root, -9999, -9999, 1, 1, 0, - XCB_WINDOW_CLASS_INPUT_ONLY. + XCB_WINDOW_CLASS_INPUT_ONLY, XCB_COPY_FROM_PARENT, XCB_COPY_FROM_PARENT, 0, mask_list); return EINA_TRUE; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_selection.c b/src/lib/ecore_x/xcb/ecore_xcb_selection.c index 2fe148b..58ab373 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_selection.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_selection.c @@ -1,3 +1,33 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_xcb_private.h" //#include "Ecore_X_Atoms.h" @@ -449,7 +479,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection, { Ecore_X_Selection_Intern *sel; Ecore_X_Selection_Converter *cnv; - void *data; + void *data = NULL; char *tgt_str; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -461,7 +491,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection, { if (cnv->target == target) { - int r = 0; + int r; r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, targtype, typesize); @@ -475,6 +505,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection, return EINA_FALSE; } } + free(tgt_str); return EINA_FALSE; } @@ -748,7 +779,7 @@ _ecore_xcb_selection_parser_text(const char *target __UNUSED__, sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text)); if (!sel) return NULL; - if (_data[size - 1]) + if (_data && _data[size - 1]) { size++; t = realloc(_data, size); @@ -790,7 +821,7 @@ _ecore_xcb_selection_parser_files(const char *target, ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free; - if (_data[size - 1]) + if (_data && _data[size - 1]) { size++; t = realloc(_data, size); diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window.c b/src/lib/ecore_x/xcb/ecore_xcb_window.c index 8e38c5a..e797f35 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_window.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_window.c @@ -1,3 +1,33 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_xcb_private.h" #ifdef ECORE_XCB_RENDER # include diff --git a/src/lib/ecore_x/xlib/ecore_x.c b/src/lib/ecore_x/xlib/ecore_x.c index 7cb777d..2b50ad0 100644 --- a/src/lib/ecore_x/xlib/ecore_x.c +++ b/src/lib/ecore_x/xlib/ecore_x.c @@ -2,6 +2,32 @@ # include #endif /* ifdef HAVE_CONFIG_H */ +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include diff --git a/src/lib/ecore_x/xlib/ecore_x_atoms.c b/src/lib/ecore_x/xlib/ecore_x_atoms.c index 6518264..2aec7ce 100644 --- a/src/lib/ecore_x/xlib/ecore_x_atoms.c +++ b/src/lib/ecore_x/xlib/ecore_x_atoms.c @@ -2,22 +2,31 @@ # include #endif /* ifdef HAVE_CONFIG_H */ +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif #ifdef HAVE_ALLOCA_H # include -#elif defined __GNUC__ -# define alloca __builtin_alloca -#elif defined _AIX -# define alloca __alloca -#elif defined _MSC_VER -# include -# define alloca _alloca -#else /* ifdef HAVE_ALLOCA_H */ -# include -# ifdef __cplusplus +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus extern "C" -# endif /* ifdef __cplusplus */ -void *alloca(size_t); -#endif /* ifdef HAVE_ALLOCA_H */ +# endif +void *alloca (size_t); +# endif +#endif #include diff --git a/src/lib/ecore_x/xlib/ecore_x_e.c b/src/lib/ecore_x/xlib/ecore_x_e.c index ea17e64..0dffa27 100644 --- a/src/lib/ecore_x/xlib/ecore_x_e.c +++ b/src/lib/ecore_x/xlib/ecore_x_e.c @@ -6,6 +6,32 @@ # include #endif /* ifdef HAVE_CONFIG_H */ +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "Ecore.h" #include "ecore_x_private.h" #include "Ecore_X.h" @@ -880,7 +906,7 @@ _ecore_x_e_clipboard_state_get(Ecore_X_Atom atom) if (atom == ECORE_X_ATOM_E_ILLUME_CLIPBOARD_OFF) return ECORE_X_ILLUME_CLIPBOARD_STATE_OFF; - return ECORE_X_ILLUME_INDICATOR_STATE_UNKNOWN; + return ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN; } EAPI void @@ -1110,6 +1136,389 @@ ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, &xev); } +EAPI void +ecore_x_e_window_rotation_supported_set(Ecore_X_Window root, + Eina_Bool enabled) +{ + Ecore_X_Window win; + + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (enabled) + { + win = ecore_x_window_new(root, 1, 2, 3, 4); + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + } + else + { + int ret; + + ret = + ecore_x_window_prop_xid_get(root, + ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, + ECORE_X_ATOM_WINDOW, + &win, 1); + if ((ret == 1) && (win)) + { + ecore_x_window_prop_property_del( + root, + ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED); + ecore_x_window_free(win); + } + } +} + +EAPI Eina_Bool +ecore_x_e_window_rotation_supported_get(Ecore_X_Window root) +{ + Ecore_X_Window win, win2; + int ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + ret = + ecore_x_window_prop_xid_get(root, + ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, + ECORE_X_ATOM_WINDOW, + &win, 1); + if ((ret == 1) && (win)) + { + ret = + ecore_x_window_prop_xid_get(win, + ECORE_X_ATOM_E_WINDOW_ROTATION_SUPPORTED, + ECORE_X_ATOM_WINDOW, + &win2, 1); + if ((ret == 1) && (win2 == win)) + return EINA_TRUE; + } + + return EINA_FALSE; +} + +EAPI void +ecore_x_e_window_available_rotations_set(Ecore_X_Window win, + const int *rots, + unsigned int count) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST, + (unsigned int *)rots, count); +} + +EAPI Eina_Bool +ecore_x_e_window_available_rotations_get(Ecore_X_Window win, + int **rots, + unsigned int *count) +{ + unsigned char *data; + int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (count) *count = 0; + if (rots) *rots = NULL; + if (!win) return EINA_FALSE; + + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_E_WINDOW_ROTATION_AVAILABLE_LIST, + XA_CARDINAL, 32, &data, &num)) + return EINA_FALSE; + + if (count) *count = num; + + if (rots) + { + (*rots) = calloc(num, sizeof(int)); + if (!(*rots)) + { + if (count) *count = 0; + if (data) free(data); + return EINA_FALSE; + } + + memcpy(*rots, (int *)data, sizeof(int) * num); + } + + if (data) XFree(data); + return EINA_TRUE; +} + +EAPI void +ecore_x_e_window_preferred_rotation_set(Ecore_X_Window win, + int rot) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_property_set(win, + ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE, + XA_CARDINAL, 32, (void *)&rot, 1); +} + +EAPI Eina_Bool +ecore_x_e_window_preferred_rotation_get(Ecore_X_Window win, + int *rot) +{ + unsigned char *data = NULL; + int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_E_WINDOW_ROTATION_PREFERRED_MODE, + XA_CARDINAL, 32, &data, &num)) + return EINA_FALSE; + + if ((data) && (num == 1) && (rot)) + { + *rot = (int)(*data); + if (data) XFree(data); + return EINA_TRUE; + } + if (data) XFree(data); + return EINA_FALSE; +} + +EAPI void +ecore_x_e_window_rotation_change_prepare_send(Ecore_X_Window win, + int rot, + Eina_Bool resize, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send + (win, ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE, + ECORE_X_EVENT_MASK_NONE, + win, rot, resize, w, h); +} + +EAPI void +ecore_x_e_window_rotation_change_prepare_done_send(Ecore_X_Window root, + Ecore_X_Window win, + int rot) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_PREPARE_DONE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = rot; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} + +EAPI void +ecore_x_e_window_rotation_change_request_send(Ecore_X_Window win, + int rot) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send + (win, ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST, + ECORE_X_EVENT_MASK_NONE, + win, rot, 0, 0, 0); +} + +EAPI void +ecore_x_e_window_rotation_change_done_send(Ecore_X_Window root, + Ecore_X_Window win, + int rot, + int w, + int h) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_DONE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = rot; + xev.xclient.data.l[2] = w; + xev.xclient.data.l[3] = h; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} + +EAPI void +ecore_x_e_window_rotation_geometry_set(Ecore_X_Window win, + int rot, + int x, + int y, + int w, + int h) +{ + Ecore_X_Atom atom; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + + switch (rot) + { + case 0: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY; break; + case 90: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY; break; + case 180: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY; break; + case 270: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY; break; + default: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY; break; + } + + ecore_x_window_prop_card32_set(win, atom, geom, 4); +} + +EAPI Eina_Bool +ecore_x_e_window_rotation_geometry_get(Ecore_X_Window win, + int rot, + int *x, + int *y, + int *w, + int *h) +{ + int ret = 0; + Ecore_X_Atom atom; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + switch (rot) + { + case 0: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY; break; + case 90: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_90_GEOMETRY; break; + case 180: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_180_GEOMETRY; break; + case 270: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_270_GEOMETRY; break; + default: atom = ECORE_X_ATOM_E_WINDOW_ROTATION_0_GEOMETRY; break; + } + + ret = ecore_x_window_prop_card32_get(win, atom, geom, 4); + + if (ret != 4) + return EINA_FALSE; + + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_e_virtual_keyboard_control_window_set(Ecore_X_Window root, + Ecore_X_Window win, + unsigned int zone, + Eina_Bool set) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_CONTROL_WINDOW; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = zone; + xev.xclient.data.l[2] = set; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} + +EAPI void +ecore_x_e_virtual_keyboard_on_prepare_request_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send + (win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_REQUEST, + ECORE_X_EVENT_MASK_NONE, win, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_virtual_keyboard_on_prepare_done_send(Ecore_X_Window root, + Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + ecore_x_client_message32_send + (root, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON_PREPARE_DONE, + ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE | ECORE_X_EVENT_MASK_WINDOW_MANAGE, + win, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_virtual_keyboard_off_prepare_request_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send + (win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_REQUEST, + ECORE_X_EVENT_MASK_NONE, + win, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_virtual_keyboard_off_prepare_done_send(Ecore_X_Window root, + Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF_PREPARE_DONE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} + /* * @since 1.3 * @@ -1588,6 +1997,74 @@ ecore_x_e_illume_indicator_opacity_send(Ecore_X_Window win, } static Ecore_X_Atom +_ecore_x_e_indicator_type_atom_get(Ecore_X_Illume_Indicator_Type_Mode mode) +{ + switch (mode) + { + case ECORE_X_ILLUME_INDICATOR_TYPE_1: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1; + + case ECORE_X_ILLUME_INDICATOR_TYPE_2: + return ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Indicator_Type_Mode +_ecore_x_e_indicator_type_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_1) + return ECORE_X_ILLUME_INDICATOR_TYPE_1; + + if (atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_2) + return ECORE_X_ILLUME_INDICATOR_TYPE_2; + + return ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN; +} + +EAPI void +ecore_x_e_illume_indicator_type_set(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Type_Mode mode) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_indicator_type_atom_get(mode); + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Indicator_Type_Mode +ecore_x_e_illume_indicator_type_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, + &atom, 1)) + return ECORE_X_ILLUME_INDICATOR_TYPE_UNKNOWN; + + return _ecore_x_e_indicator_type_get(atom); +} + +EAPI void +ecore_x_e_illume_indicator_type_send(Ecore_X_Window win, + Ecore_X_Illume_Indicator_Type_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_TYPE_MODE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_indicator_type_atom_get(mode), + 0, 0, 0, 0); +} + +static Ecore_X_Atom _ecore_x_e_illume_window_state_atom_get(Ecore_X_Illume_Window_State state) { switch (state) diff --git a/src/lib/ecore_x/xlib/ecore_x_events.c b/src/lib/ecore_x/xlib/ecore_x_events.c index 7d685cf..c87e083 100644 --- a/src/lib/ecore_x/xlib/ecore_x_events.c +++ b/src/lib/ecore_x/xlib/ecore_x_events.c @@ -522,6 +522,8 @@ _ecore_x_event_handle_button_press(XEvent *xevent) { int i; + INF("ButtonEvent:press time=%u x=%d y=%d button=%d", (unsigned int)xevent->xbutton.time, (int)xevent->xbutton.x, (int)xevent->xbutton.y, xevent->xbutton.button); + _ecore_x_last_event_mouse_move = 0; if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8)) { @@ -672,6 +674,7 @@ void _ecore_x_event_handle_button_release(XEvent *xevent) { _ecore_x_last_event_mouse_move = 0; + INF("ButtonEvent:release time=%u x=%d y=%d button=%d", (unsigned int)xevent->xbutton.time, (int)xevent->xbutton.x, (int)xevent->xbutton.y, xevent->xbutton.button); /* filter out wheel buttons */ if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7)) { @@ -1087,6 +1090,7 @@ _ecore_x_event_handle_unmap_notify(XEvent *xevent) e->win = xevent->xunmap.window; e->event_win = xevent->xunmap.event; e->time = _ecore_x_event_last_time; + e->send_event = xevent->xunmap.send_event; ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); } @@ -1415,14 +1419,10 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent) } } else - { - format = ecore_x_window_prop_property_get(xevent->xselection.requestor, - xevent->xselection.property, - AnyPropertyType, 8, &data, - &num_ret); - if (!format) - return; - } + format = ecore_x_window_prop_property_get(xevent->xselection.requestor, + xevent->xselection.property, + AnyPropertyType, 8, &data, + &num_ret); e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); if (!e) diff --git a/src/lib/ecore_x/xlib/ecore_x_image.c b/src/lib/ecore_x/xlib/ecore_x_image.c index f2b1d75..a491e89 100644 --- a/src/lib/ecore_x/xlib/ecore_x_image.c +++ b/src/lib/ecore_x/xlib/ecore_x_image.c @@ -2,6 +2,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include #include @@ -167,6 +193,7 @@ _ecore_x_image_shm_create(Ecore_X_Image *im) if (im->shminfo.shmid == -1) { XDestroyImage(im->xim); + im->xim = NULL; return; } @@ -179,6 +206,7 @@ _ecore_x_image_shm_create(Ecore_X_Image *im) shmdt(im->shminfo.shmaddr); shmctl(im->shminfo.shmid, IPC_RMID, 0); XDestroyImage(im->xim); + im->xim = NULL; return; } @@ -192,7 +220,9 @@ _ecore_x_image_shm_create(Ecore_X_Image *im) im->bpp = 1; else if (im->xim->bits_per_pixel <= 16) im->bpp = 2; - else + else if (im->xim->bits_per_pixel <= 24) + im->bpp = 3; + else im->bpp = 4; } @@ -334,7 +364,7 @@ ecore_x_image_is_argb32_get(Ecore_X_Image *im) if (!im->xim) _ecore_x_image_shm_create(im); if (((vis->class == TrueColor) || (vis->class == DirectColor)) && - (im->depth >= 24) && + (im->bpp == 4) && (vis->red_mask == 0xff0000) && (vis->green_mask == 0x00ff00) && (vis->blue_mask == 0x0000ff)) @@ -373,6 +403,8 @@ ecore_x_image_to_argb_convert(void *src, rgb565, bgr565, rgbx555, + rgb888, + bgr888, argbx888, abgrx888, rgba888x, @@ -415,40 +447,56 @@ ecore_x_image_to_argb_convert(void *src, else if ((vis->class == TrueColor) || (vis->class == DirectColor)) { - if ((vis->red_mask == 0x00ff0000) && - (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x000000ff)) - mode = argbx888; - else if ((vis->red_mask == 0x000000ff) && + if (sbpp == 24) + { + if ((vis->red_mask == 0x00ff0000) && (vis->green_mask == 0x0000ff00) && - (vis->blue_mask == 0x00ff0000)) - mode = abgrx888; - else if ((vis->red_mask == 0xff000000) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0x0000ff00)) - mode = rgba888x; - else if ((vis->red_mask == 0x0000ff00) && - (vis->green_mask == 0x00ff0000) && - (vis->blue_mask == 0xff000000)) - mode = bgra888x; - else if ((vis->red_mask == 0x0003f000) && - (vis->green_mask == 0x00000fc0) && - (vis->blue_mask == 0x0000003f)) - mode = argbx666; - else if ((vis->red_mask == 0x0000f800) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgb565; - else if ((vis->red_mask == 0x0000001f) && - (vis->green_mask == 0x000007e0) && - (vis->blue_mask == 0x0000f800)) - mode = bgr565; - else if ((vis->red_mask == 0x00007c00) && - (vis->green_mask == 0x000003e0) && - (vis->blue_mask == 0x0000001f)) - mode = rgbx555; + (vis->blue_mask == 0x000000ff)) + mode = rgb888; + else if ((vis->red_mask == 0x000000ff) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x00ff0000)) + mode = bgr888; + else + return EINA_FALSE; + } else - return EINA_FALSE; + { + if ((vis->red_mask == 0x00ff0000) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x000000ff)) + mode = argbx888; + else if ((vis->red_mask == 0x000000ff) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x00ff0000)) + mode = abgrx888; + else if ((vis->red_mask == 0xff000000) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0x0000ff00)) + mode = rgba888x; + else if ((vis->red_mask == 0x0000ff00) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0xff000000)) + mode = bgra888x; + else if ((vis->red_mask == 0x0003f000) && + (vis->green_mask == 0x00000fc0) && + (vis->blue_mask == 0x0000003f)) + mode = argbx666; + else if ((vis->red_mask == 0x0000f800) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgb565; + else if ((vis->red_mask == 0x0000001f) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000f800)) + mode = bgr565; + else if ((vis->red_mask == 0x00007c00) && + (vis->green_mask == 0x000003e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgbx555; + else + return EINA_FALSE; + } } for (row = 0; row < h; row++) { @@ -529,6 +577,29 @@ ecore_x_image_to_argb_convert(void *src, break; case 24: + s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + (x * (sbpp / 8)); + switch (mode) + { + case rgb888: + while (dp < de) + { + *dp = 0xff000000 | (s8[2] << 16) | (s8[1] << 8) | s8[0]; + s8 += 3; dp++; + } + break; + case bgr888: + while (dp < de) + { + *dp = 0xff000000 | (s8[0] << 16) | (s8[1] << 8) | s8[2]; + s8 += 3; dp++; + } + break; + default: + return EINA_FALSE; + break; + } + break; + case 32: s32 = ((unsigned int *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; switch (mode) @@ -590,7 +661,6 @@ ecore_x_image_to_argb_convert(void *src, break; } break; - break; default: return EINA_FALSE; diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/src/lib/ecore_x/xlib/ecore_x_randr_12.c index 97f1d0c..9e937d7 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr_12.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr_12.c @@ -6,6 +6,32 @@ # include #endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include "ecore_x_private.h" #include "ecore_x_randr.h" #include diff --git a/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c b/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c index 5bda332..4c37a2c 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c @@ -184,9 +184,9 @@ ecore_x_randr_edid_display_name_get(unsigned char *edid, const char *edid_name; edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; - name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + name = malloc(_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX + 1); if (!name) return NULL; - strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + strncpy(name, edid_name, _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; for (p = name; *p; p++) { @@ -288,9 +288,9 @@ ecore_x_randr_edid_display_ascii_get(unsigned char *edid, * TODO: Two of these in a row, in the third and fourth slots, * seems to be specified by SPWG: http://www.spwg.org/ */ - ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + ascii = malloc(_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX + 1); if (!ascii) return NULL; - strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + strncpy(ascii, edid_ascii, _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; for (p = ascii; *p; p++) { @@ -321,9 +321,9 @@ ecore_x_randr_edid_display_serial_get(unsigned char *edid, * TODO: Two of these in a row, in the third and fourth slots, * seems to be specified by SPWG: http://www.spwg.org/ */ - serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + serial = malloc(_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX + 1); if (!serial) return NULL; - strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + strncpy(serial, edid_serial, _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; for (p = serial; *p; p++) { diff --git a/src/lib/ecore_x/xlib/ecore_x_selection.c b/src/lib/ecore_x/xlib/ecore_x_selection.c index e94d5a3..3dcc3b2 100644 --- a/src/lib/ecore_x/xlib/ecore_x_selection.c +++ b/src/lib/ecore_x/xlib/ecore_x_selection.c @@ -2,6 +2,32 @@ # include #endif /* ifdef HAVE_CONFIG_H */ +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include @@ -536,7 +562,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection, { Ecore_X_Selection_Intern *sel; Ecore_X_Selection_Converter *cnv; - void *data; + void *data = NULL; char *tgt_str; LOGFN(__FILE__, __LINE__, __FUNCTION__); @@ -548,6 +574,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection, if (cnv->target == target) { int r; + r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, targtype, typesize); free(tgt_str); @@ -560,6 +587,7 @@ ecore_x_selection_convert(Ecore_X_Atom selection, return EINA_FALSE; } } + free(tgt_str); /* ICCCM says "If the selection cannot be converted into a form based on the target (and parameters, if any), the owner should refuse the SelectionRequest as previously described." */ return EINA_FALSE; @@ -810,7 +838,7 @@ _ecore_x_selection_parser_files(const char *target, if (!sel) return NULL; ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free; - if (data[size - 1]) + if (data && data[size - 1]) { /* Isn't nul terminated */ size++; @@ -909,7 +937,7 @@ _ecore_x_selection_parser_text(const char *target __UNUSED__, sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text)); if (!sel) return NULL; - if (data[size - 1]) + if (data && data[size - 1]) { /* Isn't nul terminated */ size++; diff --git a/src/lib/ecore_x/xlib/ecore_x_window_prop.c b/src/lib/ecore_x/xlib/ecore_x_window_prop.c index a582453..98b41c4 100644 --- a/src/lib/ecore_x/xlib/ecore_x_window_prop.c +++ b/src/lib/ecore_x/xlib/ecore_x_window_prop.c @@ -2,6 +2,32 @@ # include #endif /* ifdef HAVE_CONFIG_H */ +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + #include #include diff --git a/src/lib/ecore_x/xlib/ecore_x_xi2.c b/src/lib/ecore_x/xlib/ecore_x_xi2.c index a09f055..7538162 100755 --- a/src/lib/ecore_x/xlib/ecore_x_xi2.c +++ b/src/lib/ecore_x/xlib/ecore_x_xi2.c @@ -270,6 +270,7 @@ _ecore_x_input_handler(XEvent *xevent) break; case XI_ButtonPress: + INF("ButtonEvent:multi press time=%u x=%d y=%d devid=%d", (unsigned int)evd->time, (int)evd->event_x, (int)evd->event_y, devid); _ecore_mouse_button (ECORE_EVENT_MOUSE_BUTTON_DOWN, evd->time, @@ -289,6 +290,7 @@ _ecore_x_input_handler(XEvent *xevent) break; case XI_ButtonRelease: + INF("ButtonEvent:multi release time=%u x=%d y=%d devid=%d", (unsigned int)evd->time, (int)evd->event_x, (int)evd->event_y, devid); _ecore_mouse_button (ECORE_EVENT_MOUSE_BUTTON_UP, evd->time,