platform/upstream/weston.git
10 years agodesktop-shell: fix invalid memory access when shell execution fails
Arnaud Vrac [Mon, 25 Aug 2014 18:56:46 +0000 (20:56 +0200)]
desktop-shell: fix invalid memory access when shell execution fails

In this case wl_client_add_destroy_listener() was called with a NULL
client, which is invalid.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agonested: add missing egl extension declaration
Arnaud Vrac [Mon, 25 Aug 2014 18:56:45 +0000 (20:56 +0200)]
nested: add missing egl extension declaration

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agowindow: unbind egl surface and context on surface release
Arnaud Vrac [Mon, 25 Aug 2014 18:56:43 +0000 (20:56 +0200)]
window: unbind egl surface and context on surface release

Binding null read and write surfaces to an egl context is not standard

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoDocument output/scale configuration option in the weston.ini man page.
Magnus Hoff [Mon, 25 Aug 2014 11:22:11 +0000 (13:22 +0200)]
Document output/scale configuration option in the weston.ini man page.

v2: Different, hopefully better, wording. This patch entirely replaces
the previous similar patch I sent.

v3: Now including the correct patch. Please disregard the "v2" mail.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agodesktop-shell: Replace magic constants with named ones
Ondřej Majerech [Thu, 21 Aug 2014 13:47:22 +0000 (15:47 +0200)]
desktop-shell: Replace magic constants with named ones

Signed-off-by: Ondřej Majerech <majerech.o@gmail.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
10 years agoprotocol: fix a wrong word in wl_viewport.set_source
Pekka Paalanen [Wed, 27 Aug 2014 12:46:22 +0000 (15:46 +0300)]
protocol: fix a wrong word in wl_viewport.set_source

Obvious this affects the source, not destination.

Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoxwayland: Clean up the WM properly if X server crashes
Dima Ryazanov [Thu, 19 Jun 2014 08:03:31 +0000 (01:03 -0700)]
xwayland: Clean up the WM properly if X server crashes

The X cleanup code uses wxs->wm to check if the WM has been created - but that
variable was never initialized. So if X crashes, the WM doesn't get destroyed,
causing a crash when it tries to repaint a window.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoconfigure.ac: require libwayland 1.5.91
Pekka Paalanen [Tue, 26 Aug 2014 10:26:13 +0000 (13:26 +0300)]
configure.ac: require libwayland 1.5.91

Compositor needs the wl_surface error enums and the keyboard repeat info
protocol added in 1.5.91.

weston-info, window.c, and Weston's wayland backend need also the
keyboard repeat info.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoconfigure.ac: Bump version to 1.5.91 for the alpha release 1.5.91
Pekka Paalanen [Fri, 22 Aug 2014 15:09:54 +0000 (18:09 +0300)]
configure.ac: Bump version to 1.5.91 for the alpha release

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agotests: allow running make check without make install
Derek Foreman [Thu, 21 Aug 2014 16:32:38 +0000 (11:32 -0500)]
tests: allow running make check without make install

desktop shell and weston keyboard both refer to themselves prefixed by
LIBEXECDIR, however this is only valid once installed.  make check will
currently either fail or run pre-existing versions.

This patch adds a way to override that location by setting the env var
WESTON_BUILD_DIR - which is then set by the test env script so make check
will test the versions in the build directory regardless of whether they're
installed or not.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agobuild: do not run xwayland test for distcheck
Pekka Paalanen [Wed, 20 Aug 2014 09:11:04 +0000 (12:11 +0300)]
build: do not run xwayland test for distcheck

The Xwayland test has been broken ever since the migration to the
stand-alone Xwayland server binary.

Disable the test, so 'make distcheck' can actually run.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Boyan Ding <stu_dby@126.com>
10 years agobuild: use AM_DISTCHECK_CONFIGURE_FLAGS
Pekka Paalanen [Wed, 20 Aug 2014 09:08:37 +0000 (12:08 +0300)]
build: use AM_DISTCHECK_CONFIGURE_FLAGS

According to
http://www.gnu.org/software/automake/manual/html_node/Checking-the-Distribution.html
the DISTCHECK_CONFIGURE_FLAGS is for the user, while
AM_DISTCHECK_CONFIGURE_FLAGS is the one to use in Makefile.am.

Make it so.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Boyan Ding <stu_dby@126.com>
Reviewed-by: Marek Chalupa <mchqwerty@gmail.com>
10 years agoxdg-shell: bump experimental protocol version
Pekka Paalanen [Thu, 21 Aug 2014 14:47:20 +0000 (17:47 +0300)]
xdg-shell: bump experimental protocol version

The experimental versioning has not been updated when it was supposed
to. Let's try to be better at it now, as xdg-shell is close to have its
first stable version.

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

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

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

Cc: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoweston-test: check if resource is not NULL
Marek Chalupa [Fri, 11 Jul 2014 10:33:02 +0000 (12:33 +0200)]
weston-test: check if resource is not NULL

and post client_no_memory if is...

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoscreen-share: Add screen-share command to weston.ini man page
Andrew Wedgbury [Thu, 26 Jun 2014 15:31:43 +0000 (16:31 +0100)]
screen-share: Add screen-share command to weston.ini man page

