profile/ivi/weston-ivi-shell.git
10 years agonested: Add an option to disable subsurfaces
Neil Roberts [Sun, 8 Sep 2013 23:59:35 +0000 (00:59 +0100)]
nested: Add an option to disable subsurfaces

This adds a -b option to force the nested compositor example to use
the old blit renderer even if the appropriate extensions are
available.

10 years agonested: Add a renderer using subsurfaces
Neil Roberts [Sun, 8 Sep 2013 23:41:29 +0000 (00:41 +0100)]
nested: Add a renderer using subsurfaces

Adds a second renderer implementation to the nested compositor example
that creates a subsurface for each of the client's surfaces. The
client buffers are directly attached to the subsurface using the
EGL_WL_create_wayland_buffer_from_image extension instead of blitting
them in the redraw_handler.

The new renderer is always used if the parent compositor supports the
wl_subcompositor protocol and the EGL extension is available.
Otherwise it will fall back to the blit renderer.

10 years agoclients: Add a widget_get_wl_subsurface
Neil Roberts [Sun, 8 Sep 2013 23:40:17 +0000 (00:40 +0100)]
clients: Add a widget_get_wl_subsurface

Adds a simple accessor for the wl_subsurface for widgets created with
window_add_subsurface.

10 years agonested: Add a ‘renderer’ mechanism with a vtable
Neil Roberts [Sun, 8 Sep 2013 19:52:36 +0000 (20:52 +0100)]
nested: Add a ‘renderer’ mechanism with a vtable

Eventually the nested compositor example will want to be able to cope
with either rendering as it does now with a blit to an intermediate
surface or by attaching the client buffers directly to a subsurface
without copying. This patch moves the code that is specific to the
blitting mechanism into a separate set of functions with a vtable to
make it easier to add the second way of rendering in a later patch.

10 years agonested: Move the frame callback list to the surface
Neil Roberts [Mon, 9 Sep 2013 14:13:09 +0000 (15:13 +0100)]
nested: Move the frame callback list to the surface

Previously the frame callback list was tracked as part of the global
compositor state. This patch moves the list to be part of the surface
state like it is in Weston. The frame callback now iterates the list
of surfaces to flush all of the callbacks. This change will be useful
when the example is converted to use subsurfaces so that it can have a
separate frame callback for the subsurface and flush the list for an
individual client surface rather than flushing globally.

10 years agonested: Add damage tracking to the nested compositor example
Neil Roberts [Sun, 8 Sep 2013 19:24:14 +0000 (20:24 +0100)]
nested: Add damage tracking to the nested compositor example

The nested compositor example now responds to damage requests and
tracks them in the pending buffer state. This isn't currently used for
anything and it is immediately discarded when the surface is commited
but it will be used later when the example is converted to use
subsurfaces.

10 years agonested: Add double-buffered state semantics to the nested example
Neil Roberts [Sun, 8 Sep 2013 18:49:02 +0000 (19:49 +0100)]
nested: Add double-buffered state semantics to the nested example

The buffer and frame callback state on the surfaces in the nested
compositor example are now double-buffered so that they only take
effect when the commit request is received. This doesn't really make
much difference for the current state that the example has but it will
be useful when more state is added in later patches.

10 years agonested: Add the buffer reference semantics from Weston
Neil Roberts [Sun, 8 Sep 2013 17:49:15 +0000 (18:49 +0100)]
nested: Add the buffer reference semantics from Weston

This copies the buffer reference busy count implementation from Weston
to the nested compositor example and adds an internal nested_buffer
struct that we could eventually use to attach data. This will be
useful to adapt the example to use subsurfaces so that we can attach
our compositor-side buffer to the resource.

10 years agonested: Remove the surface from the surface list when destroyed
Neil Roberts [Fri, 22 Nov 2013 15:41:53 +0000 (15:41 +0000)]
nested: Remove the surface from the surface list when destroyed

Otherwise if the surface is destroyed then it will crash when it later
tries to render all of the surfaces. You can replicate this by doing
killall weston-nested-client while the example is running.

10 years agobuild: Fix out-of-tree build for desktop-shell
Kristian Høgsberg [Wed, 4 Dec 2013 20:57:02 +0000 (12:57 -0800)]
build: Fix out-of-tree build for desktop-shell

10 years agoshell: Fix activate logic on surface map.
Rafael Antognolli [Wed, 4 Dec 2013 19:49:55 +0000 (17:49 -0200)]
shell: Fix activate logic on surface map.

It should activate the newly mapped surface if not locked.

10 years agorpi: launcher must init before udev-seat
Pekka Paalanen [Wed, 4 Dec 2013 13:34:48 +0000 (15:34 +0200)]
rpi: launcher must init before udev-seat

udev-seat will call weston_launcher_open(), so we better init launcher
first. Fixes a segfault.

Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agorpi: seat quick fix
Pekka Paalanen [Wed, 4 Dec 2013 13:34:47 +0000 (15:34 +0200)]
rpi: seat quick fix

