Commit Graph

1466 Commits

Author SHA1 Message Date
Marius Vlad 7d070ca0ba Fix compiler warnings generated by older toolchains/compiler
This fixes warnings like ``may be used uninitialized''

libweston/compositor-drm.c: In function 'drm_device_is_kms':
libweston/compositor-drm.c:6374:12: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
  b->drm.id = id;

Signed-off-by: Marius Vlad <marius.vlad0@gmail.com>
2018-12-15 18:37:53 +02:00
Daniel Stone 8011b0fa03 Add Meson build system
Meson is a build system, currently implemented in Python, with multiple
output backends, including Ninja and Make. The build file syntax is
clean and easy to read unlike autotools. In practise, configuring and
building with Meson and Ninja has been observed to be much faster than
with autotools. Also cross-building support is excellent.

More information at http://mesonbuild.com

Since moving to Meson requires some changes from users in any case, we
took this opportunity to revamp build options. Most of the build options
still exist, some have changed names or more, and a few have been
dropped. The option to choose the Cairo flavour is not implemented since
for the longest time the Cairo image backend has been the only
recommended one.

This Meson build should be fully functional and it installs everything
an all-enabled autotools build does. Installed pkg-config files have
some minor differences that should be insignificant. Building of some
developer documentation that was never installed with autotools is
missing.

It is expected that the autotools build system will be removed soon
after the next Weston release.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 14:50:54 +02:00
Pekka Paalanen 9d771fc506 clients/simple-egl: include weston-egl-ext.h correctly
weston-egl-ext.h was moved to shared/ in
ffff92d592

Use the correct include path, so that Meson build does not need to add
../shared to the include path just for this.

Signed-off-by: Pekka Paalanen <pq@iki.fi>
2018-12-09 12:13:36 +02:00
emersion 807cd2e589 clients: configure cursor theme from XCURSOR_* env
If XCURSOR_THEME or XCURSOR_SIZE is set, use it as the cursor theme
or cursor size.

This is similar to what Qt and some X11 apps do.
2018-11-02 13:45:37 +00:00
orbitcowboy 1f3fae2f1a Fixed potential memory leaks in simple-dmabuf-drm.c found by Cppcheck. 2018-11-02 13:34:35 +00:00
emersion b49af1ed19 weston-info: add xdg-output support 2018-09-18 00:17:00 +02:00
Stefan Agner 20b241691b desktop-shell: allow to center background image
Add the centered option as background-type. This draws the image
once in the center of the screen. If the image is larger, it will
be cropped like scale-crop.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2018-09-17 14:53:03 +00:00
Stefan Agner 1c1e4fdaf4 desktop-shell: always paint background color first
Only draw the background once, using the the current default
background color or the user specified background color.

This allows for non-filling background image implemenation
while still using the specified background color.

Signed-off-by: Stefan Agner <stefan@agner.ch>
2018-09-17 14:53:03 +00:00
Pekka Paalanen b9fdc14b2a clients: add weston-debug
A tool for accessing the zcompositor_debug_v1 interface features.

Installed along weston-info, because it should be potentially useful for
people running libweston-based compositors.

Signed-off-by: Pekka Paalanen <pq@iki.fi>

Added a man page for weston-debug client

Signed-off-by: Maniraj Devadoss <Maniraj.Devadoss@in.bosch.com>
[Pekka: fixed 'missing braces aroudn initializer' warning]

Add --list and --all arguments, using interface advertisement.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
2018-09-17 13:29:47 +01:00
Emilio Pozuelo Monfort cce820dcaf simple-dmabuf-drm: fix build with --disable-egl
Just rely on getting the supported formats through the dmabuf
extension.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-07-13 16:13:32 +01:00
Emilio Pozuelo Monfort 1166f8e9a1 simple-dmabuf-drm: require zwp_linux_dmabuf_v1 v3
We effectively require it as we don't react to dmabuf_format,
only to dmabuf_modifiers, so there's a chance we may not get
the supported formats information at all.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-07-13 16:13:23 +01:00
Pekka Paalanen 82dd54d943 desktop-shell: fix output removal for background/panel
When the compositor has multiple outputs (not clones) and one of them is
removed, the ones remaining to the right will be moved to close the gap.
Because reflowing the remaining outputs happens before removing the
wl_output global, we get the new output x,y before the removal. This
causes us to consider the remaining output immediately to the right of
the removed output to be a clone of the removed output whose x,y don't
get updated. That will then hit the two assertions this patch removes.

