On 04.12.2012 00:10, Jan Arne Petersen wrote:
From: Jan Arne Petersen <jpeter...@openismus.com>

Call invoke_action request when a currently composed word is clicked.

Signed-off-by: Jan Arne Petersen <jpeter...@openismus.com>
---
  clients/editor.c | 52 +++++++++++++++++++++++++++++++++++++++++-----------
  1 file changed, 41 insertions(+), 11 deletions(-)

diff --git a/clients/editor.c b/clients/editor.c
index e32a639..76847e2 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -633,6 +633,36 @@ text_entry_set_preedit(struct text_entry *entry,
        widget_schedule_redraw(entry->widget);
  }

+static uint32_t
+text_entry_try_invoke_preedit_action(struct text_entry *entry,
+                                    int32_t x, int32_t y,
+                                    uint32_t button,
+                                    enum wl_pointer_button_state state)
+{
+       int index, trailing;
+       uint32_t cursor;
+
+       if (!entry->preedit.text)
+               return 0;
+
+       pango_layout_xy_to_index(entry->layout,
+                                x * PANGO_SCALE, y * PANGO_SCALE,
+                                &index, &trailing);
+       cursor = index + trailing;
+
+       if (cursor < entry->cursor ||
+           cursor > entry->cursor + strlen(entry->preedit.text)) {
+               return 0;
+       }
+
+       if (state == WL_POINTER_BUTTON_STATE_PRESSED)
+               text_model_invoke_action(entry->model,
+                                        button,
+                                        cursor - entry->cursor);
+

Click would be mouse release, no? That's usually when actions are done (though normally not for moving cursor).



_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to