Commit Graph

3806 Commits

Author SHA1 Message Date
Neil Roberts
2855766333 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.
2013-12-04 16:34:07 -08:00
Neil Roberts
15a8d340fd 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.
2013-12-04 16:34:07 -08:00
Neil Roberts
6bf23879e9 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.
2013-12-04 16:34:07 -08:00
Neil Roberts
8fbe3a68d4 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.
2013-12-04 16:34:07 -08:00
Kristian Høgsberg
b7fd89192f build: Fix out-of-tree build for desktop-shell 2013-12-04 12:57:02 -08:00
Rafael Antognolli
ba5d2d76af shell: Fix activate logic on surface map.
It should activate the newly mapped surface if not locked.
2013-12-04 11:55:03 -08:00
Pekka Paalanen
477333285e 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>
2013-12-04 11:38:40 -08:00
Pekka Paalanen
53b41c7890 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>
2013-12-04 11:38:26 -08:00
Pekka Paalanen
bc91e5120c rpi: compile in the common udev code
In a recent commit 37d38d932c, "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>
2013-12-04 11:38:08 -08:00
Pekka Paalanen
e47d0d986c 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>
2013-12-04 11:37:57 -08:00
Kristian Høgsberg
677a5f5ac2 desktop-shell: Split out input-panel code 2013-12-04 11:03:24 -08:00
Kristian Høgsberg
1ef231377c desktop-shell: Split out exposay immplementation 2013-12-04 10:20:02 -08:00
Kristian Høgsberg
19d1e6b185 desktop-shell: Move to new desktop-shell subdirectory 2013-12-04 10:20:02 -08:00
Kristian Høgsberg
2ba10df300 Move xwayland up one directory level 2013-12-04 10:20:02 -08:00
Kristian Høgsberg
873b515aee 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.
2013-12-04 10:18:29 -08:00
Dima Ryazanov
cae1f0ff2d 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>
2013-12-03 16:13:08 -08:00
Dima Ryazanov
b03b87fe63 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>
2013-12-03 16:12:54 -08:00
Dima Ryazanov
e5a3208373 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>
2013-12-03 15:54:44 -08:00
Jonas Ådahl
767d891c35 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>
2013-12-03 15:16:21 -08:00
David Herrmann
aedc7732eb 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..).
2013-12-03 12:57:01 -08:00
Rafael Antognolli
ea997ac696 xdg-shell: Add key bindings for setting maximized and fullscreen. 2013-12-03 12:57:01 -08:00
Rafael Antognolli
65f98d8c2f xdg-shell: xdg_surface_set_output should only affect fullscreen. 2013-12-03 12:57:01 -08:00
Rafael Antognolli
3c4e3f7cc7 xdg-shell: Add surface size to configure.
Also emit configure on unset_maximized and unset_fullscreen.
2013-12-03 12:57:01 -08:00
Rafael Antognolli
e2a3455642 xdg-shell: Implement xdg-shell interface.
The whole xdg-shell interface is implement, except from the "focused_set"
and "focused_unset" events.
2013-12-03 12:57:01 -08:00
Rafael Antognolli
4b99a40bcb 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.
2013-12-03 11:35:25 -08:00
Rafael Antognolli
ed207b4bd5 shell: Remove SHELL_SURFACE_TRANSIENT. 2013-12-03 11:35:25 -08:00
Rafael Antognolli
03b16597e0 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.
2013-12-03 11:35:25 -08:00
Rafael Antognolli
3c4dc74ceb 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.
2013-12-03 11:35:24 -08:00
Jonas Ådahl
91fed5419c 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>
2013-12-03 08:39:55 -08:00
Jonas Ådahl
7395ea05c7 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>
2013-12-03 08:38:25 -08:00
Jason Ekstrand
918f2dd4cf 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.
2013-12-02 22:17:58 -08:00
Pekka Paalanen
fdca95c7db 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>
2013-12-02 16:20:58 -08:00
Pekka Paalanen
5b4ddbc11e 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>
2013-12-02 16:20:27 -08:00
Emilio Pozuelo Monfort
8a81b83900 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>
2013-12-02 15:44:49 -08:00
Jonas Ådahl
3e12e63f03 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>
2013-12-02 15:24:36 -08:00
Jonas Ådahl
cbfa7f7b22 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>
2013-12-02 15:24:22 -08:00
Jonas Ådahl
9484b695b9 input: Keep track of number of touch points inside touch struct
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-02 15:24:05 -08:00
Jonas Ådahl
37d38d932c 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>
2013-12-02 15:23:48 -08:00
Philip Withnall
da704d97fa 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.
2013-12-02 11:44:51 -08:00
Philip Withnall
2c3849be91 shell: Fix a potential NULL pointer dereference
get_shell_surface() may return NULL. Found by scan-build.
2013-12-02 11:44:51 -08:00
Philip Withnall
648a4dd3ec 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
2013-12-02 11:44:51 -08:00
Philip Withnall
ed8f1a9e4b shell: Factor out common code to create fullscreen black surfaces 2013-12-02 11:44:51 -08:00
Philip Withnall
83ffd9d17b 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.
2013-12-02 11:44:51 -08:00
Philip Withnall
e1d75ae73f shell: Update a shsurf’s layer when its surface type changes 2013-12-02 11:44:51 -08:00
Philip Withnall
07926d90d1 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).
2013-12-02 11:44:50 -08:00
Philip Withnall
b995e1d053 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.
2013-12-02 11:44:50 -08:00
Philip Withnall
dc4332f1ff 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.
2013-12-02 11:44:50 -08:00
Philip Withnall
f85fe84ec3 shell: Tidy up unset_fullscreen()
No functional changes, merely some presentational cleanup.
2013-12-02 11:44:50 -08:00
Philip Withnall
659163d25c 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.
2013-12-02 11:44:50 -08:00
Philip Withnall
352e7ed527 shell: Factor out common code to set a shsurf’s output 2013-12-02 11:44:50 -08:00