Fix the default seat name, so that we can find the input devices by
default.

This is just a quick fix. Further enhancement would be to make the
default seat on rpi taken from a command line option like the other
backends do. Furthermore, udev_input_init() should accept NULL as seat
to use the default seat, avoiding us hardcoding "seat0" all over.

Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agorpi: compile in the common udev code
Pekka Paalanen [Wed, 4 Dec 2013 13:34:46 +0000 (15:34 +0200)]
rpi: compile in the common udev code

In a recent commit 37d38d932cea8a642e644d091747d0d9c046a00a, "rpi: Use
common udev_input for input device handling", the rpi-backend was made
to use the common udev code.

It just forgot to actually build the common udev code into the
rpi-backend.

Cc: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agogl: fix fallback definition of EGL_DEFAULT_DISPLAY
Pekka Paalanen [Wed, 4 Dec 2013 13:34:45 +0000 (15:34 +0200)]
gl: fix fallback definition of EGL_DEFAULT_DISPLAY

Compiling fbdev backend on RaspberryPi caused the following warning:

compositor-fbdev.c: In function 'fbdev_compositor_create':
compositor-fbdev.c:929:6: warning: passing argument 2 of
'gl_renderer->create' makes integer from pointer without a cast [enabled
by default]
compositor-fbdev.c:929:6: note: expected 'EGLNativeDisplayType' but
argument is of type 'void *'

Fix the definition of EGL_DEFAULT_DISPLAY to match the definition in
EGL/egl.h (of Mesa).

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agodesktop-shell: Split out input-panel code
Kristian Høgsberg [Wed, 4 Dec 2013 19:00:19 +0000 (11:00 -0800)]
desktop-shell: Split out input-panel code

10 years agodesktop-shell: Split out exposay immplementation
Kristian Høgsberg [Wed, 4 Dec 2013 08:20:01 +0000 (00:20 -0800)]
desktop-shell: Split out exposay immplementation

10 years agodesktop-shell: Move to new desktop-shell subdirectory
Kristian Høgsberg [Wed, 4 Dec 2013 00:31:10 +0000 (16:31 -0800)]
desktop-shell: Move to new desktop-shell subdirectory

10 years agoMove xwayland up one directory level
Kristian Høgsberg [Wed, 4 Dec 2013 00:38:15 +0000 (16:38 -0800)]
Move xwayland up one directory level

10 years agotablet-shell: Remove
Kristian Høgsberg [Wed, 4 Dec 2013 00:32:01 +0000 (16:32 -0800)]
tablet-shell: Remove

The tablet-shell is unmaintained and unused.  It is currently
dead-weight and a burden when we make changes to weston.  Let's
drop it for now, we can pull it out of git if we find a need for it later.

10 years agoCheck if the frame exists before reading its size
Dima Ryazanov [Fri, 15 Nov 2013 10:02:23 +0000 (02:02 -0800)]
Check if the frame exists before reading its size

This fixes crashes caused by popup windows that don't have override_redirect
(e.g., menus in VLC and KDE apps).

Signed-off-by: Dima Ryazanov <dima@gmail.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
10 years agoCheck for frame being NULL before setting/unsetting flags
Dima Ryazanov [Fri, 15 Nov 2013 10:01:19 +0000 (02:01 -0800)]
Check for frame being NULL before setting/unsetting flags

Fixes a crash in Firefox when clicking an "install plugin" popup.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
10 years agoSet the view to NULL when unmapping an X11 window
Dima Ryazanov [Fri, 15 Nov 2013 10:01:18 +0000 (02:01 -0800)]
Set the view to NULL when unmapping an X11 window

Fixes a crash caused by accessing a deleted view in weston_wm_window_schedule_repaint. It can be easily reproduced by switching between menus in Firefox.

Signed-off-by: Dima Ryazanov <dima@gmail.com>
10 years agodata-device: Fix surface configure function type
Jonas Ådahl [Tue, 3 Dec 2013 21:30:17 +0000 (22:30 +0100)]
data-device: Fix surface configure function type

The commit "Remove the weston_view.geometry.width/height fields" changed
the type of the surface configure callback function, but did not change
the callbacks in data-device.c. This commit fixes the type of the
functions left needed to be changed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agologind: delay wakeup until DRM-device is resumed
David Herrmann [Sat, 30 Nov 2013 10:25:45 +0000 (11:25 +0100)]
logind: delay wakeup until DRM-device is resumed

The logind API was designed to allow any kind of devices and any number of
devices. It has no idea of "main DRM device" or similar. However, the
weston DRM backend was designed with a single DRM device as master.
Therefore, we wake it up unconditionally on session-wakeup. But this may
fail with logind as a session may be awake, but not all devices have been
resumed, yet.

Therefore, we change the weston-logind backend to deal with this case
correctly. Instead of waking up the compositor on session-wakeup, we wait
for the main DRM device to wake up. Once we get the event, we notify the
compositor.

