Commit Graph

1547 Commits

Author SHA1 Message Date
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
Dima Ryazanov 3b7c207d06 window: Check for NULL surface in keyboard_handle_enter
This can happen if you right-click in weston-terminal a few times very quickly.
The pointer_handle_enter callback already checks for NULL, so let's do that in
keyboard_handle_enter, too.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 12:19:41 +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
Daniel Stone 08cf24bc2d desktop-shell: Support panel-position 'none'
The manpage claims that none is valid, so let's make it so.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-16 15:13:45 +00:00
Emmanuel Gil Peyrot 9cbe1c6ae0 desktop-shell: Stop asking for a RGB565 background
This makes the background image look much nicer, at the expense of
slightly more memory bandwidth used.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-16 12:55:22 +00:00
Abdur Rehman 6c1c0dd5fa clients: fix a couple of trivial typos
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:44 +00:00
Daniel Stone 7dbb0e148f Don't prepend protocol/ to include paths
No need to add protocol/, as it's already handled by an explicit
compiler include path.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
2016-11-29 09:49:00 +00: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
Derek Foreman 2b685d9de9 weston-terminal: Fix crash on first keystroke
Since 894b3rcc634 weston-terminal will crash on first keystroke if you
fail to create an xkb compose state.  This can happen if you don't have
a Compose file.

Instead, now we just return uncomposed symbols.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-22 19:14:40 +00:00
Quentin Glidic e7ed60fabe desktop-shell/client: Add left/right panel position (basic) support
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:18:04 +00:00
Quentin Glidic 51c2c37e0e desktop-shell/client: Introduce helper variables
These variables will be much more useful in the following commit.
The indentation is off to avoid future diff noise.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:18:00 +00:00
Quentin Glidic 3e37b343a2 desktop-shell/client: Parse the clock format once
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:17:57 +00:00
Quentin Glidic f9574f2314 desktop-shell/client: Use a proper enum for clock format
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:17:53 +00:00
Quentin Glidic 55d5701ddf desktop-shell/client: Add bottom panel support
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 18:17:41 +00: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
Emil Velikov 5e604082d1 clients/nested-client: call eglTerminate/eglReleaseThread at exit
Do a minimalistic teardown at program exist.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:32 +00:00
Emil Velikov 050e5d00da clients/window: use weston_platform_destroy_egl_surface wrapper
v2: Use correct (destroy) API (Dan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:22 +00:00
Emil Velikov 0050536702 clients/subsurfaces: use weston_platform_destroy_egl_surface wrapper
... over a direct eglDestroySurface call. Provides symmetry in the
create/destroy paths.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:19 +00:00
Emil Velikov 903cb5727b clients/simple-egl: use weston_platform_destroy_egl_surface wrapper
... over a direct eglDestroySurface call. Provides symmetry in the
create/destroy paths.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:16 +00:00
Emil Velikov 915ee13278 clients/nested-client: destroy the EGL surface during teardown
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 16:07:10 +00:00
Emil Velikov c77d30c516 simple-egl: add support for EGL_KHR_swap_buffers_with_damage
Functionally identical to the EXT version of the extension.

v2: s/foo/swap_damage_ext_to_entrypoint/ (Eric, Daniel)
v3: do the above sed for real (Frank)

[daniels: Fixed signed vs. unsigned warning.]

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-21 11:31:15 +00:00
Dima Ryazanov c3b63728b4 Ignore the OSC code for desktop notifications
In Fedora, bash is configured to display a desktop notification when a command
finishes (and the terminal is not focused). weston-terminal complains about it;
let's silence it.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2016-11-21 09:54:51 +00:00
Dima Ryazanov 9b1f8ef7bc Get rid of the window_create_menu function
It's currently unused, and there's actually no way to use it correctly.

The caller cannot free the menu that was created:
- the function only returns the window, not the menu
- there's no public API to destroy a menu object

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 16:08:05 +00:00
Quentin Glidic c0271533d0 terminal: Silence maybe-uninitialized warning
clients/terminal.c: In function 'redraw_handler':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]
  struct utf8_state_machine machine;
                            ^~~~~~~

clients/terminal.c: In function 'handle_char':
clients/terminal.c:213:28: warning: 'machine.unicode' may be used
uninitialized in this function [-Wmaybe-uninitialized]

Warning produced by GCC 5.3 and 6.1, with -O3.

'I found it weird that the compiler wouldn’t see that, so I re-checked
the code.

I think with -O3, this specific "for" is compile-time unlooped, and
utf8_next_char inlined.  And there is *one* path that can keep
machine.state to utf8state_start, thus triggering the warning.

Without -O3, the function is globally tagged as “changing unicode”, so
no warning is produced.

[...]

Side note: I picked 0 as the default value, but maybe in this case
0xfffd would be better?'

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-11-16 15:45:48 +00:00
Derek Foreman c3ded6603f clients: Fix weston-scaler source-only mode to use integer width and height
If only the source of a viewport is set, the width and height must
be integer or the protocol mandates that the compositor generate an
error.  This is because using only the source is a crop, and the
width and height become the surface size - all surface sizes must
be integer.

Weston was fixed to generate this error in bb32ccc0, however the
test app continued to use fractional co-ordinates when run as
weston-scaler -s  (which only sets the viewport source)

This leaves fractional width/height for the other cases, but uses
integer for the crop-only mode.  The descriptions in the help text
are still accurate with this change, but weston-scaler -s no longer
exits with an error.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-11-16 14:46:22 +00:00
Sjoerd Simons be8a6d3cfb xdg-shell: validate positioner object
According to the xdg-shell v6 protocol a positioner object is only
complete if both the size and its anchor rectangle are set. Ensure the
weston clients do this and let weston be more strict on checking if a
client has done so.

This also fixes weston-terminal popups not showing up on gnome-shell
3.22.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-11-16 10:31:11 +08:00
Daniel Stone 5b01596e3f clients: Make XKB compose support conditional
Debian Jessie's version of libxkbcommon is too old for compose support,
so rather than force people to upgrade, let's make it conditional.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Daniel Díaz <daniel.diaz@linaro.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-10-24 10:48:34 +01:00
Bryce Harrington c6a899dec7 simple-im: Rename source file to be consistent with other client tools
Except for weston-info, client source files are not prefixed "weston-".

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2016-10-12 14:03:11 -07:00
Bryce Harrington 4c66a9031c simple-im: Use the appropriate enum names to xkb calls
XKB_KEYMAP_COMPILE_NO_FLAGS and XKB_CONTEXT_NO_FLAGS are both defined as
0 so no functional change here, just improved code clarity.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2016-10-12 14:03:08 -07:00
Bryce Harrington 8224171c22 simple-im: Use returns from main() consistently
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2016-10-12 14:03:01 -07:00
Bryce Harrington e57b6a13ab window: Fix 'devlivery' misspelling 2016-10-11 16:06:44 -07:00
Bryce Harrington 894b3ecc63 clients: Add XKB compose key support
This adds single-symbol compose support using libxkbcommon's compose
functionality.  E.g., assuming you have the right alt key defined as
your compose key, typing <RAlt>+i+' will produce í, and <RAlt>+y+= will
produce ¥.  This makes compose key work for weston-editor,
weston-terminal, weston-eventdemo, and any other clients that use
Weston's window.* routines for accepting and managing keyboard input.

Compose sequences are loaded from the system's standard tables.  As
well, libxkbcommon will transparently load custom sequences from the
user's ~/.XCompose file.

Note that due to limitations in toytoolkit's key handler interface, only
compose sequences resulting in single symbols are supported.  While
libxkbcommon supports multi-symbol compose strings, support for passing
text buffers to Weston clients is left as future work.

This largely obviates the need for the weston-simple-im input method
client, which had provided a very limited compose functionality that was
only available in clients implementing the zwp_input_method protocol,
and with no mechanism to load system or user-specified compose keys.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=53648
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2016-10-11 10:42:50 -07:00
Armin Krezović eaf5841f0c
clients/stacking: Silence a compiler warning
This patch fixes a compiler warning when building with
clang, since it doesn't support gnu_printf attribute.

v2:

 - Switch to WL_PRINTF per suggestion from Eric Engestrom.

v3:

 - Explicitly include wayland-util.h

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-10-01 11:20:13 +02:00
Quentin Glidic e30b5fb2e7
Revert "terminal: Fix crash due to race condition in init"
This reverts commit 5c611d933f.
2016-09-09 19:53:38 +02:00
Bryce Harrington 5c611d933f
terminal: Fix crash due to race condition in init
weston-terminal intermittently crashes on startup.  This occurs because
some parameters in the weston_terminal structure such as data_pitch,
don't get set to non-zero until the resize_handler() callback gets
triggered.  That callback makes a call to terminal_resize_cells(), to
calculate the proper values for these parameters.

On occasion, the resize handler call is slow to resolve, and the program
proceeds to start processing characters for the terminal window.  With
the parameters defaulting to zero, certain calculations come out wrong,
leading the program to attempt to scroll the buffer when it shouldn't,
and thus follows the crash.