This adds a description of the screen-share command configuration key to the
weston.ini man page.

[Pekka Paalanen: removed the sentence about default value, because the
default value is empty, and AFAIU cannot work.]

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agodesktop-shell: use panel location to calculate correct sizes and ranges
Jonny Lamb [Wed, 20 Aug 2014 13:53:20 +0000 (15:53 +0200)]
desktop-shell: use panel location to calculate correct sizes and ranges

Now the client can let us know where the panel is using
desktop_shell.set_panel_position, we can correctly calculate where to
put new views and how big maximized views should be.

Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agodesktop-shell: add set_panel_position to help place views onscreen
Jonny Lamb [Wed, 20 Aug 2014 13:53:19 +0000 (15:53 +0200)]
desktop-shell: add set_panel_position to help place views onscreen

Panels are always assumed to be on the top edge of the output. If this
is not the case views will be placed under the panel, wherever it is,
and maximize doesn't use the correct space allocated for views.

By telling the server on which edge the panel is located, it can
correctly calculate where to put new views and how big maximized views
should be.

[Pekka Paalanen: the user of this protocol so far is Maynard.]

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoweston.ini.man: Add libinput section
Jonas Ådahl [Tue, 19 Aug 2014 19:56:12 +0000 (21:56 +0200)]
weston.ini.man: Add libinput section

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agobuild: cliptest uses also vertex-clipping.h
Pekka Paalanen [Wed, 20 Aug 2014 08:58:47 +0000 (11:58 +0300)]
build: cliptest uses also vertex-clipping.h

Add it to the list of source files.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agocliptest: sync calculate_edges with master copy
Pekka Paalanen [Wed, 20 Aug 2014 07:35:26 +0000 (10:35 +0300)]
cliptest: sync calculate_edges with master copy

The master copy of calculate_edges() lives nowadays in gl-renderer.c.
Copy it verbatim from gl-renderer.c into cliptest.c.

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

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoDon't underrun the vertex array of empty polygons
Ondřej Majerech [Tue, 19 Aug 2014 13:59:45 +0000 (15:59 +0200)]
Don't underrun the vertex array of empty polygons

This silences the following warning:
  src/vertex-clipping.c:196:22: warning: array subscript is below array
  bounds [-Warray-bounds]
    ctx->prev.x = src->x[src->n - 1];

[Pekka Paalanen: the src->n < 2 comparison comes from the fact that a
polygon with 0 or 1 points is not a polygon. A polygon with 2 points is
still degenerate, but at least it has two edges that can be clipped.]

Signed-off-by: Ondřej Majerech <oxyd.oxyd@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoRemove duplicated code from cliptest.c
Ondřej Majerech [Tue, 19 Aug 2014 13:59:44 +0000 (15:59 +0200)]
Remove duplicated code from cliptest.c

Signed-off-by: Ondřej Majerech <oxyd.oxyd@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoDon't protect xkb_*_unref from NULL
Ran Benita [Tue, 19 Aug 2014 20:59:52 +0000 (23:59 +0300)]
Don't protect xkb_*_unref from NULL

Since xkbcommon-0.3.0, which is required by weston, a NULL argument
doesn't do anything.

Signed-off-by: Ran Benita <ran234@gmail.com>
10 years agoReplace deprecated xkbcommon symbols with current names
Ran Benita [Tue, 19 Aug 2014 20:59:51 +0000 (23:59 +0300)]
Replace deprecated xkbcommon symbols with current names

These symbols (xkb_map_* and others) were replaced in xkbcommon with more
consistent names. See the header xkbcommon/xkbcommon-compat.h for how
the old names map to the new.

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

Signed-off-by: Ran Benita <ran234@gmail.com>
10 years agoconfigure.ac: use libinput by default
Pekka Paalanen [Tue, 19 Aug 2014 10:09:00 +0000 (13:09 +0300)]
configure.ac: use libinput by default

Libinput is stabilizing soon, so let's flip the default switch now. The
old input code will still be carried as an option for a while.

Cc: Peter Hutterer <peter.hutterer@who-t.net>
Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
10 years agocairo-util: Draw solid titlebar for frames with only buttons
Boyan Ding [Tue, 5 Aug 2014 07:22:04 +0000 (15:22 +0800)]
cairo-util: Draw solid titlebar for frames with only buttons

Previously geometry was changed to leave space for titlebar if a frame
has only buttons but no title. This patch fixes theme_render_frame to
avoid transparent titlebar.

Signed-off-by: Boyan Ding <stu_dby@126.com>
10 years agoxwm: check whether the picked seat can be NULL
Boyan Ding [Sun, 6 Jul 2014 03:44:58 +0000 (11:44 +0800)]
xwm: check whether the picked seat can be NULL

The seat picked in weston_wm_window_handle_moveresize can sometimes
be NULL when it is (somehow) triggered with all buttons released.

