From 0e9e05e1e6077ce5a27704e49e2cece95f82a246 Mon Sep 17 00:00:00 2001 From: raster Date: Thu, 17 Feb 2011 10:56:32 +0000 Subject: [PATCH] make the writing of a softkey much easier - you dont need ecore_x. it's wrapped and hidden. simpler. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@57120 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 10 ++++++ src/lib/elm_win.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index d49e6f4..be87b4b 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -484,6 +484,14 @@ extern "C" { ELM_WIN_KEYBOARD_KEYPAD, ELM_WIN_KEYBOARD_J2ME } Elm_Win_Keyboard_Mode; + + typedef enum _Elm_Illume_Command + { + ELM_ILLUME_COMMAND_FOCUS_BACK, + ELM_ILLUME_COMMAND_FOCUS_FORWARD, + ELM_ILLUME_COMMAND_FOCUS_HOME, + ELM_ILLUME_COMMAND_CLOSE + } Elm_Illume_Command; EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type); EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj) EINA_ARG_NONNULL(1); @@ -528,6 +536,8 @@ extern "C" { EAPI int elm_win_quickpanel_priority_minor_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_win_quickpanel_zone_set(Evas_Object *obj, int zone) EINA_ARG_NONNULL(1); EAPI int elm_win_quickpanel_zone_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); + EAPI void elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip); EINA_ARG_NONNULL(1); + EAPI void elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params); EINA_ARG_NONNULL(1); EAPI void elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled) EINA_ARG_NONNULL(1); EAPI Eina_Bool elm_win_focus_highlight_enabled_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style) EINA_ARG_NONNULL(1); diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index 9241bce..ac287d1 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -2162,6 +2162,98 @@ elm_win_quickpanel_zone_get(const Evas_Object *obj) } /** + * Set the window to be skipped by keyboard focus + * + * This sets the window to be skipped by normal keyboard input. This means + * a window manager will be asked to not focus this window as well as omit + * it from things like the taskbar, pager, "alt-tab" list etc. etc. + * + * Call this and enable it on a window BEFORE you show it for the first time, + * otherwise it may have no effect. + * + * Use this for windows that have only output information or might only be + * interacted with by the mouse or fingers, and never for typing input. + * Be careful that this may have side-effects like making the window + * non-accessible in some cases unless the window is specially handled. Use + * this with care. + * + * @param obj The window object + * @param skip The skip flag state (EINA_TRUE if it is to be skipped) + * + * @ingroup Win + */ +EAPI void +elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (skip) + { + if (win->xwin) + { + Ecore_X_Window_State states[2]; + + ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0); + states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; + states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER; + ecore_x_netwm_window_state_set(win->xwin, states, 2); + } + } +#endif +} + +/** + * Send a command to the windowing environment + * + * This is intended to work in touchscreen or small screen device environments + * where there is a more simplistic window management policy in place. This + * uses the window object indicated to select which part of the environment + * to control (the part that this window lives in), and provides a command + * and an optional parameter structure (use NULL for this if not needed). + * + * @param obj The window object that lives in the environment to control + * @param command The command to send + * @param params Optional parameters for the command + * + * @ingroup Win + */ +EAPI void +elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__) +{ + Elm_Win *win; + ELM_CHECK_WIDTYPE(obj, widtype); + win = elm_widget_data_get(obj); + if (!win) return; +#ifdef HAVE_ELEMENTARY_X + _elm_win_xwindow_get(win); + if (win->xwin) + { + switch (command) + { + case ELM_ILLUME_COMMAND_FOCUS_BACK: + ecore_x_e_illume_focus_back_send(win->xwin); + break; + case ELM_ILLUME_COMMAND_FOCUS_FORWARD: + ecore_x_e_illume_focus_forward_send(win->xwin); + break; + case ELM_ILLUME_COMMAND_FOCUS_HOME: + ecore_x_e_illume_focus_home_send(win->xwin); + break; + case ELM_ILLUME_COMMAND_CLOSE: + ecore_x_e_illume_close_send(win->xwin); + break; + default: + break; + } + } +#endif +} + +/** * Set the enabled status for the focus highlight in a window * * This function will enable or disable the focus highlight only for the -- 2.7.4