From 42bb0a819b444c8200bc45945970782fe1b781be Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Tue, 20 Mar 2012 04:35:18 +0000 Subject: [PATCH] Ecore: add ecore_wince_window_focus_get() and ecore_win32_window_focus_get() SVN revision: 69514 --- legacy/ecore/ChangeLog | 5 +-- legacy/ecore/NEWS | 2 ++ .../ecore/src/lib/ecore_win32/Ecore_Win32.h | 2 ++ .../src/lib/ecore_win32/ecore_win32_window.c | 33 +++++++++++++++++++ .../ecore/src/lib/ecore_wince/Ecore_WinCE.h | 2 ++ .../src/lib/ecore_wince/ecore_wince_window.c | 31 +++++++++++++++++ 6 files changed, 73 insertions(+), 2 deletions(-) diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index 34ee5ea008..dc855e0877 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -582,6 +582,7 @@ 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/legacy/ecore/NEWS b/legacy/ecore/NEWS index f17b40107b..22fd7a7afb 100644 --- a/legacy/ecore/NEWS +++ b/legacy/ecore/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: diff --git a/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h b/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h index d46930eb83..5df3346041 100644 --- a/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h +++ b/legacy/ecore/src/lib/ecore_win32/Ecore_Win32.h @@ -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); diff --git a/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c b/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c index 395dbfa6a6..559050d42d 100644 --- a/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c +++ b/legacy/ecore/src/lib/ecore_win32/ecore_win32_window.c @@ -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) @@ -889,6 +891,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. * diff --git a/legacy/ecore/src/lib/ecore_wince/Ecore_WinCE.h b/legacy/ecore/src/lib/ecore_wince/Ecore_WinCE.h index c3e378a3b3..63e20d5904 100644 --- a/legacy/ecore/src/lib/ecore_wince/Ecore_WinCE.h +++ b/legacy/ecore/src/lib/ecore_wince/Ecore_WinCE.h @@ -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)); diff --git a/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c b/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c index 0037ed87f3..37524cdfb0 100644 --- a/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c +++ b/legacy/ecore/src/lib/ecore_wince/ecore_wince_window.c @@ -467,6 +467,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. *