Instead, force the call to terminal_resize_cells() during the init, with
some dummy defaults, to ensure the parameters are always non-zero.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=97539
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-09-01 00:52:10 +02:00
Bryce Harrington c6ae8126e1
clients: Use ARRAY_LENGTH macro in weston-simple-im
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-09-01 00:47:18 +02:00
Bryce Harrington 6303d3ba7a Revert "clients: Add screensaver inhibitor client demo"
This reverts commit dfea66e780.

(Accidental landing)
2016-08-30 12:04:05 -07:00
Bryce Harrington dfea66e780 clients: Add screensaver inhibitor client demo
Derive client from simple-shm and hook up the API defined in
wayland-protocols to allow client screensaver inhibition requests.

v5:
  + Add simple-idle client demo
  + Add command line options to delay creation/destruction of inhibitor

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-08-29 18:36:13 -07: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
Pekka Paalanen 319397e050
gl-renderer, simple-dmabuf-v4l: fix dmabuf y-invert
Invert the Y_INVERT flag for the EGL import fo dmabufs. This fixes
weston-simple-dmabuf-intel to show the same image on both GL-composited
and with direct scanout on a hardware plane. Before, the image would
y-flip when switching between these two cases. Now the orientation also
matches the color values written in simple-dmabuf-intel.c.

The GL-renderer uses the OpenGL convention of texture coordinates, where
the origin is at the bottom-left of an image. This can be observed in
texture_region() where the texcoords are inverted if y_invert is false,
since the surface coordinates have origin at top-left.  Both wl_shm and
dmabuf buffers have origin at the top-left.

When wl_shm buffer is imported with glTexImage2D, it gets inverted
because glTexImage2D is defined to read in the bottom row first. The shm
data is top row first. This incidentally also means, that buffer pixel
0,0 ends up at texture coordinates 0,0. This is now inverted compared to
the GL coordinate convention, and therefore gl_renderer_attach_shm()
sets y_inverted to true. This causes texture_region() to NOT invert the
texcoords. Wayland surface coordinates have origin at top-left, hence
the double-inversion.

Dmabuf buffers also have the origin at top-left. However, they are
imported via EGL to GL, where they should get the GL oriented
coordinates but they do not. It is as if pixel 0,0 ends up at texcoords
0,0 - the same thing as with wl_shm buffers. Therefore we need to invert
the invert flag.

Too bad EGL_EXT_image_dma_buf_import does not seem to specify the image
orientation. The GL spec implied result seems to conflict with the
reality in Mesa 11.2.2.

I asked about this in the Mesa developer mailing list. The question with
no answers:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120249.html
and the thread I hijacked to get some answers:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120733.html
which culminated to the conclusion:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/120955.html
that supports this patch.

simple-dmabuf-v4l is equally fixed to not add Y_INVERT. There is no
rational reason to have it, and removing is necessary together with the
GL-renderer change to keep the image the right way up. This has been
tested with VIVID.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 19:07:48 +02:00
Pekka Paalanen dbb85d7173
clients/dmabuf-v4l: explain vivid setup
Add very short explanation on how to set up Vivid driver, when you don't
have suitable V4L2 device to use.

Using the XR24 (DRM_FORMAT_XRGB8888) format practically guarantees that
you can test direct scanout on a hardware overlay, too. At least on PC
hardware that has overlays. Tested to work on Intel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 18:24:52 +02:00
Jonas Ådahl 6ccd286662 clients/simple-dmabuf-v4l: Port to xdg_shell unstable v6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 20:15:58 +08:00
Jonas Ådahl 42682624a0 clients/simple-dmabuf-intel: Port to xdg_shell unstable v6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 20:15:58 +08:00
Jonas Ådahl a74eff926d clients/simple-damage: Port to xdg_shell unstable v6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 20:15:58 +08:00
Jonas Ådahl e023cbc43d clients/simple-shm: Port to xdg_shell unstable v6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 20:15:58 +08:00
Jonas Ådahl 836300210d clients/simple-egl: Port to xdg_shell unstable v6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 20:15:58 +08:00
Jonas Ådahl af7f98b172 toytoolkit: Port to xdg_shell unstable v6
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-08-15 20:15:58 +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 e776f2a4d9 config-parser: Add weston_config_section_get_color
Previously weston_config_section_get_uint was serving dual purpose for
parsing both unsigned decimal integer values (ids, counts, seconds,
etc.)  and hexadecimal values (colors), by relying on strtoul's
auto-detection mechanism.

However, this usage is unable to catch certain kinds of error
conditions, such as specifying a negative number where an unsigned
should be used.  And for colors in particular, it would misparse hex
values if the leading 0x was omitted.  E.g. "background-color=99999999"
would render a near-black background (effectively 0x05f5e0ff) instead of
medium grey, and "background-color=ffffffff" would be treated as an
error rather than white.  "background-color=0x01234567",
"background-color=01234567", and "background-color=1234567" each
resulted in the value being parsed as hexadecimal, octal, and decimal
respectively, resulting in colors 0x01234567, 0x00053977, and 0x0012d687
being displayed.

This new routine forces hexadecimal to be used in all cases when parsing
color values, so "0x01234567" and "01234567" result in the same color
value, "99999999" is grey, and "ffffffff" is white.  It also requires
exactly 8 or 10 digits (other lengths likely indicate typos), or the
value "0" (black).

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-07-26 15:57:14 -07:00
Jonas Ådahl cbfde13859 clients/confine: Toggle maximized state with 'm'
In order to test warping when pointer confinemen region changes, add
key binding to the maximized state without using the mouse.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 4a1b9a995e clients/confine: Add option for using a more complex confine region
By passing --complex-confine-region confine will draw an area looking
like a strange H in half transparent gray. This region will act as the
confine region when pointer confinement is activated (by right clicking).

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl fdcdda3679 window: Add API for manually set confine region
We can use this to test more complex confine regions.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl cadea76557 clients/confine: Reset motion lines on Backspace
Clear the white lines that is drawn by pointer motions. It makes it
easier to debug pointer movements as one won't need to restart confine
just to get a clean plate.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl fdeb2bb928 clients/confine: Use pointer confinement to confine drawed line
Use pointer confinement to make the line drawing not go outside the
drawing area. It is toggled with the letf pointer button.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 61831f42c6 clients: Fork clickdot as confine
The new confine client will be used to demonstrate pointer confinement.
It is so far identical to clickdot except that it doesn't respond to
clicks.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2016-07-26 17:21:15 +08:00
Jonas Ådahl 9f8c8942ba clients/resizor: Use pointer locking for resizing window
Resizes the window using pointer locking when holding the left pointer
button down. The pointer lock cursor position hint is used to warp the
pointer to the same position relative to the bottom right corner.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-07-26 17:21:15 +08:00
Jonas Ådahl e5a1bb4be2 clients: Add API for pointer locking and pointer confinement
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-26 17:21:15 +08:00
Emil Velikov 025ad93833 clients/simple-egl: use weston_check_egl_extension over strstr
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:17 +01:00
Emil Velikov ce5b614c80 clients/nested: use weston_check_egl_extension over strstr
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:29:04 +01:00
Emil Velikov bd6c41319d simple-egl: remove incomplete EGL_EXT_buffer_age definition
A more complete alternative is already provided by the weston-egl-ext.h
header. The latter of which we already include.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:22 +01:00
Emil Velikov 0725cf17f9 weston-egl-ext.h: add EGL_EXT_swap_buffers_with_damage definitions
... and use it from simple-egl and gl-renderer.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:23:10 +01:00
Emil Velikov 885a9fe4d9 client/nested: reuse weston-egl-ext.h declarations
Rather than introducing a local copy of the
EGL_WL_create_wayland_buffer_from_image (re)definition, just use the
local header.

This also gives us access to EGL_WL_bind_wayland_display which is also
used in the client, yet the C file is missing a fall-back definition.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-07-22 15:21:46 +01:00
Bryce Harrington 9c09fe70c7 multi-resource: Check for no digits in time description
strtoul(nptr, endptr, ...) will set *endptr to nptr in the case of where
no digits were read from the string.  E.g. "foo:bar" should trigger an
error, instead of being read as "0:0" and allowed through.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-07-08 18:05:56 -07:00
Armin Krezović ea0316a54c keyboard: Only set toplevel when there is a valid output
Currently, the keyboard client is created and the input
panel surface is set as toplevel on the first output it
finds. This does not work in a scenario when there are
no outputs, resulting in weston-keyboard to crash at
startup due to operating on an invalid output pointer.

This makes input panel toplevel setting depend on a
valid output, and if there was no output present at
startup, it will be set toplevel as soon as an output
gets plugged in.

v2:

- Remove dependency on output pointer at startup
- Only setup output_configure_handler after the
  keyboard has been created
- Let the output_configure_handler handle toplevel
  setting in all cases

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: fixed a line break]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-06-27 14:23:05 +03:00
Armin Krezović 7dda25b2d5 toytoolkit: Return NULL when no outputs are present
Currently, display_get_output returns a first member
of the linked list, which can never be NULL.