This patch checks whether the seat is NULL to avoid NULL dereference.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80837
Signed-off-by: Boyan Ding <stu_dby@126.com>
10 years agocliptest: Avoid use of uninitialized memory when regions don't intersect
Derek Foreman [Mon, 18 Aug 2014 21:13:41 +0000 (16:13 -0500)]
cliptest: Avoid use of uninitialized memory when regions don't intersect

Prevent attempting to draw the intersection polygon when it contains no
vertices.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoweston-scaler --help works even if not run inside wayland
Bill Spitzak [Fri, 8 Aug 2014 20:00:00 +0000 (13:00 -0700)]
weston-scaler --help works even if not run inside wayland

10 years agoweston-image --help works. Also help if no filename is given
Bill Spitzak [Fri, 8 Aug 2014 19:59:59 +0000 (12:59 -0700)]
weston-image --help works. Also help if no filename is given

10 years agoweston-editor --help works
Bill Spitzak [Fri, 8 Aug 2014 19:59:58 +0000 (12:59 -0700)]
weston-editor --help works

10 years agoweston-dnd --help works
Bill Spitzak [Fri, 8 Aug 2014 19:59:57 +0000 (12:59 -0700)]
weston-dnd --help works

10 years agoweston-cliptest --help works. You must use -b to run benchmark
Bill Spitzak [Fri, 8 Aug 2014 19:59:56 +0000 (12:59 -0700)]
weston-cliptest --help works. You must use -b to run benchmark

10 years agoweston-terminal --help and other command-line options
Bill Spitzak [Fri, 8 Aug 2014 19:59:55 +0000 (12:59 -0700)]
weston-terminal --help and other command-line options

Option array existed but was unused. Added --font-size.

10 years agoMade weston-screensaver --help work
Bill Spitzak [Fri, 8 Aug 2014 19:59:54 +0000 (12:59 -0700)]
Made weston-screensaver --help work

10 years agoMade weston-subsurfaces --help work
Bill Spitzak [Fri, 8 Aug 2014 19:59:53 +0000 (12:59 -0700)]
Made weston-subsurfaces --help work

10 years agoMade weston-nested --help work
Bill Spitzak [Fri, 8 Aug 2014 19:59:52 +0000 (12:59 -0700)]
Made weston-nested --help work

10 years agoweston-eventdemo --help works
Bill Spitzak [Fri, 8 Aug 2014 19:59:51 +0000 (12:59 -0700)]
weston-eventdemo --help works

Also defaults to printing all events if you specify none.
Removed incorrect "-0" switch which would turn on one of them.

10 years agoshell: Update focused surface pointer coordinates in popup grab
Jonas Ådahl [Mon, 11 Aug 2014 20:44:02 +0000 (22:44 +0200)]
shell: Update focused surface pointer coordinates in popup grab

The commit 'input: Send leave and enter pair when the surface moves
under the cursor' introduced focused surface local pointer coordinates
to keep track of if a surface had been moved or transformed in a way
that the pointer posititon relative to that surface would change.
Update these coordinates also for the popup grab as otherwise every
pointer motion during a popup grab results in leave and then enter
events.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agogears: fix invalid calculation of the first FPS
Ryo Munakata [Sun, 10 Aug 2014 14:47:45 +0000 (23:47 +0900)]
gears: fix invalid calculation of the first FPS

At the calculation of the first FPS, gears has initialized last
FPS time with gettimeofday().
But the callback_data passed in the callback of wl_surface_frame()
is the current time, in milliseconds, with an undefined base.
Because of this subtracting last FPS time from callback_data makes no sense.
 For example, below is the result of running weston-gears on weston with
drm backend:

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

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

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

Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
10 years agodesktop-shell: add close-animation config option for destroying surfaces
Jonny Lamb [Tue, 12 Aug 2014 13:13:30 +0000 (15:13 +0200)]
desktop-shell: add close-animation config option for destroying surfaces

At the moment when surfaces are destroyed they are faded out but let's
make it configurable!

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agodesktop-shell: add option to avoid creating the panel
Jonny Lamb [Tue, 12 Aug 2014 13:07:51 +0000 (15:07 +0200)]
desktop-shell: add option to avoid creating the panel

This option is so we can disable showing any panel at all. The default
is to continue showing the panel and no example is added to weston.ini
because it's an uncommon request.

Tested-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoImplemented support for mouse scrolling in weston-terminal
Magnus Hoff [Tue, 5 Aug 2014 13:05:59 +0000 (15:05 +0200)]
Implemented support for mouse scrolling in weston-terminal

[Pekka Paalanen: fixed some code style issues]

10 years agosimple-egl: Clean up unused frame_listener
Boyan Ding [Mon, 11 Aug 2014 08:08:33 +0000 (16:08 +0800)]
simple-egl: Clean up unused frame_listener

Unused since commit 1e65840b6103197a684a551925a58fb1ae6c40e3

Signed-off-by: Boyan Ding <stu_dby@126.com>
Reviewed-by: Nils Chr. Brause <nilschrbrause@gmail.com>
10 years agoclients: use repeat_info event details
Jonny Lamb [Tue, 12 Aug 2014 12:58:27 +0000 (14:58 +0200)]
clients: use repeat_info event details