For sleep, we reverse this logic. On *any* of the following events we
tell the compositor to go to sleep:
 - Session gets inactive
 - DRM device gets inactive
 - DRM device is removed
This guarantees, that weston is only active if *both*, the session and the
main DRM device are awake/active.

Note that we could actually rely solely on the DRM-device Pause/Resume
events from logind and drop all the Active-Prop-Changed handling. logind
guarantees proper ordering of both. However, in case we ever change weston
to support multiple GPUs, we need the per-device notification. Thus, keep
the code. This also makes weston more fail-safe in case logind fails to
send the PauseDevice event (for whatever reason..).

10 years agoxdg-shell: Add key bindings for setting maximized and fullscreen.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:48 +0000 (15:35 -0200)]
xdg-shell: Add key bindings for setting maximized and fullscreen.

10 years agoxdg-shell: xdg_surface_set_output should only affect fullscreen.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:47 +0000 (15:35 -0200)]
xdg-shell: xdg_surface_set_output should only affect fullscreen.

10 years agoxdg-shell: Add surface size to configure.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:46 +0000 (15:35 -0200)]
xdg-shell: Add surface size to configure.

Also emit configure on unset_maximized and unset_fullscreen.

10 years agoxdg-shell: Implement xdg-shell interface.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:45 +0000 (15:35 -0200)]
xdg-shell: Implement xdg-shell interface.

The whole xdg-shell interface is implement, except from the "focused_set"
and "focused_unset" events.

10 years agoshell: Move shell_surface_set_parent to wl_shell calls.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:44 +0000 (15:35 -0200)]
shell: Move shell_surface_set_parent to wl_shell calls.

The parent update on set_maximized and set_fullscreen is a behavior of
wl_shell.

That does not happen on xdg-shell, so it can't be in the set_fullscreen
and set_maximized common code, but rather in the wl_shell_surface
interfaces.

10 years agoshell: Remove SHELL_SURFACE_TRANSIENT.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:43 +0000 (15:35 -0200)]
shell: Remove SHELL_SURFACE_TRANSIENT.

10 years agoshell: Remove SHELL_SURFACE_FULLSCREEN and SHELL_SURFACE_MAXIMIZED.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:42 +0000 (15:35 -0200)]
shell: Remove SHELL_SURFACE_FULLSCREEN and SHELL_SURFACE_MAXIMIZED.

These surface types don't exist anymore inside weston desktop shell
implementation. They are just exposed as wl_shell surface types, but
internally the implementation is done with surface states.

The previous behavior (setting a surface type unsets another one) still
happens when using wl_shell. This change is mainly done as a refactory
to allow xdg-shell to use the same code.

10 years agoxdg_shell: Adding a new shell protocol.
Rafael Antognolli [Tue, 3 Dec 2013 17:35:41 +0000 (15:35 -0200)]
xdg_shell: Adding a new shell protocol.

xdg_shell is a protocol aimed to substitute wl_shell in the long term,
but will not be part of the wayland core protocol. It starts as a
non-stable API, aimed to be used as a development place at first, and
once features are defined as required by several desktop shells, we can
finally make it stable.

It provides mainly two new interfaces: xdg_surface and xdg_popup.

The xdg_surface interface implements a desktop-style window, that can be
moved, resized, maximized, etc. It provides a request for creating
child/parent relationship, called xdg_surface.set_transient_for.

The xdg_popup interface implements a desktop-style popup/menu. A
xdg_popup is always transient for another surface, and also has implicit
grab.

10 years agoinput: Reset keyboard state when releasing last seat keyboard
Jonas Ådahl [Tue, 3 Dec 2013 08:14:27 +0000 (09:14 +0100)]
input: Reset keyboard state when releasing last seat keyboard

Don't rely on the input driver to properly send button-up events for
every pressed key.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoinput: Move the xkb fields from weston_seat to weston_keyboard
Jonas Ådahl [Tue, 3 Dec 2013 08:14:26 +0000 (09:14 +0100)]
input: Move the xkb fields from weston_seat to weston_keyboard

XKB integration is a keyboard feature and should as such be kept track
of in the keyboard struct.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoRemove the weston_view.geometry.width/height fields
Jason Ekstrand [Tue, 3 Dec 2013 03:01:53 +0000 (21:01 -0600)]
Remove the weston_view.geometry.width/height fields

This has a couple of additional implications for the internal weston API:
 1) weston_view_configure no longer exists.  Use weston_view_set_position
    instead.
 2) The weston_surface.configure callback no longer takes a width and
    height.  If you need these, surface.width/height are set before
    configure is called.  If you need to know when the width/height
    changes, you must track that yourself.

10 years agowindow: handle insufficient buffer space
Pekka Paalanen [Fri, 29 Nov 2013 15:48:52 +0000 (17:48 +0200)]
window: handle insufficient buffer space

It is quite possible for os_create_anonymous_file() to fail when trying
to allocate a new wl_shm buffer. Propagate this failure out from
shm_surface_prepare. Most parts of toytoolkit are already avoiding NULL
cairo surfaces.

