# Process this file with autoconf to produce a configure script
#AC_INIT(scim, 1.4.7, suzhe@tsinghua.org.cn)
-AC_INIT(isf, 2.3.4821, isf@samsung.com)
+AC_INIT(isf, 2.3.5009, isf@samsung.com)
AC_CONFIG_SRCDIR([ism/src/scim.h])
m4_pattern_allow([^AS_])
# ISF version
ISF_MAJOR_VERSION=2
ISF_MINOR_VERSION=3
-ISF_MICRO_VERSION=4821
+ISF_MICRO_VERSION=5009
ISF_VERSION=$ISF_MAJOR_VERSION.$ISF_MINOR_VERSION.$ISF_MICRO_VERSION
# Check dlog library
PKG_CHECK_MODULES(DLOG, [dlog >= 0])
+# Check privilege control library
+PKG_CHECK_MODULES(PRIVILEGE_CONTROL, [libprivilege-control >= 0])
+
# Check if we should build isf-setting-efl
PKG_CHECK_MODULES(VCONF, [vconf],
[ISF_HAS_VCONF=yes],
+isf (2.3.5009-1slp2+1) unstable; urgency=low
+
+ * upload tizen beta code
+ * Git: slp/pkgs/i/isf
+ * Tag: isf_2.3.5009-1slp2+1
+
+ -- Jihoon Kim <jihoon48.kim@samsung.com> Thu, 09 Feb 2012 17:48:05 +0900
+
isf (2.3.4821-1slp2+1) unstable; urgency=low
* code cleanup
Uploaders: Ji-hoon Lee <dalton.lee@samsung.com>
Build-Depends: debhelper (>= 5), autotools-dev, pkg-config, libelm-dev, libglib2.0-dev,
libappcore-efl-dev, libslp-utilx-dev, libslp-setting-dev, libui-gadget-dev, libheynoti-dev,
- libecore-dev, libevas-dev, libx11-dev, dlog-dev
+ libecore-dev, libevas-dev, libx11-dev, dlog-dev, libprivilege-control-dev
Standards-Version: 3.7.2
Homepage: http://www.scim-im.org
static void result_cb (struct ui_gadget *ug, bundle *result, void *priv)
{
- struct appdata *ad = (appdata*) priv;
-
if (!result) return;
const char *name = bundle_get_val(result, "name");
ug_destroy (ug);
}
-static void cam_destroy_cb (struct ui_gadget *ug, void *priv)
-{
- printf ("enter cam_destroy_cb ().........\n");
- if (!ug)
- return;
-
- ug_destroy (ug);
- struct appdata *ad = (struct appdata *) priv;
- if (ad->layout_main != NULL)
- evas_object_show(ad->layout_main);
- if (ad->bg != NULL)
- evas_object_show(ad->bg);
-}
-
static void isfsetting_bt (void *data, Evas_Object *obj, void *event_info)
{
struct appdata *ad = (struct appdata *)data;
ad->data = NULL;
}
-static void response_cb (void *data, Evas_Object *obj, void *event_info)
-{
- if ((int)event_info != 5)
- evas_object_del (obj);
-}
-
static int create_demo_view (struct appdata *ad)
{
Evas_Object *li = NULL;
INPUT_PANEL_PRIVATE_KEY_SET,
INPUT_PANEL_KEY_DISABLED_SET,
INPUT_PANEL_STATE_GET,
- INPUT_PANEL_MOVE,
CONTROL_PANEL_SHOW,
CONTROL_PANEL_HIDE,
};
"PANEL PRIVATE KEY SET",
"PANEL KEY DISABLED SET",
"INPUT PANEL STATE GET",
- "INPUT PANEL MOVE",
"CTRL PANEL SHOW",
"CTRL PANEL HIDE",
};
}
}
-void test_input_panel_move (void *data, Evas_Object *obj, void *event_info)
-{
- if (imf_context != NULL) {
- ecore_imf_context_input_panel_move (imf_context, 100, 100);
- }
-}
-
char *gli_label_get (void *data, Evas_Object *obj, const char *part)
{
int j = (int)data;
case INPUT_PANEL_STATE_GET:
test_input_panel_state_get (NULL, obj, event_info);
break;
- case INPUT_PANEL_MOVE:
- test_input_panel_move (NULL, obj, event_info);
- break;
case CONTROL_PANEL_SHOW:
test_control_panel_show (NULL, obj, event_info);
break;
struct appdata *ad = (struct appdata *)data;
Evas_Object *bx = NULL ;
Evas_Object *ef = NULL ;
- Evas_Object *en = NULL ;
-
Evas_Object *parent = ad->naviframe;
bx = elm_box_add (parent);
#include <sys/time.h>
#include <sys/times.h>
#include <pthread.h>
+#include <langinfo.h>
-#include <Elementary.h>
+#include <Evas.h>
#include <Ecore_Evas.h>
#include <Ecore_X.h>
-#include <Edje.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/Xutil.h>
#include "isf_imf_context.h"
#include "isf_imf_control_ui.h"
+#ifndef CODESET
+# define CODESET "INVALID"
+#endif
+
const double DOUBLE_SPACE_INTERVAL=1.0;
const int PREDICTION_ALLOW_SET = 0xa0;
static void panel_slot_update_preedit_string (int context,
const WideString &str,
const AttributeList &attrs);
+static void panel_slot_get_surrounding_text (int context,
+ int maxlen_before,
+ int maxlen_after);
+static void panel_slot_delete_surrounding_text (int context,
+ int offset,
+ int len);
static void panel_req_focus_in (EcoreIMFContextISF *ic);
static void panel_req_update_factory_info (EcoreIMFContextISF *ic);
const String &uuid);
static void initialize_modifier_bits (Display *display);
static unsigned int scim_x11_keymask_scim_to_x11 (Display *display, uint16 scimkeymask);
-static XKeyEvent createKeyEvent (Display *display, const Window &win,
- const Window &winRoot, bool press,
- int keycode, int modifiers);
-static void _x_send_key_event (const KeyEvent &key);
+static XKeyEvent createKeyEvent (bool press, int keycode, int modifiers, bool fake);
+static void send_x_key_event (const KeyEvent &key, bool fake);
static void attach_instance (const IMEngineInstancePointer &si);
break;
}
- for (i=0; i < punc_num; i++) {
+ for (i = 0; i < punc_num; i++) {
uni_puncs[i] = eina_unicode_utf8_to_unicode(puncs[i], NULL);
}
}
// Convert into plain string
- plain_str = elm_entry_markup_to_utf8(markup_str);
+ plain_str = evas_textblock_text_markup_to_utf8(NULL, markup_str);
if (!plain_str) goto done;
// Convert string from utf8 to unicode
tail = eina_unicode_strndup(ustr+cursor_pos-2, 2);
if (tail) {
- for (i=0; i < punc_num; i++) {
+ for (i = 0; i < punc_num; i++) {
if (!eina_unicode_strcmp(tail, uni_puncs[i])) {
ret = EINA_TRUE;
break;
if (markup_str) free(markup_str);
if (plain_str) free(plain_str);
- for (i=0; i < punc_num; i++) {
+ for (i = 0; i < punc_num; i++) {
if (uni_puncs[i]) free(uni_puncs[i]);
}
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
int val;
- Ecore_X_Display *display = ecore_x_display_get ();
- if (!display) {
- std::cerr << "ecore_x_display_get () failed !!!";
- return NULL;
- }
EcoreIMFContextISF *context_scim = new EcoreIMFContextISF;
if (context_scim == NULL) {
if (context_scim->impl->preedit_updating)
return;
- if (!context_scim->impl->client_canvas)
- return;
-
if (context_scim->impl->cursor_pos != cursor_pos) {
context_scim->impl->cursor_pos = cursor_pos;
if (context_scim->impl->preedit_updating)
return;
- if (!context_scim->impl->client_canvas)
- return;
-
- ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
- if (!ee) return;
+ if (context_scim->impl->client_canvas) {
+ ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
- ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL);
+ if (ee)
+ ecore_evas_geometry_get (ee, &canvas_x, &canvas_y, NULL, NULL);
+ }
+ else if (context_scim->impl->client_window) {
+ ecore_x_window_geometry_get(context_scim->impl->client_window, &canvas_x, &canvas_y, NULL, NULL);
+ }
if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch) {
context_scim->impl->cursor_x = canvas_x + cx;
* the event was not handled), but there is no obligation of any events to be
* submitted to this function.
*/
-
EAPI Eina_Bool
isf_imf_context_filter_event (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event)
{
Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event;
timestamp = ev->timestamp;
scim_string_to_key (key, ev->key);
+ if (isupper(key.code))
+ key.mask |=SCIM_KEY_ShiftMask;
if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
timestamp = ev->timestamp;
scim_string_to_key (key, ev->key);
key.mask = SCIM_KEY_ReleaseMask;
+ if (isupper(key.code))
+ key.mask |=SCIM_KEY_ShiftMask;
if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) key.mask |=SCIM_KEY_ShiftMask;
if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) key.mask |=SCIM_KEY_ControlMask;
if (ev->modifiers & ECORE_IMF_KEYBOARD_MODIFIER_ALT) key.mask |=SCIM_KEY_AltMask;
}
}
-static const char *
-get_sw_keyname (const char *key_string)
+static int
+_keyname_to_keycode(const char *keyname)
{
- const static char *SW_KEY_NAMES[][2] = {
- {"0x1008ff84", "XF86XK_UserPB"},
- {"0x1008ff85", "XF86XK_User1KB"},
- {"0x1008ff86", "XF86XK_User2KB"},
- };
- const char* key_name = key_string;
- int loop;
- if (key_string) {
- for (loop = 0; ((unsigned int)loop) < (sizeof (SW_KEY_NAMES) / sizeof (SW_KEY_NAMES[0])); loop++) {
- if (!strcmp (key_string, SW_KEY_NAMES[loop][0])) {
- key_name = SW_KEY_NAMES[loop][1];
- break;
- }
- }
+ int keycode = 0;
+ int keysym;
+ Display *display = (Display *)ecore_x_display_get();
+
+ keysym = XStringToKeysym(keyname);
+
+ if (!strncmp(keyname, "Keycode-", 8))
+ keycode = atoi(keyname + 8);
+ else {
+ keycode = XKeysymToKeycode(display, keysym);
}
- return key_name;
+
+ return keycode;
}
static void
-feed_key_event (Evas *evas, const char *str, Eina_Bool fake)
-{
- char key_string[128] = {0};
+send_evas_key_event (Evas *evas, const KeyEvent &scim_key, bool fake)
+{
+ char *keyname;
+ char *key;
+ char key_string[256] = {0};
+ char *keysym_str;
+ char compose_buffer[256] = {0};
+ const char *str = scim_key.get_key_string().c_str();
+ char *compose = NULL;
unsigned int timestamp = 0;
+ int shift = 0;
+ int val;
+ KeySym keysym;
+ ::KeyCode keycode;
+ XKeyEvent xkey;
+
+ Display *display = (Display *)ecore_x_display_get ();
+
+ if (!evas) return;
if (!fake)
timestamp = get_time ();
- if (strncmp (str, "KeyRelease+", 11) == 0) {
- strncpy(key_string, str + 11, strlen(str)-11);
- evas_event_feed_key_up (evas, key_string, get_sw_keyname(key_string), NULL, NULL, timestamp, NULL);
- SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up ()...\n";
- } else {
+ if (scim_key.is_key_press ()) {
strncpy(key_string, str, strlen(str));
- evas_event_feed_key_down (evas, key_string, get_sw_keyname(key_string), NULL, NULL, timestamp, NULL);
+ } else {
+ if (strncmp (str, "KeyRelease+", 11) == 0) {
+ strncpy(key_string, str + 11, strlen(str)-11);
+ }
+ }
+
+ if (strncmp (key_string, "Shift+", 6) == 0) {
+ keysym_str = key_string + 6;
+ }
+ else {
+ keysym_str = key_string;
+ }
+
+ // get x keysym, keycode, keyname, and key
+ keysym = XStringToKeysym(keysym_str);
+ if (keysym == NoSymbol)
+ return;
+
+ keycode = _keyname_to_keycode(keysym_str);
+ keyname = XKeysymToString(XKeycodeToKeysym(display, keycode, 0));
+ key = keysym_str;
+
+ // check modifier
+ if (XKeycodeToKeysym(display, keycode, 0) != keysym) {
+ if (XKeycodeToKeysym(display, keycode, 1) == keysym)
+ shift = 1;
+ else
+ keycode = 0;
+ }
+ else
+ shift = 0;
+
+ unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, scim_key.mask);
+
+ if (shift)
+ modifier |= ShiftMask;
+
+ // get keystring
+ xkey = createKeyEvent(scim_key.is_key_press(), keycode, modifier, False);
+ val = XLookupString (&xkey, compose_buffer, sizeof(compose_buffer), NULL, 0);
+
+ if (val > 0) {
+ compose_buffer[val] = 0;
+ compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8",
+ compose_buffer);
+ }
+
+ if (!keyname)
+ keyname = key;
+
+ // feed key event
+ if (scim_key.is_key_press()) {
+ evas_event_feed_key_down (evas, keyname, key, compose, compose, timestamp, NULL);
SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_down ()...\n";
+ } else {
+ evas_event_feed_key_up (evas, keyname, key, compose, compose, timestamp, NULL);
+ SCIM_DEBUG_FRONTEND(1) << " evas_event_feed_key_up ()...\n";
+ }
+
+ if (compose)
+ free(compose);
+}
+
+static void
+feed_key_event (EcoreIMFContextISF *ic, const KeyEvent &key, bool fake)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ if (!ic || !ic->impl) return;
+
+ if (ic->impl->client_canvas) {
+ send_evas_key_event(ic->impl->client_canvas, key, fake);
+ } else {
+ send_x_key_event(key, fake);
}
}
EcoreIMFContextISF *ic = find_ic (context);
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << " context=" << context << " key=" << key.get_key_string () << " ic=" << ic << "\n";
- if (ic && ic->impl && ic->impl->client_canvas) {
- feed_key_event(ic->impl->client_canvas, key.get_key_string().c_str(), EINA_FALSE);
- }
+ feed_key_event (ic, key, false);
}
static void
if (strlen (key.get_key_string ().c_str ()) >= 116)
return;
- if (ic && ic->impl && ic->impl->client_canvas)
- feed_key_event (ic->impl->client_canvas, key.get_key_string ().c_str (), EINA_TRUE);
+ feed_key_event (ic, key, true);
}
static void
}
}
+static void
+panel_slot_get_surrounding_text (int context, int maxlen_before, int maxlen_after)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = find_ic (context);
+
+ if (ic && ic->impl && _focused_ic == ic && ic->impl->si) {
+ int cursor = 0;
+ WideString text = WideString ();
+ slot_get_surrounding_text (ic->impl->si, text, cursor, maxlen_before, maxlen_after);
+ _panel_client.prepare (ic->id);
+ _panel_client.update_surrounding_text (ic->id, text, cursor);
+ _panel_client.send ();
+ }
+}
+
+static void
+panel_slot_delete_surrounding_text (int context, int offset, int len)
+{
+ SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
+
+ EcoreIMFContextISF *ic = find_ic (context);
+
+ if (ic && ic->impl && _focused_ic == ic && ic->impl->si) {
+ slot_delete_surrounding_text (ic->impl->si, offset, len);
+ }
+}
+
/* Panel Requestion functions. */
static void
panel_req_show_help (EcoreIMFContextISF *ic)
_panel_client.signal_connect_show_preedit_string (slot (panel_slot_show_preedit_string));
_panel_client.signal_connect_hide_preedit_string (slot (panel_slot_hide_preedit_string));
_panel_client.signal_connect_update_preedit_string (slot (panel_slot_update_preedit_string));
+ _panel_client.signal_connect_get_surrounding_text (slot (panel_slot_get_surrounding_text));
+ _panel_client.signal_connect_delete_surrounding_text (slot (panel_slot_delete_surrounding_text));
if (!panel_initialize ()) {
std::cerr << "Ecore IM Module: Cannot connect to Panel!\n";
return state;
}
-static XKeyEvent createKeyEvent (Display *display, const Window &win,
- const Window &winRoot, bool press,
- int keycode, int modifiers)
+static XKeyEvent createKeyEvent (bool press, int keycode, int modifiers, bool fake)
{
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
XKeyEvent event;
+ Window focus_win;
+ Display *display = (Display *)ecore_x_display_get ();
+ int revert = RevertToParent;
+
+ XGetInputFocus (display, &focus_win, &revert);
event.display = display;
- event.window = win;
- event.root = winRoot;
+ event.window = focus_win;
+ event.root = DefaultRootWindow (display);
event.subwindow = None;
- event.time = CurrentTime;
+ if (fake)
+ event.time = 0;
+ else
+ event.time = get_time();
+
event.x = 1;
event.y = 1;
event.x_root = 1;
event.y_root = 1;
- event.same_screen = EINA_TRUE;
+ event.same_screen = True;
event.state = modifiers;
- event.keycode = XKeysymToKeycode (display, keycode);
+ event.keycode = keycode;
if (press)
event.type = KeyPress;
else
event.type = KeyRelease;
- event.send_event = EINA_FALSE;
+ event.send_event = False;
event.serial = 0;
return event;
}
-static void _x_send_key_event (const KeyEvent &key)
+static void send_x_key_event (const KeyEvent &key, bool fake)
{
SCIM_DEBUG_FRONTEND(1) << __FUNCTION__ << "...\n";
- //std::cout << "[slot_send_key_event] code : " << key.code << " mask : " << key.mask << "\n";
+ ::KeyCode keycode = 0;
+ ::KeySym keysym = 0;
+ int shift = 0;
+ const char *key_string;
// Obtain the X11 display.
- Display *display = XOpenDisplay (NULL);
+ Display *display = (Display *)ecore_x_display_get ();
if (display == NULL) {
- std::cerr << "XOpenDisplay failed\n";
+ std::cerr << "ecore_x_display_get () failed\n";
return;
}
- // Get the root window for the current display.
- Window winRoot = 0;// = XRootWindow (display, 1);
+ if (strncmp (key.get_key_string().c_str(), "KeyRelease+", 11) == 0) {
+ key_string = key.get_key_string().c_str() + 11;
+ } else {
+ key_string = key.get_key_string().c_str();
+ }
+
+ keysym = XStringToKeysym(key_string);
+ if (keysym == NoSymbol)
+ return;
+
+ keycode = _keyname_to_keycode(key_string);
+ if (XKeycodeToKeysym(display, keycode, 0) != keysym) {
+ if (XKeycodeToKeysym(display, keycode, 1) == keysym)
+ shift = 1;
+ else
+ keycode = 0;
+ }
+ else
+ shift = 0;
+
+ if (keycode == 0) {
+ static int mod = 0;
+ KeySym *keysyms;
+ int keycode_min, keycode_max, keycode_num;
+ int i;
+
+ XDisplayKeycodes(display, &keycode_min, &keycode_max);
+ keysyms = XGetKeyboardMapping(display, keycode_min,
+ keycode_max - keycode_min + 1,
+ &keycode_num);
+ mod = (mod + 1) & 0x7;
+ i = (keycode_max - keycode_min - mod - 1) * keycode_num;
+
+ keysyms[i] = keysym;
+ XChangeKeyboardMapping(display, keycode_min, keycode_num,
+ keysyms, (keycode_max - keycode_min));
+ XFree(keysyms);
+ XSync(display, False);
+ keycode = keycode_max - mod - 1;
+ }
// Find the window which has the current keyboard focus.
Window winFocus = 0;
XMapWindow (display, winFocus);
unsigned int modifier = scim_x11_keymask_scim_to_x11 (display, key.mask);
+
+ if (shift)
+ modifier |= ShiftMask;
+
XKeyEvent event;
if (key.is_key_press ()) {
- event = createKeyEvent (display, winFocus, winRoot, true, key.code, modifier);
+ if (shift) {
+ event = createKeyEvent (true, XKeysymToKeycode(display, XK_Shift_L), modifier, fake);
+ XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event);
+ }
+
+ event = createKeyEvent (true, keycode, modifier, fake);
XSendEvent (event.display, event.window, True, KeyPressMask, (XEvent *)&event);
} else {
- event = createKeyEvent (display, winFocus, winRoot, false, key.code, modifier);
+ event = createKeyEvent (false, keycode, modifier, fake);
XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
- }
- XCloseDisplay (display);
+ if (shift) {
+ event = createKeyEvent (false, XKeysymToKeycode(display, XK_Shift_L), modifier, fake);
+ XSendEvent (event.display, event.window, True, KeyReleaseMask, (XEvent *)&event);
+ }
+ }
}
static void
if (ic->impl->use_preedit) {
if (!ic->impl->preedit_started) {
ecore_imf_context_preedit_start_event_add (_focused_ic->ctx);
- //ecore_x_window_background_color_set ((Ecore_X_Window)(_focused_ic->impl->client_window), 0, 128, 128);
ic->impl->preedit_started = true;
}
//if (ic->impl->preedit_string.length ())
if (ic && _focused_ic == ic) {
if (!_fallback_instance->process_key_event (key)) {
- _x_send_key_event(key);
+ feed_key_event (ic, key, true);
}
}
}
if (ecore_imf_context_surrounding_get (_focused_ic->ctx, &surrounding, &cursor_index)) {
SCIM_DEBUG_FRONTEND(2) << "Surrounding text: " << surrounding <<"\n";
SCIM_DEBUG_FRONTEND(2) << "Cursor Index : " << cursor_index <<"\n";
- WideString before (utf8_mbstowcs (String (surrounding, surrounding + cursor_index)));
- WideString after (utf8_mbstowcs (String (surrounding + cursor_index)));
+ WideString before = utf8_mbstowcs (String (surrounding));
+ before = before.substr (0, cursor_index);
+ WideString after = utf8_mbstowcs (String (surrounding));
+ after = after.substr (cursor_index, after.length () - cursor_index);
if (maxlen_before > 0 && ((unsigned int)maxlen_before) < before.length ())
before = WideString (before.begin () + (before.length () - maxlen_before), before.end ());
else if (maxlen_before == 0) before = WideString ();
Ecore_IMF_Context *input_panel_ctx = NULL;
-
static Eina_Bool _prop_change (void *data, int ev_type, void *ev)
{
Ecore_X_Event_Window_Property *event = (Ecore_X_Event_Window_Property *)ev;
return ECORE_CALLBACK_PASS_ON;
}
-static void _save_current_xid (Evas *evas)
+static void _save_current_xid (Ecore_IMF_Context *ctx)
{
Ecore_X_Window xid = 0, rootwin_xid = 0;
Ecore_Evas *ee = NULL;
+ Evas *evas = NULL;
+
+ evas = (Evas *)ecore_imf_context_client_canvas_get(ctx);
if (evas) {
ee = ecore_evas_ecore_evas_get (evas);
if (ee)
xid = (Ecore_X_Window)ecore_evas_window_get (ee);
+ } else {
+ xid = (Ecore_X_Window)ecore_imf_context_client_window_get (ctx);
}
if (xid == 0)
ecore_x_sync ();
}
-static Ecore_IMF_Input_Panel_Orient _orient_get (Evas *evas)
-{
- Ecore_Evas *ee = NULL;
- int degree;
- Ecore_IMF_Input_Panel_Orient orient;
-
- if (!evas)
- return ECORE_IMF_INPUT_PANEL_ORIENT_NONE;
- ee = ecore_evas_ecore_evas_get (evas);
- if (!ee)
- return ECORE_IMF_INPUT_PANEL_ORIENT_NONE;
-
- degree = ecore_evas_rotation_get (ee);
-
- orient = (Ecore_IMF_Input_Panel_Orient)(degree % 360 / 90);
-
- return orient;
-}
-
static void _event_callback_call (Ecore_IMF_Input_Panel_Event type, int value)
{
void *list_data = NULL;
iseContext.IfFullStyle = FALSE;
iseContext.state = ECORE_IMF_INPUT_PANEL_STATE_HIDE;
iseContext.language = ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC;
- iseContext.orient = ECORE_IMF_INPUT_PANEL_ORIENT_NONE;
+ iseContext.orient = 0;
iseContext.fUseImEffect = TRUE;
if (!IfInitContext) {
void *list_data = NULL;
void *offset = NULL;
void *packet = NULL;
- Evas *evas = NULL;
input_panel_ctx = ctx;
iseContext.private_key_num = eina_list_count (private_key_list);
IMFCONTROLUIDBG("private key_num : %d\n", iseContext.private_key_num);
- evas = (Evas *)ecore_imf_context_client_canvas_get (ctx);
-
- if (evas) {
- iseContext.orient = _orient_get (evas);
- }
-
/* calculate packet size */
length = sizeof (iseContext);
length += iseContext.disabled_key_num * sizeof (Disable_Key_Item);
}
/* Set the current XID of the active window into the root window property */
- _save_current_xid (evas);
+ _save_current_xid (ctx);
iseContext.state = ECORE_IMF_INPUT_PANEL_STATE_SHOW;
isf_panel_efl_SOURCES = isf_panel_efl.cpp \
isf_panel_utility.cpp
-isf_panel_efl_CXXFLAGS = @EFL_CFLAGS@ @VCONF_CFLAGS@ @HEYNOTI_CFLAGS@
+isf_panel_efl_CXXFLAGS = @EFL_CFLAGS@ @VCONF_CFLAGS@ @HEYNOTI_CFLAGS@ @PRIVILEGE_CONTROL_CFLAGS@
isf_panel_efl_LDFLAGS = @EFL_LIBS@ @LTLIBINTL@ -rpath $(libdir) \
@VCONF_LIBS@ \
@HEYNOTI_LIBS@ \
- @X11_LIBS@
+ @X11_LIBS@ \
+ @PRIVILEGE_CONTROL_LIBS@
isf_panel_efl_LDADD = $(top_builddir)/ism/src/libscim@SCIM_EPOCH@.la
#include <vconf.h>
#include <vconf-keys.h>
#endif
+#include <privilege-control.h>
#include "isf_panel_utility.h"
#define ISF_CONFIG_PANEL_LOOKUP_TABLE_VERTICAL "/Panel/Gtk/LookupTableVertical"
#define ISF_CONFIG_PANEL_LOOKUP_TABLE_STYLE "/Panel/Gtk/LookupTableStyle"
#define ISF_CONFIG_PANEL_LOOKUP_TABLE_MODE "/Panel/Gtk/LookupTableMode"
-#define ISF_CONFIG_HARDWARE_KEYBOARD_DETECT "/isf/hw_keyboard_detect"
#define ISF_CANDIDATE_TABLE 0
Ecore_Event_Handler *xclient_msg_handler = NULL;
Ecore_Event_Handler *prop_change_handler = NULL;
+ control_privilege ();
+
check_time ("\nStarting ISF Panel EFL...... ");
DebugOutput::disable_debug (SCIM_DEBUG_AllMask);
String (_("\n(C) 2008 SAMSUNG")) +
String (_("\n\n Help file is needed!!"));
} else {
- /* FIXME -- 256 char per line for now -- mingbin.qu */
+ /* FIXME -- 256 char per line for now -- */
char str[256];
while (helpfile.getline (str, sizeof (str))) {
help_line = help_line + String (str) + String("\n");
endif
isf_query_engines_SOURCES = isf_query_engines.cpp
-isf_query_engines_CXXFLAGS = @VCONF_CFLAGS@
+isf_query_engines_CXXFLAGS = @VCONF_CFLAGS@ @PRIVILEGE_CONTROL_CFLAGS@
isf_query_engines_LDADD = libscim@SCIM_EPOCH@.la
-isf_query_engines_LDFLAGS = @LTLIBINTL@ @VCONF_LIBS@
+isf_query_engines_LDFLAGS = @LTLIBINTL@ @VCONF_LIBS@ @PRIVILEGE_CONTROL_LIBS@
libexecdir = $(libdir)/scim@SCIM_EPOCH@
libexec_PROGRAMS = scim-launcher scim-helper-launcher
-scim_launcher_SOURCES = scim_launcher.cpp
+scim_launcher_SOURCES = scim_launcher.cpp
scim_launcher_LDADD = libscim@SCIM_EPOCH@.la
-scim_launcher_LDFLAGS = @LTLIBINTL@
+scim_launcher_CXXFLAGS = @PRIVILEGE_CONTROL_CFLAGS@
+scim_launcher_LDFLAGS = @LTLIBINTL@ @PRIVILEGE_CONTROL_LIBS@
-scim_helper_launcher_SOURCES = scim_helper_launcher.cpp
+scim_helper_launcher_SOURCES = scim_helper_launcher.cpp
+scim_helper_launcher_CXXFLAGS = @PRIVILEGE_CONTROL_CFLAGS@
scim_helper_launcher_LDADD = libscim@SCIM_EPOCH@.la
-scim_helper_launcher_LDFLAGS = @LTLIBINTL@
+scim_helper_launcher_LDFLAGS = @LTLIBINTL@ @PRIVILEGE_CONTROL_LIBS@
int fUseImEffect;
Ecore_IMF_Input_Panel_Lang language;
Ecore_IMF_Input_Panel_Layout layout;
- Ecore_IMF_Input_Panel_Orient orient;
+ int orient;
unsigned int disabled_key_num;
unsigned int private_key_num;
int input_panel_x;
#include "scim_private.h"
#include "scim.h"
#include "isf_query_utility.h"
+#include <privilege-control.h>
using namespace scim;
int isetype = 0;
int uninstall = 0;
+ control_privilege ();
+
int i = 1;
while (i < argc) {
if (String ("-t") == String (argv[i]) || String ("--type") == String (argv[i])) {
if (access (engine_file_name.c_str (), F_OK | W_OK) != 0) {
FILE *filp = fopen (engine_file_name.c_str (), "a");
- if (filp == NULL)
+ if (filp == NULL) {
engine_file_name = user_file_name;
- else
+ // Create folder for saving engine list
+ scim_make_dir (USER_ENGINE_LIST_PATH);
+ } else {
fclose (filp);
+ }
}
if (uninstall == 1) {
// Declaration of macro.
/////////////////////////////////////////////////////////////////////////////
#define MAXLINE 4096
-#define USER_ENGINE_LIST_PATH "/opt/home/root/.scim"
+#define USER_ENGINE_LIST_PATH "/opt/home/app/.scim"
#ifndef SCIM_SYSCONFDIR
#define SCIM_SYSCONFDIR "/usr/etc"
#define SCIM_CONFIG_HOTKEYS_IMENGINE_LIST "/Hotkeys/IMEngine/List"
#define SCIM_CONFIG_HOTKEYS_HELPER "/Hotkeys/Helper"
#define SCIM_CONFIG_HOTKEYS_HELPER_LIST "/Hotkeys/Helper/List"
-#define SCIM_CONFIG_HOTKEYS_NEWISE "/Hotkeys/NewISE"
-#define SCIM_CONFIG_HOTKEYS_NEWISE_LIST "/Hotkeys/NewISE/List"
#define SCIM_CONFIG_FILTER_FILTERED_IMENGINES "/Filter/FilteredIMEngines"
#define SCIM_CONFIG_FILTER_FILTERED_IMENGINES_LIST "/Filter/FilteredIMEngines/List"
#define SCIM_PREDICTION_ENGINE_CONFIG_QWERTY_NEXT_WORD_PREDIECTION "/QWERTY/next_word_prediction"
#define SCIM_PREDICTION_ENGINE_CONFIG_QWERTY_AUTO_SUBSTITUTION "/QWERTY/auto_substitution"
#define SCIM_PREDICTION_ENGINE_CONFIG_QWERTY_REGIONAL_INPUT "/QWERTY/regional_input"
+
+#define ISF_CONFIG_HARDWARE_KEYBOARD_DETECT "/isf/hw_keyboard_detect"
+
/** @} */
} // namespace scim
HelperAgentSignalInt signal_update_screen;
HelperAgentSignalIntInt signal_update_spot_location;
HelperAgentSignalInt signal_update_cursor_position;
+ HelperAgentSignalInt signal_update_surrounding_text;
HelperAgentSignalString signal_trigger_property;
HelperAgentSignalTransaction signal_process_imengine_event;
HelperAgentSignalVoid signal_focus_out;
HelperAgentSignalStringVector signal_update_keyboard_ise_list;
HelperAgentSignalVoid signal_candidate_more_window_show;
HelperAgentSignalVoid signal_candidate_more_window_hide;
+ HelperAgentSignalInt signal_select_aux;
HelperAgentSignalInt signal_select_candidate;
HelperAgentSignalVoid signal_candidate_table_page_up;
HelperAgentSignalVoid signal_candidate_table_page_down;
m_impl->signal_update_cursor_position (this, ic, ic_uuid, (int) cursor_pos);
break;
}
+ case ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT:
+ {
+ String text;
+ uint32 cursor;
+ if (m_impl->recv.get_data (text) && m_impl->recv.get_data (cursor))
+ m_impl->signal_update_surrounding_text (this, ic, text, (int) cursor);
+ break;
+ }
case SCIM_TRANS_CMD_TRIGGER_PROPERTY:
{
String property;
m_impl->signal_candidate_more_window_hide (this, ic, ic_uuid);
break;
}
+ case ISM_TRANS_CMD_SELECT_AUX:
+ {
+ uint32 item;
+ if (m_impl->recv.get_data (item))
+ m_impl->signal_select_aux (this, ic, ic_uuid, item);
+ break;
+ }
case SCIM_TRANS_CMD_SELECT_CANDIDATE:
{
uint32 item;
}
/**
+ * @ brief Request to get surrounding text.
+ *
+ * @param uuid The helper ISE UUID.
+ * @param maxlen_before The max length of before.
+ * @param maxlen_after The max length of after.
+ */
+void
+HelperAgent::get_surrounding_text (const String &uuid, int maxlen_before, int maxlen_after) const
+{
+ if (m_impl->socket_active.is_connected ()) {
+ m_impl->send.clear ();
+ m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
+ m_impl->send.put_data (m_impl->magic_active);
+ m_impl->send.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
+ m_impl->send.put_data (uuid);
+ m_impl->send.put_data (maxlen_before);
+ m_impl->send.put_data (maxlen_after);
+ m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
+ }
+}
+
+/**
+ * @ brief Request to delete surrounding text.
+ *
+ * @param offset The offset for cursor position.
+ * @param len The length for delete text.
+ */
+void
+HelperAgent::delete_surrounding_text (int offset, int len) const
+{
+ if (m_impl->socket_active.is_connected ()) {
+ m_impl->send.clear ();
+ m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
+ m_impl->send.put_data (m_impl->magic_active);
+ m_impl->send.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
+ m_impl->send.put_data (offset);
+ m_impl->send.put_data (len);
+ m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
+ }
+}
+
+/**
* @brief Request to get uuid list of all keyboard ISEs.
*
* @param uuid The helper ISE UUID.
}
/**
+ * @brief Connect a slot to Helper update surrounding text signal.
+ *
+ * This signal is used to let the Helper get the surrounding text.
+ *
+ * The prototype of the slot is:
+ * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
+ */
+Connection
+HelperAgent::signal_connect_update_surrounding_text (HelperAgentSlotInt *slot)
+{
+ return m_impl->signal_update_surrounding_text.connect (slot);
+}
+
+/**
* @brief Connect a slot to Helper trigger property signal.
*
* This signal is used to trigger a property registered by this Helper.
}
/**
+ * @brief Connect a slot to Helper select aux signal.
+ *
+ * This signal is used to do something when aux is selected.
+ *
+ * The prototype of the slot is:
+ * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
+ */
+Connection
+HelperAgent::signal_connect_select_aux (HelperAgentSlotInt *slot)
+{
+ return m_impl->signal_select_aux.connect (slot);
+}
+
+/**
* @brief Connect a slot to Helper select candidate signal.
*
* This signal is used to do something when candidate is selected.
uint32 value) const;
/**
+ * @ brief Request to get surrounding text.
+ *
+ * @param uuid The helper ISE UUID.
+ * @param maxlen_before The max length of before.
+ * @param maxlen_after The max length of after.
+ */
+ void get_surrounding_text (const String &uuid,
+ int maxlen_before,
+ int maxlen_after) const;
+
+ /**
+ * @ brief Request to delete surrounding text.
+ *
+ * @param offset The offset for cursor position.
+ * @param len The length for delete text.
+ */
+ void delete_surrounding_text (int offset,
+ int len) const;
+
+ /**
* @ brief Set new candidate UI.
*
* @param style style of new candidate UI.
* void update_spot_location (const HelperAgent *agent, int ic, const String &ic_uuid, int x, int y);
*/
Connection signal_connect_update_spot_location (HelperAgentSlotIntInt *slot);
-
+
/**
* @brief Connect a slot to Helper update cursor position signal.
*
Connection signal_connect_update_cursor_position (HelperAgentSlotInt *slot);
/**
+ * @brief Connect a slot to Helper update surrounding text signal.
+ *
+ * This signal is used to let the Helper get the surrounding text.
+ *
+ * The prototype of the slot is:
+ * void update_surrounding_text (const HelperAgent *agent, int ic, const String &text, int cursor);
+ */
+ Connection signal_connect_update_surrounding_text (HelperAgentSlotInt *slot);
+
+ /**
* @brief Connect a slot to Helper trigger property signal.
*
* This signal is used to trigger a property registered by this Helper.
Connection signal_connect_candidate_more_window_hide (HelperAgentSlotVoid *slot);
/**
+ * @brief Connect a slot to Helper select aux signal.
+ *
+ * This signal is used to do something when aux is selected.
+ *
+ * The prototype of the slot is:
+ * void select_aux (const HelperAgent *agent, int ic, const String &uuid, int index);
+ */
+ Connection signal_connect_select_aux (HelperAgentSlotInt *slot);
+
+ /**
* @brief Connect a slot to Helper select candidate signal.
*
* This signal is used to do something when candidate is selected.
#include <stdlib.h>
#include "scim_private.h"
#include "scim.h"
+#include <privilege-control.h>
using namespace scim;
String uuid;
bool daemon = false;
+ control_privilege ();
+
char *p = getenv ("DISPLAY");
if (p) display = String (p);
}
size_t
-HotkeyMatcher::find_hotkeys (int id, KeyEventList &keys) const
+HotkeyMatcher::find_hotkeys (int id, KeyEventList &keys) const
{
keys.clear ();
return m_impl->m_result;
}
-//===================== IMEngineHotkeyMatcher =======================
+/*===================== IMEngineHotkeyMatcher =======================*/
class IMEngineHotkeyMatcher::IMEngineHotkeyMatcherImpl
{
public:
HotkeyMatcher m_matcher;
- std::vector <ISEInfo> m_uuids;
+ std::vector<ISEInfo> m_uuids;
};
IMEngineHotkeyMatcher::IMEngineHotkeyMatcher ()
}
}
uuids.clear ();
-
- scim_split_string_list (uuids, config->read (String (SCIM_CONFIG_HOTKEYS_NEWISE_LIST), String ("")));
-
- std::sort (uuids.begin (), uuids.end ());
- uuids.erase (std::unique (uuids.begin (), uuids.end ()), uuids.end ());
-
- if (uuids.size ()) {
- KeyEventList keys;
- for (std::vector <String>::iterator uit = uuids.begin (); uit != uuids.end (); ++uit) {
- if (scim_string_to_key_list (keys, config->read (String (SCIM_CONFIG_HOTKEYS_NEWISE "/") + *uit, String ("")))) {
- ISEInfo info;
- info.type = NEWISE_T;
- info.uuid = *uit;
- m_impl->m_matcher.add_hotkeys (keys, (int) m_impl->m_uuids.size ());
- m_impl->m_uuids.push_back (info);
- }
- }
- }
}
void
IMEngineHotkeyMatcher::save_hotkeys (const ConfigPointer &config) const
{
- if (config.null () || !config->valid () /*|| !m_impl->m_uuids.size ()*/) return;//liushuo
+ if (config.null () || !config->valid () /*|| !m_impl->m_uuids.size ()*/) return;
std::vector <String> uuids;
KeyEventList keys;
std::vector <String> i_uuids;
std::vector <String> n_uuids;
std::vector <String> h_uuids;
-//-------------------clear imengine hotkeys in config file --------------------
+ /* Clear imengine hotkeys in config file */
scim_split_string_list (uuids, config->read (String (SCIM_CONFIG_HOTKEYS_IMENGINE_LIST), String ("")));
std::sort (uuids.begin (), uuids.end ());
if (uuids.size ()) {
for (std::vector <String>::iterator uit = uuids.begin (); uit != uuids.end (); ++uit)
- {
config->write (String (SCIM_CONFIG_HOTKEYS_IMENGINE "/") + *uit, "");
- }
}
config->write (String (SCIM_CONFIG_HOTKEYS_IMENGINE_LIST), "");
- uuids.clear();
-//---------------clear new ise hotkeys in config file--------------------------
- scim_split_string_list (uuids, config->read (String (SCIM_CONFIG_HOTKEYS_NEWISE_LIST), String ("")));
-
- std::sort (uuids.begin (), uuids.end ());
- uuids.erase (std::unique (uuids.begin (), uuids.end ()), uuids.end ());
-
- if (uuids.size ()) {
- for (std::vector <String>::iterator uit = uuids.begin (); uit != uuids.end (); ++uit)
- {
- config->write (String (SCIM_CONFIG_HOTKEYS_NEWISE "/") + *uit, "");
- }
- }
-
- config->write (String (SCIM_CONFIG_HOTKEYS_NEWISE_LIST), "");
uuids.clear ();
-//-----------------clear helper hotkeys in config file----------------------------
+ /* Clear helper hotkeys in config file */
scim_split_string_list (uuids, config->read (String (SCIM_CONFIG_HOTKEYS_HELPER_LIST), String ("")));
std::sort (uuids.begin (), uuids.end ());
if (uuids.size ()) {
for (std::vector <String>::iterator uit = uuids.begin (); uit != uuids.end (); ++uit)
- {
config->write (String (SCIM_CONFIG_HOTKEYS_HELPER "/") + *uit, "");
- }
}
config->write (String (SCIM_CONFIG_HOTKEYS_HELPER_LIST), "");
uuids.clear ();
-//---------------------- save to config --------------------------------------------
+ /* Save to config */
for (size_t i = 0; i < m_impl->m_uuids.size (); ++i) {
if (m_impl->m_matcher.find_hotkeys ((int) i, keys) > 0 && scim_key_list_to_string (keystr, keys)) {
ISE_TYPE type = m_impl->m_uuids [i].type;
if (type == IMENGINE_T) {
config->write (String (SCIM_CONFIG_HOTKEYS_IMENGINE "/") + m_impl->m_uuids [i].uuid, keystr);
i_uuids.push_back (m_impl->m_uuids [i].uuid);
- } else if (type == NEWISE_T) {
- config->write (String (SCIM_CONFIG_HOTKEYS_NEWISE "/") + m_impl->m_uuids [i].uuid, keystr);
- n_uuids.push_back (m_impl->m_uuids [i].uuid);
} else if (type == HELPER_T) {
config->write (String (SCIM_CONFIG_HOTKEYS_HELPER "/") + m_impl->m_uuids [i].uuid, keystr);
h_uuids.push_back (m_impl->m_uuids [i].uuid);
}
config->write (String (SCIM_CONFIG_HOTKEYS_IMENGINE_LIST), scim_combine_string_list (i_uuids));
- config->write (String (SCIM_CONFIG_HOTKEYS_NEWISE_LIST), scim_combine_string_list (n_uuids));
config->write (String (SCIM_CONFIG_HOTKEYS_HELPER_LIST), scim_combine_string_list (h_uuids));
}
void
-IMEngineHotkeyMatcher::add_hotkey(const KeyEvent &key, const String &uuid, const ISE_TYPE &type)
+IMEngineHotkeyMatcher::add_hotkey (const KeyEvent &key, const String &uuid, const ISE_TYPE &type)
{
if (key.empty () || !uuid.length ()) return;
m_impl->m_uuids.push_back (info);
}
-
m_impl->m_matcher.add_hotkey (key, i);
}
return ISEInfo ();
}
-//============================ FrontEndHotkeyMatcher ==========================
+/*============================ FrontEndHotkeyMatcher ==========================*/
static const char *__scim_frontend_hotkey_config_paths [] =
{
0,
class FrontEndHotkeyMatcher::FrontEndHotkeyMatcherImpl
{
public:
- HotkeyMatcher m_matcher;
+ HotkeyMatcher m_matcher;
};
FrontEndHotkeyMatcher::FrontEndHotkeyMatcher ()
KeyEventList keys;
- // Load the least important hotkeys first.
+ /* Load the least important hotkeys first */
for (int i = SCIM_FRONTEND_HOTKEY_SHOW_FACTORY_MENU; i >= SCIM_FRONTEND_HOTKEY_TRIGGER; --i) {
if (scim_string_to_key_list (keys, config->read (String (__scim_frontend_hotkey_config_paths [i]), String (__scim_frontend_hotkey_defaults [i]))))
m_impl->m_matcher.add_hotkeys (keys, i);
return SCIM_FRONTEND_HOTKEY_NOOP;
}
-} // namespace scim
+} /* namespace scim */
/*
vi:ts=4:nowrap:ai:expandtab
};
typedef enum {
- NEWISE_T,
HELPER_T,
IMENGINE_T
} ISE_TYPE;
#define Uses_SCIM_CONFIG
#define Uses_C_LOCALE
#define Uses_SCIM_UTILITY
+#define Uses_SCIM_PANEL_AGENT
+
#include "scim_private.h"
#include "scim.h"
#include <sys/types.h>
#include <sys/times.h>
#include <unistd.h>
#include <signal.h>
+#include <privilege-control.h>
+#include "isf_query_utility.h"
using namespace scim;
new_argv [new_argc ++] = argv [0];
+ control_privilege ();
+
while (i < argc) {
if (++i >= argc) break;
}
gettime (clock_start, "Create Config");
+ // Create folder for saving engine list
+ scim_make_dir (USER_ENGINE_LIST_PATH);
+
/* create backend */
backend = new CommonBackEnd (config, engine_list);
gettime (clock_start, "Create backend");
unlock ();
+ helper_select_aux (item);
+
return client >= 0;
}
socket_update_spot_location ();
else if (cmd == ISM_TRANS_CMD_UPDATE_CURSOR_POSITION)
socket_update_cursor_position ();
+ else if (cmd == ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT)
+ socket_update_surrounding_text ();
else if (cmd == SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO)
socket_update_factory_info ();
else if (cmd == SCIM_TRANS_CMD_SHOW_PREEDIT_STRING)
socket_helper_im_embedded_editor_preedit_changed (client_id);
} else if(cmd == ISM_TRANS_CMD_LAUNCH_HELPER_ISE_LIST_SELECTION){
socket_helper_launch_helper_ise_list_selection();
+ } else if (cmd == SCIM_TRANS_CMD_GET_SURROUNDING_TEXT) {
+ socket_helper_get_surrounding_text (client_id);
+ } else if (cmd == SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT) {
+ socket_helper_delete_surrounding_text (client_id);
}
}
socket_transaction_end ();
}
}
+ void socket_update_surrounding_text (void)
+ {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+
+ String text;
+ uint32 cursor;
+ if (m_recv_trans.get_data (text) && m_recv_trans.get_data (cursor)) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ())
+ {
+ int client;
+ uint32 context;
+ Socket client_socket (it->second.id);
+ uint32 ctx;
+
+ lock ();
+
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (ctx);
+ m_send_trans.put_data (m_current_helper_uuid);
+ m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
+ m_send_trans.put_data (text);
+ m_send_trans.put_data (cursor);
+ m_send_trans.write_to_socket (client_socket);
+
+ unlock ();
+ }
+ }
+ }
+
void socket_update_factory_info (void)
{
SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_update_factory_info ()\n";
}
}
+ void socket_helper_get_surrounding_text (int client)
+ {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+
+ String uuid;
+ uint32 maxlen_before;
+ uint32 maxlen_after;
+
+ if (m_recv_trans.get_data (uuid) &&
+ m_recv_trans.get_data (maxlen_before) &&
+ m_recv_trans.get_data (maxlen_after)) {
+
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+
+ focused_uuid = get_focused_context (focused_client, focused_context);
+
+ ClientInfo client_info = socket_get_client_info (focused_client);
+ if (client_info.type == FRONTEND_CLIENT) {
+ Socket socket_client (focused_client);
+ lock ();
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (focused_context);
+ m_send_trans.put_command (SCIM_TRANS_CMD_GET_SURROUNDING_TEXT);
+ m_send_trans.put_data (maxlen_before);
+ m_send_trans.put_data (maxlen_after);
+ m_send_trans.write_to_socket (socket_client);
+ unlock ();
+ }
+ }
+ }
+
+ void socket_helper_delete_surrounding_text (int client)
+ {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << " (" << client << ")\n";
+
+ uint32 offset;
+ uint32 len;
+
+ if (m_recv_trans.get_data (offset) && m_recv_trans.get_data (len)) {
+
+ int focused_client;
+ uint32 focused_context;
+ String focused_uuid;
+
+ focused_uuid = get_focused_context (focused_client, focused_context);
+
+ ClientInfo client_info = socket_get_client_info (focused_client);
+ if (client_info.type == FRONTEND_CLIENT) {
+ Socket socket_client (focused_client);
+ lock ();
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (focused_context);
+ m_send_trans.put_command (SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT);
+ m_send_trans.put_data (offset);
+ m_send_trans.put_data (len);
+ m_send_trans.write_to_socket (socket_client);
+ unlock ();
+ }
+ }
+ }
+
void socket_helper_show_preedit_string (int client)
{
SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_show_preedit_string (" << client << ")\n";
}
}
- void socket_helper_im_embedded_editor_preedit_changed (int client)
+ void socket_helper_im_embedded_editor_preedit_changed (int client)
{
SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_helper_im_embedded_editor_preedit_changed (" << client << ")\n";
}
}
+ bool helper_select_aux (uint32 item)
+ {
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_select_aux \n";
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode)
+ {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ())
+ {
+ int client;
+ uint32 context;
+ Socket client_socket (it->second.id);
+ uint32 ctx;
+
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (ctx);
+ m_send_trans.put_data (m_current_helper_uuid);
+ m_send_trans.put_command (ISM_TRANS_CMD_SELECT_AUX);
+ m_send_trans.put_data ((uint32)item);
+ m_send_trans.write_to_socket (client_socket);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
- bool helper_select_candidate (uint32 item)
+ bool helper_select_candidate (uint32 item)
{
SCIM_DEBUG_MAIN(4) << "PanelAgent::helper_select_candidate \n";
typedef Signal2<void, int, int>
PanelClientSignalInt;
+typedef Signal3<void, int, int, int>
+ PanelClientSignalIntInt;
+
typedef Signal2<void, int, const String &>
PanelClientSignalString;
PanelClientSignalVoid m_signal_show_preedit_string;
PanelClientSignalVoid m_signal_hide_preedit_string;
PanelClientSignalStringAttrs m_signal_update_preedit_string;
+ PanelClientSignalIntInt m_signal_get_surrounding_text;
+ PanelClientSignalIntInt m_signal_delete_surrounding_text;
public:
PanelClientImpl ()
}
}
break;
+ case SCIM_TRANS_CMD_GET_SURROUNDING_TEXT:
+ {
+ uint32 maxlen_before;
+ uint32 maxlen_after;
+ if (recv.get_data (maxlen_before) && recv.get_data (maxlen_after))
+ m_signal_get_surrounding_text ((int) context, (int)maxlen_before, (int)maxlen_after);
+ }
+ break;
+ case SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT:
+ {
+ uint32 offset;
+ uint32 len;
+ if (recv.get_data (offset) && recv.get_data (len))
+ m_signal_delete_surrounding_text ((int) context, (int)offset, (int)len);
+ }
+ break;
default:
break;
}
m_send_trans.put_data ((uint32) cursor_pos);
}
}
+ void update_surrounding_text (int icid, const WideString &str, int cursor)
+ {
+ if (m_send_refcount > 0 && m_current_icid == icid) {
+ m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT);
+ m_send_trans.put_data (utf8_wcstombs (str));
+ m_send_trans.put_data ((uint32) cursor);
+ }
+ }
void show_preedit_string (int icid)
{
if (m_send_refcount > 0 && m_current_icid == icid)
m_signal_show_preedit_string.reset();
m_signal_hide_preedit_string.reset();
m_signal_update_preedit_string.reset();
+ m_signal_get_surrounding_text.reset();
+ m_signal_delete_surrounding_text.reset();
}
Connection signal_connect_reload_config (PanelClientSlotVoid *slot)
{
return m_signal_update_preedit_string.connect (slot);
}
+
+ Connection signal_connect_get_surrounding_text (PanelClientSlotIntInt *slot)
+ {
+ return m_signal_get_surrounding_text.connect (slot);
+ }
+
+ Connection signal_connect_delete_surrounding_text (PanelClientSlotIntInt *slot)
+ {
+ return m_signal_delete_surrounding_text.connect (slot);
+ }
+
private:
void launch_panel (const String &config, const String &display) const
{
m_impl->update_cursor_position (icid, cursor_pos);
}
void
+PanelClient::update_surrounding_text (int icid, const WideString &str, int cursor)
+{
+ m_impl->update_surrounding_text (icid, str, cursor);
+}
+void
PanelClient::show_preedit_string (int icid)
{
m_impl->show_preedit_string (icid);
return m_impl->signal_connect_update_preedit_string (slot);
}
+Connection
+PanelClient::signal_connect_get_surrounding_text (PanelClientSlotIntInt *slot)
+{
+ return m_impl->signal_connect_get_surrounding_text (slot);
+}
+
+Connection
+PanelClient::signal_connect_delete_surrounding_text (PanelClientSlotIntInt *slot)
+{
+ return m_impl->signal_connect_delete_surrounding_text (slot);
+}
} /* namespace scim */
typedef Slot2<void, int, int>
PanelClientSlotInt;
+typedef Slot3<void, int, int, int>
+ PanelClientSlotIntInt;
+
typedef Slot2<void, int, const String &>
PanelClientSlotString;
void update_factory_info (int icid, const PanelFactoryInfo &info);
void update_spot_location (int icid, int x, int y, int top_y);
void update_cursor_position (int icid, int cursor_pos);
+ void update_surrounding_text (int icid, const WideString &str, int cursor);
void show_preedit_string (int icid);
void show_aux_string (int icid);
void show_lookup_table (int icid);
*/
Connection signal_connect_update_keyboard_ise (PanelClientSlotVoid *slot);
+ /**
+ * @brief Signal: show preedit string
+ *
+ * slot prototype: void show_preedit_string (int context);
+ */
Connection signal_connect_show_preedit_string (PanelClientSlotVoid *slot);
+
+ /**
+ * @brief Signal: hide preedit string
+ *
+ * slot prototype: void hide_preedit_string (int context);
+ */
Connection signal_connect_hide_preedit_string (PanelClientSlotVoid *slot);
+
+ /**
+ * @brief Signal: update preedit string
+ *
+ * slot prototype: void update_preedit_string (int context, const WideString &str, const AttributeList &attrs);
+ */
Connection signal_connect_update_preedit_string (PanelClientSlotStringAttrs *slot);
+
+ /**
+ * @brief Signal: Request to get surrounding text
+ *
+ * slot prototype: void get_surrounding text (int context, int maxlen_before, int maxlen_after);
+ */
+ Connection signal_connect_get_surrounding_text (PanelClientSlotIntInt *slot);
+
+ /**
+ * @brief Signal: Delete surrounding text
+ *
+ * slot prototype: void delete_surrounding text (int context, int offset, int len);
+ */
+ Connection signal_connect_delete_surrounding_text (PanelClientSlotIntInt *slot);
+
/** @} */
};
const int SCIM_TRANS_CMD_UPDATE_SCREEN = 400;
const int SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION = 401;
const int ISM_TRANS_CMD_UPDATE_CURSOR_POSITION = 402;
+const int ISM_TRANS_CMD_UPDATE_SURROUNDING_TEXT = 403;
//Privately used by panel.
const int SCIM_TRANS_CMD_PANEL_EXIT = 500;
-ISF 2.3.4821 :
- 1. Initial Release
+ISF 2.3.5009 :
+ 1. Tizen beta Release
+
+ISF 2.3.4821 :
+ 1. Tizen alpha Release