platform/upstream/weston.git
7 years agoivi-shell: add layer_add_surfaces test
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:35 +0000 (15:25 +0000)]
ivi-shell: add layer_add_surfaces test

Test adds 3 surfaces in a layer's render order list.
First, it adds in the order which surfaces are created.
Later, test cleans the render order list, and adds surfaces in reverse
order.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: don't check layer is already on the screen
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:31 +0000 (15:25 +0000)]
ivi-shell: don't check layer is already on the screen

If a layer is removed from a screen's render order list, but the
changes are not commited. Then, the layer could not be added to the
same screen. Because on_screen property of the layer is only changed
in ivi_layout_commit_changes API, when active render order of the screen
is changed.

It is not possible to change the order of layers in a screen without
clearing and commiting the changes before. This patch fixes this issue.

After this patch, the pending render order list of a screen is always
modified regardless of its active render order list.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: don't check view is rendered before adding surface
Ucan, Emre (ADITG/SW1) [Wed, 18 Jan 2017 15:25:28 +0000 (15:25 +0000)]
ivi-shell: don't check view is rendered before adding surface

If a surface is removed from a layer's render order list, but the
changes are not commited. Then, the surface could not be added to the
same layer. Because ivi_view of the surface is still in the render order
list of the layer.

It is not possible to change the order of surfaces in a layer without
clearing and commiting the changes before. This patch fixes this issue.

After this patch, the pending render order list of a layer is always
modified regardless of its active render order list.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agoivi-shell: fix typo in layer_destroy API
Ucan, Emre (ADITG/SW1) [Tue, 17 Jan 2017 12:35:20 +0000 (12:35 +0000)]
ivi-shell: fix typo in layer_destroy API

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-rdp: Fix build with freerdp2, take 2
Daniel Stone [Mon, 23 Jan 2017 15:45:30 +0000 (15:45 +0000)]
compositor-rdp: Fix build with freerdp2, take 2

Hi Pekka,

On 23 January 2017 at 14:15, Pekka Paalanen <ppaalanen@gmail.com> wrote:
> On Fri, 20 Jan 2017 11:31:08 +0100
> Emilio Pozuelo Monfort <pochu@debian.org> wrote:
>> This version works for me...
>
> Hi guys,
>
> I found another guest to the party. Using net-misc/freerdp-2.0.0_pre20160722
> Weston master fails to build with:
>
>
> In file included from /usr/include/freerdp2/freerdp/codecs.h:25:0,
>                  from /usr/include/freerdp2/freerdp/freerdp.h:46,
>                  from /home/pq/git/weston/libweston/compositor-rdp.c:69:
> /home/pq/git/weston/libweston/compositor-rdp.c: In function ‘rdp_peer_context_new’:
> /usr/include/freerdp2/freerdp/codec/color.h:85:72: error: ‘FREERDP_PIXEL_FORMAT_TYPE_BGRA’ undeclared (first use in this function)
> [... snip ...]
>
> However, updating to net-misc/freerdp-2.0.0_pre20161219 allows things
> to build for me again. There is just one warning:

How about this fixup?

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-drm: Restore use-current-mode functionality
Armin Krezović [Sun, 9 Oct 2016 21:48:17 +0000 (23:48 +0200)]
compositor-drm: Restore use-current-mode functionality

It got lost during the porting to the config API.

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoreleasing: Drop extraneous word in docs
Bryce Harrington [Wed, 25 Jan 2017 05:54:41 +0000 (21:54 -0800)]
releasing: Drop extraneous word in docs

7 years agoconfigure.ac: bump to version 1.99.91 for the alpha release
Bryce Harrington [Wed, 25 Jan 2017 02:13:28 +0000 (18:13 -0800)]
configure.ac: bump to version 1.99.91 for the alpha release

7 years agotests: add missing include
Yann E. MORIN [Sun, 22 Jan 2017 13:50:42 +0000 (14:50 +0100)]
tests: add missing include

The int32_t type is defined in stdint.h.

The musl C library is very conservative in the headers that it
internally includes, and stdint.h is not included by any other header,
unlike with glibc or uClibc, which breaks the build.

Add the missing header.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agogitignore: version headers are in libweston/
Pekka Paalanen [Mon, 23 Jan 2017 12:06:49 +0000 (14:06 +0200)]
gitignore: version headers are in libweston/

