Commit graph

5662 commits

Author SHA1 Message Date
Quentin Glidic 82681571cf libweston: Position layers in an absolute way
Currently, layers’ order depends on the module loading order and it does
not survive runtime modifications (like shell locking/unlocking).
With this patch, modules can safely add their own layer at the expected
position in the stack, with runtime persistence.

v4 Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
[Pekka: fix three whitespace issues]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2017-01-17 16:50:18 +02:00
Pekka Paalanen 39d7e99a46 xwm: delete dead flags from weston_wm_window_draw_decorations()
Obviously unused. Looks like weston_wm_window_activate() is doing that
job.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 474dbcaf8f xwm: postpone geometry dirtying from pending.opaque
Changing the opaque region has no immediate effect, therefore there is
no need to mark the view geometry dirty.

The view geometry will be invalidated automatically by the next commit
from Xwayland, in weston_surface_commit_state(). The dirtying did not
apply pending state.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 8cc153b350 xwm: debug print deleted property name
Use wm_log_continue() to avoid printing the timestamp in the middle of a
message.

Print the name of the property that got deleted.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 73428a8be2 xwm: debug changes to override-redirect flag
For every event we handle and that delivers the override-redirect flag,
print it to debug log.

Add a comment to one code path explaining when it gets hit, because it
is unobvious. It also serves as a reminder that we do not handle changes
to the OR flag after Window creation.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen c9ca2c0262 xwm: move set_title and set_pid
Move the calls to set_title() and set_pid() out of
weston_wm_window_read_properties() and into the three callers, each
slightly different.

xserver_map_shell_surface(): already calls these functions after
creating the shell surface, so no need to add calls.

weston_wm_handle_map_request(): can be called only on unmapped (in X11)
Windows, so no need to add calls.

weston_wm_window_draw_decoration(): window->shsurf and window->surface
are either both set or both NULL, so the check for window->shsurf is
removed when moving the set_title() and set_pid() calls under a
window->surface check.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 9a330e1abb xwm: move frame_set_title() into draw_decoration()
The only thing using the frame title is frame_repaint(). Move the call
to frame_set_title() from weston_wm_window_read_properties() into
weston_wm_window_draw_decoration() where the only call to
frame_repaint() is.

Do not check for window->name == NULL, because frame_set_title() handles
NULL just fine. Also, once window->name becomes set, it cannot become
NULL again unless strndup() fails. The name string can be reset to
the empty string in any case.

This change is prompted by future refactoring where at
weston_wm_window_read_properties() time the frame might not have been
created yet.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 20111d5d53 xwm: clarify props[] in weston_wm_window_read_properties()
The props array contained offsets to struct members. It is convenient
for writing static const arrays as you only store a constant offset and
compute the pointer later. However, the array was not static to begin
with, the atoms are not build time constants. We can as well just store
the pointer directly in the array.

Entries that did not use the offset had bogus offsets, producing
pointers to arbitrary fields. They are changed to have a NULL pointer.
If the code unintentionally used the pointer, it will now explode rather
than corrupt memory.

Also explain the use of the #defined constants and #undef them when they
get out of scope. This clearly documents that they are just a convenient
hack to avoid lots of special cases in the function.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 505237e9f8 xwm: detect legacy fullscreen on MapRequest
The legacy fullscreen state needs to be detected at MapRequest time,
because that is when the X11 client has alredy set up the initial window
state.

Doing it at xserver_map_shell_surface() meant that it would be done as a
response to Xwayland creating the wl_surface and XWM receiving the
WL_SURFACE_ID ClientMessage, whichever came later. At that point the X11
client might still be setting things up in theory, though in practice
most of the X11 communication has already happened when
xserver_map_shell_surface() gets called.

The real reason for this is to clean up xserver_map_shell_surface() from
everything that would affect drawing the decorations. This patch is one
part of that clean-up.

The weston_output_weak_ref logic is not put into compositor.h, because
there are no other users for it at this time. We need to protect against
the output going away.

A side-effect of this patch is that saved_width and saved_height will
now get overwritten also for legacy fullscreen windows. Previously, they
were left to zero as far as I could tell.

NOTE: This stops override-redirect legacy fullscreen windows from being
detected as fullscreen. MapRequest processing does not happen for OR
windows. These windows get detected as type XWAYLAND instead.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen 0adb6a7ac5 libweston-desktop/xwayland: debug commits
Helps tracking what happens with XWM.