The weston-info client prints out the values, and the values are
respected in toytoolkit when actually repeating keys..

10 years agocompositor-wayland: listen to repeat_info and save values to pass on
Jonny Lamb [Tue, 12 Aug 2014 12:58:26 +0000 (14:58 +0200)]
compositor-wayland: listen to repeat_info and save values to pass on

10 years agocompositor: fetch repeat info from weston.ini
Jonny Lamb [Tue, 12 Aug 2014 12:58:25 +0000 (14:58 +0200)]
compositor: fetch repeat info from weston.ini

10 years agolibinput: Add tap configuration to weston.ini
Jonas Ådahl [Tue, 22 Jul 2014 20:49:41 +0000 (22:49 +0200)]
libinput: Add tap configuration to weston.ini

Enable by adding the following to your weston.ini:

[libinput]
enable_tap=true

This also makes weston require libinput >= 0.5.0.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoscreenshooter: Add a missing return; in an error path
Jasper St. Pierre [Thu, 7 Aug 2014 20:43:14 +0000 (16:43 -0400)]
screenshooter: Add a missing return; in an error path

10 years agodesktop-shell: Add a missing return; in an error path
Jasper St. Pierre [Thu, 7 Aug 2014 20:43:13 +0000 (16:43 -0400)]
desktop-shell: Add a missing return; in an error path

10 years agoDon't bother destroying resources after sending an error
Jasper St. Pierre [Thu, 7 Aug 2014 20:43:12 +0000 (16:43 -0400)]
Don't bother destroying resources after sending an error

An error makes the client exit, which cleans up the resources anyway.

Note (Jason Ekstrand):
This is safe for two reasons.  First, we should be handling object
destruction nicely anyway.  Second, in each of these cases, the resources
don't have any implementation or destruction set so it has absolutely no
effect on the rest of weston whether we destroy it now or later.

10 years agoUse the named SINCE_VERSION defines for version checks
Jasper St. Pierre [Thu, 7 Aug 2014 20:43:11 +0000 (16:43 -0400)]
Use the named SINCE_VERSION defines for version checks

To make our code more clear.

10 years agofullscreen-shell: Fix compiler warnings
Giulio Camuffo [Tue, 29 Jul 2014 18:57:24 +0000 (21:57 +0300)]
fullscreen-shell: Fix compiler warnings

10 years agodesktop-shell: don't assume there's a pointer when mapping a popup
Jonny Lamb [Wed, 6 Aug 2014 09:50:12 +0000 (11:50 +0200)]
desktop-shell: don't assume there's a pointer when mapping a popup

10 years agocompositor: Use libwayland to find a good default display for us
Jasper St. Pierre [Thu, 17 Jul 2014 17:55:44 +0000 (13:55 -0400)]
compositor: Use libwayland to find a good default display for us

10 years agowindow: Don't use the frame's geometry when fullscreen
Jasper St. Pierre [Mon, 4 Aug 2014 17:43:25 +0000 (13:43 -0400)]
window: Don't use the frame's geometry when fullscreen

When fullscreen, we don't actually update the frame's geometry, so we
can't query it for there.

10 years agoinput: Send key-repeat
Jasper St. Pierre [Mon, 4 Aug 2014 17:43:24 +0000 (13:43 -0400)]
input: Send key-repeat

10 years agoanimation: also change stop value when updating a fade target
Jonny Lamb [Tue, 29 Jul 2014 23:56:18 +0000 (00:56 +0100)]
animation: also change stop value when updating a fade target

If we're fading a view with weston_fade_run() and half way through we
want to unfade it we can use weston_fade_update() to set a new alpha
target. When the animation finishes, reset_alpha() is called which
ensures the alpha value of the view is exactly as requested.

Although weston_fade_update() was updating the spring target so the
animation would look fine, it would then reset to the alpha target
given in the first call to weston_fade_run().

10 years agocompositor: ignore unmapped sub-surfaces for view_list
Pekka Paalanen [Mon, 28 Jul 2014 09:49:24 +0000 (12:49 +0300)]
compositor: ignore unmapped sub-surfaces for view_list

It looks like that in the great conversion introducing weston_view, one
conditional was forgotten from the code that builds the global flat list
of views. Sub-surfaces are added to the view list specially, as they are
not governed by their presence in a layer's view list, and therefore
need an explicit check for mappedness.

The bug, missing the explicit check, caused sub-surfaces to enter the
global view_list regardless of their state. This lead to the pointer
focus picking code processing them, and as the input region defaults to
infinite, picking these unmapped surfaces. Clients then get confused
about the wl_pointer.enter events with unexpected wl_surface.

To trigger this issue, it is enough to just create one additional
wl_surface and make it a sub-surface of a main surface that is or gets
mapped. Literally, just a wl_subsomcpositor_get_subsurface() call is
enough. At some point later, the unmapped sub-surface will get pointer
focus, depending on view stacking order.

Fix the issue by adding a is_mapped check when building the view_list.

