summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
diff options
context:
space:
mode:
authorJihoon Kim <imfine98@gmail.com>2012-02-12 11:00:48 +0000
committerJihoon Kim <imfine98@gmail.com>2012-02-12 11:00:48 +0000
commitdca83cc17c4a5d55b6ee83fc841aba20d49804ff (patch)
treec9f0c6a4fd0777aaa11c07f45b5073c50019aac9 /legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
parentc511fece19c4e0d62bd74267a75e1add4e661296 (diff)
scim_immodule: set cursor location even though only client_window is provided without evas (ecore_imf_context_client_canvas_set)
SVN revision: 67852
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp43
1 files changed, 37 insertions, 6 deletions
diff --git a/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp b/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
index 06c31f0846..6d81c39b00 100644
--- a/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
+++ b/legacy/ecore/src/modules/immodules/scim/scim_imcontext.cpp
@@ -507,6 +507,30 @@ feed_key_event(Evas *evas, const char *str, Eina_Bool fake)
507 } 507 }
508} 508}
509 509
510static void
511window_to_screen_geometry_get(Ecore_X_Window client_win, int *x, int *y)
512{
513 Ecore_X_Window root_window, win;
514 int win_x, win_y;
515 int sum_x = 0, sum_y = 0;
516
517 root_window = ecore_x_window_root_get(client_win);
518 win = client_win;
519
520 while (root_window != win)
521 {
522 ecore_x_window_geometry_get(win, &win_x, &win_y, NULL, NULL);
523 sum_x += win_x;
524 sum_y += win_y;
525 win = ecore_x_window_parent_get(win);
526 }
527
528 if (x)
529 *x = sum_x;
530 if (y)
531 *y = sum_y;
532}
533
510/* Public functions */ 534/* Public functions */
511/** 535/**
512 * isf_imf_context_new 536 * isf_imf_context_new
@@ -1006,13 +1030,20 @@ isf_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int cx, int cy, int
1006 if (context_scim->impl->preedit_updating) 1030 if (context_scim->impl->preedit_updating)
1007 return; 1031 return;
1008 1032
1009 if (!context_scim->impl->client_canvas) 1033 if (context_scim->impl->client_canvas)
1010 return; 1034 {
1011 1035 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas);
1012 ee = ecore_evas_ecore_evas_get(context_scim->impl->client_canvas); 1036 if (!ee) return;
1013 if (!ee) return;
1014 1037
1015 ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL); 1038 ecore_evas_geometry_get(ee, &canvas_x, &canvas_y, NULL, NULL);
1039 }
1040 else
1041 {
1042 if (context_scim->impl->client_window)
1043 window_to_screen_geometry_get(context_scim->impl->client_window, &canvas_x, &canvas_y);
1044 else
1045 return;
1046 }
1016 1047
1017 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch) 1048 if (context_scim->impl->cursor_x != canvas_x + cx || context_scim->impl->cursor_y != canvas_y + cy + ch)
1018 { 1049 {