Commit Graph

1771 Commits

Author SHA1 Message Date
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
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
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
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
Philip Withnall
4a86a0a57b 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.
2013-12-02 11:44:49 -08:00
Philip Withnall
0f640e219c 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.
2013-12-02 11:44:49 -08:00
Philip Withnall
becb77e211 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.
2013-12-02 11:44:49 -08:00
Xiong Zhang
becf5a342f 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>
2013-12-02 11:44:49 -08:00
Tomeu Vizoso
e4f7b92204 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.
2013-12-02 11:36:29 -08:00
Pekka Paalanen
da75ee1de0 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.
2013-11-28 14:14:10 -08:00
Pekka Paalanen
ba34165ce2 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.
2013-11-28 14:14:08 -08:00
Pekka Paalanen
1fd9c0f81a 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.
2013-11-28 14:14:05 -08:00
Axel Davy
40ee921fff 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>
2013-11-27 22:56:43 -08:00
MoD
1b55a5918c 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.
2013-11-27 22:49:31 -08:00
Ander Conselvan de Oliveira
41a50ea71c 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.
2013-11-27 22:49:31 -08:00
Tomeu Vizoso
0f0a6ffc2e Remove dependency on <GLES2/gl2.h> by replacing GLfloat with float 2013-11-27 22:49:31 -08:00
Emilio Pozuelo Monfort
eed9344430 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.
2013-11-27 22:49:31 -08:00
Emilio Pozuelo Monfort
1539ea2f74 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.
2013-11-27 22:49:31 -08:00
Pekka Paalanen
d5fbfb2e35 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>
2013-11-27 22:49:31 -08:00
Emilio Pozuelo Monfort
234c5242ab exposay: provide a cancel func to the ptr grab iface
Fixes a crash when cancel is called while exposay is in progress.
2013-11-27 22:49:31 -08:00
Xiong Zhang
fd51e7bb57 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>
2013-11-25 16:32:00 -08:00
Kristian Høgsberg
24fc228044 Makefile.am: The wayland rpi doesn't libsession-helper.la 2013-11-25 13:54:30 -08:00
Marco Barisione
12e750bbc4 Makefile.am: The rpi backend needs libsession-helper.la
Signed-off-by: Marco Barisione <marco.barisione@collabora.co.uk>
2013-11-25 11:38:50 -08:00
Xiong Zhang
e955525f1a 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>
2013-11-25 10:59:01 -08:00
Kristian Høgsberg
989e9d582c Makefile.am: Move launcher helpers in to libsession-helper.la library 2013-11-24 15:16:23 -08:00
Kristian Høgsberg
d2c9d8af50 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.
2013-11-24 15:16:23 -08:00
Kristian Høgsberg
ebd5fd4753 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.
2013-11-22 21:12:19 -08:00
Emilio Pozuelo Monfort
3d0fc76dd5 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>
2013-11-22 13:31:55 -08:00
Giulio Camuffo
0d379744d3 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>
2013-11-21 22:00:17 -08:00
Emilio Pozuelo Monfort
46ce798d28 shell: add a client config entry 2013-11-21 21:35:17 -08:00
David Herrmann
fcb6bf43a4 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;
2013-11-21 16:28:08 -08:00
Kristian Høgsberg
f86c39058a 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>
2013-11-21 10:45:41 -08:00
Giulio Camuffo
576fe2af4b input: set the focus to NULL when the focus's resource is destroyed
with the surface ref-count feature a surface may live on after its
resource was destroyed. so listen for the resource destroy signal
and set the focus to NULL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-20 16:59:00 -08:00
Jason Ekstrand
3ec57f5d69 compositor-drm: Release the correct buffer in drm_output_release_fb 2013-11-19 13:25:10 -08:00
Jason Ekstrand
42133d47d3 input: Fix a segfault in focus checking
Without this, weston will segfault whenever the focus is a non-client
surface such as the black surface in fullscreen.
2013-11-19 13:23:40 -08:00
Ander Conselvan de Oliveira
895b1fdcb2 gl-renderer: Attach buffer during surface state creation if possible
When a renderer switch happens, it is possible that when the surface
state is created, a buffer for the given surface is already available.
In that case, run the attach routine so that the pixel contents are
properly set. Otherwise, it would only be set when a new attach request
is made for that surface.

