profile/ivi/weston-ivi-shell.git
10 years agoclients: add scaler test app
Jonny Lamb [Tue, 26 Nov 2013 17:19:48 +0000 (18:19 +0100)]
clients: add scaler test app

This client tests the wl_scaler and wl_surface_scaler protocol
extensions by cropping and then scaling a surface to ensure it is
rendered correctly. More details in comments in the code.

10 years agopixman-renderer: implement surface scaling and cropping
Jonny Lamb [Tue, 26 Nov 2013 17:19:47 +0000 (18:19 +0100)]
pixman-renderer: implement surface scaling and cropping

The pixman renderer doesn't use the weston_surface_to_buffer*
functions to alter coordinates depending on buffer transformation,
buffer scaling, and surface scaler (wl_surface_scaler).
pixman_transform_scale() is used instead to perform said
transformations without having to modify each coordinate.

10 years agocompositor: transform surface coordinates if a surface scaler is used
Jonny Lamb [Tue, 26 Nov 2013 17:19:46 +0000 (18:19 +0100)]
compositor: transform surface coordinates if a surface scaler is used

Implements wl_surface_scaler.set by setting desired
src_{x,y,width,height} and dst_{width,height} values in the
weston_buffer_viewport struct, then altering coordinates in
weston_surface_to_buffer* functions if there is a scaler set for said
surface.

10 years agocompositor: add stub scaler resources
Jonny Lamb [Tue, 26 Nov 2013 17:19:45 +0000 (18:19 +0100)]
compositor: add stub scaler resources

This registers the wl_scaler global object and lets clients create
wl_surface_scaler objects for surfaces. wl_surface_scaler.set is not
implemented so this doesn't really do anything useful yet.

10 years agoprotocol: crop & scale RFC v3
Pekka Paalanen [Tue, 26 Nov 2013 17:19:44 +0000 (18:19 +0100)]
protocol: crop & scale RFC v3

Add cropping and scaling to wl_surface.

Add a global factory interface wl_scaler, which creates
wl_scaler_surface objects tied to a given wl_surface. The
wl_scaler_surface object can be used to set a cropping and scaling
transformation to change how a wl_buffer maps to wl_surface contents.

Changes in v2:

Take into account buffer_transform and buffer_scale, and try to explain
more clearly how the coordinate transformations work and what their
order is. Add, that crop and scale state is double-buffered. Explain
missing dst_x, dst_y.  Clarify that undefined content still is some
content, but NULL buffer implies no content nor size.

Changes in v3:

Disallow zero values for dst_width and dst_height.

Open issues:

Should this be a separate interface like here, or just a wl_surface
request?

If we keep this as a separate interface, rename wl_surface_scaler to
wl_viewport.

10 years agoAdd a weston_surface_set_size function
Jason Ekstrand [Thu, 5 Dec 2013 02:32:03 +0000 (20:32 -0600)]
Add a weston_surface_set_size function

Surfaces that are created by clients get their size automatically updated
by the attach/commit.  Surfaces created directly by shells (such as black
surfaces) sometimes need to be manually resized.  This function allows you
to do that while being somewhat less messy than messing with the internals
of weston_surface manually.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
10 years agoshell: Reset fullscreen and maximized state on output unplug
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:58 +0000 (22:10 +0200)]
shell: Reset fullscreen and maximized state on output unplug

When a view is moved to another output because its current output was
unplugged, remove the fullscreen and maximized state.

10 years agodesktop-shell: Invalidate saved position when output is destroyed
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:57 +0000 (22:10 +0200)]
desktop-shell: Invalidate saved position when output is destroyed

If the saved position for a fullscreen or maximized output view is in an
output that has been unplugged, the coordinates don't make sense
anymore. In that case, invalidate them and use the initial position
algorithm when changing them back to the basic state.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor: Make pointers visible when an output is unplugged
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:56 +0000 (22:10 +0200)]
compositor: Make pointers visible when an output is unplugged

Previously, if a pointer was inside an output that was unplugged, it
could potentialy end up outside any valid output forever. With this
patch, the pointer is moved to the "closest" output to the pointer.

10 years agocompositor: Don't repaint outputs being destroyed
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:55 +0000 (22:10 +0200)]
compositor: Don't repaint outputs being destroyed