Switching back and forth to e.g. weston 1.11 branch can leave
these files in src/. Fix the gitignores to not hide them from
git-status.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agocompositor-rdp: Fix build with freerdp2
Emilio Pozuelo Monfort [Fri, 20 Jan 2017 11:53:34 +0000 (11:53 +0000)]
compositor-rdp: Fix build with freerdp2

Based on a patch from John Moser <john.r.moser@gmail.com>

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=850658

Signed-off-by: Emilio Pozuelo Monfort <pochu@debian.org>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoclients: fix errno handling
Peter Hutterer [Wed, 18 Jan 2017 22:21:45 +0000 (08:21 +1000)]
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 411ffabbb56b

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>
7 years agoxwm: explain the read_properties() in xserver_map_shell_surface()
Pekka Paalanen [Wed, 21 Dec 2016 11:41:34 +0000 (13:41 +0200)]
xwm: explain the read_properties() in xserver_map_shell_surface()

To me it was not obvious that this call is necessary, so provide some
rationale.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: schedule repaint from MapRequest
Pekka Paalanen [Tue, 20 Dec 2016 13:31:15 +0000 (15:31 +0200)]
xwm: schedule repaint from MapRequest

When we as the WM tell the X server to map a window, it gets mapped. We
can start drawing into it immediately. There is no reason to wait for
any other events before drawing the decorations.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoRemove dbus-launch from weston.desktop
Ben [Thu, 22 Dec 2016 08:56:29 +0000 (03:56 -0500)]
Remove dbus-launch from weston.desktop

Most display managers handle starting a dbus session daemon for you, so
it does not make sense to start our own. Without this patch, if you run
weston from gdm, programs cannot connect to the dbus session daemon.

Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: debug when weston_surface gets created
Pekka Paalanen [Tue, 20 Dec 2016 14:15:02 +0000 (16:15 +0200)]
xwm: debug when weston_surface gets created

This comes via Wayland, WL_SURFACE_ID comes via X11. They race. Nice to
get both printed.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: split out weston_wm_window_set_pending_state_OR()
Pekka Paalanen [Tue, 20 Dec 2016 12:05:03 +0000 (14:05 +0200)]
xwm: split out weston_wm_window_set_pending_state_OR()

Having it in a separate function makes it more clear what it is, and
allows it to be called from elsewhere.

This really is the set_pending_state() alternative for override-redirect
windows, because OR windows do not get a frame window created. Also OR
windows will never hit the normal set_pending_state() because
weston_wm_window_schedule_repaint() special-cased windows without a
frame window and returned early without scheduling.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: move fini near init in set_pending_state
Pekka Paalanen [Tue, 20 Dec 2016 12:01:42 +0000 (14:01 +0200)]
xwm: move fini near init in set_pending_state

Move the region fini just above the region init. They are a pair and
belong togeether. Split a long line.

Reads better this way. No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: split weston_wm_window_draw_decoration()
Pekka Paalanen [Mon, 19 Dec 2016 15:10:25 +0000 (17:10 +0200)]
xwm: split weston_wm_window_draw_decoration()

Split the function into two:
- weston_wm_window_draw_decoration() that only draws the decorations
with Cairo, and
- weston_wm_window_set_pending_state() which sets up the surface state
to be latches into use on the next commit from Xwayland.

The new weston_wm_window_do_repaint() is the equivalent of the old
weston_wm_window_draw_decorations(), everything still happens the same
way as it was. Just some debug messages have been reworded.

weston_wm_window_read_properties() is moved into
weston_wm_window_do_repaint() because it is not strictly a part of
drawing decorations. The same with resetting repaint_source.

draw_decorations does not need the child position nor xwayland
interface. Also some convenience variables have been eliminated.

set_pending_state code has been un-indented by one level, so the change
is best viewed with whitespace changes ignored.

This patch makes the code more readable, and prepares for calling the
draw_decorations and set_pending_state from different places.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoshell: implement set_xwayland_position
Pekka Paalanen [Wed, 16 Nov 2016 13:17:14 +0000 (15:17 +0200)]
shell: implement set_xwayland_position

Store the initial xwayland position explicitly in struct shell_surface.
New variables are needed, because e.g. saved_x, saved_y are the view
position, and to compute that we need the window geometry, which is not
available before the first commit, so it's not available at
set_xwayland_position() time.