This is problematic, as the function would return a
dangling pointer and NULL pointer checks wouldn't
work where needed and some of the invalid members
would get accessed that way, resulting in a crash.

Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
2016-06-27 13:17:05 +03:00
Pekka Paalanen b5e3ea218b Rename src/ to libweston/
This clarifies what is supposed to be the libweston code.

v2: screen-share.c is already in compositor/ instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]
2016-06-23 17:44:54 +03:00
Pekka Paalanen d56b94ac78 clients/dmabuf-intel: use three buffers
Use three buffers like simple-dmabuf-v4l instead of just two.

This is required, because when a frame callback arrives, the just
committed buffer is only on its way to the screen, while the previous
buffer is still being scanned out. It will take for the page flip to
complete, before the previous buffer is release. However, we want to be
able to repaint already at the frame callback, so three buffers can be
necessary.

This patch fixes weston-simple-dmabuf-intel to not abort with "Both
buffers busy at redraw()." when hardware overlays are used and the
surface gets directly scanned out.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-06-17 11:30:37 +03:00
Bryce Harrington f013ce96c5 terminal: Document console codes less cryptically
C.f. http://man7.org/linux/man-pages/man4/console_codes.4.html

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-06-16 11:10:35 -07:00
Bryce Harrington b4dae9beff Make config.h inclusion consistent
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-06-16 11:01:54 -07:00
Bryce Harrington cd7df632be weston-simple-im: Make capitalization consistent in error messages
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-06-16 11:01:18 -07:00
Pekka Paalanen 7b69d6c958 clients/simple-damage: migrate to wp_viewporter
Use wp_viewporter instead of wl_scaler and rename things as appropriate.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-09 11:07:22 +03:00
Pekka Paalanen 7351100cd2 clients/scaler: migrate to wp_viewporter
Use wp_viewporter instead of wl_scaler and rename things accordingly.

Since interface versions were reset, there is no need to check the
interface version anymore, and the wl_scaler.set request disappeared.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-06-09 11:07:22 +03:00
Pekka Paalanen 901ac32d9a eventdemo: use %u for uint32_t printing
I was confused why timestamp was printed negative. This fixes it, and
others while at it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Benoit Gschwind <gschwind@gnu-log.net>
2016-05-16 15:01:45 +03:00
Pekka Paalanen 0baffb0fd3 eventdemo: do not print axis events if not requested
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Benoit Gschwind <gschwind@gnu-log.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
2016-05-13 11:18:10 +03:00
Pekka Paalanen 10e92db1d3 eventdemo: use zalloc
Zero-initialize the struct, just in case.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Benoit Gschwind <gschwind@gnu-log.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
2016-05-13 11:18:10 +03:00
Pekka Paalanen 43864990a2 eventdemo: do not print pointer frames alone
Print pointer frames only if any pointer related events are printed
first.

