Re: [PATCH 2/3] editor: add support for invoke_action

2012-12-04 Thread Jan Arne Petersen
On 12/04/2012 09:34 PM, Pekka Vuorela wrote:
> On 04.12.2012 00:10, Jan Arne Petersen wrote:
>> +[...]
>> +
>> +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).

Yes, invoke_action should be called on release. I will fix it.

Thanks
Jan Arne

-- 
Jan Arne Petersen
Openismus GmbH
http://www.openismus.com
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 2/3] editor: add support for invoke_action

2012-12-04 Thread Pekka Vuorela

On 04.12.2012 00:10, Jan Arne Petersen wrote:

From: Jan Arne Petersen 

Call invoke_action request when a currently composed word is clicked.

Signed-off-by: Jan Arne Petersen 
---
  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