Regression: kcachegrind (Qt 4, X11), the first menu invocation will
slightly misplace the menu if the window has not been manually moved.

Problem: geometry is not taken into account due to a race between XWM
drawing decorations and Xwayland committing the first buffer.

Use the same debugging guard as XWM.

v3: merged with "desktop-shell: debug set_position_from_xwayland"

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwayland: detect initially positioned X11 windows
Pekka Paalanen [Wed, 16 Nov 2016 12:15:18 +0000 (14:15 +0200)]
xwayland: detect initially positioned X11 windows

X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.

During map, detect X11 windows that set an explicit position. This works
by heuristics: if window position is not 0,0 then it is explicitly
positioned. Legacy fullscreen windows are also at 0,0 but these are
detected earlier.

Explicitly store the window position at map request time to detect
client-positioned windows, and use it as the suggested initial position.
weston_wm_window::x and y have been overwritten due to reparenting when
we eventually need the initial position.

This patch requires that the new set_toplevel_with_position() hook is
implemented in the shell.

Note that this patch is about positioning xwayland toplevels, not
override-redirect windows which are already handled.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop: add set_xwayland_position API
Pekka Paalanen [Wed, 16 Nov 2016 12:03:31 +0000 (14:03 +0200)]
libweston-desktop: add set_xwayland_position API

X11 applications expect -geometry command line option to work for
setting the initial window position, but currently this does not work.

Add provision to relay the initial position through libweston-desktop:
- weston_desktop_api gains a new entry set_xwayland_position
- implement set_toplevel_with_position() in xwayland internal interface

Once xwayland plugin starts calling set_toplevel_with_position(),
libweston-desktop can relay that information to a shell if the shell
wants to hear it.

If a shell does not implement the set_xwayland_position hook, the
old behaviour remains: the shell positions xwayland toplevels like any
other.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwayland: add set_toplevel_with_position to internal API
Pekka Paalanen [Wed, 16 Nov 2016 12:12:11 +0000 (14:12 +0200)]
xwayland: add set_toplevel_with_position to internal API

Add a new entry to the internal interface between the xwayland plugin
and libweston-desktop (or any other desktop protocol implementation).
The new entry is identical to set_toplevel except it carries an absolute
position for the toplevel window.

Following patches will implement this new entry in
libweston-desktop and start using it in XWM.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoxwm: fix intermittent half-drawn decorations problem
Pekka Paalanen [Mon, 16 Jan 2017 15:01:11 +0000 (17:01 +0200)]
xwm: fix intermittent half-drawn decorations problem

To reproduce the problem:
- start weston (x11 backend worked, glamor in Xwayland makes no
  difference)
- start xterm
- very very slowly move the pointer in the xterm decorations onto or
  away from a button
- the moment the decorations are updated, they will appear incomplete,
  e.g. completely without buttons and title text
- if you cause just one more pointer motion event, the decorations will
  update to completely drawn appearance

Another way to reproduce the problem is to have an xterm and change its
window title. This is easy if you use a shell prompt that updates the
terminal window title. When the title updates, decorations will be
half-drawn until something happens in XWM.

The fix: flush.

Apparently the drawing commands did not get flushed to the X server
until any other X11 action pushed them through.

xcb_flush() is the real fix here. cairo_surface_flush() is added just
for good measure, because documentation indicates it would be better
used, however it was not strictly necessary to fix the problem in my
experiments.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
Reviewed-by: Emmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>
7 years agoweston: Add a specific option to load XWayland
Quentin Glidic [Mon, 4 Jul 2016 12:34:48 +0000 (14:34 +0200)]
weston: Add a specific option to load XWayland

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston: Make the shell entrypoint specific
Quentin Glidic [Fri, 2 Dec 2016 13:17:08 +0000 (14:17 +0100)]
weston: Make the shell entrypoint specific

This avoids loading a shell as a module, so we are sure to have only one
shell loaded at a time.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston: Properly namespace modules entrypoint
Quentin Glidic [Fri, 2 Dec 2016 13:21:46 +0000 (14:21 +0100)]
weston: Properly namespace modules entrypoint

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Properly namespace modules entrypoint
Quentin Glidic [Fri, 2 Dec 2016 13:20:35 +0000 (14:20 +0100)]
libweston: Properly namespace modules entrypoint