Note, that 95ec0f95aa2df74c2da19e7dda24528fa8f765cc accidentally also
prevents this bug from happening, because it adds a test against the
transform.masked_boundingbox in weston_compositor_pick_view().

Reported-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
10 years agoDo not assume 64x64 cursor, added support for other sizes (like in AMD Kaveri, 128x128).
Alvaro Fernando García [Mon, 28 Jul 2014 21:30:17 +0000 (18:30 -0300)]
Do not assume 64x64 cursor, added support for other sizes (like in AMD Kaveri, 128x128).

Init cursor size to 64x64 if drmGetCap() fails.

Use Mesa GBM_BO_USE_CURSOR define (which removes 64x64 restriction)

Signed-off-by: Alvaro Fernando García <alvarofernandogarcia@gmail.com>
10 years agocompositor: quick fix for sub-surface mapping
Pekka Paalanen [Mon, 30 Jun 2014 08:52:07 +0000 (11:52 +0300)]
compositor: quick fix for sub-surface mapping

If a client does this:
1. create a main window and map it
2. create a wl_surface, and make it a sub-surface of the main window
3. set the sub-surface to desync
4. commit content to the sub-surface to map it

Then step 4 should cause the sub-surface to become mapped. However,
Weston fails to schedule a repaint in that case, so the sub-surface will
not appear until something else causes a repaint on that output, e.g.
the main window.

A quick and dirty fix is to set the output mask for the surface in
Weston, which allows the repaint to be scheduled. This patch implements
that, and might only work right on single-output systems.

A proper fix would involve rewriting the whole "is surface mapped"
mechanism in Weston, to not rely on output assignments but to have a
separate flag for "mapped", and figuring out how to schedule repaints
for the right outputs.

Following is the actual protocol sequence used to trigger the problem:

[3224648.125]  -> wl_compositor@4.create_surface(new id wl_surface@3)
[3224648.206]  -> xdg_shell@7.get_xdg_surface(new id xdg_surface@8, wl_surface@3)
[3224648.311]  -> xdg_surface@8.set_title("simple-shm")
[3224648.378]  -> wl_surface@3.damage(0, 0, 250, 250)
[3224649.888]  -> wl_shm@6.create_pool(new id wl_shm_pool@9, fd 6, 250000)
[3224650.031]  -> wl_shm_pool@9.create_buffer(new id wl_buffer@10, 0, 250, 250, 1000, 1)
[3224650.244]  -> wl_shm_pool@9.destroy()
[3224651.975]  -> wl_surface@3.attach(wl_buffer@10, 0, 0)
[3224652.100]  -> wl_surface@3.damage(20, 20, 210, 210)
[3224652.243]  -> wl_surface@3.frame(new id wl_callback@11)
[3224652.317]  -> wl_surface@3.commit()
[3228652.535]  -> wl_compositor@4.create_surface(new id wl_surface@12)
[3228652.610]  -> wl_subcompositor@5.get_subsurface(new id wl_subsurface@13, wl_surface@12, wl_surface@3)
[3228652.644]  -> wl_subsurface@13.set_desync()
[3228652.659]  -> wl_subsurface@13.set_position(100, 100)
[3228654.090]  -> wl_shm@6.create_pool(new id wl_shm_pool@14, fd 6, 250000)
[3228654.140]  -> wl_shm_pool@14.create_buffer(new id wl_buffer@15, 0, 250, 250, 1000, 1)
[3228654.180]  -> wl_shm_pool@14.destroy()
[3228654.408]  -> wl_surface@12.attach(wl_buffer@15, 0, 0)
[3228654.436]  -> wl_surface@12.damage(0, 0, 250, 250)
[3228654.462]  -> wl_surface@12.commit()

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: George Kiagiadakis <george.kiagiadakis@collabora.com>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
10 years agoxwayland: Better handle a race with X
Jason Ekstrand [Thu, 24 Jul 2014 20:17:47 +0000 (13:17 -0700)]
xwayland: Better handle a race with X

If X windows are created and destroyed very fast sometimes the WM window
object gets created and destroyed before we get around to handling client
messages.  Failing to check that the window is still valid can result in a
segfault.

10 years agoxwayland/window-manager: Rename a variable for clerity
Jason Ekstrand [Thu, 24 Jul 2014 20:16:58 +0000 (13:16 -0700)]
xwayland/window-manager: Rename a variable for clerity

10 years agoxwayland: set surface_id to 0 when client resource is found
Tyler Veness [Wed, 2 Jul 2014 22:00:44 +0000 (15:00 -0700)]
xwayland: set surface_id to 0 when client resource is found

When Xwayland requests that a wl_surface be created and the X event is
handled before the wayland requests, a surface ID is stored to
window->surface_id and the window is added to the unpaired window list. When
weston_wm_create_surface is called, the window is removed from the list and
window->surface_id is set to zero. If window->surface_id is not zero when
weston_wm_window_destroy is called, the window is assumed to be in the
unpaired window list and wl_list_remove is called. If
weston_wm_window_handle_surface_id is called and the surface has already
been created, the window is not added to the unpaired window list, but
window->surface_id isn't set to zero. When the window is destroyed, removing
the window from the list is attempted anyway and a crash occurs.