If cairo surface allocation fails, do not try to call the widget redraw
functions, those are not prepared to deal with NULL. Also do not
schedule a frame callback, this allows us to retry drawing the next
time.

If redraw fails for the main_surface of a window, restore the widget
geometry to what the compositor currently is showing. This keeps the
window visual appearance in sync with application state, so interacting
with the application does not break too badly.

If the very first draw of any window fails, then forcefully exit the
program. E.g. if weston-desktop-shell fails to allocate buffers for the
unlock dialog, w-d-s exits, and weston unlocks the screen automatically.

This patch allows e.g. weston-terminal to stop from enlarging while
resizing, if new sized buffers can no longer the allocated. Even then,
the application stays usable, as it can often repaint in the last
successful size. It does not crash, and the user is able to resize it
smaller, too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoos: use posix_fallocate in creating sharable buffers
Pekka Paalanen [Fri, 29 Nov 2013 15:48:51 +0000 (17:48 +0200)]
os: use posix_fallocate in creating sharable buffers

If posix_fallocate is available, use it instead of ftruncate. Unlike
ftruncate, when posix_fallocate succeeds, it guarantees that you cannot
run out of disk space, when later writing to the mmap()'ed file.

With posix_fallocate, if os_create_anonymous_file() succeeds, the
program cannot get a SIGBUS later from accessing this file via mmap. If
there is insufficient disk space, the function fails and errno is set to
ENOSPC.

This is useful on systems, that limit the available buffer space by
having XDG_RUNTIME_DIR on a small tmpfs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoMake the default desktop shell client configurable
Emilio Pozuelo Monfort [Mon, 2 Dec 2013 11:53:32 +0000 (12:53 +0100)]
Make the default desktop shell client configurable

The default can be set by passing WESTON_SHELL_CLIENT as an argument
to configure, similarly to WESTON_NATIVE_BACKEND.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
10 years agoinput: Reset pointer state when last pointer device was removed
Jonas Ådahl [Mon, 2 Dec 2013 21:05:05 +0000 (22:05 +0100)]
input: Reset pointer state when last pointer device was removed

Reset pointer button count in case the driver did not emit appropriate
number of number button released events.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoinput: Reset touch state when last touch device was removed
Jonas Ådahl [Mon, 2 Dec 2013 21:05:04 +0000 (22:05 +0100)]
input: Reset touch state when last touch device was removed

Reset the touch point count in case the driver did not emit appropriate
number of touch up events.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoinput: Keep track of number of touch points inside touch struct
Jonas Ådahl [Mon, 2 Dec 2013 21:05:03 +0000 (22:05 +0100)]
input: Keep track of number of touch points inside touch struct

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agorpi: Use common udev_input for input device handling
Jonas Ådahl [Mon, 2 Dec 2013 21:05:02 +0000 (22:05 +0100)]
rpi: Use common udev_input for input device handling

The purpose of this patch is to move away from separating evdev
functionality from udev functionality in order to rely on a separate
library to do this for us.

This patch is only compile tested and I have no idea how much it breaks.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoshell: Change stacking order calculation for popup surfaces
Philip Withnall [Mon, 25 Nov 2013 18:01:46 +0000 (18:01 +0000)]
shell: Change stacking order calculation for popup surfaces

Always put them as the top-most layer in the layer list of their parent.
This ensures that, for example, the popup menu produced by
right-clicking on a surface (which is not currently at the top of the
stacking order in the current workspace) is displayed at the top of the
stacking order.

10 years agoshell: Fix a potential NULL pointer dereference
Philip Withnall [Mon, 25 Nov 2013 18:01:45 +0000 (18:01 +0000)]
shell: Fix a potential NULL pointer dereference

get_shell_surface() may return NULL. Found by scan-build.

10 years agoshell: Store parent–child links between shsurfs for window stacking
Philip Withnall [Mon, 25 Nov 2013 18:01:44 +0000 (18:01 +0000)]
shell: Store parent–child links between shsurfs for window stacking

This ensures transient surfaces are included in the layer of their
parent, even if the parent later changes layers. It achieves this by
recursively changing the layers of all children of a surface when that
surface’s layer is changed. The recursion is unbounded unless transient
surfaces are restricted to not being children of other popup or transient
surfaces.

This fixes a bug whereby a surface which is transient for a fullscreen
surface could end up being stacked below it.

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

10 years agoshell: Factor out common code to create fullscreen black surfaces
Philip Withnall [Mon, 25 Nov 2013 18:01:43 +0000 (18:01 +0000)]
shell: Factor out common code to create fullscreen black surfaces

10 years agoshell: Remove weston_view_restack()
Philip Withnall [Mon, 25 Nov 2013 18:01:42 +0000 (18:01 +0000)]
shell: Remove weston_view_restack()

It’s tied too deeply into the shell’s window stacking and ordering code
to legitimately be split out into compositor.c. Inline it in the shell,
and refactor some code around it a little, tidying up the stacking
behaviour for fullscreen surfaces.