The reason the assertions were not actually hit is because of a
compositor bug which moved the remaining outputs in the wrong direction.
The next patch will fix the reflow, so we need this patch first to avoid
the asserts.

Remove the assertions and hand over the background and panel if the
"clone" does not already have them. If the clone already has them, we
destroy the unnecessary background and panel.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Marius Vlad <marius-cristian.vlad@nxp.com>
2018-07-05 10:38:25 +03:00
Yong Gan bc04d70336 client: Fix segmentation fault in the case weston-nested
eglTerminate should be called before the display was disconnected.

Signed-off-by: Yong Gan <yong.gan@nxp.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-06-07 18:07:08 +01:00
Daniel Stone 3a80ca0629 simple-dmabuf-drm: Fallback DRM_FORMAT_MOD_LINEAR definition
Just in case we're running on something quite old.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-06-07 08:55:39 +01:00
Louis-Francis Ratté-Boulianne b79dead1dd clients: add a new touchscreen calibrator
The new calibrator uses weston_touch_calibration protocol extension and
provides the following features:

- chooses the physical touch device to be calibrated by DEVPATH or by
  the output/head name; device enumeration provided

- the compositor ensures the calibrator window is shown in the correct
  position and size

- no matter how wrong the old calibration is, the touch events will
  always arrive in the application

- the calibration is complete, not incremental; the received touch
  events are guaranteed to be unmodified

- computes a libinput style calibration matrix directly, not the
  WL_CALIBRATION format

- supports multiple touch devices: calibrate one device at a time, and
  show user feedback on touching a wrong device instead of recording bad
  data

- uses four touch point samples: three to compute the calibration, and
  one to verify the calibration is roughly correct

- consistent exit codes

- upload the new calibration into the server after successful
  and verified calibration

Due to using special touchscreen calibration protocol extension, this
application cannot be tested without touch input from the compositor.

Practically all of the above mentioned are unlike how the old
calibrator client worked.

Co-developed by Louis-Francis and Pekka.

v2:
- improve help() text
- rename wrong_touch_handler() to invalid_touch_handler()
- improve debug prints by adding sample number
- reorganize code into sample funcs vs. touch funcs
- add a state machine to properly process touch and related events

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v1 Tested-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-30 14:46:24 +03:00
Markus Ongyerth 995bf51b2c weston-info: destroy wl_keyboard
Fixes a memory leak by calling wl_keyboard_destroy on any keyboard
that was used to listen for events.

Signed-off-by: Markus Ongyerth <wl@ongy.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 13:34:46 +03:00
Markus Ongyerth ccdc81d609 weston-info: Add support for tablet-unstable-v2
This now prints each tablet seat with at least one tablet/pad/tool
attached.
For each tablet seat, each tablet, pad and tool is printed with as much
detail about the device as the protocol provides.
Seat info is stored to be referenced, because the protocol requires to
request a tablet_seat for each wl_seat and it's not guaranteed that the
tablet_v2_manager is available when seats are advertised.

Signed-off-by: Markus Ongyerth <wl@ongy.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-29 13:33:13 +03:00
Dima Ryazanov e0dc5d47cb Fix a crash when unlocking or unconfining a pointer
In GNOME (but not in Weston), if a window loses focus, the client first receives
the focus event, then the unlock/unconfine event. This causes toytoolkit to
dereference a NULL window when unlocking or unconfining the pointer.

To repro:
- Run weston-confine
- Click the window
- Alt-Tab away from it

Result:

[1606837.869] wl_keyboard@19.modifiers(63944, 524352, 0, 0, 0)
[1606837.926] wl_keyboard@19.leave(63945, wl_surface@15)
[1606837.945] wl_pointer@18.leave(63946, wl_surface@15)
[1606837.956] wl_pointer@18.frame()
[1606837.961] zwp_confined_pointer_v1@26.unconfined()
Segmentation fault (core dumped)