Use the same debugging guard as XWM.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Pekka Paalanen a04eacc488 xwayland: WM debug prints
Add WM debug prints on map, decoration drawing and geometry setting.
These help see the sequence and timing of operations, when debugging
Xwayland window management glitches.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-17 16:35:35 +02:00
Armin Krezović b08e1a5c12 compositor-wayland: Support building without EGL
Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-17 12:54:03 +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
Quentin Glidic 46ffea638d man/weston.ini: Fix panel-position
It was renamed from panel-location in
55d5701ddf, and gained a few possible
values.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-16 15:13:48 +00: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
Daniel Stone 8de91494b3 desktop-shell: Initialise panel surface listener
The desktop-shell output destroy code assumes that we always set up a
panel listener. Initialise its list explicitly, so if we don't have a
panel, then we can still unconditionally destroy the listener on output
destroy.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-16 15:13:39 +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
Daniel Stone f86e67d01f compositor-x11: Remove support for ancient XCB
We had two non-pkg-config check paths in the configure script, to
support XCB functionality used before XCB had had an accompanying
release: xcb_poll_for_queued_event (released in 1.8, 2012), and a
usable XKB event mechanism (released in 1.9, 2013).

Convert the former to a version-based hard dependency, and the latter to
a version-based soft dependency. This avoids two compiler checks.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-16 12:36:06 +00:00
Yann E. MORIN b51e6ed710
configure: search for lib with clock_getres()
Like clock_gettime(), clock_getres() is in -lrt for glibc < 2.17.
Add a check for it, like is done for clock_gettime().

Fixes:
    http://autobuild.buildroot.net/results/bce/bcecdbbce4a99eb1e9bfbf519857bf94d8952037/

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2017-01-15 13:51:13 +01:00
Emmanuel Gil Peyrot 226408d2f4 autoconf: Fix AC_MSG_RESULT message when disabling features
Some variables were previously only set inside conditions, making their
output empty.

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2017-01-03 16:13:30 +00:00
Abdur Rehman b8b150bf6f xwayland: fix three minor typos
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:19 +00:00
Abdur Rehman 1580e70d7a wcap: fix a typo in README
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:17 +00:00
Abdur Rehman 3caed395ec zunitc: fix a typo in a comment
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:15 +00:00
Abdur Rehman 6f7f9468f1 zunitc: fix a couple of typos
- even -> event
- attatch -> attach

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:12 +00:00
Abdur Rehman b5f838d90f shared: fix a typo in a comment
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:09 +00:00
Abdur Rehman 5735eedb43 shared/helpers.h: fix a typo in a comment
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:08 +00:00
Abdur Rehman eedf49f594 releasing: fix a typo
Fix duplicate word "the".

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:05 +00:00
Abdur Rehman b7ccfe5ddd protocol: fix grammar
a icon -> an icon

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:03 +00:00
Abdur Rehman 9b5126c89e notes: fix a typo
pratically -> practically

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:59:01 +00:00
Abdur Rehman 999bc4e108 man: fix grammar
an user -> a user

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:59 +00:00
Abdur Rehman bc46292caa compositor: fix a minor typo
emited -> emitted

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:57 +00:00
Abdur Rehman 4dca0e1717 compositor-drm: fix a couple of typos
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:55 +00:00
Abdur Rehman b833d742c7 ivi-shell: fix minor typos
- ivi-shell/hmi-controller.c:41: a to an
- ivi-shell/hmi-controller.c:1296: Duplicated 'a'
- ivi-shell/ivi-layout-export.h:28: An to A

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:52 +00:00
Abdur Rehman 7f1da1f524 desktop-shell: fix a typo
Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:49 +00:00
Abdur Rehman 7631f38f13 configure.ac: correct text
Fix duplicate occurrence of "and".

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2017-01-03 11:58:47 +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 fb4869d628 compositor: Assign new views to the primary plane
When we create a new view, assign it to the primary plane from the
beginning.

Currently, every view across the compositor will be assigned to a plane
during every repaint cycle of every output: the DRM renderer's
assign_planes hook will either move a view to a drm_plane, or to the
primary plane if a suitable drm_plane could not be found for the output
it is on. There are no other assign_planes implementation, and the
fallback when none is provided, is to assign every view to the primary
plane.

DRM's behaviour is undesirable in multi-output situations, since it
means that views which were on a plane on one output will be demoted to
the primary plane; doing this causes damage, which will cause a spurious
repaint for the output. This spurious repaint will have no effect on the
other output, but it will do the same demotion of views to the primary
plane, which will again provoke a repaint on the other output.

With a simple fix for this behaviour (i.e. not moving views which are
only visible on other outputs), the following behaviour is observed:
  - outputs A and B are present
  - views A and B are created for those outputs respectively, with SHM
    buffers attached; view->plane == NULL for both
  - current buffer content for views A and B are uploaded to the
    renderer
  - output A runs its repaint cycle, and sets keep_buffer to false on
    surface B's output, as it can never be promoted to a plane; it does
    not move view B to another plane
  - output B runs its repaint cycle, and moves view B to the primary
    plane
  - weston_view_assign_to_plane has work to do (as the plane is changing
    from NULL to the primary plane), calls weston_surface_damage and
    calls weston_surface_damage
  - weston_surface_damage re-uploads buffer content, possibly from
    nowhere at all; e508ce6a notes that this behaviour is broken