This patch stores the surface ID in a temporary variable and only assigns it
to window->surface_id when the window is added to the unpaired window list.
Otherwise window->surface_id is set to zero to maintain its use as a flag
variable.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80273
Signed-off-by: Tyler Veness <calcmogul@gmail.com>
10 years agocompositor: add a masking mechanism to weston_layer
Giulio Camuffo [Wed, 9 Jul 2014 19:12:57 +0000 (22:12 +0300)]
compositor: add a masking mechanism to weston_layer

this adds a mechanism to mask the views belonging to a layer
to an arbitrary rect, in the global space. The parts that don't fit
in that rect will be clipped away.
Supported by the gl and pixman renderer only for now.

10 years agocompositor: keep track of the weston_layer a weston_view is in
Giulio Camuffo [Wed, 9 Jul 2014 19:12:56 +0000 (22:12 +0300)]
compositor: keep track of the weston_layer a weston_view is in

This introduces a new struct, weston_layer_entry, which is now used
in place of wl_list to keep the link for the layer list in weston_view
and the head of the list in weston_layer.
weston_layer_entry also has a weston_layer*, which points to the layer
the view is in or, in the case the entry it's the head of the list, to
the layer itself.

10 years agotests: use expect_protocol_error in tests
Marek Chalupa [Wed, 16 Jul 2014 09:40:25 +0000 (11:40 +0200)]
tests: use expect_protocol_error in tests

Turn FAIL_TESTs to TESTs. FAIL_TESTs are bad...

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agotests: add frame_callback_wait_nofail
Marek Chalupa [Wed, 16 Jul 2014 09:32:50 +0000 (11:32 +0200)]
tests: add frame_callback_wait_nofail

With expect_protocol_error, we need a possibility to wait for a frame
without aborting the test when wl_display_dispatch returns -1;
This patch adds function frame_callback_wait_nofail that only
returns 1 or 0 (instead of aborting on error).

Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agotests: add expect_protocol_error function
Marek Chalupa [Wed, 16 Jul 2014 09:27:06 +0000 (11:27 +0200)]
tests: add expect_protocol_error function