To fix this, get the input from the window instead of the other way around.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-29 13:26:53 +03:00
Guido Günther da1888356e simple-dmabuf-drm: support DRM_FORMAT_LINEAR for NV12 as well
This makes --import-format=NV12 testable on e.g. intel

We only set nv12_format_found to true if we found that format and at
least one understood modifier. Store modifier verbatim instead of using
a boolean flag. Last advertised and supported modifier currently wins.

The NV12 DRM_FORMAT_LINEAR image should be green in the upper left
corner and white in the lower right.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-29 11:43:03 +03:00
Guido Günther 577b346412 simple-dmabuf-drm: don't exit from create_display
Only exit from main so control flow is in one place.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-28 15:54:53 +03:00
Guido Günther f7d035b28c simple-dmabuf-drm: drop superfluous declaration
variable is defined in simple-dmabuf-drm.h

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-28 15:54:53 +03:00
Guido Günther bff906304f simple-dmabuf-drm: support etnaviv drm as well
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-28 15:24:15 +03:00
Guido Günther f9f5953b2d simple-dmabuf-drm: simplify fd_map_bo
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-28 15:24:15 +03:00
Guido Günther 324cdf294d simple-dmabuf-drm: 0 is a valid fd (freedreno)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-05-28 15:24:15 +03:00
Daniel Stone ee96ce2fc2 terminal: Fix unintended fallthrough to cursor restore
ef57a9b788 added support for window operations such as reporting the
title in escape mode. It implemented this by which-window-op case,
inside the existing which-escape-code case. Whilst it would break out of
the former window-op case, it never broke out of the latter escape-code
case. This would lead to window ops (such as reporting title) falling
through to restoring the saved cursor position.

This doesn't seem at all right, and also fixes a warning with GCC 8.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-04-05 10:31:20 -05:00
Guido Günther 3ed7a00008 simple-dmabuf-drm: use appropriately sized buffer (freedreno)
Use stride instead of width for buffer calculation.

[Derek Foreman edited the commit log and removed the leftover
initialization of 'size']

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-03-19 14:26:52 -05:00
Guido Günther dc0e65413e simple-dmabuf-drm: Always define ALIGN
Other backends might want to use it.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2018-03-19 12:20:02 -05:00
Guido Günther 60970ec27c simple-dmabuf-drm: use getopt_long
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-19 12:00:09 +02:00
Guido Günther 2e24198974 simple-dmabuf-drm: use opt bitmask instead of is_immediate
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-19 12:00:09 +02:00
Guido Günther a4e206e170 Allow simple-dmabuf-drm to pass y_inverted flag
This allows to check if ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT is
interpreted correctly by the compositor.

We introduce an OPT_* bitmask to hold this flag and possible future
command line flags.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-19 12:00:09 +02:00
Guido Günther 4fc3a679eb simple-dmabuf-drm: use vfunc for drm_device_destroy
Remove ifdef clutter and makes sure it's only called for the active
backend.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-16 13:39:49 +02:00
Guido Günther 512d29f828 simpla-dmabuf-drm: Use more weston like coding style
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-16 13:39:23 +02:00
Guido Günther 6ed5700da5 simple-dmabuf-drm: allow multiple backends
This allows to enable freedreno and intel backends at the same time
building the prerequisites for adding further ones.

[Pekka: fix configure.ac if statements]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-03-16 13:39:10 +02:00
Pekka Paalanen 64a26bc192 clients: consolidate timer code part 2
Continue moving bits to use toytimer instead of carelessly open-coded
equivalent. Many of the copies were flawed against the race mentioned
in toytimer_fire().

This patch handles window.c's key repeat, confine demo, and
desktop-shell panel clock.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2018-03-12 10:17:22 +02:00
Pekka Paalanen 3f5f3afa81 clients: consolidate timer code part 1
There are multiple copies for the timerfd handling code, and I need a
timer in one more app. Consolidate all the timerfd code into window.c to
reduce the duplication. Many of the copies were also flawed against the
race mentioned in toytimer_fire().

