Ecore: add ecore_wince_window_focus_get() and ecore_win32_window_focus_get()
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Mar 2012 04:35:18 +0000 (04:35 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 20 Mar 2012 04:35:18 +0000 (04:35 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@69514 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/ecore_win32/Ecore_Win32.h
src/lib/ecore_win32/ecore_win32_window.c
src/lib/ecore_wince/Ecore_WinCE.h
src/lib/ecore_wince/ecore_wince_window.c

index 34ee5ea..dc855e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
 2012-03-20  Vincent Torri
 
-        * Change ecore_win32_window_focus_set() to ecore_win32_window_focus()
+        * Rename ecore_win32_window_focus_set() to ecore_win32_window_focus()
        to match ecore_x API.
-       * Add ecore_wince_window_focus_set()
+       * Add ecore_wince_window_focus(), ecore_wince_window_focus_get()
+       and ecore_win32_window_focus_get().
diff --git a/NEWS b/NEWS
index f17b401..22fd7a7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -39,8 +39,10 @@ Additions:
      - ecore_imf_context_input_panel_caps_lock_mode_get()
     * ecore_win32:
      - ecore_win32_focus()
+     - ecore_win32_focus_get()
     * ecore_wince:
      - ecore_wince_focus()
+     - ecore_wince_focus_get()
 
 Fixes:
     * ecore_thread:
index d46930e..5df3346 100644 (file)
@@ -462,6 +462,8 @@ EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window,
 
 EAPI void ecore_win32_window_focus(Ecore_Win32_Window *window);
 
+EAPI void *ecore_win32_window_focus_get(void);
+
 EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
                                            Eina_Bool           on);
 
index 395dbfa..559050d 100644 (file)
@@ -249,6 +249,8 @@ ecore_win32_window_free(Ecore_Win32_Window *window)
  *
  * This function returns the window HANDLE associated to @p window. If
  * @p window is @c NULL, this function returns @c NULL.
+ *
+ * @note The returned value is of type HWND.
  */
 EAPI void *
 ecore_win32_window_hwnd_get(Ecore_Win32_Window *window)
@@ -890,6 +892,37 @@ ecore_win32_window_focus(Ecore_Win32_Window *window)
 }
 
 /**
+ * @brief Get the current focused window.
+ *
+ * @return The window that has focus.
+ *
+ * This function returns the window that has focus. If the calling
+ * thread's message queue does not have an associated window with the
+ * keyboard focus, the return value is @c NULL.
+ *
+ * @note Even if the returned value is @c NULL, another thread's queue
+ * may be associated with a window that has the keyboard focus.
+ *
+ * @note The returned value is of type HWND.
+ */
+EAPI void *
+ecore_win32_window_focus_get(void)
+{
+   HWND focused;
+
+   INF("getting focused window");
+
+   focused = GetFocus(window->window);
+   if (!focused)
+     {
+        ERR("GetFocus() failed");
+        return NULL;
+     }
+
+   return focused;
+}
+
+/**
  * @brief Iconify or restore the given window.
  *
  * @param window The window.
index c3e378a..63e20d5 100644 (file)
@@ -282,6 +282,8 @@ EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window,
 
 EAPI void ecore_wince_window_focus(Ecore_WinCE_Window *window);
 
+EAPI void *ecore_wince_window_focus_get(void);
+
 EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend);
 
 EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int));
index 0037ed8..37524cd 100644 (file)
@@ -468,6 +468,37 @@ ecore_wince_window_focus(Ecore_WinCE_Window *window)
 }
 
 /**
+ * @brief Get the current focused window.
+ *
+ * @return The window that has focus.
+ *
+ * This function returns the window that has focus. If the calling
+ * thread's message queue does not have an associated window with the
+ * keyboard focus, the return value is @c NULL.
+ *
+ * @note Even if the returned value is @c NULL, another thread's queue
+ * may be associated with a window that has the keyboard focus.
+ *
+ * @note The returned value is of type HWND.
+ */
+EAPI void *
+ecore_wince_window_focus_get(void)
+{
+   HWND focused;
+
+   INF("getting focused window");
+
+   focused = GetFocus(window->window);
+   if (!focused)
+     {
+        ERR("GetFocus() failed");
+        return NULL;
+     }
+
+   return focused;
+}
+
+/**
  * @brief Set the graphic backend used for the given window.
  *
  * @param window The window.