diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index fe09c18389..36790b5f98 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -333,3 +333,13 @@ * Ecore_Win32, Ecore_WinCE: fix Shift, Control and Alt keys detection * Ecore_Win32: fix "mouse-down inside and mouse-up outside" issue + +2011-11-2 Carsten Haitzler (The Rasterman) + + * Fix bug ecore-evas for fb, buffer, sdl back-ends to ensure + mouse is in on init (as events wont always give this) and focus + is set on show if appropriate if no focus in/out events come + from the back-end later + * Fix setting override state to only hide if it should be + visible at that point in x back end support + diff --git a/legacy/ecore/NEWS b/legacy/ecore/NEWS index b7011804e3..6a1b81f6a3 100644 --- a/legacy/ecore/NEWS +++ b/legacy/ecore/NEWS @@ -88,6 +88,7 @@ Fixes: * use current size not requested size when getting geom in ecore-evas * ecore_cocoa now handles windows correctly * ecore_file_download error handling when ecore_con_url_get fails + * focus and mouse-in ininital siate on some ecore-evas back-ends Improvements: @@ -104,6 +105,7 @@ Improvements: * inet_ntop instead of getnameinfo for ecore_con_client_get_ip * ecore-con unit tests added * ecore-evas fb uses ecore_input_evas now instead of going direct + * fix ecore-evas x changing of override support if window not shown yet Removals: diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c index 3299f61e52..a3e49d63a1 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_buffer.c @@ -101,6 +101,16 @@ _ecore_evas_buffer_shutdown(void) return _ecore_evas_init_count; } +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->engine.buffer.image) return; + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + int _ecore_evas_buffer_render(Ecore_Evas *ee) { @@ -484,7 +494,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = NULL, NULL, NULL, - NULL, + _ecore_evas_show, NULL, NULL, NULL, @@ -629,6 +639,8 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i ee->engine.func->fn_render = _ecore_evas_buffer_render; _ecore_evas_register(ee); + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + return ee; #else return NULL; diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c index df70843621..1f946d5072 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -113,10 +113,12 @@ _ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, vo ee = _ecore_evas_cocoa_match(); - if (!ee) return 1; + if (!ee) return ECORE_CALLBACK_PASS_ON; ee->prop.focused = 1; - - return 0; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + + return ECORE_CALLBACK_PASS_ON; } static int @@ -128,10 +130,12 @@ _ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, v ee = _ecore_evas_cocoa_match(); - if (!ee) return 1; + if (!ee) return ECORE_CALLBACK_PASS_ON; + evas_focus_out(ee->evas); ee->prop.focused = 0; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); - return 0; + return ECORE_CALLBACK_PASS_ON; } static int @@ -149,7 +153,7 @@ _ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, return 0;*/ DBG("Video Resize"); - + return ECORE_CALLBACK_PASS_ON; } static int @@ -163,11 +167,11 @@ _ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, ee = _ecore_evas_cocoa_match(); - if (!ee) return 1; + if (!ee) return ECORE_CALLBACK_PASS_ON; evas_output_size_get(ee->evas, &w, &h); evas_damage_rectangle_add(ee->evas, 0, 0, w, h); - return 0; + return ECORE_CALLBACK_PASS_ON; } static int @@ -187,7 +191,7 @@ _ecore_evas_idle_enter(void *data __UNUSED__) evas_norender(ee->evas); } - return 1; + return EINA_TRUE; } static int @@ -544,6 +548,7 @@ ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) _ecore_evas_register(ee); ecore_event_window_register(0, ee, ee->evas, NULL, NULL, NULL, NULL); + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); printf("Ecore Evas returned : %p\n", ee); return ee; diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c index 943ef7fc1d..47c13cca8e 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c @@ -102,9 +102,9 @@ _ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, e = event; ee = _ecore_evas_fb_match(); - if (!ee) return EINA_TRUE; /* pass on event */ + if (!ee) return ECORE_CALLBACK_PASS_ON; _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); - return EINA_TRUE; /* dont pass it on */ + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -115,9 +115,9 @@ _ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, vo e = event; ee = _ecore_evas_fb_match(); - if (!ee) return EINA_TRUE; /* pass on event */ + if (!ee) return ECORE_CALLBACK_PASS_ON; _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); - return EINA_TRUE; /* dont pass it on */ + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -128,9 +128,9 @@ _ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *e e = event; ee = _ecore_evas_fb_match(); - if (!ee) return EINA_TRUE; /* pass on event */ + if (!ee) return ECORE_CALLBACK_PASS_ON; _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); - return EINA_TRUE; /* dont pass it on */ + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -141,9 +141,9 @@ _ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void * e = event; ee = _ecore_evas_fb_match(); - if (!ee) return EINA_TRUE; /* pass on event */ + if (!ee) return ECORE_CALLBACK_PASS_ON; _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); - return EINA_TRUE; /* dont pass it on */ + return ECORE_CALLBACK_PASS_ON; } static int @@ -370,6 +370,15 @@ _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__) if (ee->func.fn_resize) ee->func.fn_resize(ee); } +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + static void _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { @@ -508,7 +517,7 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func = _ecore_evas_move_resize, _ecore_evas_rotation_set, NULL, - NULL, + _ecore_evas_show, NULL, NULL, NULL, @@ -636,10 +645,7 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) ee->engine.func->fn_render = _ecore_evas_fb_render; _ecore_evas_register(ee); fb_ee = ee; - evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); - evas_focus_in(ee->evas); - return ee; } #else diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c index 88fa974e4d..0849c7928d 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c @@ -46,8 +46,10 @@ _ecore_evas_psl1ght_event_got_focus(void *data __UNUSED__, int type __UNUSED__, if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ ee->prop.focused = 1; - - return ECORE_CALLBACK_DONE; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -59,9 +61,11 @@ _ecore_evas_psl1ght_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + evas_focus_out(ee->evas); ee->prop.focused = 0; - - return ECORE_CALLBACK_DONE; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -77,7 +81,7 @@ _ecore_evas_psl1ght_event_video_expose(void *data __UNUSED__, int type __UNUSED_ evas_output_size_get(ee->evas, &w, &h); evas_damage_rectangle_add(ee->evas, 0, 0, w, h); - return ECORE_CALLBACK_DONE; + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -91,7 +95,7 @@ _ecore_evas_psl1ght_event_key_modifiers(void *data __UNUSED__, int type __UNUSED if (!ee) return ECORE_CALLBACK_PASS_ON; ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); - return ECORE_CALLBACK_DONE; + return ECORE_CALLBACK_PASS_ON; } static int @@ -254,6 +258,15 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int _ecore_evas_resize (ee, w, h); } +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + static void _ecore_evas_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) { @@ -327,7 +340,7 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = _ecore_evas_move_resize, NULL, NULL, - NULL, + _ecore_evas_show, NULL, NULL, NULL, @@ -441,13 +454,13 @@ ecore_evas_psl1ght_new(const char *name, int w, int h) psl1ght_ee = ee; - evas_event_feed_mouse_in(ee->evas, _ecore_evas_time_get (), NULL); - evas_focus_in(ee->evas); _ecore_evas_screen_resized (ee); if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH")) ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0); + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + return ee; } diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c index e70c995231..b333d969f1 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_sdl.c @@ -52,8 +52,9 @@ _ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ ee->prop.focused = 1; - - return ECORE_CALLBACK_DONE; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -66,8 +67,9 @@ _ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, voi if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ ee->prop.focused = 0; - - return ECORE_CALLBACK_DONE; + evas_focus_out(ee->evas); + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -82,7 +84,7 @@ _ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, v if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ evas_output_size_set(ee->evas, e->w, e->h); - return ECORE_CALLBACK_DONE; + return ECORE_CALLBACK_PASS_ON; } static Eina_Bool @@ -98,7 +100,7 @@ _ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, v evas_output_size_get(ee->evas, &w, &h); evas_damage_rectangle_add(ee->evas, 0, 0, w, h); - return ECORE_CALLBACK_DONE; + return ECORE_CALLBACK_PASS_ON; } static int @@ -239,14 +241,21 @@ _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int if (ee->func.fn_resize) ee->func.fn_resize(ee); } +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); +} + static void _ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) { Ecore_Evas *ee; ee = data; - if (ee) - ee->prop.cursor.object = NULL; + if (ee) ee->prop.cursor.object = NULL; } static void @@ -304,7 +313,7 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = _ecore_evas_move_resize, NULL, NULL, - NULL, + _ecore_evas_show, NULL, NULL, NULL, @@ -458,10 +467,6 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu _ecore_evas_register(ee); sdl_ee = ee; - - evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); - evas_focus_in(ee->evas); - return ee; } #endif diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c index 2bb8f15fe0..d9ccd6eb8c 100644 --- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_x.c @@ -1005,7 +1005,8 @@ _ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void } if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11"))) evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); - if (ee->visible) return ECORE_CALLBACK_DONE; + if (ee->visible) return ECORE_CALLBACK_PASS_ON; +// if (ee->visible) return ECORE_CALLBACK_DONE; // printf("SHOW EVENT %p\n", ee); ee->visible = 1; if (ee->func.fn_show) ee->func.fn_show(ee); @@ -1022,7 +1023,8 @@ _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void ee = ecore_event_window_match(e->win); if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; - if (!ee->visible) return ECORE_CALLBACK_DONE; + if (!ee->visible) return ECORE_CALLBACK_PASS_ON; +// if (!ee->visible) return ECORE_CALLBACK_DONE; // printf("HIDE EVENT %p\n", ee); ee->visible = 0; if (ee->func.fn_hide) ee->func.fn_hide(ee); @@ -2460,9 +2462,9 @@ static void _ecore_evas_x_override_set(Ecore_Evas *ee, int on) { if (ee->prop.override == on) return; - ecore_x_window_hide(ee->prop.window); + if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window); ecore_x_window_override_set(ee->prop.window, on); - if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->should_be_visible) ecore_x_window_show(ee->prop.window); if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); ee->prop.override = on; }