Commit Graph

92 Commits

Author SHA1 Message Date
Silvan Jegen
e31d95f262 weston-editor: Free preferred_language in text_entry_destroy
Signed-off-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:12:08 +00:00
Derek Foreman
2af7e208cf weston-editor: Close the data source after sending
We're leaking the fd when sending cut'n'paste.  Failure to close can also
makes the other end unhappy because it doesn't know the paste is finished.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-08-16 12:51:49 +08:00
Jussi Kukkonen
649bbce607 include stdint.h for int32_t/uint32_t
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-07-26 16:26:08 -07:00
Bryce Harrington
e99e4bf2b9 clients & tests: Unify multiple definitions of x*alloc and related functions
Direct fail_on_null calls now produce output like:

    [weston-info] clients/weston-info.c:714: out of memory

xmalloc, et al produce output on failure like:

    [weston-info] out of memory (-1)

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-17 14:13:13 +02:00
Jonas Ådahl
3bcba347a2 Use text input protocol from wayland-protocols
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 13:07:10 +02:00
Ryo Munakata
5e653caa4a Use [x]zalloc instead of [x]malloc + memset
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-08-07 11:59:10 -07:00
Jon Cruz
35b2eaa989 Moved helper macro to a discrete include file.
To help reduce code duplication and also 'kitchen-sink' includes
the ARRAY_LENGTH macro was moved to a stand-alone file and
referenced from the sources consuming it. Other macros will be
added in subsequent passes.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:45 -07:00
Bryce Harrington
1f6b0d1d2c clients: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Bryce Harrington
7dd12ec713 editor: warn when write fails
Fixes warning:

 clients/editor.c: In function ‘data_source_send’:
 clients/editor.c:573:7: warning: ignoring return value of ‘write’,
 declared with attribute warn_unused_result [-Wunused-result]
   write(fd, editor->selected_text, strlen(editor->selected_text) + 1);
        ^
2015-05-19 15:32:09 -07:00
Michael Vetter
2a18a52844 remove trailing whitespaces
Remove trailing whitespaces because they are not needed and jumping to
the end of al ine should do just that and not jump to the whitespace.
2015-05-15 13:12:32 -07:00
Manuel Bachmann
22f3430175 editor: implement Cut,Copy,Paste
weston-editor is the only stock client spawning the virtual
keyboard ; which means it may be the only client able to
obtain some special characters (depending on the user's
keyboard layout).

If we implement Cut, Copy and Paste, the user has now a way
to copy such characters to other useful clients (such as
weston-terminal). Plus, it demonstrates text data exchange
between two clients of different nature.

Functionality is implemented in a right-click menu and the
Ctrl+Shift+X/C/V bindings, just as in weston-terminal.

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
2015-05-07 16:27:30 -07:00
Derek Foreman
237a684e40 editor: Make editor multi-seat aware
With multi-seat, multiple entries can occur on the text inputs in the
editor.  Also, the panel shouldn't be hidden by the editor if either
text entry is still active.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-01-27 14:40:05 -08:00
Derek Foreman
2204492636 clients: Use xmalloc in a few more places
Just changes some places where a malloc failure is unhandled
to our xmalloc function that exit()s a little more gracefully.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-11-28 16:01:22 +02:00
Olivier Blin
30e1f3c311 editor: do not crash when text input manager is not available
[Pekka Paalanen: whitespace fix]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-17 13:55:24 +03:00
Bill Spitzak
bb0bb9ce96 weston-editor --help works 2014-08-19 12:21:44 +03:00
vivek
31732f7c68 Clients: Fix memleak issues in various clients of weston
In many clients of weston, Display was not being destroyed so added it.
Also destroy windows, widgets which were not being destroyed.

Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-06-24 10:22:43 -07:00
Ander Conselvan de Oliveira
8e37d96bf7 editor: Fix cursor positioning with pointer and touch
The calculation off the vertical offset between the widget coordinates
and where the text was rendered was wrong. It was using the constant for
horizontal offset for that too.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=78411
2014-05-09 15:32:20 -07:00
Kristian Høgsberg
6375ea02e5 editor: Remove unused variables 2014-04-21 15:33:51 -07:00
Manuel Bachmann
8986c18f69 editor: react on Enter, Tab, and Up-Down arrow keys
The editor will now insert new lines and tabulations when
pressing the corresponding keys on the virtual keyboard.

The Up and Down arrows can be used to navigate through
lines.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77496

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-21 15:32:45 -07:00
Kristian Høgsberg
966e3ed247 editor: Add missing touch-to-activate for the entries
Closes: https://bugs.freedesktop.org/show_bug.cgi?id=72996
2014-01-07 10:42:41 -08:00
Kristian Høgsberg
7885890df8 editor: Add keyboard_focus handler to schedule repaint
This let the editor client repaint the frame to indicate it's active
when it receives keyboard focus.
2014-01-01 23:57:42 -08:00
Jason Ekstrand
ee7fefcffc Rename frame_create and frame_set_child_size with a window_ prefix
This is to avoid a collision with an actual frame structure.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-13 22:12:16 -07:00
Brian Lovin
bc91926e0c clients: use xmalloc in more places
For the clients continue to use xmalloc() to simplify OOM-handling.