Set a flag when an output is being destroyed and use that to avoid
repainting. This allows functions that schedule an output repaint to
be called when the output is being destroyed without causing the
compositor to crash.

10 years agocompositor: Ensure views are visible if their output was unplugged
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:54 +0000 (22:10 +0200)]
compositor: Ensure views are visible if their output was unplugged

Use the output destroy signal to move the views in the event the output
was unplugged.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor: Move views when outputs are moved
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:53 +0000 (22:10 +0200)]
compositor: Move views when outputs are moved

Previously, when an output was moved due to another output being
unplugged, the views on the first output would remain in the same
position.

This patch adds an output_move signal that the views listen too in
order to repostion themselves in the event of an unplug.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor-headless, compositor-rdp: Don't call weston_output_move()
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:52 +0000 (22:10 +0200)]
compositor-headless, compositor-rdp: Don't call weston_output_move()

The call to weston_output_move() when creating the output is
unnecessary. That is already called by wesotn_output_init().

10 years agocompositor: Move the logic of moving outputs into the core
Zhang, Xiong Y [Fri, 13 Dec 2013 20:10:51 +0000 (22:10 +0200)]
compositor: Move the logic of moving outputs into the core

Instead of having the backends move the remaining outputs when one is
destroyed, let the core compositor deal with that.

Signed-off-by: Zhang, Xiong Y <xiong.y.zhang@intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
10 years agocompositor: Remove output from list in weston_output_destroy()
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:50 +0000 (22:10 +0200)]
compositor: Remove output from list in weston_output_destroy()

When destroying ouputs, they would sometimes be removed before the call
to weston_output_destory() and sometimes after, depending on the
backend. Now the output is remove withing that function so the behavior
is standard across all backends.

10 years agocompositor-x11: Only destroy one output when the close button is pressed
Ander Conselvan de Oliveira [Fri, 13 Dec 2013 20:10:49 +0000 (22:10 +0200)]
compositor-x11: Only destroy one output when the close button is pressed

Instead of terminating the compositor, destroy the output whose close
button was clicked and move the other outputs, as is done in the drm
backend.

10 years agoevdev: Drop joystick rejection heurstics
Kristian Høgsberg [Mon, 16 Dec 2013 23:57:53 +0000 (15:57 -0800)]
evdev: Drop joystick rejection heurstics

We now no longer add joysticks at all.  They show up as absolute motion
devices without has_button, so we don't add them as a pointer.  We may add
a keyboard for the keyboard-style keys, but that's fine.  With the previous
commit, we no longer generate spurious absolute pointer motion for the abs
axes.

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

10 years agoevdev: Reject absolute motion if we're not a pointer or a touch device
Kristian Høgsberg [Mon, 16 Dec 2013 23:51:22 +0000 (15:51 -0800)]
evdev: Reject absolute motion if we're not a pointer or a touch device

Some joysticks have certain buttons that acts keyboard keys.  As such,
we'll reconize them as keyboards but not pointers.  In that case, don't
send pointer motion events when we get absolute joystick events.

10 years agoevdev: Drop obsolete accelerometer reject rule
Kristian Høgsberg [Mon, 16 Dec 2013 23:37:16 +0000 (15:37 -0800)]
evdev: Drop obsolete accelerometer reject rule

This rule triggers for devices with an ABS_X/Y evaluators and no
keyboard or multitouch events.  There is no way we would ever add such
a device as a pointer, keyboard or touch device anyway.  A pointer
device requires has_button (in which case the !has_key condtion would
fail); a keyboard device would also mean !has_key is false and a touch
screen device implies that !device->is_mt is false.

10 years agoevdev: Remove EVDEV_TOUCH and with it evdev_device->caps
Kristian Høgsberg [Mon, 16 Dec 2013 23:19:30 +0000 (15:19 -0800)]
evdev: Remove EVDEV_TOUCH and with it evdev_device->caps

We now keep all the configuration intermediate results inside
evdev_configure_device() and the result is device->seat_caps.

10 years agoevdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit
Kristian Høgsberg [Mon, 16 Dec 2013 23:07:59 +0000 (15:07 -0800)]
evdev: Use a has_keyboard flag instead of EVDEV_KEYBOARD bit

10 years agoevdev: Replace EVDEV_BUTTON with local has_button flag
Kristian Høgsberg [Mon, 16 Dec 2013 22:43:29 +0000 (14:43 -0800)]
evdev: Replace EVDEV_BUTTON with local has_button flag