Use different functions so we cannot load a libweston common module in
weston directly or the other way around.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Properly namespace backends entrypoint
Quentin Glidic [Fri, 2 Dec 2016 13:08:44 +0000 (14:08 +0100)]
libweston: Properly namespace backends entrypoint

This prevents loading a backend as a simple module. This will avoid
messing up with backends when we will introduce libweston common
modules.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoMakefile.am: Link modules to libweston.la
Quentin Glidic [Thu, 18 Aug 2016 08:58:58 +0000 (10:58 +0200)]
Makefile.am: Link modules to libweston.la

Modules are using libweston symbols (at least weston_log) and should
explicitly link to it.

This patch also reorders some flags.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-drm: allow mode frequency selection
Fabien Dessenne [Tue, 17 Jan 2017 16:17:21 +0000 (17:17 +0100)]
compositor-drm: allow mode frequency selection

As an option, allow to specify a mode (from the configuration file) by
its refresh rate.
Example of valid syntax:
- "mode=1920x1080"    Select a 1920x1080 mode, refresh rate undefined.
- "mode=1920x1080@60" Select the (or one of the) 1920x1080 60 Hz mode.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston: Position layers in an absolute way
Quentin Glidic [Sat, 17 Dec 2016 12:40:51 +0000 (13:40 +0100)]
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>
7 years agoxwm: delete dead flags from weston_wm_window_draw_decorations()
Pekka Paalanen [Mon, 19 Dec 2016 14:33:40 +0000 (16:33 +0200)]
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>
7 years agoxwm: postpone geometry dirtying from pending.opaque
Pekka Paalanen [Mon, 19 Dec 2016 13:51:12 +0000 (15:51 +0200)]
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>
7 years agoxwm: debug print deleted property name
Pekka Paalanen [Mon, 19 Dec 2016 13:18:45 +0000 (15:18 +0200)]
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>
7 years agoxwm: debug changes to override-redirect flag
Pekka Paalanen [Mon, 19 Dec 2016 13:10:01 +0000 (15:10 +0200)]
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>
7 years agoxwm: move set_title and set_pid
Pekka Paalanen [Thu, 15 Dec 2016 14:04:14 +0000 (16:04 +0200)]
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>
7 years agoxwm: move frame_set_title() into draw_decoration()
Pekka Paalanen [Thu, 15 Dec 2016 13:37:24 +0000 (15:37 +0200)]
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>
7 years agoxwm: clarify props[] in weston_wm_window_read_properties()
Pekka Paalanen [Thu, 1 Dec 2016 15:07:12 +0000 (17:07 +0200)]
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>
7 years agoxwm: detect legacy fullscreen on MapRequest
Pekka Paalanen [Thu, 1 Dec 2016 13:41:11 +0000 (15:41 +0200)]
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>
7 years agolibweston-desktop/xwayland: debug commits
Pekka Paalanen [Mon, 28 Nov 2016 14:37:07 +0000 (16:37 +0200)]
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>
7 years agoxwayland: WM debug prints
Pekka Paalanen [Mon, 28 Nov 2016 14:42:25 +0000 (16:42 +0200)]
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>
7 years agocompositor-wayland: Support building without EGL
Armin Krezović [Fri, 9 Dec 2016 21:58:27 +0000 (22:58 +0100)]
compositor-wayland: Support building without EGL

Signed-off-by: Armin Krezović <krezovic.armin@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agowindow: Check for NULL surface in keyboard_handle_enter
Dima Ryazanov [Wed, 30 Nov 2016 20:10:55 +0000 (12:10 -0800)]
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>
7 years agoeditor: Drop g_type_init() call
Quentin Glidic [Thu, 23 Jun 2016 19:00:31 +0000 (21:00 +0200)]
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>
7 years agoman/weston.ini: Fix panel-position
Quentin Glidic [Wed, 4 Jan 2017 18:15:47 +0000 (19:15 +0100)]
man/weston.ini: Fix panel-position