10 years agoshell: Update a shsurf’s layer when its surface type changes
Philip Withnall [Mon, 25 Nov 2013 18:01:41 +0000 (18:01 +0000)]
shell: Update a shsurf’s layer when its surface type changes

10 years agoshell: Factor out code to set the layer for a shsurf
Philip Withnall [Mon, 25 Nov 2013 18:01:40 +0000 (18:01 +0000)]
shell: Factor out code to set the layer for a shsurf

This will be used more extensively in the next few commits, where shsurf
layering is handled more explicitly when changing the type of a surface.

This commit introduces the minor functional change that map() will now
always add the new surface to a layer list, as
shell_surface_calculate_layer_link() always returns a non-NULL link
element. This affects fullscreen and ‘none’ surfaces (which are now added
to the fullscreen and current workspace’s layer list, respectively).

10 years agoshell: Don’t change popups’ window types until the next configure event
Philip Withnall [Mon, 25 Nov 2013 18:01:39 +0000 (18:01 +0000)]
shell: Don’t change popups’ window types until the next configure event

This standardises their behaviour with that of the other window types,
where the type change is only committed on configure.

10 years agoshell: Factor out code to set a shsurf’s parent
Philip Withnall [Mon, 25 Nov 2013 18:01:38 +0000 (18:01 +0000)]
shell: Factor out code to set a shsurf’s parent

This is in preparation for unifying how surface layering works. It
introduces the small functional change that fullscreen, maximized and
top-level surfaces now explicitly have no parent surface. Only popup and
transient surfaces have a non-NULL parent.

10 years agoshell: Tidy up unset_fullscreen()
Philip Withnall [Mon, 25 Nov 2013 18:01:37 +0000 (18:01 +0000)]
shell: Tidy up unset_fullscreen()

No functional changes, merely some presentational cleanup.

10 years agoshell: Refactor workspace code to operate on shsurfs rather than views
Philip Withnall [Mon, 25 Nov 2013 18:01:36 +0000 (18:01 +0000)]
shell: Refactor workspace code to operate on shsurfs rather than views

This is needed for the work to refactor window stacking and ordering, as
window order operates on shsurfs, not views.

10 years agoshell: Factor out common code to set a shsurf’s output
Philip Withnall [Mon, 25 Nov 2013 18:01:35 +0000 (18:01 +0000)]
shell: Factor out common code to set a shsurf’s output

10 years agoclients: Add a new weston-stacking demo
Philip Withnall [Mon, 25 Nov 2013 18:01:34 +0000 (18:01 +0000)]
clients: Add a new weston-stacking demo

This allows creation of a variety of window types, for the purposes of
testing window ordering and stacking in Weston.

10 years agoclients: Add window_is_transient() helper to the toy toolkit window
Philip Withnall [Mon, 25 Nov 2013 18:01:33 +0000 (18:01 +0000)]
clients: Add window_is_transient() helper to the toy toolkit window

10 years agoshell: Add missing cases to switch statements for animations and fading
Philip Withnall [Mon, 25 Nov 2013 18:01:32 +0000 (18:01 +0000)]
shell: Add missing cases to switch statements for animations and fading

This fixes two GCC warnings when compiling with -Wswitch-enum
-Wswitch-default, and makes it clearer that those cases have been
thought about explicitly when writing the code, rather than just being
forgotten.

10 years agoshell: Add missing cases to switch statements for surface types
Philip Withnall [Mon, 25 Nov 2013 18:01:31 +0000 (18:01 +0000)]
shell: Add missing cases to switch statements for surface types

This fixes a load of GCC warnings when compiling with -Wswitch-enum
-Wswitch-default, and makes it clearer that those cases have been
thought about explicitly when writing the code, rather than just being
forgotten.

10 years agoshell: Reorganise set/unset methods for fullscreen/maximize/popup/transient
Philip Withnall [Mon, 25 Nov 2013 18:01:30 +0000 (18:01 +0000)]
shell: Reorganise set/unset methods for fullscreen/maximize/popup/transient

Move them to be next to each other, and standardise the naming scheme so
they’re more greppable. This should make maintenance easier.

10 years agosrc/shell.c: set black_surface->width and height
Xiong Zhang [Fri, 29 Nov 2013 03:18:14 +0000 (11:18 +0800)]
src/shell.c: set black_surface->width and height

full screen black_surface doesn't have associated wl_buffer, so
black_surface->width and height can't get value through
weston_surface_commit(). then weston_surface_damage(black_surface)
will be wrong in shell_stack_fullscreen(), the result is that we
can't see a full screen view whe APP window's size isn't equal to
output's size like running weston-gears

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
10 years agorpi: Support opaque regions
Tomeu Vizoso [Mon, 2 Dec 2013 16:18:58 +0000 (17:18 +0100)]
rpi: Support opaque regions

This is needed for XWayland surfaces with alpha channel, as X will be
sending crap in there that should be discarded.