Also, change the drm backend so that it keeps the buffer reference in
the weston_surface when running with the pixman renderer. The pixman
renderer keeps a reference to it anyway, so it is never released
early.

This makes the renderer transition seamless, without leaving a black
screen as before.
2013-11-19 13:11:25 -08:00
Ander Conselvan de Oliveira
65796816b9 compositor-drm: Add key binding to switch from pixman to GL renderer
When running with the pixman renderer, the debug binding 'W'
(mod-shift-space W) will cause the compositor to load gl-renderer.so
and start using it instead of the pixman renderer.
2013-11-19 13:11:20 -08:00
Pekka Paalanen
b188e912c3 compositor: fix sub-surface view stacking order
If you opened a window with sub-surfaces, and then raised another window
on top of that, the underlaying window's main surface was stacked
properly, but the sub-surfaces remained on top of the raised window.
IOW, the raised window was in between the other window and its
sub-surfaces.

This got broken in a7af70436b, "Split the
geometry information from weston_surface out into weston_view".

Fix the issues:

In view_list_add_subsurface_view(), the views need to be added to the
end of the list, not to the head. This alone fixes the above problem,
but causes the sub-surface views to be stacked irrespective of their
surface stacking order. The stacking order in this test case is fixed by
the changes to view_list_add(), but for sub-sub-surfaces a similar
change is needed in view_list_add_subsurface_view() too.

In view_list_add(), build the view list in the sub-surface stacking
order, instead of pulling the parent surface always on top. Also handle
the case, when the subsurface_list is completely empty: the parent
surface's view must still be added.

Reported-by: Julien Isorce <julien.isorce@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Cc: Jason Ekstrand <jason@jlekstrand.net>
2013-11-19 12:57:24 -08:00
Emilio Pozuelo Monfort
17467d602d exposay: move the pointer in our motion handler
This is necessary since commit 1959ab.
2013-11-19 11:52:12 -08:00
Emilio Pozuelo Monfort
da64426685 shell: Set output on the focus_surfaces' view
Otherwise we crash when animating the view.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2013-11-19 11:51:51 -08:00
Emilio Pozuelo Monfort
5c22ce652d exposay: Activate a surface when hovering it
This causes the surface to get the keyboard focus, which in turn
causes focus-animation to nicely work with exposay, making the
not focused surfaces to be dimmed.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2013-11-19 11:51:44 -08:00
Emilio Pozuelo Monfort
8224309f14 exposay: add cancel impl to the kbd grab iface
Otherwise we'll crash when cancel is called.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2013-11-19 11:51:26 -08:00
Emilio Pozuelo Monfort
03251b6a7a shell: Implement alt-tab switcher
Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2013-11-19 11:51:18 -08:00
Emilio Pozuelo Monfort
aa7a4761f6 input: Don't send leave events to destroyed views
If a view which has focus is destroyed, we would send a leave
event while changing focus, causing a segfault. Prevent this
by listening to the view's destroy signal and removing it from
the pointer focus.

Signed-off-by: Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
2013-11-19 11:49:40 -08:00
Daniel Stone
df8133b725 Add Exposay
Exposay provides window overview functions which, when a key which
produces the binding modifier is pressed on its own, scales all
currently-open windows down to be shown overlaid on the desktop,
providing keyboard and mouse navigation to be able to switch window
focus.

[pochu: rebased, ported to weston_view]
2013-11-19 11:49:33 -08:00
Daniel Stone
a67e6b9818 Add move/scale animation
Add an animation which moves a surface to a new location, at the same
time as also rescaling it to a different size from the origin, rather
than the existing scale animation which resizes from the centre.

[pochu: rebased, ported to weston_view]
2013-11-19 11:49:28 -08:00
Daniel Stone
96d47c0ef7 Add modifier-only binding
Add the ability to bind to modifiers; the binding is armed when a key
which sets the requested modifier is pressed, and triggered if the key
is released with no other keys having been pressed in the meantime, as
well as mouse buttons or scroll axes.

