Commit graph

350 commits

Author SHA1 Message Date
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
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
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 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
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
Emilio Pozuelo Monfort 46ce798d28 shell: add a client config entry 2013-11-21 21:35:17 -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
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
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 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
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 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
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
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 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 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
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 724c8d9e7c shell: Add a new weston.ini to control the startup animation
The new key startup-animation in the [shell] section lets you
control the startup animation.  Default is fade, but with this patch
we can also do none, which just show the desktop as fast as possible.
2013-10-16 11:38:24 -07:00
Neil Roberts e14aa4f0a9 Don't remove the touch grab until the last touch point is removed
Previously if you move a window around and temporarily add a second
finger then it will cancel the grab even though the original finger is
still held on the screen. It seems more robust to avoid cancelling the
grab until all fingers have been removed.
2013-10-14 13:53:16 -07:00
Neil Roberts aba0f25cb0 Add a touch move binding
When holding the compositor super key the touch events can now be used
to move a window.
2013-10-14 13:53:08 -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
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
Kristian Høgsberg 2e3c396ae3 shell: Use wl_resource_for_each() for sending out workspace status 2013-09-11 12:00:47 -07:00
Kristian Høgsberg e1b655df92 shell: Make sure we have seat->pointer and seat->touch before dereferencing
Either of these may not be available when we handle wl_shell_surface.move,
and we need to not crash when that's the case.

https://bugs.freedesktop.org/show_bug.cgi?id=68649
2013-08-28 23:17:09 -07:00
Rusty Lynch 1084da506e Add touch support for wl_shell_surface_move 2013-08-16 10:56:00 -07:00
Rob Bradford 880ebc7ed9 input: For serial generation get the display from the compositor
This removes the use of wl_client_get_display() where the client is
derived from the focussed resource. This starts the removal of the
assumption of a single resource on a client that would be notified about
events on the focussed surface.
2013-08-12 16:54:10 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00