This is currently done with a copy in the compositor, while we wait for
support in the VideoCore side.

10 years agocompositor: merge surface size from buffer size funcs
Pekka Paalanen [Tue, 26 Nov 2013 17:19:43 +0000 (18:19 +0100)]
compositor: merge surface size from buffer size funcs

Replace the two functions getting the intended surface dimensions from
the surface's buffer and buffer transformation parameters by a single
function that just set the surface size according to all the buffer
state.

The old functions were always called in pairs, and always assigned to
the surface dimension variables.

This function also deals with a NULL buffer by setting the dimensions to
zero, just like the callers used to do.

The new function has no users outside this source file, so do not export
it. This basically unexports the old functions.

10 years agocompositor: do not recompute size on pointer_set_cursor
Pekka Paalanen [Tue, 26 Nov 2013 17:19:42 +0000 (18:19 +0100)]
compositor: do not recompute size on pointer_set_cursor

This removes the calls to weston_surface_buffer_width/height() from
input.c, which are the last external calls to them.

Instead, use the cached values from weston_surface::width,height. These
have already been set by weston_surface_commit(), because that is the
only way a weston_surface can get a buffer.

10 years agocompositor: gather buffer_transform and _scale into a struct
Pekka Paalanen [Tue, 26 Nov 2013 17:19:41 +0000 (18:19 +0100)]
compositor: gather buffer_transform and _scale into a struct

Gather the variables affecting the coordinate transformations between
buffer and local coordinates into a new struct weston_buffer_viewport.

This will be more useful later, when the crop & scale extension is
implemented.

10 years agoDo not set output->current_mode in compositor.c
Axel Davy [Fri, 8 Nov 2013 11:59:34 +0000 (12:59 +0100)]
Do not set output->current_mode in compositor.c

The field is already set - correctly - in the backend switch_mode.
setting output->current_mode to mode in compositor.c leads to bugs,
since mode can be freed by the shell.
For example, the shell allocates it on the stack for
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER

Signed-off-by: Axel Davy <axel.davy@ens.fr>
10 years agocompositor-x11: Allow r5g6b5 visuals for X11 backend SHM
MoD [Thu, 28 Nov 2013 05:24:21 +0000 (05:24 +0000)]
compositor-x11: Allow r5g6b5 visuals for X11 backend SHM

The support is already present in the pixman renderer, so we can just
check and use it.

10 years agogl-renderer: Fix support for Y_XUXV buffers
Ander Conselvan de Oliveira [Wed, 27 Nov 2013 15:43:51 +0000 (17:43 +0200)]
gl-renderer: Fix support for Y_XUXV buffers

Due to a copy and paste error, the pointer to the vertex shader source
was NULL and the program failed to link.

10 years agoRemove dependency on <GLES2/gl2.h> by replacing GLfloat with float
Tomeu Vizoso [Wed, 27 Nov 2013 12:22:42 +0000 (13:22 +0100)]
Remove dependency on <GLES2/gl2.h> by replacing GLfloat with float

10 years agoexposay: properly go away when the modifier is pressed
Emilio Pozuelo Monfort [Wed, 27 Nov 2013 09:49:08 +0000 (10:49 +0100)]
exposay: properly go away when the modifier is pressed

We no longer receive an exposay_binding() call while exposay
is in-flight as we have grabbed the keyboard, so we need to
listen on the modifiers callback for the modifier press and
release.

10 years agoinput: don't run modifier bindings when the kbd is grabbed
Emilio Pozuelo Monfort [Wed, 27 Nov 2013 09:34:32 +0000 (10:34 +0100)]
input: don't run modifier bindings when the kbd is grabbed

We don't want bindings to be run while the keyboard is grabbed.
Otherwise the binding handler may grab the keyboard too, making
the old grab go away without even being cancelled.

10 years agorpi: avoid vc_dispmanx_set_wl_buffer_in_use without EGL
Pekka Paalanen [Fri, 22 Nov 2013 15:30:39 +0000 (17:30 +0200)]
rpi: avoid vc_dispmanx_set_wl_buffer_in_use without EGL

The symbol is needed only for the EGL buffer path. If --disable-egl is
given to ./configure, there is no need for it, so fix it to actually not
look for that symbol needlessly.

This should fix the runtime error:

Failed to load module: .../rpi-backend.so: undefined symbol:
vc_dispmanx_set_wl_buffer_in_use

when you use --disable-egl and do not have a recent enough
libraspberrypi package (/opt/vc, a.k.a userland.git) that would provide
vc_dispmanx_set_wl_buffer_in_use. Apparently no released version of
userland yet provides this.

The calls are organized into two helper functions to avoid a boolean
argument, and put the #ifdefs away from the main parts of the code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>
10 years agoexposay: provide a cancel func to the ptr grab iface
Emilio Pozuelo Monfort [Tue, 26 Nov 2013 12:32:08 +0000 (13:32 +0100)]
exposay: provide a cancel func to the ptr grab iface