This function checks if a particular protocol error came in wire.
It's usefull in the cases where we hitherto used FAIL_TEST.
The problem with FAIL_TEST is that *any* assert will pass the test,
but we want only some asserts to pass the test (i. e. we don't
want the test to pass when it, for example, can't connect to display).
FAIL_TESTs are good only for sanity testing.

The expect_protocol_error allows us to turn all FAIL_TESTs to TESTs
as will be introduced in following patches.

v2: fixed white-space error and a mistake in comment

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoxdg-shell: Fix documentation
Jasper St. Pierre [Thu, 17 Jul 2014 21:34:44 +0000 (17:34 -0400)]
xdg-shell: Fix documentation

request_change_state has been folded into the configure event.

10 years agoshell: Replace set_margin with set_window_geometry
Jasper St. Pierre [Fri, 2 May 2014 14:21:38 +0000 (10:21 -0400)]
shell: Replace set_margin with set_window_geometry

Currently, there is a fun flicker when toggling maximization or
fullscreen on a window in mutter or more sophisicated compositors
and WMs.

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

In order to fix this, make the the configure request correspond to
the window geometry we'd like the window to be at. At the same time,
replace set_margin with set_window_geometry, where we specify a rect
rather than a border around the window.

10 years agoInterpret the size in the configure event as window geometry
Jasper St. Pierre [Mon, 14 Jul 2014 20:28:48 +0000 (16:28 -0400)]
Interpret the size in the configure event as window geometry

The size of the configure event has always been specified as in window
geometry coordinates, but it was never implemented this way.

10 years agoCreate a weston_surface_state structure for storing pending surface state and move...
Jason Ekstrand [Tue, 20 May 2014 19:33:03 +0000 (14:33 -0500)]
Create a weston_surface_state structure for storing pending surface state and move the surface commit logic into weston_surface_commit_state

This new structure is used for both weston_surface.pending and
weston_subsurface.cached.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoMove weston_frame_callback above weston_surface_create
Jason Ekstrand [Thu, 26 Jun 2014 17:04:49 +0000 (10:04 -0700)]
Move weston_frame_callback above weston_surface_create

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agoMove weston_subsurface to after weston_surface
Jason Ekstrand [Tue, 20 May 2014 16:23:53 +0000 (11:23 -0500)]
Move weston_subsurface to after weston_surface

It makes more sense there.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
10 years agocairo-util: Set geometry_dirty in frame_set_title
Boyan Ding [Fri, 4 Jul 2014 07:19:23 +0000 (15:19 +0800)]
cairo-util: Set geometry_dirty in frame_set_title

Title can decide the geometry of a frame because it may affect the
existence of titlebar, so setting geometry_dirty in frame_set_title for
potential change.

Signed-off-by: Boyan Ding <stu_dby@126.com>
10 years agocairo-util: Fix geometry for frames with buttons but without title
Boyan Ding [Fri, 4 Jul 2014 07:19:22 +0000 (15:19 +0800)]
cairo-util: Fix geometry for frames with buttons but without title

There exist frames which have buttons without title such as a simple
X application piped through xwayland which doesn't specify a title.
We draw the title bar with buttons, but hide it under the window
because geometry thinks a window needs titlebar only if it has title.

This patch change the condition, making it titlebar is needed if a
frame has title or has button(s), which makes more sense.

Signed-off-by: Boyan Ding <stu_dby@126.com>
10 years agoUse pixman_region32_clear instead of our own empty_region
Jason Ekstrand [Thu, 26 Jun 2014 17:37:36 +0000 (10:37 -0700)]
Use pixman_region32_clear instead of our own empty_region

This requires pixman 0.25.2

Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
10 years agoshell: fix segfault in fullscreen binding
Boyan Ding [Thu, 26 Jun 2014 02:19:32 +0000 (10:19 +0800)]
shell: fix segfault in fullscreen binding

Commit 9aa8ce69 forgot to set shsurf->fullscreen_output in
fullscreen_binding(), causing segfault when fullscreening using key
bindings. This patch fixes that.

https://bugs.freedesktop.org/show_bug.cgi?id=79828
Signed-off-by: Boyan Ding <stu_dby@126.com>
10 years agoscreen-share: Allow fullscreen shell command to be configured
Andrew Wedgbury [Fri, 2 May 2014 09:01:18 +0000 (10:01 +0100)]
screen-share: Allow fullscreen shell command to be configured

I've updated this based on comments, simplifying the command handling.

Currently the screen-share module uses a hard-coded command to start the
fullscreen shell server. This patch causes the module to read the command from
the weston config file (from the "command" key in the "screen-share" section).
The default value remains the same (i.e. to run weston with the RDP backend and
fullscreen shell), but is now located in the weston config file.

As well as allowing the arguments to the fullscreen shell server to be changed,
this also permits an alternative fullscreen shell server to be used if required,
without needing to recompile. Since the command is run as the user running
weston, this should not pose any additional security risk.

Signed-off-by: Andrew Wedgbury <andrew.wedgbury@realvnc.com>
10 years agodata-device: Clean up the logic in start_drag
Jason Ekstrand [Wed, 25 Jun 2014 04:19:24 +0000 (21:19 -0700)]
data-device: Clean up the logic in start_drag

Previoiusly, we had a mess of logic that was repeated with one of the
repeats negated.  Not only was this unnecisaraly confusing, but it
segfaulted and one of the negations was wrong.  This cleans the whole mess
up and should fix bug #79725.

10 years agoBetter error message when exec'ing Xwayland fails
Arnout Engelen [Fri, 20 Jun 2014 19:36:54 +0000 (21:36 +0200)]
Better error message when exec'ing Xwayland fails

10 years agoRequire libinput 0.4.0
Peter Hutterer [Wed, 25 Jun 2014 04:07:36 +0000 (14:07 +1000)]
Require libinput 0.4.0

No functional changes, just adjusting for API changes in libinput:
- libinput_destroy() replaced by libinput_unref()
- log functions now take a libinput context, userdata is gone
- udev seat creation is now libinput_udev_create_context() and
  libinput_udev_assign_seat()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoChange the defacto output transform from flipped-270 to flipped-90
Jason Ekstrand [Tue, 24 Jun 2014 18:10:28 +0000 (11:10 -0700)]
Change the defacto output transform from flipped-270 to flipped-90

It turns out that flipped-270 is the second-simplest transformation besides
normal because it is a direct swapping of the x and y axes.  Having that as
the default encourages people to use flipped-270 as the default test for "I
want to try this with a transform".  Unfortunately, because flipped-270 is
so simple, it is really easy to have something that works for normal,
flipped-270, and nothing else.  This encourages people to test with a
transform thats actually "hard".

10 years agoFix a comment
Jason Ekstrand [Tue, 24 Jun 2014 18:10:02 +0000 (11:10 -0700)]
Fix a comment

10 years agoClients: Fix memleak issues in various clients of weston
vivek [Thu, 15 May 2014 13:28:16 +0000 (18:58 +0530)]
Clients: Fix memleak issues in various clients of weston

In many clients of weston, Display was not being destroyed so added it.
Also destroy windows, widgets which were not being destroyed.

Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewed-by: Pekka Paalanen <ppaalanen@gmail.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
10 years agoxdg-shell: Fix a typo in description
Boyan Ding [Mon, 23 Jun 2014 02:51:49 +0000 (10:51 +0800)]
xdg-shell: Fix a typo in description

Signed-off-by: Boyan Ding <stu_dby@126.com>
10 years agodesktop-shell: Don't assume there is a pointer when resizing
Emilio Pozuelo Monfort [Wed, 18 Jun 2014 15:48:58 +0000 (17:48 +0200)]
desktop-shell: Don't assume there is a pointer when resizing

Fixes a crash on touch devices without a pointer, when touching
the window frame of a client.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
10 years agoweston-build: Fix aclocal error during autogen.sh
Srivardhan Hebbar [Sat, 21 Jun 2014 09:46:25 +0000 (15:16 +0530)]
weston-build: Fix aclocal error during autogen.sh

This is a fix to the following bug:
https://bugs.freedesktop.org/show_bug.cgi?id=80214

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
10 years agocompositor: update the surface size when there is a size change without a buffer...
George Kiagiadakis [Fri, 13 Jun 2014 16:14:20 +0000 (18:14 +0200)]
compositor: update the surface size when there is a size change without a buffer attach

This fixes at least the case where you want to do wl_viewport.set_destination
to resize the surface but without attaching new content in it.

10 years agoweston: Fix memleak issue in compositor.c
Srivardhan Hebbar [Tue, 27 May 2014 09:00:59 +0000 (14:30 +0530)]
weston: Fix memleak issue in compositor.c

Based on a previous patch by Hardening <rdp.effort@gmail.com>.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
10 years agocompositor-wayland: Fix compiler warning
Thierry Reding [Tue, 27 May 2014 07:08:29 +0000 (09:08 +0200)]
compositor-wayland: Fix compiler warning

sizeof returns size_t, for which the correct printf specifier is %zu.
Fixes the following warning when building for ARMv7.

src/compositor-wayland.c: In function 'wayland_output_get_shm_buffer':
src/compositor-wayland.c:260:3: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'unsigned int' [-Wformat=]
   weston_log("could not zalloc %ld memory for sb: %m\n", sizeof *sb);
   ^

Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agobuild: Silence libtoolize warnings
Thierry Reding [Tue, 27 May 2014 07:07:54 +0000 (09:07 +0200)]
build: Silence libtoolize warnings

When running the autogen.sh script, libtoolize complains thusly:

libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

Silence the warnings by following libtoolize's advice.

Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodesktop-shell: make background applications less dark
Jonny Lamb [Thu, 22 May 2014 20:41:34 +0000 (22:41 +0200)]
desktop-shell: make background applications less dark

10 years agoanimation: ensure repaints are always scheduled during animations
Jonny Lamb [Thu, 22 May 2014 20:41:33 +0000 (22:41 +0200)]
animation: ensure repaints are always scheduled during animations

Animations are run off the repaint cycle so if there's nothing to
repaint, an animation will stop running. This is usually not a problem
as each frame function of an animation causes something to change and
therefore a repaint to happen. This patch helps detect when the
animation isn't in said case and triggers a repaint to keep the
animation running.

This problem was found by using weston_move_scale_run() to move a view
onscreen from completely off. The very first time the animation frame
function was called the progress wasn't enough to move it into
view. The compositor saw there was nothing to repaint and stopped
doing anything else. When something else (like a pointer move) forced
a redraw, the view's position was very much onscreen and jumped into
view in an ugly way.

10 years agoexposay: fix crash when navigating with the keyboard
Emilio Pozuelo Monfort [Sat, 24 May 2014 00:43:04 +0000 (02:43 +0200)]
exposay: fix crash when navigating with the keyboard

Commit a7592019 introduced an optimization that caused some
exposay struct members to not be properly initialized, particularly
cur_output, leading to crashes in some circumstances (e.g. pressing
the down arrow key after going to exposay).

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
10 years agoanimation: fix move scale animation
Jonny Lamb [Thu, 22 May 2014 20:41:30 +0000 (22:41 +0200)]
animation: fix move scale animation

Both weston_move_scale_run() and weston_slide_run() were broken in
commit 3a869019. Commit a4a6f161 fixed and explained the problem for
weston_slide_run() but weston_move_scale_run() remained broken.

To fix weston_move_scale_run(), weston_view_animation_run() is also
required. It was removed when _run() was split into two functions
_create() and _run() in commit f5cc2b56, but _run() was not added in
this commit.

10 years agocompositor: unmap subsurface views before destroying the subsurfaces
George Kiagiadakis [Fri, 13 Jun 2014 16:10:26 +0000 (18:10 +0200)]
compositor: unmap subsurface views before destroying the subsurfaces

This is to avoid recursing into weston_compositor_build_view_list()
and therefore fix crashing when destroying a stack of visible subsurfaces
due to weston_compositor_build_view_list() being called recursively
and corrupting the lists it works on.

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

10 years agoAdd a simple client for testing compositor damage handling
Jason Ekstrand [Sat, 5 Apr 2014 14:22:15 +0000 (09:22 -0500)]
Add a simple client for testing compositor damage handling

This allows for easily testing a compositor's damage tracking in all
currently available configurations including wl_surface.buffer_transform,
wl_surface.buffer_scale, and wl_viewport.  It also includes a
--rotating-damage that flag instructs the client to change the
wl_surface.buffer_transform on every commit.  This tests the compositor for
proper handling of texture uploads even when the transform has changed but
the buffer size hasn't.

10 years agolibinput: Use floating point instead of fixed point numbers
Jonas Ådahl [Mon, 2 Jun 2014 21:15:48 +0000 (23:15 +0200)]
libinput: Use floating point instead of fixed point numbers

Also update configure.ac to require libinput 0.3 when enabled, as it is
the version where double replaced li_fixed_t.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>