This avoids flooding the output with "pointer frame" just because of
motion. You can test this with e.g.
  $ ./weston-eventdemo --log-button

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Tested-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Benoit Gschwind <gschwind@gnu-log.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
2016-05-13 11:17:39 +03:00
Pekka Paalanen 6a20950ea2 ivi-shell-user-interface: ignore all but first seat
This client should support binding to multiple seats, but as it does
not, make a quick and dirty fix to ignore all seats beyond the first
one.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2016-05-12 11:49:03 +03:00
U. Artie Eoff 2dd10e0c60 clients/nested: fix undefined reference to xzalloc
Include shared/xalloc.h in clients/nested.c to fix
compilation error: undefined reference to `xzalloc'

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-04-25 13:44:09 +03:00
Pekka Paalanen 13a26e02e5 weston-info: look for the right wp_presentation
Patch b00c79b587 forgot to update the
global interface name to look for. Fix it.

This makes weston-info report the presentation clock again.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-22 10:43:40 +03:00
Pekka Paalanen 48fbb54959 weston-info: do not round refresh rates
Weston-info was accidentally rounding refresh rates to integer Hz.

Fix it to print 3 decimals, as the protocol carries exactly that.

Reported-by: Michel Dänzer <michel@daenzer.net>
Cc: John Galt <johngaltfirstrun@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-04-12 11:50:50 +03:00
Eric Engestrom d962be1493 client: fix spelling mistake
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-04-05 16:00:21 -07:00
Bryce Harrington 720e0c9bfa ivi: Switch from MEM_ALLOC to the now equivalent xzalloc
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-17 14:17:41 +02: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
Murray Calavera 1ddb8dd8f1 clients: fix incorrect format handling in simple-shm
the `shm_format` function seems to assume the `wl_shm_format`
enum has bit-exclusive enumerations which is not true.

Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
[Pekka: fix whitespace with an 'if'.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-16 11:16:52 +02:00
Marek Chalupa c21cb3d003 simple-egl: use roundtrip after get_registry request
Sometimes weston-simple-egl aborts in create_surface
under some conditions. It is because wl_display_dispatch()
may not be enough to make sure we have all requried objects.
Can be modeled by wldbg:

  $ wldbg -i weston-simple-egl
  (wldbg) b re get_registry
  (wldbg) c
  (wldbg) c

After these steps the weston-simple-egl aborts, because
it has not got shell neither ivi-shell objects

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-15 14:31:07 +02:00
Armin Krezović c6a55dbf04 desktop-shell: make panel clock configurable
This patch enhances the panel clock by adding a config file
option which can be used to either disable the clock or make
it also show seconds in the current clock format.

v2: Implement suggestions from Pekka:
    - Include Signed-off-by
    - Coding style fixes
    - Implement clock widget allocation by using
      width from cairo_text_extents
    - Highlight config option values in man page
v3: Implement suggestions from Pekka and Bryce:
    - Use CLOCK_FORMAT_* instead of FORMAT_* in the enum
    - Switch to using fixed clock widget size instead
      of one returned from cairo_text_extents
    - Fixes to config option highlighting in the man page
v4: Implement more suggestions from Pekka and Bryce:
    - Improve patch changelog
    - Move the check for CLOCK_FORMAT_NONE into the
      caller function
    - Fix a memory leak in panel_create introduced by
      previous revision of this patch

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57583
Signed-off-by: Armin Krezović <armin.krezovic@fet.ba>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-03-10 14:58:16 -08:00
Bryce Harrington 0d1a622375 clients: Use zalloc
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2016-03-09 22:54:54 -08:00
Pekka Paalanen b00c79b587 protocol: migrate to stable presentation-time.xml
Remove the unstable presentation_timing.xml file, and use
presentation-time.xml from wayland-protocols instead to generate all the
Presentation extension bindings.

The following renames are done according to the XML changes:
- generated header includes
- enum constants and macros prefixed with WP_
- interface symbol names prefixed with wp_
- protocol API calls prefixed with wp_

Clients use wp_presentation_interface.name rather than hardcoding the
global interface name: presentation-shm, weston-info, presentation-test.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
[Pekka: updated wayland-protocols dependency to 1.2]
2016-03-07 13:29:27 +02:00
Carlos Garnacho f377535aff dnd: Turn into a full blown example
In order to keep things simple, weston-dnd made a few choices that
turn out to be unrealistic, a few tweaks have been done to make it
less of a playground demo:

- It now caters for copy/move operations, instead of just move,
  which still remains the default nonetheless.
- As "move" operations are no longer assumed, the item isn't removed
  on start_drag, instead it is made translucent until the drag
  operation finishes (and we know whether the item is to be
  removed after transfer or left as is)
- For the same reasons, "Drop nowhere to delete item" no longer
  happens. Drag-and-drop is a failable operation and must not result
  in data loss.
- As multiple actions are now allowed, we set the pointer icon
  surface accordingly to the current operation.

This makes weston-dnd a better example of what applications usually
want to do here.

Changes since v2:
  - Updated to behave alright-ish with version < 3.

Changes since v1:
  - Remove unneeded include. Remove extra newlines. Other minor
    code fixes.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-01-19 12:34:36 +08:00
Carlos Garnacho 5ccf0476c3 client: Add DnD cursors to the managed cursors list
That way we'll be able to set the corresponding pointer surface to
a current DnD operation.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-01-19 12:34:36 +08:00
Carlos Garnacho 9c93179023 data-device: Implement DnD actions
The policy in weston in order to determine the chosen DnD action is
deliberately simple, and is probably the minimals that any compositor
should be doing here.

Besides honoring the set_actions requests on both wl_data_source and
wl_data_offer, weston now will emit the newly added "action" events
notifying both source and dest of the chosen action.

The "dnd" client has been updated too (although minimally), so it
notifies the compositor of a "move" action on both sides.

Changes since v8:
  - Add back wl_data_offer.source_actions emission, gone during last
    code shuffling. Fix nits found in review.

Changes since v7:
  - Fixes spotted during review. Add client-side version checks.
    Implement .action emission as specified in protocol patch v11.

Changes since v6:
  - Emit errors as defined in DnD actions patch v10.

Changes since v5:
  - Use enum types and values for not-a-bitfield stored values.
    handle errors when finding unexpected dnd_actions values.

Changes since v4:
  - Added compositor-side version checks. Spaces vs tabs fixes.
    Fixed resource versioning. Initialized new weston_data_source/offer
    fields.

Changes since v3:
  - Put data_source.action to use in the dnd client, now updates
    the dnd surface like data_source.target events do.

Changes since v2:
  - Split from DnD progress notification changes.

Changes since v1:
  - Updated to v2 of DnD actions protocol changes, implement
    wl_data_offer.source_actions.
  - Fixed coding style issues.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2016-01-19 12:34:35 +08:00
Carlos Garnacho 78d4bf9a3e data-device: Implement DnD progress notification
Weston now sends wl_data_source.dnd_drop_performed and .dnd_finished in
order to notify about the different phases of DnD.

wl_data_source.cancelled is also used as mentioned in the docs, being
emitted also on DnD when the operation is meant to fail (eg. source
and dest didn't agree on a mimetype).

The dnd demo is also fixed so the struct dnd_drag isn't leaked.

https://bugs.freedesktop.org/show_bug.cgi?id=91943
https://bugs.freedesktop.org/show_bug.cgi?id=91944

Changes since v6:
  - Add client-side version checks. Minor code shuffling.

Changes since v5:
  - Dissociate source and offer after cancel. Updated to
    apply on top of c9f8f8a7f.

Changes since v4:
  - Make wl_data_offer.finish with the wrong state an error.

Changes since v3:
  - Fixed wl_data_source.dnd_finished vs cancelled emission on
    when interoperating with version < 3 drag destinations.

Changes since v2:
  - Handle wl_data_offer.finish. Fixed commit log inconsistencies.
    Added version checks. Spaces vs tabs fixes. Fixed resource
    versioning.

Changes since v1:
  - Updated to protocol v2.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Michael Catanzaro <mcatanzaro@igalia.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-01-19 12:34:35 +08:00
Peter Hutterer 87743e9303 Support axis source, axis discrete, frame and axis stop events
[jonas: only send focus wl_pointer.frame if resource supports it]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2016-01-19 12:33:26 +08:00
Christopher Michael e1434d3ca8 clients: Fix compositor version check for WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
Reviewed-By: David Fort <contact@hardening-consulting.com>
2016-01-14 16:36:21 -06:00
Olivier Fourdan 602b6b6435 clients: fix build on Linux
Cannot find out why stropts.h is needed and Linux doesn't support
streams anyway, so there is no stropts.h.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2016-01-14 13:50:23 -06:00
Emmanuel Gil Peyrot 5d43af3e88 clients: add simple-v4l-dmabuf client
This client opens a V4L2 device, usually exposed as /dev/videoN, and
retrieves its frames as dmabuf for later import into the compositor.

It supports both single- and multi-planar devices, and any format
exposed by the V4L2 device the Wayland compositor accepts.

This client never changes the v4l2 settings, use `v4l2-ctl -c` if you
want to change those.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Derek Foreman <derekf@osg.samsung.com>

Maniphest Tasks: T90

Differential Revision: https://phabricator.freedesktop.org/D339
2016-01-11 13:34:22 -06:00
Emmanuel Gil Peyrot 8ef2957873 clients: Fix a few issues in simple-dmabuf-intel
Those were found while working on simple-dmabuf-v4l, as found in the
next patch of this series.

After each buffer’s params were ready to be submitted to the
compositor, a roundtrip was done, which is wasteful since we can do it
only once after having queued all the params we want.  Removing those
nested roundtrips also prevent the potentially dangerous side-effect of
calling callbacks for later events while previous events were still
being processed.

An extraneous surface damage was also removed.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>

Differential Revision: https://phabricator.freedesktop.org/D344
2016-01-11 13:31:48 -06:00
Emmanuel Gil Peyrot 3b65b0b38f clients: rename simple-dmabuf into simple-dmabuf-intel
This client was using an Intel-specific way to allocate a dmabuf, so it
makes sense to have that in its name.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>

Differential Revision: https://phabricator.freedesktop.org/D342
2016-01-11 13:30:49 -06:00
Jonny Lamb ba9dca054e weston-info: display output scale
Fall back to not showing anything as before if we don't have a
compositor with wl_output new enough (version 2 or newer).

Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-12-18 17:45:30 +02:00
Nobuhiko Tanibata 2e656769b6 hmi-controller: allocate background surfaces for multi-screen
A surface ID for layer of background/panel image is set by key: background-id
or panel-id at weston.ini. To support multi screens, it also support offset,
surface-id-offset, to offset the surface ID to next ID for a layer on next
screen.

According to the above key, hmi-controller and ivi-shell-user-interface
who increments the number of screens per notification of wl_output.
crate surface and draw background/panel image on multi surface on screens.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-12-14 13:16:11 +02:00
Derek Foreman fb1e1268d5 simple-damage: Add --use-damage-buffer flag
Add a new flag for testing damage in buffer co-ordinates

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-12-03 09:54:37 -06:00
Derek Foreman 29b846eaa6 simple-damage: Offset drawing co-ordinates not buffer start
We've been setting up the viewport by moving the start pointer of the
draw buffer, but later when we want to post damage in buffer co-ordinates
we'll need to keep track of the x,y offsets anyway.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-30 10:03:09 -06:00
Yong-iL Joh cd9bb710e7 ivi-shell-user-interface: fix runtime error caused by missing header inclusion
when weston is running on qemux86 device, there is an error with following.

[08:02:07.897] launching '/usr/lib/weston/weston-ivi-shell-user-interface'
[08:02:08.201] /usr/lib/weston/weston-ivi-shell-user-interface died on signal 11

this is caused by type mismatch, and
it does occur on qemux86-64

Signed-off-by: Yong-iL Joh <yong-il.joh@windriver.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-24 00:31:28 -08:00
Chris Michael b50ed17bda clients: Adjust grammar of comment for toysurface->prepare function pointer
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-11-23 19:28:47 -08:00
Bryce Harrington f69bd1a909 clients: Fix a few minor typos in comments 2015-11-20 11:58:13 -08:00
Derek Foreman 118387e541 toytoolkit: Remove window_damage()
It's just a direct call to wl_surface_damage() anyway, and the only
caller no longer exists.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-20 15:27:55 +02:00
Derek Foreman 0aba785384 smoke: Don't post extra damage
We're going to post damage when the widget redraw happens anyway.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-20 15:27:55 +02:00
Jonas Ådahl 5b0b770c2d Remove workspaces protocol
It doesn't fill a useful function and is not intended to be continued.
If there is need for workspace manipulation from clients a protocol
based on those future needs need to be properly designed.
workspaces.xml is probably not very relevant since it did the bare
minimum.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 15:11:08 +02:00
Jonas Ådahl cf1efd2ab7 Rename screenshooter protocol to weston_screenshooter
Due to the effort of moving a way from non-prefixed protocols, rename
the weston specific screenshooter protocol to weston_screenshooter.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 15:07:24 +02:00
Jonas Ådahl 6d6fb61a32 desktop-shell: Rename protocol weston_desktop_shell
In the effort of going away from generic names of protocols only
relevant for weston, rename the weston desktop shell
weston_desktop_shell.

This also resets the version to 1, as there will be no prior versions
to weston_desktop_shell.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 14:58:58 +02:00
Jonas Ådahl 2a229338a5 Use xdg_shell protocol from wayland-protocols
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
2015-11-19 14:49:52 +02:00
Jonas Ådahl b57f472c84 Use input method 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:17:59 +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
Jonas Ådahl 57e48f023c Use linux-dmabuf protocol from wayland-protocols
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 12:58:58 +02:00
Jonas Ådahl 496adb3bb3 Use fullscreen-shell.xml from wayland-protocols
Use the fullscreen-shell protocol XML from the wayland-protocols
installation, and remove the one we provide ourself.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Mariusz Ceier <mceier+wayland@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-11-19 12:50:56 +02:00
Derek Foreman 46812b6e71 clients: don't discard motion if we have a grab
We discard motion outside the window on the assumption it's from before
some event that caused the window to shrink. However, if we have a grab
it's likely that this motion is actually from dragging from the inside
of the window out.

This fixes a problem where drag selecting in weston terminal behaves
oddly - it doesn't update the select region while the drag is happening
outside the window.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-23 12:46:05 -07:00
Derek Foreman 5d13548c7e clients: try harder to discard motion after resize
If we're going to ignore motion below and to the right when coming
out of maximize, we should probably also ignore it above and to
the left.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-10-23 12:45:55 -07:00
Ben Hummon 1ab9ca7e01 clients: Correct drawing glitch in stacking demo
Fix a graphics glitch in the stacking demo in which a transient
window's drop shadow is visibile within the interior of the window.

Signed-off-by: Ben Hummon <benjamin.hummon@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-10-21 16:57:47 -05:00
Derek Foreman 32838c93a5 compositor/clients: Protect CLOCK_BOOTTIME with ifdefs
CLOCK_BOOTTIME is a relatively new* feature that may not actually be
present everywhere (I'm looking at you wheezy).  Since our use of it
is actually only cosmetic, I've just ifdef'd if.

* No it isn't.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-10-21 16:44:14 -05:00
Derek Foreman 3a1580fb47 clients: track seat_version per seat, not per display
Apparently it's possible for a compositor to advertise seats with
different versions on the same connection, so this makes us more robust
against that dubious behaviour.

This also tracks the seat version we requested instead of the advertised
maximum.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-10-19 14:40:40 -05:00
FORT David f7bb9352f7 weston: release keyboard/touch/pointer objects
This patch adds the missing calls to release when the seat has capabilities
changes. It also fixes a missing release of the touch object and a leak with
old clients.

Signed-off-by: David FORT <contact@hardening-consulting.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-10-09 15:23:08 -05:00
Derek Foreman bdc8c721e4 cosmetic: Remove a few double semicolons
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-10-07 11:22:03 -07:00
Manuel Bachmann e54cee17a7 terminal: allow copy-paste when selection is scrolled out
We could not paste text when its source went outside the
visible part of the buffer ; this is because we were
incorrectly assuming that our iterator should start at
row 0, while it could very well be negative.

Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-22 18:37:19 -07:00
Derek Foreman 673bbe2e8c clients: ungrab the correct input when menus close
We need to input_ungrab() on the stored input, not the one that caused
the release - otherwise bad things can happen in multi-seat environments
when a seat that didn't open the menu closes it.

To reproduce:
 configure two seats
 launch weston terminal
 open the right click pop up
 select a menu item from the other seat

The next click from the seat that opened the menu will cause a segfault.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-22 18:22:28 -07:00
Derek Foreman 7978bc82dd terminal: Don't crash when selecting non-ascii characters
So it turns out if you cat /dev/urandom and drag select in the mess
you can crash weston-terminal.  There may also be more legitimate
ways of doing this.

The reason is that isalpha() and isdigit() only accept values that
fit within an unsigned char or are EOF.

By treating values < 0 the same as values > 127 we prevent this crash.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-09-10 10:07:16 +03:00
Bryce Harrington ae6f1bb3f7 clients: Fix height typo in clamp_view()
We should be checking our scaled image height against the allocation
height rather than the allocation width.

Fixes vertical image motion when horizontal motion restricted, i.e.
when window is wide and short compared to the image.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-09-09 10:07:27 +03:00
Jonas Ådahl decc965be9 clients: Drop deadlock circumvention hack now that we don't need it
mesa supports EGLSwapInterval 0 now, so lets remove this hack. As a
bonus we don't conflict with the XDG shell protocol that doesn't allow
committing a null-buffer, which was a side effect of this hack.

This patch reverts e9297f8e7e. See that
commit for an explanation how this worked.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
[Pekka: added reference to the original commit]
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-08-21 15:22:03 +03:00
George Kiagiadakis 53868985ff clients: add simple-dmabuf client
v2:
- adapted to protocol changes
- added TODO comments
- minor clean-up
- change y-invert from per-plane boolean to per-buffer flag

v3:
- fix a typo: 1 -> i (noticed by Carlos Olmedo Escobar)

Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2015-08-14 15:53:26 +03:00
Dawid Gajownik 74a635b1ec Coding style fixes
- opening braces are on the same line as the if statement
- opening braces are not on the same line as the function name
- space between for/while/if and opening parenthesis

Signed-off-by: Dawid Gajownik <gajownik@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2015-08-07 12:01:22 -07: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
Bill Spitzak 2ccd9a2d62 test/ivi: include protocol headers for all used protocols
This seems like a good idea for consistency that the protocol header
is included for any protocols used by the code. This also means the
code will compile with headers generated by wayland-scanner -c.

Fixed to use angle brackets.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-08-06 16:24:59 +01:00
Derek Foreman 118a429504 window: Use wl_cursor_frame_and_duration() for mouse cursor updates
Some animated cursor sets use very long delays, but until now we'd use the
frame callback and update the cursor at the display framerate anyway.

Now we use a timerfd to drive cursor animation if the delay is longer
than 100ms, or the old method for short delays.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-17 17:48:45 -07:00
Mario Kleiner c1809b230c presentation-shm: Allow setting of delay before surface.commit
A new optional parameter "-d msecs" allows to specify a
delay before the surface attach/damage/commit to shift
the point in time when a surface update is committed.

This allows to test how different client timings interact
with the compositors repaint timing.

Suggested by Pekka Paalanen.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

v2: Clarify the intent, doing a delay in window_create_feedback()
    is a bit surprising. Use nanosleep() instead of clock_nanosleep(),
    which may not support the chosen presentation clock.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-07-16 13:51:03 +03:00
Bryce Harrington da9d8fa3e4 clients: Simplify memory allocation with xzalloc()
It is redundant to check x*alloc's return value for null pointers, since
they are guaranteed to either return non-NULL or terminate the program.

In cases where we memset the malloc'd memory to 0, we can more
efficiently use the xzalloc() routine.  zalloc looks for opportunities
to return memory chunks that have already been zero'd out, so it can
provide better performance.

This patch addresses this warning, reported by Denis Denisov:

  [clients/window.c:1164] -> [clients/window.c:1166]: (warning) Possible
  null pointer dereference: surface - otherwise it is redundant to check
  it against null.

  [clients/window.c:4513] -> [clients/window.c:4514]: (warning) Possible
  null pointer dereference: surface - otherwise it is redundant to check
  it against null.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2015-07-10 00:15:42 -07:00
Pekka Paalanen 0a9d348fd8 Remove weston-screensaver
This removes the weston-screensaver client.

Screensavers are not so useful, DPMS is much better. This example has
existed here for a good while, and things that we could learn from it
have been learnt.

Nowadays this is just dead weigth, which is usually not even compiled,
because it depends on both cairo-gl and GLU. Removing it removes the
only possible dependency to GLU and one user of cairo-gl. Now the last
user of cairo-gl is gears (clients/nested.c uses cairo-glesv2).

Support for screensavers is still left in desktop-shell, so external
projects can still have their screensavers if they want.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-06-22 15:19:14 +03:00
Jon Cruz 867d50eea7 Unified multiple definitions of container_of() macro.
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.

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:58 -07:00
Jon Cruz d618f688d5 Moved the MIN() macro to the helper include.
Removed multiple definitions of the MIN() macro from existing
locations and unified with a single definition. Updated sources
to use the shared version.

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:52 -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
Jon Cruz 4678bab13c Remove redundant #include path component.
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.

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:09 -07:00
Bryce Harrington 1f6b0d1d2c clients: Update boilerplate from MIT X11 license to MIT Expat licenses 2015-06-15 13:04:18 -07:00
Murray Calavera 883ac02d22 Whitespace corrections
Signed-off-by: Murray Calavera <murray.calavera@gmail.com>
2015-06-06 12:39:51 -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
Dima Ryazanov cead794101 desktop-shell: Remove the panel popup
It doesn't work anymore, and it never did anything useful.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-04-13 15:27:14 +03:00
Manuel Bachmann 56d9b88e69 nested-client: fix typo
Should be "client" instead of "nclient".

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-30 15:28:24 +03:00
Pekka Paalanen 807f09c94f terminal: add "Minimize" to context menu
Terminal is a nice app that support fullscreening. To be able to test
minimizing of a fullscreen app, add an entry to the context menu. That
is the only way to minimize, as window frame is not there when
fullscreen.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-27 15:48:54 +02:00
Pekka Paalanen 6c71aaeec5 Pass config file from compositor to everything
We have the Weston command line option '--no-config' which is meant to
prevent loading weston.ini at all. It works for Weston itself, but it
does not work for any clients that also want to read weston.ini.

To fix that, introduce a new environment variable WESTON_CONFIG_FILE.
Weston will set it to the absolute path of the config file it loads.
Clients will load the config file pointed to by WESTON_CONFIG_FILE. If
the environment variable is set but empty, no config file will be
loaded. If the variable is unset, things fall back to the default
"weston.ini".

Note, that Weston will only set WESTON_CONFIG_FILE, it never reads it.
The ability to specify a custom config file to load will be another patch.

All programs that loaded "weston.ini" are modified to honour
WESTON_CONFIG_FILE.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-27 09:38:12 +02:00
Jonny Lamb abff883d2c platform: rename create_egl_window to create_egl_surface
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 5c332900f7 nested-client: include platform.h
Missed because buliding nested clients requires cairo-glesv2.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-26 09:54:49 +02:00
Jonny Lamb 4bdcb5732b clients & tests: use eglCreatePlatformWindowSurfaceEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:57:24 -07:00
Jonny Lamb 51a7ae5f89 clients & tests: use eglGetPlatformDisplayEXT when supported
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-20 13:56:38 -07:00
Bryce Harrington a86c3ee697 Spellcheck fixes
./ivi-shell/README:19: protocal  ==> protocol
./src/compositor.h:596: seperate  ==> separate
./src/version.h.in:33: actualy  ==> actually
./src/cms-helper.h:44: embeded  ==> embedded
./protocol/fullscreen-shell.xml:65: seperate  ==> separate
./protocol/xdg-shell.xml:150: auxilliary  ==> auxiliary
./clients/window.c:1035: preferrably  ==> preferably

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-19 17:02:08 +02:00
Derek Foreman 493d979e57 window: Fix crash in input_set_pointer_image when cursor is special
Certain circumstances may lead to the "force" clause in
input_set_pointer_image() being reached when the current cursor
is blank or unset.  These are special cursors that don't have
images, and they need to be handled differently than image cursors.

This patch puts the special cursor handling in its own function and calls
it from both places that need it.  Previously only the frame callback
handler did this correctly.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-03-05 10:14:25 +02:00
Jasper St. Pierre 5ba1e1d137 xdg-shell: Bump unstable version
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:43 +02:00
Jasper St. Pierre 14f330c619 xdg-shell: Remove the flags from get_xdg_popup
There haven't been any ideas for flags, so we don't need a useless,
unused parameter hanging around. Any future ideas should be done with a
new request entirely.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:59:05 +02:00
Jasper St. Pierre ecf2a0f1ca xdg-shell: Remove the serial from popup_done
It doesn't serve any purpose, as it's a serial that the client gave to
the server when starting the popup, which the client already has.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:58:57 +02:00
Jasper St. Pierre 66bc949b72 xdg-shell: Take a xdg_surface as the parent surface
There is no other valid surface that we should be using here.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2015-02-27 14:58:35 +02:00
Pekka Paalanen 4d012bc191 presentation-shm: put run mode in window title
This way JSON timeline logs will contain the information about in which
mode the program runs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2015-02-19 15:00:17 +02: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
Jonas Ådahl 6c3bd9c7c3 clients: Remove stray new-line
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2015-01-26 11:52:18 -08:00
Bryce Harrington 61613576fe Revert "simple-egl: HACK to report presentation flags"
This reverts commit b77acf592f.

Change is listed as "not for upstream"
2015-01-20 17:22:16 -08:00
Pekka Paalanen b77acf592f simple-egl: HACK to report presentation flags
So that we can test the per-surface ZERO_COPY flag:
- start Weston on DRM backend
- run ./weston-simple-egl -o (need to be opaque to end up on overlay)
- hit debug key 'V' to enable the (broken) hw overlays

The debug key is used by first hitting Mod+Shift+space, then hitting 'v'.

Enabling overlays should change the flags from 0x7 to 0xe. To verify the
window is really on an overlay, use debug key 'S' to tint all
GL-composited things green.

This patch is not intended for upstream.

Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-01-20 17:13:33 -08:00
Pekka Paalanen 63495864d3 tests, clients: add Presentation feedback flags
Decode the new feedback flags.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-01-20 17:13:27 -08:00
Marek Chalupa a519d06a53 window: use roundtrip instead of dispatch after get_registry
wl_display_dispatch() just dispatches events that are in
default and display queues and if there are no events,
then it will wait for them. But only dispatching
the events doesn't guarantee that we got all the global announcements,
we need to do sync too. Therefore use wl_display_roundtrip() instead
of wl_display_dispatch().

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-12 13:57:05 +02:00
Nobuhiko Tanibata b1d121d835 clients: support ivi-application.xml for clients/window.c
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-04 17:25:50 +02:00
Nobuhiko Tanibata 4f01a0b1f7 clients: support ivi-application.xml for clients/simple-egl.c
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-04 17:25:50 +02:00
Nobuhiko Tanibata fba4ea3627 clients: support ivi-application.xml for clients/simple-shm.c
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-04 17:25:50 +02:00
Nobuhiko Tanibata 923bc14097 clients: a reference implementation of UI client how to use ivi-hmi-controller.
- introduces ivi-shell-user-interface.c

This is launched from hmi-controller by launch_hmi_client_process and
invoke a
client process.

The basic flow is as followed,
1/ process invoked
2/ read configuration from weston.ini.
3/ draw png file to surface according to configuration of weston.ini
4/ all parts of UI are ready. request "UI_ready" to draw UI.
5/ Enter event loop
6/ If a surface receives touch/pointer event, followings are invoked
according
   to type of event and surface
6-1/ If a surface to launch ivi_application receive touch up, it execs
     ivi-application configured in weston.ini.
6-2/ If a surface to switch layout mode receive touch up, it sends a
request,
     ivi_hmi_controller_switch_mode, to hmi-controller.
6-3/ If a surface to show workspace having launchers, it sends a
request,
     ivi_hmi_controller_home, to hmi-controller.
6-4/ If touch down events happens in workspace,
     ivi_hmi_controller_workspace_control is sent to slide workspace.
     When control finished, event:
ivi_hmi_controller_workspace_end_control
     is received.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-04 17:13:42 +02: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
Derek Foreman ba0f33dc28 dnd: Fix some mouse cursor issues
When ending a drag in the window the cursor will be wrong until the mouse
is moved again.  This is because the item being dragged isn't added
until after the enter event.

Also, when picking up an item while moving the mouse the cursor can switch
back to a non-drag cursor before the drag begins.  This is because of a
slight delay between button click and drag start.

Finally picking up or dropping an item under a second pointer could cause
that pointer to have the wrong cursor.

Closes one of the issues in bug 56298
https://bugs.freedesktop.org/show_bug.cgi?id=56298

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-28 13:13:57 +02:00
Pekka Paalanen 8b5211835f simple-shm: explain two initial roundtrips
Explain carefully why we need two roundtrips, not just one, not just
dispatch and roundtrip, but two roundtrips after creating the
wl_registry object.

v2: Explain what initial events are, and that this is a general
technique.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
2014-11-27 09:13:39 +02:00
Frank Binns 77f7daca68 smoke: fix valgrind invalid read errors
There are a number of invalid read errors reported by valgrind of the
form:
	==13428== Invalid read of size 4
        ==13428==    at 0x405656: advect (smoke.c:116)
        ==13428==    by 0x405E80: redraw_handler (smoke.c:228)
        ==13428==    by 0x40DE74: widget_redraw (window.c:3995)
        ==13428==    by 0x40E02D: surface_redraw (window.c:4053)
        ==13428==    by 0x40E0C9: idle_redraw (window.c:4082)
        ==13428==    by 0x410FC9: display_run (window.c:5561)
        ==13428==    by 0x406518: main (smoke.c:373)
        ==13428==  Address 0xb2c9b14 is 4 bytes after a block of size
                   160,000 alloc'd
        ==13428==    at 0x4C29DB4: calloc
        ==13428==    by 0x40646B: main (smoke.c:360)

This results in invalid rendering when running a debug version of the
application.

Fix the issue by limiting the maximum values of px and py to 1.5 less
than width and height. This prevents reading past the end of the source
buffer.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82287
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-11 12:59:43 +02:00
Jasper St. Pierre c8e41868fd smoke: Don't commit an xdg_surface with a NULL buffer
Committing to an xdg_surface with a NULL buffer is currently illegal in
the mutter implementation, so this simply causes the client to error and
exit.

It seems the reason the client did this was so it could add its own
frame callback, but toytoolkit actually provides accurate everything we
need. Just use its functions instead to get the time and schedule a
redraw.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-11 12:33:01 +02:00
kabeer khan 6ce67ecbce window : compare version and call appropriate destructor
[Pekka Paalanen: removed trailing space, split long line.]

Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-04 15:27:07 +02:00
Pekka Paalanen ef2b592ad4 clients: add presentation-shm demo
This started as a copy of simple-shm.c before it was converted to
xdg_shell.

This demo excercises the presentation feedback interface in five
different modes:

- A continuous repaint loop triggered by frame callbacks, and using
  immediate commits, just gathering presentation feedback and computing
  some time intervals for statistics.

- The same as above, except with 1s sleep before actually repainting as
  a response to frame callback. This tests how well the compositor can
  do a repaint from idle state (not continuously repainting), assuming
  nothing else is causing repaints.

- A continuous repaint loop triggered by 'presented' events rather than
  by frame callbacks. If Weston uses an appropriate scheduling
  algorithm, this mode achieves the smallest possible frame latency
  (below one output refresh period).

In all modes, all frames are pre-rendered at startup, so no rendering
happens during the animation.

[Louis-Francis Ratté-Boulianne: split queuing feature]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
2014-09-30 13:02:20 +03:00
Pekka Paalanen 93a6afdf6e weston-info: report presentation clock
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v3 Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2014-09-30 11:37:02 +03:00
Xiong Zhang 382de46a2f clients: Maximize window when double touch on title bar
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2014-09-22 10:19:44 +03: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
Olivier Blin 814f0ee5a6 keyboard: do not crash when input panel is not available
[Pekka Paalanen: whitespace fix]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-17 13:52:09 +03:00
Ondřej Majerech b2c1864777 window: Don't needlessly sync parent and geometry
When a toytoolkit client redraws, the toolkit syncs the parent and
geometry. If a client redraws often (such as the terminal drawing a huge
amount of output), this can spam the compositor with requests and may
result in the client's eventual being killed.

We don't need to send requests for changing the geometry or parent if
these haven't changed. So remember the last geometry and parent, and
update them only if needed.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83297
Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-15 11:22:05 +03:00
Bill Spitzak 5e3b693a11 image: don't print redundant error
This error is printed by load_image() now

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 13:11:29 +03:00
Pekka Paalanen 2623786277 Partially revert "xdg-shell: Add show_window_menu request"
This reverts the parts of commit 81ff075bf4
that touch window.c.

This brings the toytoolkit window context menus back, until someone
implements the xdg-shell equivalent in the compositor.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82972
Acked-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-11 11:34:31 +03:00
Jonas Ådahl 16fe4dcea9 input: Schedule pointer sprite repaint when cursor is set
If a cursor was set with wl_pointer.set_cursor but not in combination
with an action that has the side effect of damaging the region where the
cursor is positioned, it would not be drawn. This patch explicitly
schedules a repaint of the pointer sprite when it is set.

clickdot is updated to illustrate the bug; when moving the pointer over
clickdot, the pointer is hidden. When not having moved the pointer for
500 ms it is made visible using wl_pointer.set_pointer.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-10 14:20:13 +03:00
Xiong Zhang bfb4ade1a0 clients: Maximize window when double click on title bar
Signed-off-by: Xiong Zhang <panda0626@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-04 17:11:22 +03:00
Arnaud Vrac fb754a0a05 desktop-shell: properly set background widget as opaque
Toytoolkit resets the opaque region which was set manually using the
wayland protocol directly, so use the widget API instead.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-28 13:41:00 +03:00
Arnaud Vrac 488b7cd0f0 simple-egl: fix opaque and 16 bits mode options
In those cases we were writing to the wrong EGL config attribute.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-28 13:27:48 +03:00
Ryo Munakata 30b2a37a9a multi-resource: remove an unnecessary call of wl_display_get_fd()
Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-28 13:08:43 +03:00
Ryo Munakata 445436c593 simple-shm: remove an unnecessary call of wl_display_get_fd()
Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
2014-08-28 11:56:29 +03:00
Arnaud Vrac 38d90be5bb window: unbind egl surface and context on surface release
Binding null read and write surfaces to an egl context is not standard

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-27 16:37:44 +03:00
Pekka Paalanen 71182aed84 xdg-shell: bump experimental protocol version
The experimental versioning has not been updated when it was supposed
to. Let's try to be better at it now, as xdg-shell is close to have its
first stable version.

Bump the version now to bring the world into the same exact version.

There may be some protocol changes still coming, but we try to land them
before 1.6 gets out. Those changes will bump the experimental version
again as needed.

When 1.6.0 is released, the experimental version will no longer be
bumped, and no incompatible protocol changes will be made. Xdg-shell.xml
file will move to Wayland in 1.7.0, drop the experimental versioning,
and become stable.

Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-21 17:47:20 +03:00
Pekka Paalanen effef73926 cliptest: sync calculate_edges with master copy
The master copy of calculate_edges() lives nowadays in gl-renderer.c.
Copy it verbatim from gl-renderer.c into cliptest.c.

Update cliptest.c for the following changes that happened in Weston
core, vertex.clipping.c, and gl-renderer.c:
- replace GLfloat with float
- introduction of weston_view, here replacing weston_surface
- API change of weston_view_to_global_float

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-20 11:51:27 +03:00
Ondřej Majerech 06e089275d Remove duplicated code from cliptest.c
Signed-off-by: Ondřej Majerech <oxyd.oxyd@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-20 11:43:26 +03:00
Ran Benita 2e1968fa1f Replace deprecated xkbcommon symbols with current names
These symbols (xkb_map_* and others) were replaced in xkbcommon with more
consistent names. See the header xkbcommon/xkbcommon-compat.h for how
the old names map to the new.

The new names have been available since the first stable xkbcommon
release (0.2.0).

Signed-off-by: Ran Benita <ran234@gmail.com>
2014-08-20 01:05:13 -07:00
Derek Foreman a0fae4657f cliptest: Avoid use of uninitialized memory when regions don't intersect
Prevent attempting to draw the intersection polygon when it contains no
vertices.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-19 12:46:11 +03:00
Bill Spitzak 0fc3786dff weston-scaler --help works even if not run inside wayland 2014-08-19 12:21:44 +03:00
Bill Spitzak a8292618a6 weston-image --help works. Also help if no filename is given 2014-08-19 12:21:44 +03:00
Bill Spitzak bb0bb9ce96 weston-editor --help works 2014-08-19 12:21:44 +03:00
Bill Spitzak 6fd10c6c6c weston-dnd --help works 2014-08-19 12:21:37 +03:00
Bill Spitzak 36bcf47054 weston-cliptest --help works. You must use -b to run benchmark 2014-08-19 12:19:56 +03:00
Bill Spitzak 5cad843989 weston-terminal --help and other command-line options
Option array existed but was unused. Added --font-size.
2014-08-19 12:19:17 +03:00
Bill Spitzak 6e16a556f8 Made weston-screensaver --help work 2014-08-19 12:19:17 +03:00
Bill Spitzak 852254a7c7 Made weston-subsurfaces --help work 2014-08-19 12:19:17 +03:00
Bill Spitzak 6df71aae03 Made weston-nested --help work 2014-08-19 12:19:16 +03:00
Bill Spitzak 4fb8491e1b weston-eventdemo --help works
Also defaults to printing all events if you specify none.
Removed incorrect "-0" switch which would turn on one of them.
2014-08-19 12:19:16 +03:00
Ryo Munakata a3a5debe31 gears: fix invalid calculation of the first FPS
At the calculation of the first FPS, gears has initialized last
FPS time with gettimeofday().
But the callback_data passed in the callback of wl_surface_frame()
is the current time, in milliseconds, with an undefined base.
Because of this subtracting last FPS time from callback_data makes no sense.
 For example, below is the result of running weston-gears on weston with
drm backend:

$ weston-gears
Warning: FPS count is limited by the wayland compositor or monitor refresh rate
1 frames in 1094460.125 seconds =  0.000 FPS
301 frames in  5.016 seconds = 60.008 FPS
301 frames in  5.016 seconds = 60.008 FPS
301 frames in  5.016 seconds = 60.008 FPS

As you can see, the the first FPS value is something odd.

This patch fixes it by initializing last FPS time with the callback_data passed in
the first callback.

Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
2014-08-18 15:27:16 +03:00
Jonny Lamb e67118c80a desktop-shell: add option to avoid creating the panel
This option is so we can disable showing any panel at all. The default
is to continue showing the panel and no example is added to weston.ini
because it's an uncommon request.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-18 13:26:41 +03:00
Magnus Hoff 1046f121f7 Implemented support for mouse scrolling in weston-terminal
[Pekka Paalanen: fixed some code style issues]
2014-08-15 16:06:05 +03:00
Boyan Ding 45ee1f9ef7 simple-egl: Clean up unused frame_listener
Unused since commit 1e65840b61

Signed-off-by: Boyan Ding <stu_dby@126.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
2014-08-15 15:52:08 +03:00
Jonny Lamb 0695908a9f clients: use repeat_info event details
The weston-info client prints out the values, and the values are
respected in toytoolkit when actually repeating keys..
2014-08-15 15:39:47 +03:00
Jasper St. Pierre a177df09bf window: Don't use the frame's geometry when fullscreen
When fullscreen, we don't actually update the frame's geometry, so we
can't query it for there.
2014-08-05 12:31:04 -07:00
Jasper St. Pierre ccf48fb4f9 shell: Replace set_margin with set_window_geometry
Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.

What happens is that the client want so go maximized, so we
calculate the size that we want the window to resize to (640x480),
and then add on its margins to find the buffer size (+10 = 660x500),
and then send out a configure event for that size. The client
renders to that size, realizes that it's maximized, and then
says "oh hey, my margins are actually 0 now!", and so the compositor
has to send out another configure event.

In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.
2014-07-17 13:59:01 -07:00
Jasper St. Pierre bd65e50875 Interpret the size in the configure event as window geometry
The size of the configure event has always been specified as in window
geometry coordinates, but it was never implemented this way.
2014-07-17 13:58:45 -07:00
Jason Ekstrand ef5400843f Use pixman_region32_clear instead of our own empty_region
This requires pixman 0.25.2

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-07-05 01:03:55 -07: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
Jason Ekstrand 549a53f186 Add a simple client for testing compositor damage handling
This allows for easily testing a compositor's damage tracking in all
currently available configurations including wl_surface.buffer_transform,
wl_surface.buffer_scale, and wl_viewport.  It also includes a
--rotating-damage that flag instructs the client to change the
wl_surface.buffer_transform on every commit.  This tests the compositor for
proper handling of texture uploads even when the transform has changed but
the buffer size hasn't.
2014-06-18 10:45:50 -07:00
Jasper St. Pierre 81ff075bf4 xdg-shell: Add show_window_menu request 2014-05-23 09:43:17 -07:00
Jasper St. Pierre de8bd50d35 clients: Allow creating a "detached" menu
This will be used by the xdg_surface.show_menu_window implementation.
2014-05-23 09:37:19 -07:00
Jasper St. Pierre dda9313bd9 clients: Remove the window / user parameters from the menu function
We want the ability to create a detached menu.
2014-05-18 13:54:15 -07:00
Kristian Høgsberg be803ad67c window: Send ack_configure immediately from configure handler
Once we've updated the window state and scheduled a resize, we know that
the next frame we send to the compositor will match the configured state.
This means we can just ack the configure immediately and not jump
through hoops to try to do it from the redraw stage.
2014-05-12 23:34:34 -07:00
Jasper St. Pierre f184c382e8 window: Move the resize after interpreting the states
As the protocol says, the states determine how the width and height
arguments should be interpreted, so it makes logical sense to do the
interpretation after.
2014-05-12 23:34:31 -07:00
Jasper St. Pierre ccf908b078 window: Set frame flags immediately when we handle the new states in configure 2014-05-12 23:34:05 -07:00
Jasper St. Pierre 973d7879e3 xdg-shell: Turn "activated" into a state
This drops two events, and makes new window decorations race-free with
an attach in-flight.
2014-05-12 23:34:05 -07:00
Jasper St. Pierre de6809912e terminal: Only add the new size to the title when we're resizing
Add a new state_changed_handler callback to the window to know when the
window has changed state; the terminal will use this to know when the
window started and ended its resize operation, and modify the terminal's
titlebar accordingly.
2014-05-12 23:34:05 -07:00
Jasper St. Pierre 5befdda84f xdg-shell: Turn the resizing heuristics into an explicit state
Currently, there's a race condition. When resizing from the left, and
a client attaches a buffer after the resize ends, you suddenly see the
buffer jump to the right, because the resize ended while multiple
attaches were in-flight. Making resize a state can fix this, as the
server can now know exactly when the resize ended, and whether a commit
was before or after that place.

We don't implement the correct tracking in this commit; that's left as
an exercise to the reader.

Additionally, clients like terminals might want to display resize popups
to display the number of cells when in a resize. They can use the hint
here to figure out whether they are resizing.
2014-05-12 23:34:05 -07:00
Jasper St. Pierre ab2c108137 xdg-shell: Rework the state system
The states system, so far, has been a complicated mix of weird APIs
that solved a real race condition, but have been particularly ugly
for both compositors and clients to implement.
2014-05-12 23:33:59 -07:00
Jasper St. Pierre c815d62b85 xdg-shell: Rename set_transient_for to set_parent
It's a confusing name that comes from the ICCCM. The ICCCM is best
forgotten about.

With the addition of the potential new "transient" role meaning a
parent-relative toplevel like a long-lived popup, used for e.g.
tooltips, the set_transient_for name will become even more confusing.
2014-05-13 00:35:30 -04:00
Jasper St. Pierre 11f1433e0a fullscreen: Remove dirty sizing trick
xdg-shell mandates that the FULLSCREEN state means that we must match
the size that we were configured to, at least by default. Other states
or protocol extensions might relax this requirement, but at least for
now implement the behavior specified in the protocol documentation.
2014-05-13 00:35:29 -04:00
Jasper St. Pierre af314bb4f5 fullscreen: Remove our own focused state tracking
This is decided by xdg-shell now.
2014-05-13 00:35:29 -04:00
Ander Conselvan de Oliveira a57c9f1b90 window: Ignore input events from subsurfaces
Toytoolkit was not designed to handle input from subsurfaces and
instead it expects subsurfaces to have an empty input region. That way
input events for subsurfaces are generated on the main surface and
there is no need to convert coordinates before reporting the event to
the user.

However it is possible that a subsurface has a non-empty input region,
but in that case those events aren't properly processed. The function
window_find_widget() assumes the coordinates are in the main surface
coordinate space, and ends up chosing the wrong widget.

This patch changes the input code to completely ignore input events from
subsurfaces. This option was chosen instead of ensuring that the input
region on those surfaces is always empty since there's no enforcement
that a subsurface should completely overlap with the main surface. If
an event happens in the area of the surface that doesn't overlap, the
event could cause a completely unrelated surface to be picked.

https://bugs.freedesktop.org/show_bug.cgi?id=78207
2014-05-12 12:50:00 -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
Bill Spitzak 79b7cb3ee3 desktop-shell: Fix black edges on scaled desktop pattern
Filter sampling outside the source image can leak black into the edges
of the
desktop image. This is most easily seen by scaling the default tiled image
with this weston.ini:

	# no background-image and no background-color
	background-type=scale-crop
2014-05-09 14:03:05 -07:00
Ander Conselvan de Oliveira c3f03f557b simple-touch: Handle multiple seats properly
If simple-touch ran on a compositor with multiple seats, and the first
one happened to have the touch capability while the second one didn't,
the handler for seat capabilities would destroy the wl_touch device it
created on the first call for the first seat when it was called a again
for the second seat that has not touch capabilities.

Fix this problem by creating a separate struct for each seat.

https://bugs.freedesktop.org/show_bug.cgi?id=78365
2014-05-09 12:50:11 -07:00
Bryce W. Harrington 762b231e0b clients: Initialize label in keyboard handling code
Quells warning:
  clients/keyboard.c: In function ‘keyboard_handle_key.isra.5’:
  clients/keyboard.c:556:11: warning: ‘label’ may be used uninitialized in
  this function [-Wuninitialized]

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-05-09 12:33:20 -07:00
Jasper St. Pierre bf39e5e1ba window: Add a simple getenv to force SHM rendering 2014-04-30 21:04:34 -07:00
Jasper St. Pierre bd600774be window: Clean up buffer type choosing
Extracting it to a function makes this cleaner and more
understandable.
2014-04-30 21:04:22 -07:00
Kristian Høgsberg 9c60933a13 window.c: Dismiss menu on touch up events 2014-04-29 14:47:19 -07:00
Kristian Høgsberg 1f67117f6f window.c: Also grab touch events when grabbing input 2014-04-29 14:30:44 -07:00
Kristian Høgsberg c31f624141 window.c: Prevent key event delivery while a grab is active
Ideally, we'll update the key event handling to deliver events to widgets,
but in the meantime, just blocking key event delivery while a grab is
active goes a long way.
2014-04-29 14:21:46 -07:00
Kristian Høgsberg 41f7ebc36a window.c: Update pointer focus when taking a grab 2014-04-29 14:12:20 -07:00
Bryce W. Harrington 66cd2c1ce1 terminal: Convert all *alloc's to x*alloc's.
This ensures the allocation results are checked for NULL (out of
memory), and terminates the program in such a case.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-29 13:25:50 -07:00
Neil Roberts a69dc01a6e clients/window: Don't remove the touch listener on a frame event
It looks like the handler for frame events from the wl_touch interface for
widgets may have been erroneously copied from the cancel handler so that it
removes all handlers as they are processed. I don't think this makes much sense
for the frame event. This was stopping the panel icons from being pushable with
touch events when using libinput since commit 1679f232e5. All that commit
does it make it start sending the frame events.
2014-04-25 15:18:37 -07:00
Kristian Høgsberg 4c3661fd7b desktop-shell: Only use default background if no background color is set
Previously we would only use the set background color if the
background-image value was explicitly set to empty or a non-existing
image.  With this change, we only load the default background image
if there's no configure background image or background color.  In case
of both an image and a color, the image takes precedence as before.
2014-04-21 22:54:37 -07:00
U. Artie Eoff cb0e3579af weston-info: fix log message typo
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-04-21 15:40:26 -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
Manuel Bachmann 301f06b894 keyboard: add the missing symbols layout, fix arabic layout
The "symbols" modifier key of weston-keyboard is no longer
inactive, but will provide an additionnal layout with
numerals and special characters.

Fix the Arabic keyboard, which was rendering out of the
bounds, and now use the Arabic IBM PC keyboard as a
reference for its standard and new symbols layouts.

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

Signed-off-by: Manuel Bachmann <manuel.bachmann@open.eurogiciel.org>
2014-04-16 22:42:27 -07:00
Daiki Ueno 56d8a7a155 terminal: Don't try to render RLE used as a placeholder
weston-terminal uses RLE (U+202B) as a placeholder of the right half
of a double width character.  However, not all fonts include this
glyph and cairo renders it as .notdef (glyph index 0) in that case.
2014-04-08 10:03:17 -07:00
Kristian Høgsberg cdbbae2cac window.c: Create xdg_surface up front
Fixes initial fullscreen for calibrator.

https://bugs.freedesktop.org/show_bug.cgi?id=76970
2014-04-07 11:28:05 -07:00