This only works for direct modifiers (e.g. Shift and Alt), not modifiers
which latch or lock.

[pochu: rebased]
2013-11-19 11:49:25 -08:00
Louis-Francis Ratté-Boulianne
b482dbd7eb animation, shell: add kbd focus change animation
When enabled, this will make all but the keyboard-focused window dim.
Also the background gets dimmed, if there are any windows open. The
panel is not dimmed.

When the keyboard focus changes, the change in dimming is animated.

The dimming is implemented with transparent solid-color surfaces, two at
most. The net effect of two overlapping dim surfaces is kept constant
during animations (stable fade animation).

There is a new weston.ini option "focus-animation", that defaults to
none, and can be set to "dim-layer" to enable the focus change
animation.

[pq: Sliced, squashed, and rebased the patch series. Fixed surface alpha
interaction with the switcher. Wrote the commit message.]

[pochu: rebased, ported to weston_view]
2013-11-19 11:49:20 -08:00
Axel Davy
dd8b88d102 Wayland backend: set the opaque region when starting fullscreen
The opaque region is not set when we start the nested
compositor fullscreen. This patch fixes this.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
2013-11-19 11:44:51 -08:00
Pekka Paalanen
a662206e71 protocol: move sub-surfaces to Wayland
This reverts commit 2396aec684.

This exact version of the sub-surface protocol has been copied into
Wayland core. Therefore it must be removed from here to avoid build
conflicts and useless duplication.

No other changes to sub-surface protocol consumers are needed, the
identical API is now offered by libwayland-client and libwayland-server.

The commit adding sub-surfaces to Wayland is:
Author: Pekka Paalanen <pekka.paalanen@collabora.co.uk>

    protocol: add sub-surfaces to the core

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-11-15 16:23:17 -08:00
Lubomir Rintel
ba44c6bf2e Add [core] backend option
This allows specifying a particular backend to load in a manner similar to
modules.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
2013-11-15 16:17:51 -08:00
Giulio Camuffo
cdb4d29096 compositor: add a way to override the default pointer grab 2013-11-15 16:17:51 -08:00
Giulio Camuffo
1959ab8d22 input: let the pointer motion handlers move the pointer
this allows to implement pointer barriers by using a custom handler
2013-11-15 16:17:51 -08:00
Giulio Camuffo
412b024be8 zoom: use the new pointer motion signal to move the zoom frame. 2013-11-15 16:17:51 -08:00
Giulio Camuffo
6fcb378c01 input: add a motion signal to weston_pointer
The signal will be emitted after the pointer is moved. A shell plugin
can listen to the signal and activate certain effects when the pointer
touches the screen corners, for instance.
2013-11-15 16:17:51 -08:00
Kristian Høgsberg
a3a784adae compositor: Schedule a repaint in weston_view_damage_below()
We always want a repaint if the view was damaged or changed.  In
particular, we want weston_view_update_transform() to schedule a
repaint for the old and new position if we change the view transform.
2013-11-13 21:33:43 -08:00
Neil Roberts
e505171a32 Add calls to wl_shm_buffer_begin/end_access
This wraps all accesses to an SHM buffer between wl_shm_buffer_begin
and end so that wayland-shm can install a handler for SIGBUS and catch
attempts to pass the compositor a buffer that is too small.
2013-11-13 16:32:58 -08:00
Jonas Ådahl
f707e8145b filter: Remove unused variable
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-12 16:20:34 -08:00
Jonas Ådahl
e82f8e4b0f evdev: Synchronize keys only if seat is keyboard capable
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-11-12 16:20:19 -08:00
Jason Ekstrand
5ea048014d compositor-wayland: Add fullscreen support
This adds fullscreen support to the wayland backend.  You can make any
output fullscreen by the shortcut CTRL+ALT+F.  You can also run weston with
the --fullscreen option which causes it to create a single fullscreen
output.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-11 13:38:02 -08:00
Jason Ekstrand
12c6dd965b compositor-wayland: Add a --scale option
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-11 13:37:19 -08:00
Jason Ekstrand
0cf39351bb compositor-wayland: Move config parsing into backend_init
This cleans up the configuration and command parsing and separates it from
compositor/output initialization.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-11 13:37:08 -08:00
Jason Ekstrand
584fb62437 compositor-wayland: Fix cursor coordinate transforms so it works on translated outputs
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-11 13:36:45 -08:00
Jason Ekstrand
06ced80f93 compositor-wayland: rename wayland_compositor.inputs to input_list
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-11 13:36:32 -08:00
Jason Ekstrand
4d615a7aa1 compositor-wayland: Remove unused output handling code
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-11 13:36:22 -08:00
Jason Ekstrand
48ce42177f compositor-wayland: Parse [output] config sections and more options
This commit makes the wayland backend search through the config for
[output] sections with names starting with "WL" and create outputs
accordingly.  Outputs created due to the config file support mode, scale,
and transform parameters.  It also listens for the --output-count
command-line option.

