Commit Graph

373 Commits

Author SHA1 Message Date
Zhang, Xiong Y 31236932a1 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>
2013-12-16 17:23:08 -08:00
Ander Conselvan de Oliveira 54e90c7e1e 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.
2013-12-16 17:23:08 -08:00
Ander Conselvan de Oliveira e1e2352dcc 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.
2013-12-16 17:23:01 -08:00
Zhang, Xiong Y 010d0b1695 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>
2013-12-16 16:46:22 -08:00
Zhang, Xiong Y f301241d1a 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>
2013-12-16 16:23:11 -08:00
Giulio Camuffo 1aaf3e42e2 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.
2013-12-09 16:20:48 -08:00
Kristian Høgsberg 8d344a0548 shell: Make sure the shell implementation and protocol versions match 2013-12-08 22:27:11 -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
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
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
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 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
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
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
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 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
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
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
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
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
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
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 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 10ddd97ecf compositor: Remove redundant and not well-defined focus field
It was never clear what this field really did.
2013-10-22 12:40:54 -07:00
David Herrmann 1edf44ce26 compositor: finish frame if redraw fails
If we are about to finish a frame, but a redraw is pending and we let the
compositor redraw, we need to check for errors. If the redraw fails and
the backend cannot schedule a page-flip, we need to finish the frame,
anyway.

All backends except DRM use a timer to schedule frames. Hence, they cannot
fail. But for DRM, we need to be able to handle drmModePageFlip() failures
in case access got revoked.

This fixes a bug where logind+drm caused keyboard input to be missed as we
didn't reenable it after a failed page-flip during deactivation.
2013-10-22 12:24:56 -07:00
Jonas Ådahl d6e1c34405 evdev: Reference count input device's seat capabilities
When the only input device of a certain seat capability is unplugged,
stop advertising the capability.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-10-21 13:45:03 -07:00
Ander Conselvan de Oliveira 97f2952bca gl-renderer: Build as a loadable module
The time spent loading EGL and GLES libraries from disk can be a
considerable hit in some embedded use cases. If Weston is compiled
with EGL support, the binary will depend on those libraries, even if
a software renderer is in use.

This patch splits the GL renderer into a separate loadable module,
and moves the dependency on EGL and GLES to it. The backends still
need the EGL headers for the native types and EGLint. The function
load_module() is renamed to weston_load_module() and exported, so
that it can be used by the backends.

The gl renderer interface is changed so that there is only one symbol
that needs to be dlsym()'d. This symbol contains pointers to all the
functions and data necessary to interact with the renderer. As a side
effect, this change simplifies gl-renderer.h a great deal.
2013-10-14 15:02:20 -07:00
Neil Roberts 306fe0838b Only update the touch grab position for the first finger
Previously if you add a second finger while moving a window with a
touch grab then the position will keep jumping between the position of
each finger as you move them around. This patch changes it so that it
keeps track of the first touch id that starts the grab and only
updates the grab position when that finger moves.
2013-10-14 13:53:14 -07:00
Neil Roberts a28c69358c Add a touch binding to activate a surface
Adds a new binding type for touch events via the new function
weston_compositor_add_touch_binding. The binding can only be added for
a touch down with the first finger. The shell now uses this to install
a binding to activate the current surface.
2013-10-14 13:53:08 -07:00
Neil Roberts 96d790e74b input: Emit events on all resources for a client
The Wayland protocol permits a client to request the pointer, keyboard
and touch multiple times from the seat global. This is very useful in a
component like Clutter-GTK where we are combining two libraries that use
Wayland together.

This change migrates the weston input handling code to emit the
events for all the resources for the client by using the newly added
wl_resource_for_each macro to iterate over the resources that are
associated with the focused surface's client.

We maintain a list of focused resources on the pointer and keyboard
which is updated when the focus changes. However since we can have
resources created after the focus has already been set we must add the
resources to the right list and also update any state.

Additionally when setting the pointer focus it will now send the
keyboard modifiers regardless of whether the focused client has a
pointer resource. This is important because otherwise if the client
gets the pointer later than you getting the keyboard then the
modifiers might not be up-to-date.

Co-author: Neil Roberts <neil@linux.intel.com>
2013-09-21 20:56:55 -07:00
Hardening 57388e44e5 Notify clients on mode_switch()
This patch implements the notification of clients during mode_switch.
As discussed on IRC, clients are notified of mode_switch only when the
"native" mode is changed and activated. That means that if the native
mode is changed and the compositor had activated a temporary mode for
a fullscreen surface, the clients will be notified only when the native
mode is restored.
The scaling factor is treated the same way as modes.
2013-09-21 11:40:21 -07:00
Hardening ff39efa5c0 Rename current, origin, scale, origin_scale
This patch renames that fields to have consistent names.
2013-09-21 11:40:17 -07:00
Kristian Høgsberg 61741a293c compositor: Generalize VT switching as a session_signal
Instead of a callback from the tty module, we now have a compositor level
signal that fires when our session is activated or deactivated.
2013-09-18 11:14:14 -07:00
Kristian Høgsberg 05ad1e4e8a launcher: Collect launcher state in new struct weston_launcher
We're going to add a bit more launcher state, so start out by creating
a new struct weston_launcher we can track it in.
2013-09-18 11:14:14 -07:00
Giulio Camuffo 62942ad3a6 xwm: set the shell_surface's title
add a new function pointer to the weston_shell_interface struct that
shells will set accordingly.
2013-09-11 13:50:54 -07:00
Stanislav Vorobiov bfbb8e59fa gl_renderer: Use EGL_WAYLAND_Y_INVERTED_WL to query wl_buffer's orientation 2013-09-11 10:56:00 -07:00
Andrew Wedgbury 9a6f02a6b1 Copying xkb_info when creating a seat causes problems
Hi Kristian,

Here's a new patch for ref counting weston_xkb_info, as suggested.
So a seat created with a NULL keymap will now point to the global xkb_info.
2013-09-11 10:06:23 -07:00
Kristian Høgsberg 85de9c25fe compositor: Split dnd setup up into weston_seat_start_drag()
This makes the drag-and-drop code available to in-weston data sources,
similar to how we can set a selection data source internally.  The
wl_data_device.start_drag entry point now calls this function after
validating protocol arguments.
2013-09-04 20:46:56 -07:00
Pier Luigi Fiorini 403ea92c48 compositor.h: Don't include config.h
Public headers should not include config.h.
2013-08-26 15:22:42 -07:00
Daniel Stone 8e7a8bdeea Add more missing config.h includes
config.h includes were missing in a few files, including input.c, the
lack of which caused the X11 backend to segfault instantly due to not
having an xkbcommon context.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2013-08-16 10:56:00 -07:00
Giulio Camuffo 13b85bdb65 compositor: ref-count weston_surface instances
This allows a surface to live on after its resource has been
destroyed.  The ref-count can be increased in a resource destroy signal
listener, to keep the surface around for a destroy animation, for example.
2013-08-13 15:19:50 -07:00