This patch handles clickdot and window.c's tooltip timer and cursor
timer.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2018-03-12 10:17:18 +02:00
Pekka Paalanen c1bcce6a25 clients/desktop-shell: preserve background/panel in clone mode
In shared-CRTC clone mode there are several wl_output globals for one
weston_output. Only one panel and background is needed per
weston_output, so the extra wl_outputs do not get their own panel and
background.

When a head is unplugged, the corresponding wl_output is removed. If
that was the wl_output associated with the background and panel
surfaces, we must transfer the ownership to a remaining wl_output that
was a clone to avoid losing the background and panel completely.

The transfer relies on desktop-shell.so implementation to register
background and panel surfaces with the weston_output, not the
weston_head, so it does not actually matter the wl_output used to bind
the surfaces is going away.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-12 13:14:39 +02:00
Pekka Paalanen 1cbfcf49a7 clients/desktop-shell: avoid invalid sized panel
If for some reason the desktop-shell plugin would configure a panel with
an invalid size, just destroy the whole panel and forget about it for
this wl_output.

A following patch will cause desktop-shell to configure 0x0 panel when
it deems the panel redundant.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-12 13:14:39 +02:00
Pekka Paalanen cb11538049 clients/desktop-shell: avoid invalid sized background
If for some reason the desktop-shell plugin would configure a background
with an invalid size, just destroy the whole background and forget
about it for this wl_output.

A following patch will cause desktop-shell to configure 0x0 background
when it deems the background redundant.

Fortify weston-desktop-shell against not every output having a
background.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-12 13:14:39 +02:00
Aleksander Morgado c34a9f5ca6 screenshot: save screenshot files in XDG_PICTURES_DIR
If XDG_PICTURES_DIR not given, it will use the current directory, as
it was before.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Aleksander Morgado e3c2a76d8f screenshot: save each new screenshot in a different file
Instead of overwriting the 'wayland-screenshot.png' file over and
over, store each requested screenshot in a filename based on timestamp
and sequence number.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-02-09 15:16:07 +00:00
Derek Foreman e277276b85 shared: Update all users of DATADIR
Replace every use of DATADIR to create a filename with a call to the new
function that allows overriding DATADIR with an env var at runtime.

No attention is paid to asprintf failure.

This restores make distcheck to a passing state after commit 6b58ea
began checking cairo surfaces for validity and exchanged undefined
behaviour we shouldn't have been dependent on for consistent test failure.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: split if-branches into two lines]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2018-02-07 11:39:36 +02:00
Emmanuel Gil Peyrot 6b58ea8c43 xwm: Add icon support to the frame
This fetches the _NET_WM_ICON property of the X11 window, and use the
first image found as the frame icon.

This has been tested with various X11 programs, and improves usability
and user-friendliness a bit.

Changes since v1:
- Changed frame_button_create() to use
  frame_button_create_from_surface() internally.
- Removed a check that should never have been commited.

Changes since v2:
- Request UINT32_MAX items instead of 2048, to avoid cutting valid
  icons.
- Strengthen checks against malformed input.
- Handle XCB_PROPERTY_DELETE to remove the icon.
- Schedule a repaint if the icon changed.

Changes since v3:
- Keep the previous Cairo surface until the new one has been
  successfully loaded.
- Use uint32_t for cardinals.  Unsigned is the same type except on
  16-bit machines, but uint32_t is clearer.
- Declare length as uint32_t too, like in xcb_get_property_reply_t.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-01-18 12:24:19 +00:00
Alexandros Frantzis 787fa611de shared: Add timespec_from_proto helper function
Add helper function to convert tv_sec_hi, tv_sec_lo, tv_nsec triplets,
used for sending high-resolution timestamp data over the wayland
protocol, to struct timespec values. Replace existing conversion code
with the helper function.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-12-18 11:27:43 +02:00
Tomohiro Komagata 7861fa9151 clients: simple-egl: Restore window size when un-maximized
The window position was correct but the window size was wrong
when simple-egl returns from maximized window to un-maximized.
Its size should be restored to original size.