This brings the wayland backend almost up to par, in terms of functionality
with the X11 backend.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:35:01 -08:00
Jason Ekstrand
33ff636812 Move region transformation code to weston_transformed_region
Both the Pixman renderer and the X11 backend contained effectively the same
region transformation code.  This commit adds a weston_transformed_region
function and changes pixman-renderer and compositor-x11 to use it.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:59 -08:00
Jason Ekstrand
b6a3cc7f17 Make weston_output_transform_coordinate more sane
The output is renamed "output" from "x11_output" and the input coordinates
are changed to wl_fixed_t from int.  This way it is useable in
compositor-wayland as well as compositor-x11 and evdev.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:57 -08:00
Jason Ekstrand
00b842854b Remove the concept of a border from weston_output.
The only user for this was the wayland backend with the GL renderer.  It is
not needed in the Pixman renderer because you can easily create subimages.
All of the fancy output matrix calculations can be replaced by a single
glViewport call.  Also, it didn't work with outputs located anywhere but
(0, 0) and I'm pretty sure output transformed outputs would break it too.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:54 -08:00
Jason Ekstrand
ff2fd46e9c compositor-wayland: Add pixman/SHM fallback mode
This also adds a --use-pixman command-line option to enable the pixman
renderer explicitly.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:47 -08:00
Jason Ekstrand
310382fb2f gl-renderer: Remove the renderer-global border support
This was only ever used by the wayland backend and is no longer used there.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:13 -08:00
Jason Ekstrand
7744f71550 compositor-wayland: Add an actual frame around the compositor window
This adds a window frame with a close button.  Similar to the X11 backend,
The window supports dragging but not resizing.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:10 -08:00
Jason Ekstrand
0b61bf444b gl-renderer: Add support for per-output multi-texture borders.
The first advantage of this new API is that it is per-output instead of
global to the gl_renderer instance.  This means that different windows can
have different titles, different button states, etc.  The new api also uses
four textures (one for each side) instead of one.  This allows you to draw
real borders with text and buttons in them instead of a simple image that
gets streached.

Images will be scaled as needed, so the right and left can be one pixel
tall if desired.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:08 -08:00
Jason Ekstrand
8f89fcb22b compositor-wayland: Rename structure members and make things more consistant
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-11-07 16:34:04 -08:00
Kristian Høgsberg
1d75c7d3a2 xwm: Set input region for fullscreen surfaces correctly
The logic here broke at some point so that we would only update the
input region for non-fullscreen windows.  Thus, a fullscreen window would
be stuck with whatever size the most recent non-fullscreen size was.

https://bugs.freedesktop.org/show_bug.cgi?id=69219
2013-10-30 23:46:08 -07:00
Jason Ekstrand
286ff6817b compositor-wayland: Flush the display on commit
This fixes the problem where animations will wait to play until input is
received.  In general, it also makes the backend far more responsive.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>

