focus in/out signals.
authorGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 4 Apr 2009 16:58:28 +0000 (16:58 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Sat, 4 Apr 2009 16:58:28 +0000 (16:58 +0000)
SVN revision: 39860

src/lib/Elementary.h.in
src/lib/elm_win.c

index 97a918d..a160df5 100644 (file)
@@ -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);
index e728508..4b32999 100644 (file)
@@ -43,6 +43,22 @@ _elm_win_resize(Ecore_Evas *ee)
 }
 
 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)
 {
    ecore_evas_free(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)