It was renamed from panel-location in
55d5701ddf018887a30d9ddede38550967da61bc, and gained a few possible
values.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agodesktop-shell: Support panel-position 'none'
Daniel Stone [Mon, 16 Jan 2017 13:18:21 +0000 (13:18 +0000)]
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>
7 years agodesktop-shell: Initialise panel surface listener
Daniel Stone [Mon, 16 Jan 2017 13:22:15 +0000 (13:22 +0000)]
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>
7 years agodesktop-shell: Stop asking for a RGB565 background
Emmanuel Gil Peyrot [Sun, 15 Jan 2017 17:54:56 +0000 (17:54 +0000)]
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>
7 years agocompositor-x11: Remove support for ancient XCB
Daniel Stone [Tue, 29 Nov 2016 12:03:35 +0000 (12:03 +0000)]
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>
7 years agoconfigure: search for lib with clock_getres()
Yann E. MORIN [Mon, 19 Dec 2016 17:20:09 +0000 (18:20 +0100)]
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>
7 years agoautoconf: Fix AC_MSG_RESULT message when disabling features
Emmanuel Gil Peyrot [Sun, 4 Dec 2016 21:34:56 +0000 (21:34 +0000)]
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>
7 years agoxwayland: fix three minor typos
Abdur Rehman [Sun, 1 Jan 2017 14:46:46 +0000 (19:46 +0500)]
xwayland: fix three minor typos

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agowcap: fix a typo in README
Abdur Rehman [Sun, 1 Jan 2017 14:46:45 +0000 (19:46 +0500)]
wcap: fix a typo in README

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agozunitc: fix a typo in a comment
Abdur Rehman [Sun, 1 Jan 2017 14:46:44 +0000 (19:46 +0500)]
zunitc: fix a typo in a comment

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agozunitc: fix a couple of typos
Abdur Rehman [Sun, 1 Jan 2017 14:46:43 +0000 (19:46 +0500)]
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>
7 years agoshared: fix a typo in a comment
Abdur Rehman [Sun, 1 Jan 2017 14:46:42 +0000 (19:46 +0500)]
shared: fix a typo in a comment

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoshared/helpers.h: fix a typo in a comment
Abdur Rehman [Sun, 1 Jan 2017 14:46:41 +0000 (19:46 +0500)]
shared/helpers.h: fix a typo in a comment

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoreleasing: fix a typo
Abdur Rehman [Sun, 1 Jan 2017 14:46:40 +0000 (19:46 +0500)]
releasing: fix a typo

Fix duplicate word "the".

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoprotocol: fix grammar
Abdur Rehman [Sun, 1 Jan 2017 14:46:39 +0000 (19:46 +0500)]
protocol: fix grammar

a icon -> an icon

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agonotes: fix a typo
Abdur Rehman [Sun, 1 Jan 2017 14:46:38 +0000 (19:46 +0500)]
notes: fix a typo

pratically -> practically

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoman: fix grammar
Abdur Rehman [Sun, 1 Jan 2017 14:46:37 +0000 (19:46 +0500)]
man: fix grammar

an user -> a user

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agocompositor: fix a minor typo
Abdur Rehman [Sun, 1 Jan 2017 14:46:36 +0000 (19:46 +0500)]
compositor: fix a minor typo

emited -> emitted

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agocompositor-drm: fix a couple of typos
Abdur Rehman [Sun, 1 Jan 2017 14:46:35 +0000 (19:46 +0500)]
compositor-drm: fix a couple of typos

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoivi-shell: fix minor typos
Abdur Rehman [Sun, 1 Jan 2017 14:46:34 +0000 (19:46 +0500)]
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>
7 years agodesktop-shell: fix a typo
Abdur Rehman [Sun, 1 Jan 2017 14:46:33 +0000 (19:46 +0500)]
desktop-shell: fix a typo

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoconfigure.ac: correct text
Abdur Rehman [Sun, 1 Jan 2017 14:46:32 +0000 (19:46 +0500)]
configure.ac: correct text

Fix duplicate occurrence of "and".

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agoclients: fix a couple of trivial typos
Abdur Rehman [Sun, 1 Jan 2017 14:46:31 +0000 (19:46 +0500)]
clients: fix a couple of trivial typos

Signed-off-by: Abdur Rehman <arehmanq199@gmail.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
7 years agocompositor: Assign new views to the primary plane
Daniel Stone [Fri, 9 Dec 2016 16:27:54 +0000 (16:27 +0000)]
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>

7 years agocompositor-drm: Reshuffle and comment plane conditions
Daniel Stone [Fri, 21 Oct 2016 17:05:37 +0000 (18:05 +0100)]
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