Fixes a crash when cancel is called while exposay is in progress.

10 years agoAutomatically generate weston.ini with the right paths
Neil Roberts [Fri, 22 Nov 2013 16:46:00 +0000 (16:46 +0000)]
Automatically generate weston.ini with the right paths

Previously weston.ini had hardcoded paths for the weston-* clients in
/usr/bin and /usr/libexec. This was a bit annoying when testing Weston
because you wouldn't usually install those in the system prefix. This
patch adds a make rule to automatically generate weston.ini from a
template file with some replacement markers for the paths so that they
can have the right prefix.

10 years agodistinguish touch screen and pointer dnd in client
Xiong Zhang [Mon, 25 Nov 2013 10:42:51 +0000 (18:42 +0800)]
distinguish touch screen and pointer dnd in client

Data device interface in client just handle with pointer's dnd.
If a touch screen trigger dnd, it will use pointer struct like i
nput->sx, input->sy, input->pointer_focus. So if pointer is moving
when touch screen trigeer a dnd, wrong behaviore will occur.
Before touch screen start dnd, system call touch_grab()
to mark the following drag and drop operation is generated by
touch screen.
Defined some common variables in struct input to track dnd.

Note, touch screen and pointer can't generate drag and drop at the
same time, becuae data device protocol can't identify the drag
and drop event is generated by touch screen or pointer.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
10 years agoclient/dnd.c: add dnd support for touch screen in client
Xiong Zhang [Mon, 25 Nov 2013 10:42:50 +0000 (18:42 +0800)]
client/dnd.c: add dnd support for touch screen in client

Adding the interface for touch screen event in clients/dnd.c, once
user touch down on this app, it will trigger a touch and drag
operation.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
10 years agosrc/data_device.c: add dnd support for touch screen
Xiong Zhang [Mon, 25 Nov 2013 10:42:49 +0000 (18:42 +0800)]
src/data_device.c: add dnd support for touch screen

Adding the drag and drop grab interface for touch screen in
src/data-device.c, so the server can handle touch screen
drag and drop operation.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
10 years agoMakefile.am: The wayland rpi doesn't libsession-helper.la
Kristian Høgsberg [Mon, 25 Nov 2013 21:54:30 +0000 (13:54 -0800)]
Makefile.am: The wayland rpi doesn't libsession-helper.la

10 years agoMakefile.am: The rpi backend needs libsession-helper.la
Marco Barisione [Mon, 25 Nov 2013 18:00:48 +0000 (18:00 +0000)]
Makefile.am: The rpi backend needs libsession-helper.la

Signed-off-by: Marco Barisione <marco.barisione@collabora.co.uk>
10 years agoterminal: add touch screen selection support
Xiong Zhang [Mon, 25 Nov 2013 10:42:52 +0000 (18:42 +0800)]
terminal: add touch screen selection support

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Reviewed-by: Kristian Hogsberg <hoegsberg@gmail.com>
10 years agosrc/Makefile.am: correct compile failure for launcher-util.c
Xiong Zhang [Mon, 25 Nov 2013 07:22:50 +0000 (15:22 +0800)]
src/Makefile.am: correct compile failure for launcher-util.c

The following error message is generated during compile
In file included from launcher-util.c:43:0:
compositor.h:35:28: fatal error: wayland-server.h: No such file or directory
 #include <wayland-server.h>

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
10 years agoterminal: Update terminal->end whenever we write a character
Kristian Høgsberg [Mon, 25 Nov 2013 00:54:12 +0000 (16:54 -0800)]
terminal: Update terminal->end whenever we write a character

We used to only update it on newline, which breaks when somebody moves
the cursor below terminal->end and writes stuff.  Instead update it whenever
we write a character to the terminal.

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

10 years agoMakefile.am: Move launcher helpers in to libsession-helper.la library
Kristian Høgsberg [Sun, 24 Nov 2013 23:10:19 +0000 (15:10 -0800)]
Makefile.am: Move launcher helpers in to libsession-helper.la library

10 years agoconfigure.ac: The drm backend no longer requires EGL
Kristian Høgsberg [Sun, 24 Nov 2013 22:45:23 +0000 (14:45 -0800)]
configure.ac: The drm backend no longer requires EGL

We can run with just the pixman renderer and 'dumb' kms buffers.

10 years agoconfigure.ac: Make libdrm optional in weston-launch
Kristian Høgsberg [Sun, 24 Nov 2013 22:37:07 +0000 (14:37 -0800)]
configure.ac: Make libdrm optional in weston-launch

If libdrm is available, weston-launch and launcer-util.c will support
getting the drm device and setting and dropping drm master, otherwise
we'll only support getting input devices.

10 years agotests: Remove an unecessary Makefile.am variable
Kristian Høgsberg [Sat, 23 Nov 2013 20:59:01 +0000 (12:59 -0800)]
tests: Remove an unecessary Makefile.am variable

