From b9670eb4611096ec03a6848a83a98dbf56129be3 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Sat, 4 Apr 2009 16:58:28 +0000 Subject: [PATCH] focus in/out signals. SVN revision: 39860 --- legacy/elementary/src/lib/Elementary.h.in | 2 ++ legacy/elementary/src/lib/elm_win.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index 97a918d9d3..a160df56c7 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -247,6 +247,8 @@ extern "C" { EAPI Ecore_X_Window elm_win_xwindow_get(const Evas_Object *obj); /* smart callbacks called: * "delete-request" - the user requested to delete the window + * "focus-in" - window got focus + * "focus-out" - window lost focus */ EAPI Evas_Object *elm_bg_add(Evas_Object *parent); diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index e72850869d..4b3299944d 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -42,6 +42,22 @@ _elm_win_resize(Ecore_Evas *ee) win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win); } +static void +_elm_win_focus_in(Ecore_Evas *ee) +{ + Elm_Win *win = elm_widget_data_get(ecore_evas_object_associate_get(ee)); + if (!win) return; + evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); +} + +static void +_elm_win_focus_out(Ecore_Evas *ee) +{ + Elm_Win *win = elm_widget_data_get(ecore_evas_object_associate_get(ee)); + if (!win) return; + evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); +} + static void _deferred_ecore_evas_free(void *data) { @@ -318,6 +334,8 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) ecore_evas_name_class_set(win->ee, name, _elm_appname); ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request); ecore_evas_callback_resize_set(win->ee, _elm_win_resize); + ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in); + ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out); evas_image_cache_set(win->evas, _elm_config->image_cache * 1024); evas_font_cache_set(win->evas, _elm_config->font_cache * 1024); EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)