https://bugs.freedesktop.org/show_bug.cgi?id=68221
2013-10-30 23:31:46 -07:00
Kristian Høgsberg
453de7a7e5 compositor-wayland: Handle HUP or ERR from event loop
Otherwise we end up in a busy loop instead of exiting nicely.
2013-10-30 23:15:44 -07:00
Kristian Høgsberg
a28ba55b56 launcher: Make sure we drop drm master before we allow VT switches
On shutdown, we can risk having a pending vt switch that we normally
handle in the vt signal handler.  However as we put the vt back in VT_AUTO
mode, the pending VT switch will go through and if we haven't dropped
drm master at that point, we could switch to another display server
without dropping drm master.  That will typically crash the other server,
so let's try to make sure we don't do that.

https://bugs.freedesktop.org/show_bug.cgi?id=70877
2013-10-30 16:27:16 -07:00
Kristian Høgsberg
aa2ee8bdf6 shell: Create view for lock surface
Nothing created the view for the lock surface and weston would crash
when trying to display it.

https://bugs.freedesktop.org/show_bug.cgi?id=70873
2013-10-30 15:49:45 -07:00
Kristian Høgsberg
529a81a898 logind: Return proper error value when tty or seat doesn't match
If the seat or tty doesn't match we return with r == 0, which looks like
success to weston_launcher_connect(), which then fails to fall back
to the legacy path.

https://bugs.freedesktop.org/show_bug.cgi?id=70876
2013-10-30 13:53:01 -07:00
Kristian Høgsberg
90dfb11428 animation.c: Schedule a repaint when the animation is done
Otherwise we don't repaint with the final state of the surface and
we're stuck with the second-to-last frame of the animation until
something else (moving the mouse or such) triggers a redraw.

https://bugs.freedesktop.org/show_bug.cgi?id=70930
2013-10-30 09:07:04 -07:00
Kristian Høgsberg
912e0a117a Fall back to ANIMATION_NONE if startup-animation is zoom
get_animation_type() parses "none", "zoom" and "fade" but for the
startup animation, we only support "none" and "fade".  If we get "zoom"
just fall back to "none" like we do for all unrecognized strings.

https://bugs.freedesktop.org/show_bug.cgi?id=71006
2013-10-30 08:59:55 -07:00
Kristian Høgsberg
b27901c5a7 input.c: Rename default grab functions to be consistent
Jonas recent patches made the inconsistency obvious, this patch fixes it.
2013-10-28 15:32:02 -07:00
Jonas Ådahl
1ea343e1be Add cancel function to grab interfaces
A grab can potentially allocate memory and would normally end the grab
itself, freeing the allocated memory in the process. However at in some
situations the compositor may want to abort a grab. The grab owner still
needs to free some memory and abort the grab properly. To do this a new
function 'cancel' is introduced in all the grab interfaces instructing
the grabs owner to abort the grab.

This patch also hooks up grab cancelling to seat device releasing and
when the compositor looses focus, which would potentially leak memory
before.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-28 14:44:06 -07:00
Jonas Ådahl
1c6e63e880 shell: Don't leak weston_touch_move_grab structs
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-28 14:39:18 -07:00
Jonas Ådahl
b18018867b input: Remove unused variable
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-28 14:38:38 -07:00
Jonas Ådahl
f88571fdef compositor-x11: Hide update_xkb_keymap behind #ifdef HAVE_XCB_XKB
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-28 14:38:27 -07:00
Tomeu Vizoso
96dc9e4f1f rpi: Remove create_view and destroy_view implementations
And also remove the vfunc definitions from the compositor as they
are unused now.
2013-10-28 14:36:26 -07:00
Kristian Høgsberg
0eee0a28ba weston-launch: Revoke and close input fds when we vt switch away
We used to leak the input fds, as weston would reopen all fds on vt
enter.  We could just close them after sending the open fd through the
socket, but this patch also adds support for the new EVIOCREVOKE evdev
ioctl, that revokes the fd in question (including the copy that we
sent to the compositor).

https://bugs.freedesktop.org/show_bug.cgi?id=70849
2013-10-25 13:34:58 -07:00
Ander Conselvan de Oliveira
adda00e72f pixman-renderer, gl-renderer: Destroy surface state with the renderer
Previously the renderers destroy function assumed they are only called
when the compositor is shutting down and that the compositor had
already destroyed all the surfaces. However, if a runtime renderer
switch would be done, the surface state would be leaked.