10 years agoevdev: Replace EVDEV_MOTION_ABS with local has_abs flag
Kristian Høgsberg [Mon, 16 Dec 2013 21:55:48 +0000 (13:55 -0800)]
evdev: Replace EVDEV_MOTION_ABS with local has_abs flag

10 years agoevdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events
Kristian Høgsberg [Mon, 16 Dec 2013 21:42:40 +0000 (13:42 -0800)]
evdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events

We split up has_abs into plain ABS_X/Y and MT events, but this shouldn't
introduce any logic changes.

10 years agoevdev: Drop EVDEV_MOTION_REL flag
Kristian Høgsberg [Mon, 16 Dec 2013 19:25:19 +0000 (11:25 -0800)]
evdev: Drop EVDEV_MOTION_REL flag

This is only used inside evdev_configure_device() and we now use a local
has_rel flag instead.

10 years agoevdev: Combine evdev_handle_device() and evdev_configure_device()
Kristian Høgsberg [Mon, 16 Dec 2013 19:01:56 +0000 (11:01 -0800)]
evdev: Combine evdev_handle_device() and evdev_configure_device()

We split the device probing and idenfication somewhat arbitrarily between
these two functions.  This commit combines them into one.  Return of -1
indicates error, 0 success, but succesful probing can return a device
with device->caps == 0, which means we don't handle the device.

10 years agosdk: make C++11 plugins build again
Giulio Camuffo [Mon, 9 Dec 2013 21:47:58 +0000 (22:47 +0100)]
sdk: make C++11 plugins build again

compositor.h must not define a 'static_assert' macro, since that
conflicts with the new 'static_assert' in the standard and breaks
the build.

10 years agoUpdate .gitignore
Jasper St. Pierre [Mon, 9 Dec 2013 20:18:16 +0000 (15:18 -0500)]
Update .gitignore

Ignore the new stacking demo...

10 years agoUpdate .gitignore
Jasper St. Pierre [Mon, 9 Dec 2013 20:06:45 +0000 (15:06 -0500)]
Update .gitignore

10 years agoshell: Fix set_transient_for with a NULL parent
Jasper St. Pierre [Sat, 7 Dec 2013 18:49:28 +0000 (13:49 -0500)]
shell: Fix set_transient_for with a NULL parent

10 years agoshell: Make sure the shell implementation and protocol versions match
Kristian Høgsberg [Mon, 9 Dec 2013 06:27:11 +0000 (22:27 -0800)]
shell: Make sure the shell implementation and protocol versions match

10 years agosimple-egl: Add option to allow not syncing to compositor repaint cycle
Kristian Høgsberg [Sun, 8 Dec 2013 06:25:56 +0000 (22:25 -0800)]
simple-egl: Add option to allow not syncing to compositor repaint cycle

It's the GO FASTER option.

10 years agosimple-egl: Print fps for the spinning triangle
Kristian Høgsberg [Sat, 7 Dec 2013 06:02:45 +0000 (22:02 -0800)]
simple-egl: Print fps for the spinning triangle

This is not a benchmark.

10 years agotests: Test whether a simple EGL main loop uses too many buffers
Neil Roberts [Tue, 29 Oct 2013 20:13:45 +0000 (20:13 +0000)]
tests: Test whether a simple EGL main loop uses too many buffers

This adds a test that tries to simulate a simple game loop that would
be like this:

while (1) {
        draw_something();
        eglSwapBuffers();
}

In this case the test is relying on eglSwapBuffers to throttle to a
sensible frame rate.

The test then verifies that only 2 EGL buffers are used. This is done
via a new request and event in the wayland-test protocol.

Currently this causes 3 buffers to be created because the release
event generated by the swap buffers is not processed by Mesa until it
blocks for the frame complete event in the next swap buffers call, but
that is too late.

This can be fixed in Mesa by issuing a sync request after the swap
buffers and blocking on it before deciding whether to allocate a new
buffer.

10 years agoinput: make sure the devices get the resource destruction signal
Giulio Camuffo [Fri, 6 Dec 2013 11:46:27 +0000 (12:46 +0100)]
input: make sure the devices get the resource destruction signal

The device may not have a resource for the client yet, but install
the listeners nevertheless.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=65726