7 years agoRemove DPMS-on when going offscreen
Daniel Stone [Tue, 8 Nov 2016 15:47:09 +0000 (15:47 +0000)]
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>
7 years agocompositor-drm: Remove open-coded weston_compositor_wake
Daniel Stone [Sat, 5 Nov 2016 08:10:13 +0000 (08:10 +0000)]
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>
7 years agocompositor-drm: Delete drm_backend_set_modes
Daniel Stone [Sat, 5 Nov 2016 08:04:07 +0000 (08:04 +0000)]
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>
7 years agocompositor-drm: Store width and height inside drm_fb
Daniel Stone [Mon, 14 Nov 2016 17:45:58 +0000 (17:45 +0000)]
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>
7 years agocompositor-drm: Use signed int for width/height
Daniel Stone [Mon, 14 Nov 2016 17:43:57 +0000 (17:43 +0000)]
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>
7 years agocompositor-drm: Use fb->fd consistently
Daniel Stone [Mon, 30 Nov 2015 16:07:19 +0000 (16:07 +0000)]
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

7 years agocompositor-drm: Extract EGL destroy to helper
Daniel Stone [Fri, 4 Nov 2016 17:24:06 +0000 (17:24 +0000)]
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>
7 years agocompositor-drm: Simplify drm_sprite_crtc_supported
Daniel Stone [Sat, 28 Nov 2015 12:07:36 +0000 (12:07 +0000)]
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

7 years agocompositor-drm: Comment struct members
Daniel Stone [Sat, 28 Nov 2015 12:09:47 +0000 (12:09 +0000)]
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

7 years agolibweston-desktop: don't crash when getting the pid for X clients
Giulio Camuffo [Thu, 8 Dec 2016 08:21:08 +0000 (09:21 +0100)]
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>
7 years agotests: Skip Xwayland test if binary isn't available
Daniel Stone [Tue, 29 Nov 2016 11:05:49 +0000 (11:05 +0000)]
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>
7 years agolibweston: Make module loading safe against long paths
Daniel Stone [Mon, 28 Nov 2016 12:13:54 +0000 (12:13 +0000)]
libweston: Make module loading safe against long paths

Avoid any buffer overflows here by checking we don't go over PATH_MAX
with stupid module names.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agocompositor-wayland: Destroy cursor images earlier
Daniel Stone [Thu, 24 Nov 2016 15:31:33 +0000 (15:31 +0000)]
compositor-wayland: Destroy cursor images earlier

Destroying a wl_cursor will attempt to access the wl_display, which
we have just freed. Avoid a segfault by destroying the cursor images
before we destroy the display.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
7 years agoDon't prepend protocol/ to include paths
Daniel Stone [Thu, 24 Nov 2016 15:30:41 +0000 (15:30 +0000)]
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>
7 years agoeditor: Load a file if specified on command line
Bryce Harrington [Mon, 21 Nov 2016 21:26:23 +0000 (13:26 -0800)]
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>
7 years agoeditor: Use parse_options() from shared for command line options
Bryce Harrington [Mon, 21 Nov 2016 21:26:22 +0000 (13:26 -0800)]
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>
7 years agocompositor-wayland: Set frame callback for Pixman
Daniel Stone [Mon, 28 Nov 2016 16:05:35 +0000 (16:05 +0000)]
compositor-wayland: Set frame callback for Pixman

Fixing 89c2f637b9, also set the output's frame_cb for the Pixman
renderer, not just GL. Fixes a segfault when using compositor-wayland
with --use-pixman.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Dima Ryazanov <dima@gmail.com>
7 years agogl-renderer: Fix an invalid write when closing a Weston window
Dima Ryazanov [Thu, 24 Nov 2016 02:41:00 +0000 (18:41 -0800)]
gl-renderer: Fix an invalid write when closing a Weston window

Call eglMakeCurrent before destroying the native EGL window, similar to what
other sample clients are already doing.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-wayland: Fix a use after free
Dima Ryazanov [Thu, 24 Nov 2016 13:13:12 +0000 (05:13 -0800)]
compositor-wayland: Fix a use after free

When a window is being closed, the frame_done callback often runs after
the output is already destroyed, i.e:

  wayland_output_start_repaint_loop
  input_handle_button
    wayland_output_destroy
  frame_done

To fix this, destroy the callback before destroying the output.

(Also, fix the type of output in frame_done: it's passed in
a wayland_output, not a weston_output.)

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xwayland: add is_mapped handling for XWAYLAND
Pekka Paalanen [Tue, 15 Nov 2016 12:24:21 +0000 (14:24 +0200)]
libweston-desktop/xwayland: add is_mapped handling for XWAYLAND