This patch adds a destroy_signal to the pixman and gl renderers. The
surface state objects will listen for that signal and destroy
themselves if needed.

This is a step towards runtime switchable renderers.
2013-10-25 12:21:51 -07:00
Ander Conselvan de Oliveira
aa398ae1f3 compositor: Let renderers create and destroy surface state on their own
Remove create_surface() and destroy_surface() from the renderer
interface and change the renderers to create surface state on demand
and destroy it using the weston_surface's destroy signal.

Also make sure the surfaces' renderer state is reset to NULL on
destruction.

This is a step towards runtime switchable renderers.

(rpi-renderer changes are only compile-tested)
2013-10-25 12:21:51 -07:00
Ander Conselvan de Oliveira
6b16214fb9 pixman-renderer, gl-renderer: Destroy debug bindings on clean up
Also make sure backends destroy the renderers before shutting down the
compositor to avoid a double call to weston_binding_destroy().

This is a step towards making renderers switchable during runtime.
2013-10-25 12:17:51 -07:00
Ander Conselvan de Oliveira
c68b1085ed pixman-renderer: Initialize pixman-renderer struct with zeros
Othrewise a crash may happen because of an unitialized value of the
create_view field.
2013-10-25 11:09:10 -07:00
Tomeu Vizoso
7498758525 rpi: Protect in-use DispmanX resources from premature deletion
The compositor will check if the client destroyed the wl_buffer
while it was in use in a display update, and delete the resource
itself once the update has finished.
2013-10-25 11:05:45 -07:00
Tomeu Vizoso
34dad7d69b rpi: Remove dangling reference to weston_view
This also marks the rpir_view for destroy in rpi_renderer_finish_frame()
2013-10-25 11:05:03 -07:00
Tomeu Vizoso
e3df6f1bbc rpi: Only check for prematurely destroyed wl_buffers in the EGL case 2013-10-25 11:03:57 -07:00
Tomeu Vizoso
4424774782 rpi: EGL surfaces need to be swapped always that we have an incoming back buffer 2013-10-25 11:03:47 -07:00
Tomeu Vizoso
15767813c2 rpi: Fix logging of buffer swaps for the EGL case 2013-10-25 11:03:25 -07:00
Tomeu Vizoso
5c3ea3b71a rpi: Initialize surface's list of views 2013-10-25 11:03:18 -07:00
Tomeu Vizoso
1d7ad62768 rpi: Link with EGL if ENABLE_EGL 2013-10-25 11:03:06 -07:00
Kristian Høgsberg
c85f1d4595 shell.c: Prevent moving a window from more than one source
It was possible to start a move or resize with a pointer and then
start another move for the same surface with touch or a pointer from
another seat, which would make the window flicker around.  With this
commit, we now reject any attempts to move or resize a surface that is
currently grabbed.
2013-10-24 16:52:00 -07:00
Kristian Høgsberg
0d94f41b44 shell.c: Don't overwrite focus surface argument in activate_binding()
We need either the pointer or touch focus, which is passed in to
activate_binding().  Don't overwrite this with the pointer focus.
2013-10-24 16:29:51 -07:00
Kristian Høgsberg
7ab139ce16 shell: Don't cast weston_view to surface when we just need view->surface
Most of the shell.c bindings take effect on the current pointer or
touch focus.  That's now a view, but we need a surface in these cases.
Just get the surface from view->surface instead of trying to cast a
view to a surface.
2013-10-24 16:21:39 -07:00
Kristian Høgsberg
aa2700dcc8 compositor: Remove two unused variables 2013-10-24 15:54:49 -07:00
Kristian Høgsberg
48588f8696 shell: Create a view for the grab_surface
Without the view, we can't set pointer and touch focus to the grab_surface
and touch moving fails.
2013-10-24 15:51:35 -07:00
Kristian Høgsberg
c3244d7abc input: Properly handle setting touch focus to NULL
This happens on TOUCH_UP, and we unconditionally dereference view->surface.
2013-10-24 14:21:53 -07:00
Kristian Høgsberg
b5a4f986d4 compositor-x11: Use the fullscreen size provided by the configure event
Make sure we initialize the x11 shm state using the right window size.