10 years agodesktop-shell: Drop next_type from shell_surface
Kristian Høgsberg [Fri, 6 Dec 2013 07:20:33 +0000 (23:20 -0800)]
desktop-shell: Drop next_type from shell_surface

The surface type now no longer changes and we track pending state changes in
next_state.  Instead of testing type != next_type to detect changes in
state, we just look at state_changed.

10 years agoshell: Put xwayland surface at the top of the fullscreen layer
Kristian Høgsberg [Fri, 6 Dec 2013 06:43:03 +0000 (22:43 -0800)]
shell: Put xwayland surface at the top of the fullscreen layer

An xwayland surface corresponds to a override-redirect window under X,
which is typically a menu or a popup window.  They typically appear
with a keyboard and mouse grab and by nature of being override-redirect
these window can appear anywhere on screen and in the stack.

We need to resort to heuristics to decide where to place the
override-redirect in our surface stack, and for now we'll just put it on
top of everything.  That's going to be correct for almost all cases of
clicking to open a menu, but we can revisit and refine if we run into
a case that needs better handling.

10 years agodesktop-shell: Make set_toplevel() clear surface states
Kristian Høgsberg [Fri, 6 Dec 2013 06:31:25 +0000 (22:31 -0800)]
desktop-shell: Make set_toplevel() clear surface states

This is used from wl_shell and xwayland and we need to make sure
xwayland also gets this behavior.

10 years agodesktop-shell: Set fullscreen flags in common code path
Kristian Høgsberg [Fri, 6 Dec 2013 06:04:42 +0000 (22:04 -0800)]
desktop-shell: Set fullscreen flags in common code path

Just as for set_maximized() we can move the setting of the fullscreen and
state_changed flags into the common set_fullscreen() function.  This
function is also used from the xwayland wm to set fullscreen windows, and
with this change that now works again.

10 years agodesktop-shell: Set maximized flags in common code path
Kristian Høgsberg [Fri, 6 Dec 2013 06:00:40 +0000 (22:00 -0800)]
desktop-shell: Set maximized flags in common code path

We can set the maximized and state_changed flags in set_maximized(),
which is shared between shell_surface_set_maximized() and
xdg_surface_set_maximized().

10 years agostacking: Set a keyboard focus handler so we can repaint the frame
Kristian Høgsberg [Thu, 5 Dec 2013 23:14:45 +0000 (15:14 -0800)]
stacking: Set a keyboard focus handler so we can repaint the frame

Yes, perhaps this should be more automatic...

10 years agoshell: Don't try to switch to a NULL shell surface.
Rafael Antognolli [Thu, 5 Dec 2013 21:01:21 +0000 (19:01 -0200)]
shell: Don't try to switch to a NULL shell surface.

Fixes the crash from alt+tab when there's a fullscreen surface.

10 years agoshell: Set a surface as TOPLEVEL instead of the old surface types.
Rafael Antognolli [Thu, 5 Dec 2013 20:53:17 +0000 (18:53 -0200)]
shell: Set a surface as TOPLEVEL instead of the old surface types.

Since internally there's no more SHELL_SURFACE_FULLSCREEN and
SHELL_SURFACE_MAXIMIZED, the surface must be set to
SHELL_SURFACE_TOPLEVEL on the respective functions.

This fixes the bug when clients start already in fullscreen mode. In
that case, they aren't set first to toplevel, and then change to
fullscreen. They are set as fullscreen directly, not receiving the
SHELL_SURFACE_TOPLEVEL type on the set_fullscreen function.

10 years agocompositor-x11: Damage output when we receive expose events for the window
Kristian Høgsberg [Thu, 5 Dec 2013 20:30:37 +0000 (12:30 -0800)]
compositor-x11: Damage output when we receive expose events for the window

The gl renderer typically repaints everything since we don't have
EGL_buffer_age under X, but the pixman renderer carefully only repaints
damaged regions.  So to actually repaint anything with the pixman
renderer, we need to damage the output.

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

10 years agoshell: Add missing break to a case statement inside set_surface_type.
Rafael Antognolli [Wed, 4 Dec 2013 20:37:16 +0000 (18:37 -0200)]
shell: Add missing break to a case statement inside set_surface_type.

This should fix the surface not going back to its original position
after unsetting fullscreen or maximized states.

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

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