From a0a1b0135a29aeabf2ecec63c2a4a712dfe31fc7 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 18 Nov 2008 10:11:57 +0000 Subject: [PATCH] more todo items done/added SVN revision: 37702 --- src/lib/Elementary.h | 25 +++++++++++++++--- src/lib/elm_entry.c | 3 +++ src/lib/elm_priv.h | 7 +++-- src/lib/elm_widget.c | 43 +++++++++++++++++++++++++++++++ src/lib/elm_win.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 141 insertions(+), 9 deletions(-) diff --git a/src/lib/Elementary.h b/src/lib/Elementary.h index 40abd08..4cac6ce 100644 --- a/src/lib/Elementary.h +++ b/src/lib/Elementary.h @@ -69,6 +69,20 @@ extern "C" { ELM_WIN_BASIC, ELM_WIN_DIALOG_BASIC } Elm_Win_Type; + + typedef enum _Elm_Win_Keyboard_Mode + { + ELM_WIN_KEYBOARD_UNKNOWN, + ELM_WIN_KEYBOARD_OFF, + ELM_WIN_KEYBOARD_ON, + ELM_WIN_KEYBOARD_ALPHA, + ELM_WIN_KEYBOARD_NUMERIC, + ELM_WIN_KEYBOARD_PIN, + ELM_WIN_KEYBOARD_PHONE_NUMBER, + ELM_WIN_KEYBOARD_HEX, + ELM_WIN_KEYBOARD_TERMINAL, + ELM_WIN_KEYBOARD_PASSWORD + } Elm_Win_Keyboard_Mode; /**************************************************************************/ /* General calls */ @@ -87,7 +101,8 @@ extern "C" { EAPI void elm_win_shaped_set(Evas_Object *obj, Evas_Bool shaped); EAPI void elm_win_alpha_set(Evas_Object *obj, Evas_Bool alpha); EAPI void elm_win_override_set(Evas_Object *obj, Evas_Bool override); -// FIXME: implement more of the above calls + EAPI void elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode); + EAPI void elm_win_keyboard_win_set(Evas_Object *obj, Evas_Bool is_keyboard); /* smart callbacks called: * "delete-request" - the user requested to delete the window */ @@ -295,11 +310,10 @@ extern "C" { // * disabled not supported // * tab widget focusing (not useful for touchscreen tho...) // * bubble should allow style (left/right + top/bottom) -// * need to get toplevel object (win) -// * entry needs to set vkbd properties/hint (as does win) -// * entry selection conflicts with finger scroll (make selection start/stop work on signals?) // * on the fly theme changes - test (should work) // * entry doesnt talk with x copy & paste at all +// * entry selection conflicts with finger scroll (make selection start/stop work on signals?) +// * need a hold-scroll counter in elm_widget // //// (more widgets/features - medium priority) // * toolbar widget (edje + box + button + separators) @@ -327,5 +341,8 @@ extern "C" { // a page size // * current sizing tree inefficient // * need a way to filter entry data for entry (eg for phone numbers) +// * win should emit signals based on vkbd type - if it gets a message and is a vkbd win +// * win needs a way of setting aspect too +// * use the wrong call on the wrong widget and *BOOM* // #endif diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c index e585052..09f96ea 100644 --- a/src/lib/elm_entry.c +++ b/src/lib/elm_entry.c @@ -101,15 +101,18 @@ static void _on_focus_hook(void *data, Evas_Object *obj) { Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *top = elm_widget_top_get(obj); if (elm_widget_focus_get(obj)) { evas_object_focus_set(wd->ent, 1); edje_object_signal_emit(wd->ent, "elm,action,focus", "elm"); + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON); } else { edje_object_signal_emit(wd->ent, "elm,action,unfocus", "elm"); evas_object_focus_set(wd->ent, 0); + elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF); } } diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h index 370760d..f80aa47 100644 --- a/src/lib/elm_priv.h +++ b/src/lib/elm_priv.h @@ -62,6 +62,7 @@ EAPI void elm_widget_can_focus_set(Evas_Object *obj, int can_focus); EAPI int elm_widget_can_focus_get(Evas_Object *obj); EAPI int elm_widget_focus_get(Evas_Object *obj); EAPI Evas_Object *elm_widget_focused_object_get(Evas_Object *obj); +EAPI Evas_Object *elm_widget_top_get(Evas_Object *obj); EAPI int elm_widget_focus_jump(Evas_Object *obj, int forward); EAPI void elm_widget_focus_set(Evas_Object *obj, int first); EAPI void elm_widget_focused_object_clear(Evas_Object *obj); @@ -73,8 +74,10 @@ EAPI void elm_widget_disabled_set(Evas_Object *obj, int disabled); EAPI int elm_widget_disabled_get(Evas_Object *obj); EAPI void elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); EAPI void elm_widget_show_region_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); - - +EAPI void elm_widget_scroll_hold_push(Evas_Object *obj); +EAPI void elm_widget_scroll_hold_pop(Evas_Object *obj); +EAPI int elm_widget_scroll_hold_get(Evas_Object *obj); + extern char *_elm_appname; extern Elm_Config *_elm_config; diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 60e9612..20ef1bd 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -28,6 +28,7 @@ struct _Smart_Data void *on_show_region_data; void *data; Evas_Coord rx, ry, rw, rh; + int scroll_hold; unsigned char can_focus : 1; unsigned char child_can_focus : 1; unsigned char focused : 1; @@ -212,6 +213,11 @@ elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj) API_ENTRY return; if (sd->resize_obj) { + if (!strcmp(evas_object_type_get(sd->resize_obj), SMART_NAME)) + { + Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj); + if (sd2) sd2->parent_obj = NULL; + } evas_object_event_callback_del(sd->resize_obj, EVAS_CALLBACK_DEL, _sub_obj_del); evas_object_event_callback_del(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN, _sub_obj_mouse_down); evas_object_smart_member_del(sd->resize_obj); @@ -219,6 +225,11 @@ elm_widget_resize_object_set(Evas_Object *obj, Evas_Object *sobj) sd->resize_obj = sobj; if (sd->resize_obj) { + if (!strcmp(evas_object_type_get(sd->resize_obj), SMART_NAME)) + { + Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj); + if (sd2) sd2->parent_obj = obj; + } evas_object_clip_set(sobj, evas_object_clip_get(obj)); evas_object_smart_member_add(sobj, obj); evas_object_event_callback_add(sobj, EVAS_CALLBACK_DEL, _sub_obj_del, sd); @@ -283,6 +294,15 @@ elm_widget_focused_object_get(Evas_Object *obj) return obj; } +EAPI Evas_Object * +elm_widget_top_get(Evas_Object *obj) +{ + Eina_List *l; + API_ENTRY return NULL; + if (sd->parent_obj) return elm_widget_top_get(sd->parent_obj); + return obj; +} + EAPI int elm_widget_focus_jump(Evas_Object *obj, int forward) { @@ -544,6 +564,29 @@ elm_widget_show_region_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_ if (h) *h = sd->rh; } +EAPI void +elm_widget_scroll_hold_push(Evas_Object *obj) +{ + API_ENTRY return; + sd->scroll_hold++; + if (sd->parent_obj) elm_widget_scroll_hold_push(sd->parent_obj); +} + +EAPI void +elm_widget_scroll_hold_pop(Evas_Object *obj) +{ + API_ENTRY return; + sd->scroll_hold--; + if (sd->parent_obj) elm_widget_scroll_hold_pop(sd->parent_obj); +} + +EAPI int +elm_widget_scroll_hold_get(Evas_Object *obj) +{ + API_ENTRY return 0; + return sd->scroll_hold; +} + /* local subsystem functions */ static void _smart_reconfigure(Smart_Data *sd) diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c index bbabccd..72e6ab4 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -13,8 +13,10 @@ struct _Elm_Win Ecore_X_Window xwin; Ecore_Job *deferred_resize_job; Ecore_Job *deferred_child_eval_job; - Elm_Win_Type type; - Evas_Bool autodel : 1; + + Elm_Win_Type type; + Elm_Win_Keyboard_Mode kbdmode; + Evas_Bool autodel : 1; }; static void _elm_win_resize(Ecore_Evas *ee); @@ -270,7 +272,9 @@ _elm_win_xwin_update(Elm_Win *win) break; } } - + if (win->xwin) + ecore_x_e_virtual_keyboard_state_set + (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode); } static void @@ -529,3 +533,65 @@ elm_win_override_set(Evas_Object *obj, Evas_Bool override) ecore_evas_override_set(win->ee, override); _elm_win_xwin_update(win); } + +EAPI void +elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode) +{ + Elm_Win *win = evas_object_data_get(obj, "__Elm"); + if (!win) return; + if (mode == win->kbdmode) return; + win->xwin = 0; + switch (_elm_config->engine) + { + case ELM_SOFTWARE_X11: + if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee); + break; + case ELM_SOFTWARE_FB: + break; + case ELM_SOFTWARE_16_X11: + if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee); + break; + case ELM_XRENDER_X11: + if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee); + break; + case ELM_OPENGL_X11: + if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee); + break; + default: + break; + } + win->kbdmode = mode; + if (win->xwin) + ecore_x_e_virtual_keyboard_state_set + (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode); +} + +EAPI void +elm_win_keyboard_win_set(Evas_Object *obj, Evas_Bool is_keyboard) +{ + Elm_Win *win = evas_object_data_get(obj, "__Elm"); + if (!win) return; + win->xwin = 0; + switch (_elm_config->engine) + { + case ELM_SOFTWARE_X11: + if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee); + break; + case ELM_SOFTWARE_FB: + break; + case ELM_SOFTWARE_16_X11: + if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee); + break; + case ELM_XRENDER_X11: + if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee); + break; + case ELM_OPENGL_X11: + if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee); + break; + default: + break; + } + if (win->xwin) + ecore_x_e_virtual_keyboard_set + (win->xwin, is_keyboard); +} -- 2.7.4