https://bugs.freedesktop.org/show_bug.cgi?id=70590
2013-10-23 23:38:50 -07:00
Kristian Høgsberg
a3a0e1867e shell: Add the right output object to the shell output_list
Error on my part while renaming the shell_output variable.
2013-10-23 23:36:04 -07:00
Xiong Zhang
6b48142f8a shell: register output->destroy_signal handler
setup_output_destroy_handler() deal with output created at
drm backend initialize time.
handle_output_create() deal with output created by hot plug handler
output_destroy_handler is removed when output was unplugged or
shell is destroyed.

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2013-10-23 23:17:15 -07:00
Xiong Zhang
971165368d compositor: set surface->plane from destroyed plane to NULL
In drm backend, the cursor_surface->plane point to
drm_output->cursor_plane.when this output is removed,
drm_output->cursor_plane is destroyed, butcursor_surface->plane
still point to destroyed plane. So once mouse move to this
cursor_surface and system will repaint this cursor_surface,
segment fault will generate in weston_surface_damage_below() function.

V2:
-set surface->plane to NULL whose plane point to unplugged output,
 then change weston_surface_damage_below() to do nothing if
 surface->plane is NULL (Kristian)
-set surface->plane to NULL in weston_surface_unmap(),
 so that all surfaces that have a non-NULL plane pointer wil be
 on compositor->surface_list (Kristian).

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

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
2013-10-23 22:23:28 -07:00
Rui Matos
0c194ced57 compositor-wayland: Handle keymap changes 2013-10-22 15:25:01 -07:00
Rui Matos
c6c2f8e655 compositor-x11: Update keymap when XKB keymap changes 2013-10-22 15:24:58 -07:00
Rui Matos
65196bc0b9 input: Add core API to update the keymap
How and when to update the keymap is left to each backend.

The new keymap only becomes effective when no keys are pressed and we
keep latched and locked modifiers from the previous state.
2013-10-22 15:24:55 -07:00
Jason Ekstrand
a7af70436b Split the geometry information from weston_surface out into weston_view
The weston_surface structure is split into two structures:

 * The weston_surface structure storres everything required for a
   client-side or server-side surface.  This includes buffers; callbacks;
   backend private data; input, damage, and opaque regions; and a few other
   bookkeeping bits.

 * The weston_view structure represents an entity in the scenegraph and
   storres all of the geometry information.  This includes clip region,
   alpha, position, and the transformation list as well as all of the
   temporary information derived from the geometry state.  Because a view,
   and not a surface, is a scenegraph element, the view is what is placed
   in layers and planes.

There are a few things worth noting about the surface/view split:

 1. This is *not* a modification to the protocol.  It is, instead, a
    modification to Weston's internal scenegraph to allow a single surface
    to exist in multiple places at a time.  Clients are completely unaware
    of how many views to a particular surface exist.

 2. A view is considered a direct child of a surface and is destroyed when
    the surface is destroyed.  Because of this, the view.surface pointer is
    always valid and non-null.

 3. The compositor's surface_list is replaced with a view_list.  Due to
    subsurfaces, building the view list is a little more complicated than
    it used to be and involves building a tree of views on the fly whenever
    subsurfaces are used.  However, this means that backends can remain
    completely subsurface-agnostic.

 4. Surfaces and views both keep track of which outputs they are on.

 5. The weston_surface structure now has width and height fields.  These
    are populated when a new buffer is attached before surface.configure
    is called.  This is because there are many surface-based operations
    that really require the width and height and digging through the views
    didn't work well.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-10-22 13:34:11 -07:00
Kristian Høgsberg
d4c1cd77c3 logind: Remove missing 'else'
Only fall through to cleaning up weston-launch or standalone state
if we didn't use logind.
2013-10-22 13:19:23 -07:00