Signed-off-by: Tomohiro Komagata <tomohiro.komagata.aj@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:40:31 +00:00
Derek Foreman dc4f9deaee weston-resizor: Don't add new frame callbacks every click
The frame callback added on button click re-adds itself when done,
so adding a new one every click resulted in an ever increasing
number of callbacks.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:21:11 +00:00
Derek Foreman bd9069ffad dnd: Abort with an error message if compositor doesn't support drag and drop
This test isn't particularly useful when the compositor doesn't support
drag and drop - so bail if we fail to create a data source.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:03:29 +00:00
Derek Foreman 11b6242ba9 clients: Don't crash when compositor doesn't support drag and drop
display_create_data_source() can return NULL when there's no data device
manager present.  Instead of carrying on blindly, test its return value.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-04 19:03:22 +00:00
Emmanuel Gil Peyrot 55cdf69b4b weston-info: Add support for zwp_linux_dmabuf_v1
This now prints each (format, modifier) tuple, to show which ones the
compositor sends to its clients.  It is only implemented for version 3+,
since I didn’t have any compositor implementing previous versions, and
the old `format` event is deprecated anyway.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-12-01 17:04:30 +00:00
Joshua Watt 8093fd5db2 clients/editor: Toggle panel visibility on click
If the --click-to-show option is specified, clicking an input field will toggle
the input panel visiblity

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Tested-by: Silvan Jegen <s.jegen@gmail.com>
Reviewed-by: Jan Arne Petersen <janarne@gmail.com>
2017-11-30 16:15:56 +02:00
Matt Hoosier 3052bc7e6d compositor: fix starvation of wl_buffer::release
This change replaces a queued emission of buffer-release events (which
is prone to starvation) with a regular event emission. This means that
client programs no longer need to secretly install surface frame
listeners just to guarantee that they get correctly notified of buffer
lifecycle events.

v2:

More information about the historical reasons why this change hadn't
happened yet, and the consensus to finally move ahead with it can be
found at the discussion terminating in this message:

https://lists.freedesktop.org/archives/wayland-devel/2017-September/035147.html

Signed-off-by: Matt Hoosier <matt.hoosier@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
2017-09-26 11:22:45 -05:00
Fabien Lahoudere e80bdcdad2 calibrator: Make mouse button optional
When calibrating touchscreen with weston-calibrator, you can use the mouse to
click on the cross which is recorded as a touch event. This event is used to
compute the final calibration of the touchscreen which results in invalid
touchscreen calibration and broken touchscreen behaviour.

In order to avoid to use the mouse in weston-calibrator, we disable mouse
operation by default and add a parameter "--enable-mouse" to enable it.

Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-09-18 12:16:49 +03:00
Eric Engestrom c05ee89ab0 clients/nested: fix boolean test
weston_check_egl_extension() returns a bool, not a pointer.

Fixes: ce5b614c80 "clients/nested: use weston_check_egl_extension
                             over strstr"
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-09-18 11:57:27 +03:00
Varad Gautam ee58911912 clients/simple-dmabuf-drm: import with dmabuf modifiers
mesa's freedreno driver supports importing dmabufs with format
DRM_FORMAT_NV12 and DRM_FORMAT_MOD_SAMSUNG_64_32_TILE modifier.
demonstrate weston modifier advertising and import path using this
combination when run with --import-format=NV12.

v2:
 - hard code format if platform doesn't implement
   EGL_EXT_image_dma_buf_import_modifiers and cannot advertise
   format/modifier support.
 - squash using valid frame data to fill dmabuf planes

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-06-12 10:39:01 +01:00
Varad Gautam f7b3a39625 clients/simple-dmabuf-drm: add freedreno support alongside intel
abstract drm specific bits to struct drm_device and support running on
freedreno. introduce 'modifier' event.

v2: rebase to master, deprecate 'format' event.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-06-12 10:38:03 +01:00
Varad Gautam f9dec67990 clients/simple-dmabuf-intel: rename to simple-dmabuf-drm
this will allow adding other drm backends later.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-06-12 10:37:38 +01:00
Varad Gautam 48be0be7a3 clients/simple-dmabuf-intel: request no-roundtrip dmabuf import
request immediate dmabuf import when run with "immed" arg.