10 years agotests: Use a helper library for weston-test clients
Kristian Høgsberg [Sat, 23 Nov 2013 20:53:16 +0000 (12:53 -0800)]
tests: Use a helper library for weston-test clients

10 years agotests: Use TEST_CLIENT for test client modules
Kristian Høgsberg [Sat, 23 Nov 2013 20:40:34 +0000 (12:40 -0800)]
tests: Use TEST_CLIENT for test client modules

We abused SIMPLE_CLIENT_LIBS before, but if you disable simple clients,
the test suite fails to link.  Use test client specific variables instead.

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

10 years agoterminal: Init tab ruler after setting terminal->width
Kristian Høgsberg [Sat, 23 Nov 2013 06:43:20 +0000 (22:43 -0800)]
terminal: Init tab ruler after setting terminal->width

terminal_init_tabs() needs an accurate terminal->width to be able
to correctly initialize the tab ruler.

10 years agoinput: Cancel pointer grabs when compositor loses kb focus
Kristian Høgsberg [Sat, 23 Nov 2013 05:12:19 +0000 (21:12 -0800)]
input: Cancel pointer grabs when compositor loses kb focus

This makes sure we pop down popups when the X backend loses keyboard
focus or when the kms backend vt-switches away.

10 years agoshell: don't crash if a pointer's focus is null
Emilio Pozuelo Monfort [Fri, 22 Nov 2013 15:21:20 +0000 (16:21 +0100)]
shell: don't crash if a pointer's focus is null

It's possible for a pointer's focus to be null, e.g. because
the focus surface has been bestroyed. Prevent a crash when
that happens and a client takes too long to respond to a ping.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
10 years agodnd: Simplify drag icon creation
Kristian Høgsberg [Fri, 22 Nov 2013 19:37:16 +0000 (11:37 -0800)]
dnd: Simplify drag icon creation

We used to have to composite the pointer on top of the drag icon, but
the final protocol allows us to specify both a drag icon and a cursor.
Remove the complexity that dealt with that.

10 years agocompositor: set weston_surface:resource to NULL when destroyed
Giulio Camuffo [Fri, 15 Nov 2013 21:06:15 +0000 (22:06 +0100)]
compositor: set weston_surface:resource to NULL when destroyed

with the previous patch the resource isn't used inside weston_surface_destroy()
anymore (aside sending events unuseful for a closing client), so we can safely
reset it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
10 years agotests: .gitignore log files
Pekka Paalanen [Thu, 21 Nov 2013 14:23:58 +0000 (16:23 +0200)]
tests: .gitignore log files

10 years agotests: allow weston test plugin to keep on running
Pekka Paalanen [Thu, 21 Nov 2013 14:23:57 +0000 (16:23 +0200)]
tests: allow weston test plugin to keep on running

If the environment variable WESTON_TEST_CLIENT_PATH is not set, do not
quit Weston in the test plugin.

This allows one to start Weston with the test plugin manually, and then
run any tests also manually, while observing Weston's behaviour over
time. This is useful for:
- Running a test multiple times and checking if Weston leaks (e.g. with
  Valgrind)
- Running tests manually on a backend that is not x11 or wayland,
  especially the backends that require weston-launch, and therefore
  cannot be used with the 'make check' machinery.

This change should not affect 'make check' behaviour, because there
WESTON_TEST_CLIENT_PATH is always set.

Cc: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agotests: add a test causing SIGBUS to the compositor
Pekka Paalanen [Thu, 21 Nov 2013 14:47:02 +0000 (16:47 +0200)]
tests: add a test causing SIGBUS to the compositor

This tests the wl_shm buffer access wrappers, that are supposed to catch
the invalid accesses to a memory-mapped file beyond EOF.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
10 years agoman: document new focus-animation config entry
Emilio Pozuelo Monfort [Wed, 20 Nov 2013 12:22:30 +0000 (13:22 +0100)]
man: document new focus-animation config entry

10 years agoshell: add a client config entry
Emilio Pozuelo Monfort [Wed, 20 Nov 2013 12:22:29 +0000 (13:22 +0100)]
shell: add a client config entry

10 years agologind: change to -1+errno
David Herrmann [Thu, 21 Nov 2013 08:14:46 +0000 (09:14 +0100)]
logind: change to -1+errno

Set errno and return -1 in public API calls like all other weston code
does. Most systemd+dbus calls return negative error-codes instead of -1
and setting errno. Thus, we need to explicitly set errno before returning.

Also note that we must set errno _after_ the cleanup path. Calling
functions like close() in the cleanup path might overwrite errno (which is
not what we want). So protect errno until the final return -1;

10 years agologind: Use dbus_bool_t for bool types in dbus calls
Kristian Høgsberg [Thu, 21 Nov 2013 00:37:07 +0000 (16:37 -0800)]
logind: Use dbus_bool_t for bool types in dbus calls

The gcc built-in 'bool' type is not the same size as dbus_bool_t, which is
an uint32_t.  Passing a pointer to bool where dbus expects a uint32_t *
doesn't work.

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>