Commit Graph

99 Commits

Author SHA1 Message Date
Derek Foreman 11b6242ba9 clients: Don't crash when compositor doesn't support drag and drop
display_create_data_source() can return NULL when there's no data device
manager present.  Instead of carrying on blindly, test its return value.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:03:22 +00:00
Joshua Watt 8093fd5db2 clients/editor: Toggle panel visibility on click
If the --click-to-show option is specified, clicking an input field will toggle
the input panel visiblity

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Tested-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2017-11-30 16:15:56 +02:00
Raúl Peñacoba 745e647f18
editor: Add missing free() and display_destroy() in main
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:36:06 +02:00
Peter Hutterer c8b46459d7 clients: fix errno handling
clients/editor.c: In function ‘read_file’:
clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean
constant [-Wlogical-op]
  errno = errsv || EINVAL;

This works in the shell, but not in C. Introduced in 411ffabbb5

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emilio Pozuelo Monfort <pochu@debian.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-01-19 10:08:17 +00:00
Quentin Glidic db776dbecf
editor: Drop g_type_init() call
HAVE_PANGO is not in any AC_DEFINE(), so the check is just wrong.
g_type_init() was never called, which is fine since GLib 2.36 anyway.
It is better not to have a wrong usage of HAVE_PANGO here.
Just check for GLib 2.36 in configure.ac instead.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-16 16:22:13 +01:00
Bryce Harrington 411ffabbb5 editor: Load a file if specified on command line
Add support for basic text file loading, to facilitate more expansive
testing of its UTF-8 text editing support.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-28 15:41:01 -08:00
Bryce Harrington 3d90da21fe editor: Use parse_options() from shared for command line options
Also add a basic --help option

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-28 15:40:21 -08:00
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