The xwayland window type XWAYLAND is not handled by the shell at all,
instead libweston-desktop maps such surfaces itself. However, it forgot
to set weston_surface::is_mapped and weston_view::is_mapped.

weston_surface::is_mapped affects the behaviour of weston_view_unmap()
and weston_surface_attach().

weston_view::is_mapped affects the behaviour of weston_view_unmap() and
weston_view_destroy().

When manually mapping a window of type XWAYLAND, mark both the view and
surface as mapped. This follows the expections in libweston, even though
the meaning of is_mapped is not clearly defined for either surface or
view.

Also, when the XWAYLAND window is manually unmapped, unmap the
weston_surface. This updates weston_surface::is_mapped to reflect the
state. However, as a side-effect it will also unmap all sibling views,
should any exist.

v2: rename surface_base to wsurface
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Acked-by: Daniel Stone <daniels@collabora.com>
7 years agolibweston-desktop/xwayland: XWAYLAND surfaces are never 'added'
Pekka Paalanen [Tue, 15 Nov 2016 10:22:09 +0000 (12:22 +0200)]
libweston-desktop/xwayland: XWAYLAND surfaces are never 'added'

Add documentation (asserts) that show that windows of types XWAYLAND are
never registered with the shell.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston-desktop/xwayland: clarify 'added' logic
Pekka Paalanen [Tue, 15 Nov 2016 09:48:42 +0000 (11:48 +0200)]
libweston-desktop/xwayland: clarify 'added' logic

Setting to a constant is much easier to read and grep for than setting to
a computed variable.

There are no functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
7 years agolibweston-desktop/xwayland: window type XWAYLAND cannot have a parent
Pekka Paalanen [Tue, 15 Nov 2016 09:43:36 +0000 (11:43 +0200)]
libweston-desktop/xwayland: window type XWAYLAND cannot have a parent

Add an assert to ensure that a window of type XWAYLAND is never
attempted with a parent. Following the code though, the assert can be
made even stricter by allowing only TRANSIENT to have a parent.

This is essentially adding documentation.

v2: use stricter assert
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoXWM: debug position and size on map request
Pekka Paalanen [Mon, 14 Nov 2016 13:38:43 +0000 (15:38 +0200)]
XWM: debug position and size on map request

Helps debugging initial placement problems.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoXWM: debug position on create_notify
Pekka Paalanen [Mon, 14 Nov 2016 12:30:57 +0000 (14:30 +0200)]
XWM: debug position on create_notify

Helps debugging X11 window positioning issues.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agocompositor-x11: fix segfault when use_pixman is true
Ryo Munakata [Thu, 24 Nov 2016 10:05:07 +0000 (19:05 +0900)]
compositor-x11: fix segfault when use_pixman is true

Signed-off-by: Ryo Munakata <ryomnktml@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoDon't include version.h from compositor.h
Daniel Stone [Wed, 23 Nov 2016 18:48:23 +0000 (18:48 +0000)]
Don't include version.h from compositor.h

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewd-by: Bryce Harrington <bryce@osg.samsung.com>
7 years agotests: Extend subsurface place_{above,below} hierarchy
Daniel Stone [Tue, 22 Nov 2016 12:40:34 +0000 (12:40 +0000)]
tests: Extend subsurface place_{above,below} hierarchy

Following on from b8c16c995b, extend the family tree being tested by
place_above and place_below a little, ensuring that subsurfaces can't be
placed above or below surfaces which are related to them, but aren't
their immediate parent or sibling.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
7 years agobuild: fix wayland-backend distcheck
Pekka Paalanen [Wed, 23 Nov 2016 09:46:57 +0000 (11:46 +0200)]
build: fix wayland-backend distcheck

Fix the following error from 'make distcheck':

  CC       libweston/wayland_backend_la-compositor-wayland.lo
../../libweston/compositor-wayland.c:54:51: fatal error: xdg-shell-unstable-v6-client-protocol.h: No such file or directory
 #include "xdg-shell-unstable-v6-client-protocol.h"

Files generated with the scanner belong in nodist_*_SOURCES, not with
the regular sources.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoweston-terminal: Fix crash on first keystroke
Derek Foreman [Tue, 22 Nov 2016 19:00:38 +0000 (13:00 -0600)]
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>