Assigning views to the primary plane when created makes it possible to
fix the DRM assign_planes implementation: assign_planes will always set
keep_buffer to true if there is any chance the buffer can ever be
promoted to a plane, regardless of view configruation. If the buffer
cannot be promoted to a plane, it must by definition never migrate from
the primary plane. This means that there is no opportunity to hit the
same issue, where the buffer content has already been discarded, but
weston_view_assign_to_plane is not a no-op.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2016-12-16 12:43:07 +00:00
Daniel Stone 296d7a92ad compositor-drm: Reshuffle and comment plane conditions
Try to harmonise the various plane-import paths a little bit, starting
with reshuffling and commenting the conditions to do so.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>

Differential Revision: https://phabricator.freedesktop.org/D1413
2016-12-12 20:49:29 +00:00
Daniel Stone 893b936f9a Remove DPMS-on when going offscreen
Forcing DPMS on when we lose our session may force an expensive modeset
operation, which is pointless if the next consumer (another compositor,
or the console) is going to do a modeset. These should force DPMS on
regardless.

This actively causes problems for the DRM backend, in that it may
actually require a repaint to set coherent state for DPMS off -> DPMS on
transitions, which is very much not what we want when going offscreen.

As DRM is the only backend which actually implements DPMS, just remove
this call.

Differential Revision: https://phabricator.freedesktop.org/D1483

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-12-12 20:49:12 +00:00
Daniel Stone f33e104865 compositor-drm: Remove open-coded weston_compositor_wake
This always changes the state to ACTIVE when we enter the session,
whereas the previous implementation preserved the state (i.e. if state
was SLEEPING on exit, it would be restored to SLEEPING, but also with a
repaint). This seems more helpful behaviour, however: if you enter a
session, it's probably in order to interact with it.

Differential Revision: https://phabricator.freedesktop.org/D1482

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-12-12 17:18:08 +00:00
Daniel Stone 47224cc931 compositor-drm: Delete drm_backend_set_modes
Even if we do have a framebuffer matching the mode, we immediately
schedule a repaint, meaning we either do work for no reason, or show
stale content before we bring up the new content.

Delete this and just let repaint deal with it.

Differential Revision: https://phabricator.freedesktop.org/D1481

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-12-12 17:15:08 +00:00
Daniel Stone c8c917cb61 compositor-drm: Store width and height inside drm_fb
This will be used so we can later determine the compatibility of drm_fbs
without needing to introspect external state.

Differential Revision: https://phabricator.freedesktop.org/D1487

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-12-12 17:15:08 +00:00
Daniel Stone f214fdca5a compositor-drm: Use signed int for width/height
This makes it sign-compatible with weston_output->{width,height}.

Differential Revision: https://phabricator.freedesktop.org/D1486

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-12-12 17:15:08 +00:00
Daniel Stone 4e5eceb075 compositor-drm: Use fb->fd consistently
Everyone else uses fb->fd rather than pulling the FD back out of GBM.
Use that in the destroy callback too.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>

Differential Revision: https://phabricator.freedesktop.org/D1406
2016-12-12 17:15:08 +00:00
Daniel Stone 3e661f7b6c compositor-drm: Extract EGL destroy to helper
No functional change.

Differential Revision: https://phabricator.freedesktop.org/D1484

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
2016-12-12 17:15:08 +00:00
Daniel Stone a3ae4767ad compositor-drm: Simplify drm_sprite_crtc_supported
No need to walk the CRTC list every time looking for CRTC indices, when we
already have the CRTC index stashed away. Taking the plane as an argument
also simplifies things a little for callers, and future-proofs for a
potential future KMS API which passes a list of supported CRTC IDs rather
than a bitmask of supported CRTC indices.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>

Differential Revision: https://phabricator.freedesktop.org/D1407
2016-12-12 17:15:08 +00:00
Daniel Stone 17339233a0 compositor-drm: Comment struct members
Clarify the difference between crtc_id (DRM object) and pipe (index into
drmModeRes->crtcs array, possible_crtcs bitmask).

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1405
2016-12-12 16:52:22 +00:00
Giulio Camuffo f15320faee
libweston-desktop: don't crash when getting the pid for X clients
X client's don't have a wl_client associated with their
weston_desktop_client, so make sure to not use it.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2016-12-08 11:58:18 +01:00
Daniel Stone 2295a62788 tests: Skip Xwayland test if binary isn't available
We know we're not going to succeed if the binary isn't installed, so
skip the test in that case.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-30 10:28:04 +00:00