Signed-off-by: Brian Lovin <brian.j.lovin@intel.com>
2013-08-07 16:27:33 -07:00
Rob Bradford
7000283741 editor: Support shift-left/right for selecting text
If the shift modifier is active then we don't make the cursor and the
anchor the same and as a result we develop a selection in the direction
that the arrow key gets pressed in.

https://bugs.freedesktop.org/show_bug.cgi?id=66802
2013-07-12 23:56:18 -04:00
Peter Maatman
b9a23f4fb8 clients/editor.c: Draw cursor at correct verical position
With this patch, the editor cursor now moves up and down correctly
instead of having the top part stuck on the first line.
2013-07-09 19:43:53 -04:00
Peter Maatman
08c38d4bc5 clients/editor.c: Ignore ESC key
Otherwise, editor would print the "unknown UTF-8 glyph" boxes.
2013-07-09 19:41:12 -04:00
Daiki Ueno
b08b3296b8 editor: Fix segfault when deleting the first character 2013-07-02 00:02:56 -04:00
Jan Arne Petersen
8ccb7cc258 editor: Do not commit/preedit after invalid delete
Ignore the whole commit-string or preedit_string transaction when the
delete_surrounding event was invalid.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-06-04 00:34:55 -04:00
Jan Arne Petersen
895a128ce1 editor: Improve checks on delete add asserts
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-06-04 00:34:52 -04:00
Jan Arne Petersen
9eaa8e51ca editor: Properly adjust cursor on delete
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-06-04 00:34:48 -04:00
Jan Arne Petersen
a96953dffa editor: Support deleting text in preedit_string
Delete text marked with wl_text_input::delete_surrounding_text on
preedit_string event. When text is explicitly marked with
delete_surrounding_text do not delete selected text.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-06-04 00:34:46 -04:00
Jan Arne Petersen
1c45b4a4a9 editor: Fix text selection
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-06-04 00:34:42 -04:00
Kristian Høgsberg
a0868a2d64 editor: Removed unused utf8_characters() function
I left this in when I merged Jans patches.
2013-05-10 12:51:08 -04:00
Jan Arne Petersen
685168661a editor: Fix some offsets for multi-byte characters
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-06 20:26:23 -04:00
Jan Arne Petersen
62ece76b1e text: Rename text_input to wl_text_input
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:06:27 -04:00
Jan Arne Petersen
919bc149e1 text: delete text on commit_string
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 17:06:26 -04:00
Jan Arne Petersen
00191c7c4a text: Fix serial handling
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:41:48 -04:00
Jan Arne Petersen
fe89e713ca editor: Send cursor position to the input method
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:24:57 -04:00
Jan Arne Petersen
dfd344609a editor: Only delete on backspace key released
Do not delete two characters when key is pressed and released.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:24:02 -04:00
Jan Arne Petersen
78d00e45cc text: Rename text_model to text_input
Also rename text_model_factory to text_input_manager.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:23:35 -04:00
Jan Arne Petersen
7ef8effca5 text: Order requests and events in a nice way
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:23:14 -04:00
Jan Arne Petersen
fa3573852d text: rename text_model::commit to commit_state
Use ::commit_state as a request name to make clear what is commited.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:22:36 -04:00
Jan Arne Petersen
08015b6ba0 editor: Reset text model on reset
There were some reset calls missing, which resulted in wrong preedit
state on input method side.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:21:59 -04:00
Jan Arne Petersen
9d41913eff text: Add example for language/text direction
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:21:34 -04:00
Jan Arne Petersen
ece6b5af51 text: Add language and text-direction to protocol
Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-05-02 16:21:18 -04:00
Kristian Høgsberg
4172f668e7 Pass argc pointer to parse_options()
This lets us keep argc up to date as the backend picks out arguments
from the argv array.
2013-02-20 15:27:49 -05:00
Jan Arne Petersen
1cc9e08d2f text: Split out cursor_position
Add an extra cursor_position, which also allows to change the anchor
(for slections). Change the index type to int to allow setting it before
the beginning of a commited string.

The cursor should not be moved as a direct repsonse to this event but
atomically on the next commit_string event.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:08:01 -05:00
Jan Arne Petersen
6138197337 text: Add show/hide_input_panel requests
Allows to show/hide the input panel (virtual keyboard) more independent
of focus (some applications might to require additionaly click on a
focused entry to show the input panel).

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:07:35 -05:00
Jan Arne Petersen
0eabcaafae text: Add commit request
Allows for atomic state changes. Updated surrounding text, content type
and micro focus is taken into account all at once at commit.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:07:03 -05:00
Jan Arne Petersen
f255165bd4 text: Remove unused requests/events
Put them back in, when we know what arguments they will have.

Signed-off-by: Jan Arne Petersen <jpetersen@openismus.com>
2013-02-15 17:06:48 -05:00