Signed-off-by: Varad Gautam <varad.gautam@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-06-12 10:35:39 +01:00
Derek Foreman 6156d675f4 clients: Allow simple-egl to use wl_surface_damage_buffer
wl_surface_damage_buffer landed ages ago, but in order for GL to
use it the client must bind a wl_compositor version >= 4 (the
version where damage_buffer was introduced).

This patch updates the bind version and allows
eglSwapBuffersWithDamage to actually use the provided damage
rectangles instead of performing full surface damage.

This log is much longer than the patch.

Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-05-19 16:43:55 -05:00
Raúl Peñacoba 745e647f18
editor: Add missing free() and display_destroy() in main
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-31 01:36:06 +02:00
Raúl Peñacoba 07a2b99f7f
desktop-shell: Remove unused variable in panel_create
Signed-off-by: Raúl Peñacoba <raul.mikaop.zelda@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-25 17:25:32 +01:00
Derek Foreman 88353ddad7
weston-terminal: Fix race at startup
If anything is printed for the terminal window to display before the
window has been initially sized we end up with a segfault.

This defers the exec() of the shell child process until after the
window is sized so this can't happen anymore.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 22:43:20 +01:00
Derek Foreman 091c801705
desktop-shell: launch clients in their own process group.
Client applications shouldn't be in the same process group as
the display server.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-03-24 21:18:20 +01:00
Derek Foreman 7609178917 weston-terminal: Add a --maximized command line parameter
This is useful for testing compositor response to a client that
requests a maximized initial surface.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-03-17 17:48:49 +00:00
Derek Foreman 300bc6efea simple-dmabuf-v4l: Remove incorrect assert
According to v4l2 documentation, DQBUF always clears FLAG_DONE, so
this assert can be expected to fire 100% of the time.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-03-17 13:53:46 +02:00
Eero Tamminen 8a888a5fe5 clients/simple-egl: add delay option
This emulates extra drawing work by usleep().

This is an enhancement to reproduce the problem in the bug report.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98833
[Pekka: reordered the help text]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-02-28 17:07:08 +02:00
Pekka Paalanen 78dc6a9a02 clients/weston-info: print unknown formats better
Don't just dump the raw 32-bit values, try to interpret it as a DRM
fourcc too.

This prints properly the formats YUYV, NV12 and YU12 supported by
Weston.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-02-28 17:01:55 +02:00
Daniel Stone 4b341a8b33 clients: Fix build without Cairo/GLES2
If we're building with EGL support generally, but without Cairo/GLESv2,
building the clients fail, because window.c defines the EGL native
types, however platform.h also brings these in.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Bryce Harrington <brycef@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
2017-02-21 12:33:04 -08:00
Yong Bakos 53361535be (multiple): Use standard permission notice
A handful of source files were not using the MIT Expat text in
COPYING. Update these files to bring them inline with the rest,
standardizing on the MIT Expat text.

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-02-13 21:45:12 +00:00
Daniel Stone d5fa090904 Revert "clients: teach simple-dmabuf-v4l to deal with flipped input"
This reverts commit 0fee977c46.

This commit introduces a requirement on v4l2_query_ext_ctrl and
VIDIOC_QUERY_EXT_CTRL, which were introduced in kernel 3.17. Some Ubuntu
LTS releases ship with much older kernels (and, significantly, UAPI),
which don't have these.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
2017-02-08 12:02:03 +00:00
Micah Fedke 0fee977c46 clients: teach simple-dmabuf-v4l to deal with flipped input
The v4l2 API can be queried to detect if the input video image is
horizontally or vertically flipped. If the image is y-flipped, we can
set the ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT flag to notify the
compositor.  If the image is h-flipped, we can only print a warning
since linux_buffer_params_v1 does not support horizontal flipping.

Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-02-07 11:47:10 +02:00
Peter Hutterer c8b46459d7 clients: fix errno handling
clients/editor.c: In function ‘read_file’:
clients/editor.c:1578:16: warning: logical ‘or’ applied to non-boolean
constant [-Wlogical-op]
  errno = errsv || EINVAL;

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emilio Pozuelo Monfort <pochu@debian.org>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2017-01-19 10:08:17 +00:00
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