2011-01-18 15:53:49 +03:00
|
|
|
|
/*
|
2012-02-20 03:52:44 +04:00
|
|
|
|
* Copyright © 2010-2012 Intel Corporation
|
2012-01-27 18:25:16 +04:00
|
|
|
|
* Copyright © 2011-2012 Collabora, Ltd.
|
2013-11-19 14:37:14 +04:00
|
|
|
|
* Copyright © 2013 Raspberry Pi Foundation
|
2011-01-18 15:53:49 +03:00
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and
|
|
|
|
|
* its documentation for any purpose is hereby granted without fee, provided
|
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of the copyright holders not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software
|
|
|
|
|
* without specific, written prior permission. The copyright holders make
|
|
|
|
|
* no representations about the suitability of this software for any
|
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
|
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
|
|
|
|
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
|
|
|
|
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
|
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-05-22 19:03:19 +04:00
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2011-01-18 15:53:49 +03:00
|
|
|
|
#include <stdlib.h>
|
2011-09-06 21:48:16 +04:00
|
|
|
|
#include <stdio.h>
|
2011-01-18 15:53:49 +03:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <unistd.h>
|
2011-04-13 01:25:42 +04:00
|
|
|
|
#include <linux/input.h>
|
2011-11-15 15:34:54 +04:00
|
|
|
|
#include <assert.h>
|
2011-12-02 18:31:49 +04:00
|
|
|
|
#include <signal.h>
|
2012-01-20 18:48:25 +04:00
|
|
|
|
#include <math.h>
|
2012-05-26 21:41:06 +04:00
|
|
|
|
#include <sys/types.h>
|
2011-01-18 15:53:49 +03:00
|
|
|
|
|
2013-12-04 12:20:01 +04:00
|
|
|
|
#include "shell.h"
|
2011-09-06 21:48:16 +04:00
|
|
|
|
#include "desktop-shell-server-protocol.h"
|
2012-08-30 00:13:01 +04:00
|
|
|
|
#include "workspaces-server-protocol.h"
|
2011-12-07 13:49:52 +04:00
|
|
|
|
#include "../shared/config-parser.h"
|
2013-12-03 21:35:45 +04:00
|
|
|
|
#include "xdg-shell-server-protocol.h"
|
2011-01-18 15:53:49 +03:00
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
#define DEFAULT_NUM_WORKSPACES 1
|
2012-06-13 02:01:23 +04:00
|
|
|
|
#define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200
|
2012-06-13 02:01:22 +04:00
|
|
|
|
|
2013-12-10 01:47:58 +04:00
|
|
|
|
#ifndef static_assert
|
|
|
|
|
#define static_assert(cond, msg)
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-06-13 02:01:24 +04:00
|
|
|
|
struct focus_state {
|
|
|
|
|
struct weston_seat *seat;
|
2012-08-01 00:36:34 +04:00
|
|
|
|
struct workspace *ws;
|
2012-06-13 02:01:24 +04:00
|
|
|
|
struct weston_surface *keyboard_focus;
|
|
|
|
|
struct wl_list link;
|
|
|
|
|
struct wl_listener seat_destroy_listener;
|
|
|
|
|
struct wl_listener surface_destroy_listener;
|
|
|
|
|
};
|
|
|
|
|
|
2013-10-23 09:58:32 +04:00
|
|
|
|
struct shell_output {
|
|
|
|
|
struct desktop_shell *shell;
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
struct wl_listener destroy_listener;
|
|
|
|
|
struct wl_list link;
|
|
|
|
|
};
|
|
|
|
|
|
2011-11-23 19:52:40 +04:00
|
|
|
|
enum shell_surface_type {
|
2011-12-01 12:42:22 +04:00
|
|
|
|
SHELL_SURFACE_NONE,
|
2011-11-23 19:52:40 +04:00
|
|
|
|
SHELL_SURFACE_TOPLEVEL,
|
2013-06-12 22:43:21 +04:00
|
|
|
|
SHELL_SURFACE_POPUP,
|
|
|
|
|
SHELL_SURFACE_XWAYLAND
|
2011-11-23 18:42:16 +04:00
|
|
|
|
};
|
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
struct ping_timer {
|
|
|
|
|
struct wl_event_source *source;
|
|
|
|
|
uint32_t serial;
|
|
|
|
|
};
|
|
|
|
|
|
2013-11-25 22:01:44 +04:00
|
|
|
|
/*
|
|
|
|
|
* Surface stacking and ordering.
|
|
|
|
|
*
|
|
|
|
|
* This is handled using several linked lists of surfaces, organised into
|
|
|
|
|
* ‘layers’. The layers are ordered, and each of the surfaces in one layer are
|
|
|
|
|
* above all of the surfaces in the layer below. The set of layers is static and
|
|
|
|
|
* in the following order (top-most first):
|
|
|
|
|
* • Lock layer (only ever displayed on its own)
|
|
|
|
|
* • Cursor layer
|
|
|
|
|
* • Fullscreen layer
|
|
|
|
|
* • Panel layer
|
|
|
|
|
* • Input panel layer
|
|
|
|
|
* • Workspace layers
|
|
|
|
|
* • Background layer
|
|
|
|
|
*
|
|
|
|
|
* The list of layers may be manipulated to remove whole layers of surfaces from
|
|
|
|
|
* display. For example, when locking the screen, all layers except the lock
|
|
|
|
|
* layer are removed.
|
|
|
|
|
*
|
|
|
|
|
* A surface’s layer is modified on configuring the surface, in
|
|
|
|
|
* set_surface_type() (which is only called when the surface’s type change is
|
|
|
|
|
* _committed_). If a surface’s type changes (e.g. when making a window
|
|
|
|
|
* fullscreen) its layer changes too.
|
|
|
|
|
*
|
|
|
|
|
* In order to allow popup and transient surfaces to be correctly stacked above
|
|
|
|
|
* their parent surfaces, each surface tracks both its parent surface, and a
|
|
|
|
|
* linked list of its children. When a surface’s layer is updated, so are the
|
|
|
|
|
* layers of its children. Note that child surfaces are *not* the same as
|
|
|
|
|
* subsurfaces — child/parent surfaces are purely for maintaining stacking
|
|
|
|
|
* order.
|
|
|
|
|
*
|
|
|
|
|
* The children_link list of siblings of a surface (i.e. those surfaces which
|
|
|
|
|
* have the same parent) only contains weston_surfaces which have a
|
|
|
|
|
* shell_surface. Stacking is not implemented for non-shell_surface
|
|
|
|
|
* weston_surfaces. This means that the following implication does *not* hold:
|
|
|
|
|
* (shsurf->parent != NULL) ⇒ !wl_list_is_empty(shsurf->children_link)
|
|
|
|
|
*/
|
|
|
|
|
|
2011-11-23 18:14:12 +04:00
|
|
|
|
struct shell_surface {
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
struct wl_signal destroy_signal;
|
2011-11-25 14:09:16 +04:00
|
|
|
|
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
struct weston_surface *surface;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2013-12-03 07:01:53 +04:00
|
|
|
|
int32_t last_width, last_height;
|
2011-11-25 14:09:16 +04:00
|
|
|
|
struct wl_listener surface_destroy_listener;
|
2012-06-27 18:22:58 +04:00
|
|
|
|
struct weston_surface *parent;
|
2013-11-25 22:01:44 +04:00
|
|
|
|
struct wl_list children_list; /* child surfaces of this one */
|
|
|
|
|
struct wl_list children_link; /* sibling surfaces of this one */
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell;
|
2011-11-23 18:42:16 +04:00
|
|
|
|
|
2013-12-06 11:20:33 +04:00
|
|
|
|
enum shell_surface_type type;
|
2012-05-02 17:47:44 +04:00
|
|
|
|
char *title, *class;
|
2011-11-23 19:52:40 +04:00
|
|
|
|
int32_t saved_x, saved_y;
|
2013-12-03 21:35:46 +04:00
|
|
|
|
int32_t saved_width, saved_height;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
bool saved_position_valid;
|
2013-12-03 21:35:46 +04:00
|
|
|
|
bool saved_size_valid;
|
2012-04-27 05:07:24 +04:00
|
|
|
|
bool saved_rotation_valid;
|
2013-10-25 03:52:00 +04:00
|
|
|
|
int unresponsive, grabbed;
|
2014-02-06 09:36:04 +04:00
|
|
|
|
uint32_t resize_edges;
|
2011-11-22 15:43:52 +04:00
|
|
|
|
|
2012-01-20 18:48:25 +04:00
|
|
|
|
struct {
|
|
|
|
|
struct weston_transform transform;
|
2012-01-27 22:36:13 +04:00
|
|
|
|
struct weston_matrix rotation;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
} rotation;
|
|
|
|
|
|
2012-01-05 07:19:14 +04:00
|
|
|
|
struct {
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct wl_list grab_link;
|
2012-01-05 07:19:14 +04:00
|
|
|
|
int32_t x, y;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct shell_seat *shseat;
|
2012-04-13 20:40:07 +04:00
|
|
|
|
uint32_t serial;
|
2012-01-05 07:19:14 +04:00
|
|
|
|
} popup;
|
|
|
|
|
|
2012-05-07 16:23:08 +04:00
|
|
|
|
struct {
|
|
|
|
|
int32_t x, y;
|
2012-05-19 00:37:43 +04:00
|
|
|
|
uint32_t flags;
|
2012-05-07 16:23:08 +04:00
|
|
|
|
} transient;
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
struct {
|
|
|
|
|
enum wl_shell_surface_fullscreen_method type;
|
|
|
|
|
struct weston_transform transform; /* matrix from x, y */
|
|
|
|
|
uint32_t framerate;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *black_view;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
} fullscreen;
|
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
struct ping_timer *ping_timer;
|
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
struct weston_transform workspace_transform;
|
|
|
|
|
|
2012-02-18 08:49:07 +04:00
|
|
|
|
struct weston_output *fullscreen_output;
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
struct weston_output *output;
|
2013-12-03 21:35:47 +04:00
|
|
|
|
struct weston_output *recommended_output;
|
2011-11-22 15:43:52 +04:00
|
|
|
|
struct wl_list link;
|
2012-05-23 00:05:52 +04:00
|
|
|
|
|
|
|
|
|
const struct weston_shell_client *client;
|
2013-12-03 21:35:42 +04:00
|
|
|
|
|
|
|
|
|
struct {
|
|
|
|
|
bool maximized;
|
|
|
|
|
bool fullscreen;
|
2013-12-03 21:35:43 +04:00
|
|
|
|
bool relative;
|
2013-12-03 21:35:42 +04:00
|
|
|
|
} state, next_state; /* surface states */
|
|
|
|
|
bool state_changed;
|
2013-12-10 02:36:28 +04:00
|
|
|
|
|
|
|
|
|
int focus_count;
|
2011-11-23 18:14:12 +04:00
|
|
|
|
};
|
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_grab {
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer_grab grab;
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
struct wl_listener shsurf_destroy_listener;
|
|
|
|
|
};
|
|
|
|
|
|
2013-08-15 20:10:08 +04:00
|
|
|
|
struct shell_touch_grab {
|
|
|
|
|
struct weston_touch_grab grab;
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
struct wl_listener shsurf_destroy_listener;
|
|
|
|
|
struct weston_touch *touch;
|
|
|
|
|
};
|
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct weston_move_grab {
|
|
|
|
|
struct shell_grab base;
|
2012-05-08 20:17:55 +04:00
|
|
|
|
wl_fixed_t dx, dy;
|
2011-01-18 15:53:49 +03:00
|
|
|
|
};
|
|
|
|
|
|
2013-08-15 20:10:08 +04:00
|
|
|
|
struct weston_touch_move_grab {
|
|
|
|
|
struct shell_touch_grab base;
|
2014-01-18 03:18:10 +04:00
|
|
|
|
int active;
|
2013-08-15 20:10:08 +04:00
|
|
|
|
wl_fixed_t dx, dy;
|
|
|
|
|
};
|
|
|
|
|
|
2012-01-20 18:48:25 +04:00
|
|
|
|
struct rotate_grab {
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_grab base;
|
2012-01-27 22:36:13 +04:00
|
|
|
|
struct weston_matrix rotation;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
struct {
|
2012-09-30 04:57:21 +04:00
|
|
|
|
float x;
|
|
|
|
|
float y;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
} center;
|
|
|
|
|
};
|
|
|
|
|
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct shell_seat {
|
|
|
|
|
struct weston_seat *seat;
|
|
|
|
|
struct wl_listener seat_destroy_listener;
|
2013-12-10 02:36:28 +04:00
|
|
|
|
struct weston_surface *focused_surface;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
|
|
|
|
|
struct {
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer_grab grab;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct wl_list surfaces_list;
|
|
|
|
|
struct wl_client *client;
|
|
|
|
|
int32_t initial_up;
|
|
|
|
|
} popup_grab;
|
|
|
|
|
};
|
|
|
|
|
|
2014-01-07 19:41:40 +04:00
|
|
|
|
void
|
|
|
|
|
set_alpha_if_fullscreen(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
if (shsurf && shsurf->state.fullscreen)
|
|
|
|
|
shsurf->fullscreen.black_view->alpha = 0.25;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-17 13:20:49 +04:00
|
|
|
|
static struct desktop_shell *
|
|
|
|
|
shell_surface_get_shell(struct shell_surface *shsurf);
|
|
|
|
|
|
2013-02-15 06:31:44 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
surface_rotate(struct shell_surface *surface, struct weston_seat *seat);
|
2013-02-15 06:31:44 +04:00
|
|
|
|
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_fade_startup(struct desktop_shell *shell);
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
static struct shell_seat *
|
|
|
|
|
get_shell_seat(struct weston_seat *seat);
|
|
|
|
|
|
2013-11-25 22:01:44 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_update_child_surface_layers(struct shell_surface *shsurf);
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_wl_shell_surface(struct shell_surface *shsurf);
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_xdg_surface(struct shell_surface *shsurf);
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_xdg_popup(struct shell_surface *shsurf);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_parent(struct shell_surface *shsurf,
|
|
|
|
|
struct weston_surface *parent);
|
|
|
|
|
|
2012-04-17 13:20:49 +04:00
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_top_fullscreen(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *top_fs_ev;
|
2012-04-17 13:20:49 +04:00
|
|
|
|
|
|
|
|
|
shell = shell_surface_get_shell(shsurf);
|
2013-01-29 17:16:13 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (wl_list_empty(&shell->fullscreen_layer.view_list))
|
2012-04-17 13:20:49 +04:00
|
|
|
|
return false;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
top_fs_ev = container_of(shell->fullscreen_layer.view_list.next,
|
|
|
|
|
struct weston_view,
|
2012-04-17 13:20:49 +04:00
|
|
|
|
layer_link);
|
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-13 07:38:11 +04:00
|
|
|
|
return (shsurf == get_shell_surface(top_fs_ev->surface));
|
2012-04-17 13:20:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
static void
|
2012-04-12 07:18:23 +04:00
|
|
|
|
destroy_shell_grab_shsurf(struct wl_listener *listener, void *data)
|
2012-04-04 18:48:05 +04:00
|
|
|
|
{
|
|
|
|
|
struct shell_grab *grab;
|
|
|
|
|
|
|
|
|
|
grab = container_of(listener, struct shell_grab,
|
|
|
|
|
shsurf_destroy_listener);
|
|
|
|
|
|
|
|
|
|
grab->shsurf = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-04 12:20:01 +04:00
|
|
|
|
struct weston_view *
|
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-13 07:38:11 +04:00
|
|
|
|
get_default_view(struct weston_surface *surface)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
struct weston_view *view;
|
|
|
|
|
|
|
|
|
|
if (!surface || wl_list_empty(&surface->views))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(surface);
|
|
|
|
|
if (shsurf)
|
|
|
|
|
return shsurf->view;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(view, &surface->views, surface_link)
|
|
|
|
|
if (weston_view_is_mapped(view))
|
|
|
|
|
return view;
|
|
|
|
|
|
|
|
|
|
return container_of(surface->views.next, struct weston_view, surface_link);
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-30 22:07:27 +04:00
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
popup_grab_end(struct weston_pointer *pointer);
|
2012-10-30 22:07:27 +04:00
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
static void
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_start(struct shell_grab *grab,
|
2013-05-07 06:15:05 +04:00
|
|
|
|
const struct weston_pointer_grab_interface *interface,
|
2012-06-28 19:08:05 +04:00
|
|
|
|
struct shell_surface *shsurf,
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer,
|
2012-06-28 19:08:05 +04:00
|
|
|
|
enum desktop_shell_cursor cursor)
|
2012-04-04 18:48:05 +04:00
|
|
|
|
{
|
2012-06-28 19:08:05 +04:00
|
|
|
|
struct desktop_shell *shell = shsurf->shell;
|
|
|
|
|
|
2012-10-30 22:07:27 +04:00
|
|
|
|
popup_grab_end(pointer);
|
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
grab->grab.interface = interface;
|
|
|
|
|
grab->shsurf = shsurf;
|
2012-04-12 07:18:23 +04:00
|
|
|
|
grab->shsurf_destroy_listener.notify = destroy_shell_grab_shsurf;
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_signal_add(&shsurf->destroy_signal,
|
2012-04-12 07:18:23 +04:00
|
|
|
|
&grab->shsurf_destroy_listener);
|
2012-04-04 18:48:05 +04:00
|
|
|
|
|
2013-10-25 03:52:00 +04:00
|
|
|
|
shsurf->grabbed = 1;
|
2013-05-07 06:15:05 +04:00
|
|
|
|
weston_pointer_start_grab(pointer, &grab->grab);
|
2013-07-04 03:24:57 +04:00
|
|
|
|
if (shell->child.desktop_shell) {
|
|
|
|
|
desktop_shell_send_grab_cursor(shell->child.desktop_shell,
|
|
|
|
|
cursor);
|
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-13 07:38:11 +04:00
|
|
|
|
weston_pointer_set_focus(pointer,
|
|
|
|
|
get_default_view(shell->grab_surface),
|
2013-07-04 03:24:57 +04:00
|
|
|
|
wl_fixed_from_int(0),
|
|
|
|
|
wl_fixed_from_int(0));
|
|
|
|
|
}
|
2012-04-04 18:48:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_end(struct shell_grab *grab)
|
2012-04-04 18:48:05 +04:00
|
|
|
|
{
|
2013-10-25 03:52:00 +04:00
|
|
|
|
if (grab->shsurf) {
|
2012-06-08 02:08:04 +04:00
|
|
|
|
wl_list_remove(&grab->shsurf_destroy_listener.link);
|
2013-10-25 03:52:00 +04:00
|
|
|
|
grab->shsurf->grabbed = 0;
|
2014-02-06 09:36:04 +04:00
|
|
|
|
grab->shsurf->resize_edges = 0;
|
2013-10-25 03:52:00 +04:00
|
|
|
|
}
|
2012-06-28 19:08:05 +04:00
|
|
|
|
|
2013-07-23 03:31:53 +04:00
|
|
|
|
weston_pointer_end_grab(grab->grab.pointer);
|
2012-04-04 18:48:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 20:10:08 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_touch_grab_start(struct shell_touch_grab *grab,
|
|
|
|
|
const struct weston_touch_grab_interface *interface,
|
|
|
|
|
struct shell_surface *shsurf,
|
|
|
|
|
struct weston_touch *touch)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = shsurf->shell;
|
2014-01-17 22:08:25 +04:00
|
|
|
|
|
2013-08-15 20:10:08 +04:00
|
|
|
|
grab->grab.interface = interface;
|
|
|
|
|
grab->shsurf = shsurf;
|
|
|
|
|
grab->shsurf_destroy_listener.notify = destroy_shell_grab_shsurf;
|
|
|
|
|
wl_signal_add(&shsurf->destroy_signal,
|
|
|
|
|
&grab->shsurf_destroy_listener);
|
|
|
|
|
|
|
|
|
|
grab->touch = touch;
|
2013-10-25 03:52:00 +04:00
|
|
|
|
shsurf->grabbed = 1;
|
2013-08-15 20:10:08 +04:00
|
|
|
|
|
|
|
|
|
weston_touch_start_grab(touch, &grab->grab);
|
|
|
|
|
if (shell->child.desktop_shell)
|
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-13 07:38:11 +04:00
|
|
|
|
weston_touch_set_focus(touch->seat,
|
|
|
|
|
get_default_view(shell->grab_surface));
|
2013-08-15 20:10:08 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_touch_grab_end(struct shell_touch_grab *grab)
|
|
|
|
|
{
|
2013-10-25 03:52:00 +04:00
|
|
|
|
if (grab->shsurf) {
|
2013-08-15 20:10:08 +04:00
|
|
|
|
wl_list_remove(&grab->shsurf_destroy_listener.link);
|
2013-10-25 03:52:00 +04:00
|
|
|
|
grab->shsurf->grabbed = 0;
|
|
|
|
|
}
|
2013-08-15 20:10:08 +04:00
|
|
|
|
|
|
|
|
|
weston_touch_end_grab(grab->touch);
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
static void
|
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-13 07:38:11 +04:00
|
|
|
|
center_on_output(struct weston_view *view,
|
2012-03-01 08:57:46 +04:00
|
|
|
|
struct weston_output *output);
|
|
|
|
|
|
2012-05-30 19:31:42 +04:00
|
|
|
|
static enum weston_keyboard_modifier
|
2012-04-20 19:54:25 +04:00
|
|
|
|
get_modifier(char *modifier)
|
|
|
|
|
{
|
|
|
|
|
if (!modifier)
|
|
|
|
|
return MODIFIER_SUPER;
|
|
|
|
|
|
|
|
|
|
if (!strcmp("ctrl", modifier))
|
|
|
|
|
return MODIFIER_CTRL;
|
|
|
|
|
else if (!strcmp("alt", modifier))
|
|
|
|
|
return MODIFIER_ALT;
|
|
|
|
|
else if (!strcmp("super", modifier))
|
|
|
|
|
return MODIFIER_SUPER;
|
|
|
|
|
else
|
|
|
|
|
return MODIFIER_SUPER;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-25 15:09:52 +04:00
|
|
|
|
static enum animation_type
|
|
|
|
|
get_animation_type(char *animation)
|
|
|
|
|
{
|
2014-01-16 02:26:31 +04:00
|
|
|
|
if (!animation)
|
|
|
|
|
return ANIMATION_NONE;
|
|
|
|
|
|
2012-04-25 15:09:52 +04:00
|
|
|
|
if (!strcmp("zoom", animation))
|
|
|
|
|
return ANIMATION_ZOOM;
|
|
|
|
|
else if (!strcmp("fade", animation))
|
|
|
|
|
return ANIMATION_FADE;
|
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 14:37:11 +04:00
|
|
|
|
else if (!strcmp("dim-layer", animation))
|
|
|
|
|
return ANIMATION_DIM_LAYER;
|
2012-04-25 15:09:52 +04:00
|
|
|
|
else
|
|
|
|
|
return ANIMATION_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-26 01:57:11 +04:00
|
|
|
|
static void
|
2013-05-27 05:48:14 +04:00
|
|
|
|
shell_configuration(struct desktop_shell *shell)
|
2011-12-07 13:49:52 +04:00
|
|
|
|
{
|
2013-05-24 05:40:56 +04:00
|
|
|
|
struct weston_config_section *section;
|
|
|
|
|
int duration;
|
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
|
|
section = weston_config_get_section(shell->compositor->config,
|
|
|
|
|
"screensaver", NULL, NULL);
|
|
|
|
|
weston_config_section_get_string(section,
|
|
|
|
|
"path", &shell->screensaver.path, NULL);
|
|
|
|
|
weston_config_section_get_int(section, "duration", &duration, 60);
|
2013-02-21 20:35:21 +04:00
|
|
|
|
shell->screensaver.duration = duration * 1000;
|
2013-05-24 05:40:56 +04:00
|
|
|
|
|
|
|
|
|
section = weston_config_get_section(shell->compositor->config,
|
|
|
|
|
"shell", NULL, NULL);
|
2013-11-20 16:22:29 +04:00
|
|
|
|
weston_config_section_get_string(section,
|
2013-12-02 15:53:32 +04:00
|
|
|
|
"client", &s, LIBEXECDIR "/" WESTON_SHELL_CLIENT);
|
2013-11-20 16:22:29 +04:00
|
|
|
|
shell->client = s;
|
2013-05-24 05:40:56 +04:00
|
|
|
|
weston_config_section_get_string(section,
|
|
|
|
|
"binding-modifier", &s, "super");
|
|
|
|
|
shell->binding_modifier = get_modifier(s);
|
2013-06-18 11:11:03 +04:00
|
|
|
|
free(s);
|
2014-01-17 04:51:52 +04:00
|
|
|
|
|
|
|
|
|
weston_config_section_get_string(section,
|
|
|
|
|
"exposay-modifier", &s, "none");
|
|
|
|
|
if (strcmp(s, "none") == 0)
|
|
|
|
|
shell->exposay_modifier = 0;
|
|
|
|
|
else
|
|
|
|
|
shell->exposay_modifier = get_modifier(s);
|
|
|
|
|
free(s);
|
|
|
|
|
|
2013-05-24 05:40:56 +04:00
|
|
|
|
weston_config_section_get_string(section, "animation", &s, "none");
|
|
|
|
|
shell->win_animation_type = get_animation_type(s);
|
2013-06-18 11:11:03 +04:00
|
|
|
|
free(s);
|
2013-10-16 22:38:24 +04:00
|
|
|
|
weston_config_section_get_string(section,
|
|
|
|
|
"startup-animation", &s, "fade");
|
|
|
|
|
shell->startup_animation_type = get_animation_type(s);
|
|
|
|
|
free(s);
|
2013-10-30 19:59:55 +04:00
|
|
|
|
if (shell->startup_animation_type == ANIMATION_ZOOM)
|
|
|
|
|
shell->startup_animation_type = ANIMATION_NONE;
|
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 14:37:11 +04:00
|
|
|
|
weston_config_section_get_string(section, "focus-animation", &s, "none");
|
|
|
|
|
shell->focus_animation_type = get_animation_type(s);
|
|
|
|
|
free(s);
|
2013-05-24 05:40:56 +04:00
|
|
|
|
weston_config_section_get_uint(section, "num-workspaces",
|
|
|
|
|
&shell->workspaces.num,
|
|
|
|
|
DEFAULT_NUM_WORKSPACES);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-04 12:20:01 +04:00
|
|
|
|
struct weston_output *
|
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 14:37:11 +04:00
|
|
|
|
get_default_output(struct weston_compositor *compositor)
|
|
|
|
|
{
|
|
|
|
|
return container_of(compositor->output_list.next,
|
|
|
|
|
struct weston_output, link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* no-op func for checking focus surface */
|
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
focus_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
|
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 14:37:11 +04:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct focus_surface *
|
|
|
|
|
get_focus_surface(struct weston_surface *surface)
|
|
|
|
|
{
|
|
|
|
|
if (surface->configure == focus_surface_configure)
|
|
|
|
|
return surface->configure_private;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
is_focus_surface (struct weston_surface *es)
|
|
|
|
|
{
|
|
|
|
|
return (es->configure == focus_surface_configure);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
is_focus_view (struct weston_view *view)
|
|
|
|
|
{
|
|
|
|
|
return is_focus_surface (view->surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct focus_surface *
|
|
|
|
|
create_focus_surface(struct weston_compositor *ec,
|
|
|
|
|
struct weston_output *output)
|
|
|
|
|
{
|
|
|
|
|
struct focus_surface *fsurf = NULL;
|
|
|
|
|
struct weston_surface *surface = NULL;
|
|
|
|
|
|
|
|
|
|
fsurf = malloc(sizeof *fsurf);
|
|
|
|
|
if (!fsurf)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
fsurf->surface = weston_surface_create(ec);
|
|
|
|
|
surface = fsurf->surface;
|
|
|
|
|
if (surface == NULL) {
|
|
|
|
|
free(fsurf);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
surface->configure = focus_surface_configure;
|
|
|
|
|
surface->output = output;
|
|
|
|
|
surface->configure_private = fsurf;
|
|
|
|
|
|
2014-01-16 02:45:59 +04:00
|
|
|
|
fsurf->view = weston_view_create(surface);
|
|
|
|
|
if (fsurf->view == NULL) {
|
|
|
|
|
weston_surface_destroy(surface);
|
|
|
|
|
free(fsurf);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2013-11-19 14:37:19 +04:00
|
|
|
|
fsurf->view->output = output;
|
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 14:37:11 +04:00
|
|
|
|
|
2013-12-05 06:32:03 +04:00
|
|
|
|
weston_surface_set_size(surface, output->width, output->height);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(fsurf->view, output->x, output->y);
|
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 14:37:11 +04:00
|
|
|
|
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
|
|
|
|
|
pixman_region32_fini(&surface->opaque);
|
|
|
|
|
pixman_region32_init_rect(&surface->opaque, output->x, output->y,
|
|
|
|
|
output->width, output->height);
|
|
|
|
|
pixman_region32_fini(&surface->input);
|
|
|
|
|
pixman_region32_init(&surface->input);
|
|
|
|
|
|
|
|
|
|
wl_list_init(&fsurf->workspace_transform.link);
|
|
|
|
|
|
|
|
|
|
return fsurf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
focus_surface_destroy(struct focus_surface *fsurf)
|
|
|
|
|
{
|
|
|
|
|
weston_surface_destroy(fsurf->surface);
|
|
|
|
|
free(fsurf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
focus_animation_done(struct weston_view_animation *animation, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *ws = data;
|
|
|
|
|
|
|
|
|
|
ws->focus_animation = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:24 +04:00
|
|
|
|
static void
|
|
|
|
|
focus_state_destroy(struct focus_state *state)
|
|
|
|
|
{
|
|
|
|
|
wl_list_remove(&state->seat_destroy_listener.link);
|
|
|
|
|
wl_list_remove(&state->surface_destroy_listener.link);
|
|
|
|
|
free(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
focus_state_seat_destroy(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct focus_state *state = container_of(listener,
|
|
|
|
|
struct focus_state,
|
|
|
|
|
seat_destroy_listener);
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&state->link);
|
|
|
|
|
focus_state_destroy(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
focus_state_surface_destroy(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct focus_state *state = container_of(listener,
|
|
|
|
|
struct focus_state,
|
2012-07-31 18:30:26 +04:00
|
|
|
|
surface_destroy_listener);
|
2012-08-01 01:29:30 +04:00
|
|
|
|
struct desktop_shell *shell;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_surface *main_surface, *next;
|
|
|
|
|
struct weston_view *view;
|
2012-08-01 01:29:30 +04:00
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
main_surface = weston_surface_get_main_surface(state->keyboard_focus);
|
|
|
|
|
|
2012-08-01 01:29:30 +04:00
|
|
|
|
next = NULL;
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &state->ws->layer.view_list, layer_link) {
|
|
|
|
|
if (view->surface == main_surface)
|
2012-08-01 01:29:30 +04:00
|
|
|
|
continue;
|
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 14:37:11 +04:00
|
|
|
|
if (is_focus_view(view))
|
|
|
|
|
continue;
|
2012-08-01 01:29:30 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
next = view->surface;
|
2012-08-01 01:29:30 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
/* if the focus was a sub-surface, activate its main surface */
|
|
|
|
|
if (main_surface != state->keyboard_focus)
|
|
|
|
|
next = main_surface;
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
shell = state->seat->compositor->shell_interface.shell;
|
2012-08-01 01:29:30 +04:00
|
|
|
|
if (next) {
|
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 14:37:11 +04:00
|
|
|
|
state->keyboard_focus = NULL;
|
2012-08-01 01:29:30 +04:00
|
|
|
|
activate(shell, next, state->seat);
|
|
|
|
|
} else {
|
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 14:37:11 +04:00
|
|
|
|
if (shell->focus_animation_type == ANIMATION_DIM_LAYER) {
|
|
|
|
|
if (state->ws->focus_animation)
|
|
|
|
|
weston_view_animation_destroy(state->ws->focus_animation);
|
|
|
|
|
|
|
|
|
|
state->ws->focus_animation = weston_fade_run(
|
|
|
|
|
state->ws->fsurf_front->view,
|
|
|
|
|
state->ws->fsurf_front->view->alpha, 0.0, 300,
|
|
|
|
|
focus_animation_done, state->ws);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 01:29:30 +04:00
|
|
|
|
wl_list_remove(&state->link);
|
|
|
|
|
focus_state_destroy(state);
|
|
|
|
|
}
|
2012-06-13 02:01:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct focus_state *
|
2012-08-01 00:36:34 +04:00
|
|
|
|
focus_state_create(struct weston_seat *seat, struct workspace *ws)
|
2012-06-13 02:01:24 +04:00
|
|
|
|
{
|
|
|
|
|
struct focus_state *state;
|
|
|
|
|
|
|
|
|
|
state = malloc(sizeof *state);
|
|
|
|
|
if (state == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
state->keyboard_focus = NULL;
|
2012-08-01 00:36:34 +04:00
|
|
|
|
state->ws = ws;
|
2012-06-13 02:01:24 +04:00
|
|
|
|
state->seat = seat;
|
2012-08-01 00:36:34 +04:00
|
|
|
|
wl_list_insert(&ws->focus_list, &state->link);
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
|
|
|
|
state->seat_destroy_listener.notify = focus_state_seat_destroy;
|
|
|
|
|
state->surface_destroy_listener.notify = focus_state_surface_destroy;
|
2013-05-07 06:27:40 +04:00
|
|
|
|
wl_signal_add(&seat->destroy_signal,
|
2012-06-13 02:01:24 +04:00
|
|
|
|
&state->seat_destroy_listener);
|
2012-08-01 00:36:34 +04:00
|
|
|
|
wl_list_init(&state->surface_destroy_listener.link);
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:03 +04:00
|
|
|
|
static struct focus_state *
|
|
|
|
|
ensure_focus_state(struct desktop_shell *shell, struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *ws = get_current_workspace(shell);
|
|
|
|
|
struct focus_state *state;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(state, &ws->focus_list, link)
|
|
|
|
|
if (state->seat == seat)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (&state->link == &ws->focus_list)
|
|
|
|
|
state = focus_state_create(seat, ws);
|
|
|
|
|
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-23 00:25:20 +04:00
|
|
|
|
static void
|
|
|
|
|
focus_state_set_focus(struct focus_state *state,
|
|
|
|
|
struct weston_surface *surface)
|
|
|
|
|
{
|
|
|
|
|
if (state->keyboard_focus) {
|
|
|
|
|
wl_list_remove(&state->surface_destroy_listener.link);
|
|
|
|
|
wl_list_init(&state->surface_destroy_listener.link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state->keyboard_focus = surface;
|
|
|
|
|
if (surface)
|
|
|
|
|
wl_signal_add(&surface->destroy_signal,
|
|
|
|
|
&state->surface_destroy_listener);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:24 +04:00
|
|
|
|
static void
|
2012-08-01 00:36:34 +04:00
|
|
|
|
restore_focus_state(struct desktop_shell *shell, struct workspace *ws)
|
2012-06-13 02:01:24 +04:00
|
|
|
|
{
|
|
|
|
|
struct focus_state *state, *next;
|
2013-05-08 17:54:37 +04:00
|
|
|
|
struct weston_surface *surface;
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
|
|
|
|
wl_list_for_each_safe(state, next, &ws->focus_list, link) {
|
2014-01-18 00:18:53 +04:00
|
|
|
|
if (state->seat->keyboard == NULL)
|
|
|
|
|
continue;
|
|
|
|
|
|
2013-05-08 17:54:37 +04:00
|
|
|
|
surface = state->keyboard_focus;
|
2012-08-30 00:12:59 +04:00
|
|
|
|
|
2013-05-07 07:19:49 +04:00
|
|
|
|
weston_keyboard_set_focus(state->seat->keyboard, surface);
|
2012-06-13 02:01:24 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
static void
|
|
|
|
|
replace_focus_state(struct desktop_shell *shell, struct workspace *ws,
|
|
|
|
|
struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct focus_state *state;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(state, &ws->focus_list, link) {
|
|
|
|
|
if (state->seat == seat) {
|
2014-01-23 00:25:20 +04:00
|
|
|
|
focus_state_set_focus(state, seat->keyboard->focus);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
drop_focus_state(struct desktop_shell *shell, struct workspace *ws,
|
|
|
|
|
struct weston_surface *surface)
|
|
|
|
|
{
|
|
|
|
|
struct focus_state *state;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(state, &ws->focus_list, link)
|
|
|
|
|
if (state->keyboard_focus == surface)
|
2014-01-23 00:25:20 +04:00
|
|
|
|
focus_state_set_focus(state, NULL);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
}
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
static void
|
|
|
|
|
animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
|
|
|
|
struct weston_view *from, struct weston_view *to)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
bool focus_surface_created = false;
|
|
|
|
|
|
|
|
|
|
/* FIXME: Only support dim animation using two layers */
|
|
|
|
|
if (from == to || shell->focus_animation_type != ANIMATION_DIM_LAYER)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
output = get_default_output(shell->compositor);
|
|
|
|
|
if (ws->fsurf_front == NULL && (from || to)) {
|
|
|
|
|
ws->fsurf_front = create_focus_surface(shell->compositor, output);
|
2014-01-16 02:45:59 +04:00
|
|
|
|
if (ws->fsurf_front == NULL)
|
|
|
|
|
return;
|
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 14:37:11 +04:00
|
|
|
|
ws->fsurf_front->view->alpha = 0.0;
|
2014-01-16 02:45:59 +04:00
|
|
|
|
|
|
|
|
|
ws->fsurf_back = create_focus_surface(shell->compositor, output);
|
|
|
|
|
if (ws->fsurf_back == NULL) {
|
|
|
|
|
focus_surface_destroy(ws->fsurf_front);
|
|
|
|
|
return;
|
|
|
|
|
}
|
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 14:37:11 +04:00
|
|
|
|
ws->fsurf_back->view->alpha = 0.0;
|
2014-01-16 02:45:59 +04:00
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
focus_surface_created = true;
|
|
|
|
|
} else {
|
|
|
|
|
wl_list_remove(&ws->fsurf_front->view->layer_link);
|
|
|
|
|
wl_list_remove(&ws->fsurf_back->view->layer_link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ws->focus_animation) {
|
|
|
|
|
weston_view_animation_destroy(ws->focus_animation);
|
|
|
|
|
ws->focus_animation = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (to)
|
|
|
|
|
wl_list_insert(&to->layer_link,
|
|
|
|
|
&ws->fsurf_front->view->layer_link);
|
|
|
|
|
else if (from)
|
|
|
|
|
wl_list_insert(&ws->layer.view_list,
|
|
|
|
|
&ws->fsurf_front->view->layer_link);
|
|
|
|
|
|
|
|
|
|
if (focus_surface_created) {
|
|
|
|
|
ws->focus_animation = weston_fade_run(
|
|
|
|
|
ws->fsurf_front->view,
|
|
|
|
|
ws->fsurf_front->view->alpha, 0.6, 300,
|
|
|
|
|
focus_animation_done, ws);
|
|
|
|
|
} else if (from) {
|
|
|
|
|
wl_list_insert(&from->layer_link,
|
|
|
|
|
&ws->fsurf_back->view->layer_link);
|
|
|
|
|
ws->focus_animation = weston_stable_fade_run(
|
|
|
|
|
ws->fsurf_front->view, 0.0,
|
|
|
|
|
ws->fsurf_back->view, 0.6,
|
|
|
|
|
focus_animation_done, ws);
|
|
|
|
|
} else if (to) {
|
|
|
|
|
wl_list_insert(&ws->layer.view_list,
|
|
|
|
|
&ws->fsurf_back->view->layer_link);
|
|
|
|
|
ws->focus_animation = weston_stable_fade_run(
|
|
|
|
|
ws->fsurf_front->view, 0.0,
|
|
|
|
|
ws->fsurf_back->view, 0.6,
|
|
|
|
|
focus_animation_done, ws);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
static void
|
|
|
|
|
workspace_destroy(struct workspace *ws)
|
|
|
|
|
{
|
2012-06-13 02:01:24 +04:00
|
|
|
|
struct focus_state *state, *next;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each_safe(state, next, &ws->focus_list, link)
|
|
|
|
|
focus_state_destroy(state);
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
if (ws->fsurf_front)
|
|
|
|
|
focus_surface_destroy(ws->fsurf_front);
|
|
|
|
|
if (ws->fsurf_back)
|
|
|
|
|
focus_surface_destroy(ws->fsurf_back);
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
free(ws);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:24 +04:00
|
|
|
|
static void
|
|
|
|
|
seat_destroyed(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct weston_seat *seat = data;
|
|
|
|
|
struct focus_state *state, *next;
|
|
|
|
|
struct workspace *ws = container_of(listener,
|
|
|
|
|
struct workspace,
|
|
|
|
|
seat_destroyed_listener);
|
|
|
|
|
|
|
|
|
|
wl_list_for_each_safe(state, next, &ws->focus_list, link)
|
|
|
|
|
if (state->seat == seat)
|
|
|
|
|
wl_list_remove(&state->link);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
static struct workspace *
|
|
|
|
|
workspace_create(void)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *ws = malloc(sizeof *ws);
|
|
|
|
|
if (ws == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
weston_layer_init(&ws->layer, NULL);
|
|
|
|
|
|
2012-06-13 02:01:24 +04:00
|
|
|
|
wl_list_init(&ws->focus_list);
|
|
|
|
|
wl_list_init(&ws->seat_destroyed_listener.link);
|
|
|
|
|
ws->seat_destroyed_listener.notify = seat_destroyed;
|
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 14:37:11 +04:00
|
|
|
|
ws->fsurf_front = NULL;
|
|
|
|
|
ws->fsurf_back = NULL;
|
|
|
|
|
ws->focus_animation = NULL;
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
return ws;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
static int
|
|
|
|
|
workspace_is_empty(struct workspace *ws)
|
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
return wl_list_empty(&ws->layer.view_list);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
static struct workspace *
|
|
|
|
|
get_workspace(struct desktop_shell *shell, unsigned int index)
|
|
|
|
|
{
|
|
|
|
|
struct workspace **pws = shell->workspaces.array.data;
|
2012-09-01 18:03:05 +04:00
|
|
|
|
assert(index < shell->workspaces.num);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
pws += index;
|
|
|
|
|
return *pws;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-04 12:20:01 +04:00
|
|
|
|
struct workspace *
|
2012-06-13 02:01:22 +04:00
|
|
|
|
get_current_workspace(struct desktop_shell *shell)
|
|
|
|
|
{
|
|
|
|
|
return get_workspace(shell, shell->workspaces.current);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
activate_workspace(struct desktop_shell *shell, unsigned int index)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *ws;
|
|
|
|
|
|
|
|
|
|
ws = get_workspace(shell, index);
|
|
|
|
|
wl_list_insert(&shell->panel_layer.link, &ws->layer.link);
|
|
|
|
|
|
|
|
|
|
shell->workspaces.current = index;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
static unsigned int
|
|
|
|
|
get_output_height(struct weston_output *output)
|
|
|
|
|
{
|
|
|
|
|
return abs(output->region.extents.y1 - output->region.extents.y2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
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 14:37:11 +04:00
|
|
|
|
view_translate(struct workspace *ws, struct weston_view *view, double d)
|
2012-06-13 02:01:23 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_transform *transform;
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
if (is_focus_view(view)) {
|
|
|
|
|
struct focus_surface *fsurf = get_focus_surface(view->surface);
|
|
|
|
|
transform = &fsurf->workspace_transform;
|
|
|
|
|
} else {
|
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(view->surface);
|
|
|
|
|
transform = &shsurf->workspace_transform;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
if (wl_list_empty(&transform->link))
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_insert(view->geometry.transformation_list.prev,
|
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 14:37:11 +04:00
|
|
|
|
&transform->link);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
weston_matrix_init(&transform->matrix);
|
|
|
|
|
weston_matrix_translate(&transform->matrix,
|
2012-06-13 02:01:23 +04:00
|
|
|
|
0.0, d, 0.0);
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_geometry_dirty(view);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
workspace_translate_out(struct workspace *ws, double fraction)
|
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-06-13 02:01:23 +04:00
|
|
|
|
unsigned int height;
|
|
|
|
|
double d;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
|
|
|
|
|
height = get_output_height(view->surface->output);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
d = height * fraction;
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
view_translate(ws, view, d);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
workspace_translate_in(struct workspace *ws, double fraction)
|
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-06-13 02:01:23 +04:00
|
|
|
|
unsigned int height;
|
|
|
|
|
double d;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
|
|
|
|
|
height = get_output_height(view->surface->output);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
|
|
|
|
|
if (fraction > 0)
|
|
|
|
|
d = -(height - height * fraction);
|
|
|
|
|
else
|
|
|
|
|
d = height + height * fraction;
|
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
view_translate(ws, view, d);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:01 +04:00
|
|
|
|
static void
|
|
|
|
|
broadcast_current_workspace_state(struct desktop_shell *shell)
|
|
|
|
|
{
|
2013-09-11 23:00:47 +04:00
|
|
|
|
struct wl_resource *resource;
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
2013-09-11 23:00:47 +04:00
|
|
|
|
wl_resource_for_each(resource, &shell->workspaces.client_list)
|
|
|
|
|
workspace_manager_send_state(resource,
|
2012-08-30 00:13:01 +04:00
|
|
|
|
shell->workspaces.current,
|
|
|
|
|
shell->workspaces.num);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
static void
|
|
|
|
|
reverse_workspace_change_animation(struct desktop_shell *shell,
|
|
|
|
|
unsigned int index,
|
|
|
|
|
struct workspace *from,
|
|
|
|
|
struct workspace *to)
|
|
|
|
|
{
|
|
|
|
|
shell->workspaces.current = index;
|
|
|
|
|
|
|
|
|
|
shell->workspaces.anim_to = to;
|
|
|
|
|
shell->workspaces.anim_from = from;
|
|
|
|
|
shell->workspaces.anim_dir = -1 * shell->workspaces.anim_dir;
|
|
|
|
|
shell->workspaces.anim_timestamp = 0;
|
|
|
|
|
|
2012-08-13 19:58:41 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shell->compositor);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
workspace_deactivate_transforms(struct workspace *ws)
|
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
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 14:37:11 +04:00
|
|
|
|
struct weston_transform *transform;
|
2012-06-13 02:01:23 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
|
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 14:37:11 +04:00
|
|
|
|
if (is_focus_view(view)) {
|
|
|
|
|
struct focus_surface *fsurf = get_focus_surface(view->surface);
|
|
|
|
|
transform = &fsurf->workspace_transform;
|
|
|
|
|
} else {
|
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(view->surface);
|
|
|
|
|
transform = &shsurf->workspace_transform;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!wl_list_empty(&transform->link)) {
|
|
|
|
|
wl_list_remove(&transform->link);
|
|
|
|
|
wl_list_init(&transform->link);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
}
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_geometry_dirty(view);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
finish_workspace_change_animation(struct desktop_shell *shell,
|
|
|
|
|
struct workspace *from,
|
|
|
|
|
struct workspace *to)
|
|
|
|
|
{
|
2012-08-13 19:58:41 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shell->compositor);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
|
|
|
|
|
wl_list_remove(&shell->workspaces.animation.link);
|
|
|
|
|
workspace_deactivate_transforms(from);
|
|
|
|
|
workspace_deactivate_transforms(to);
|
|
|
|
|
shell->workspaces.anim_to = NULL;
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&shell->workspaces.anim_from->layer.link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
animate_workspace_change_frame(struct weston_animation *animation,
|
|
|
|
|
struct weston_output *output, uint32_t msecs)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
|
container_of(animation, struct desktop_shell,
|
|
|
|
|
workspaces.animation);
|
|
|
|
|
struct workspace *from = shell->workspaces.anim_from;
|
|
|
|
|
struct workspace *to = shell->workspaces.anim_to;
|
|
|
|
|
uint32_t t;
|
|
|
|
|
double x, y;
|
|
|
|
|
|
|
|
|
|
if (workspace_is_empty(from) && workspace_is_empty(to)) {
|
|
|
|
|
finish_workspace_change_animation(shell, from, to);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shell->workspaces.anim_timestamp == 0) {
|
|
|
|
|
if (shell->workspaces.anim_current == 0.0)
|
|
|
|
|
shell->workspaces.anim_timestamp = msecs;
|
|
|
|
|
else
|
|
|
|
|
shell->workspaces.anim_timestamp =
|
|
|
|
|
msecs -
|
|
|
|
|
/* Invers of movement function 'y' below. */
|
|
|
|
|
(asin(1.0 - shell->workspaces.anim_current) *
|
|
|
|
|
DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH *
|
|
|
|
|
M_2_PI);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t = msecs - shell->workspaces.anim_timestamp;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* x = [0, π/2]
|
|
|
|
|
* y(x) = sin(x)
|
|
|
|
|
*/
|
|
|
|
|
x = t * (1.0/DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH) * M_PI_2;
|
|
|
|
|
y = sin(x);
|
|
|
|
|
|
|
|
|
|
if (t < DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH) {
|
2012-08-13 19:58:41 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shell->compositor);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
|
|
|
|
|
workspace_translate_out(from, shell->workspaces.anim_dir * y);
|
|
|
|
|
workspace_translate_in(to, shell->workspaces.anim_dir * y);
|
|
|
|
|
shell->workspaces.anim_current = y;
|
|
|
|
|
|
2012-08-13 19:58:41 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shell->compositor);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
2012-06-13 02:01:24 +04:00
|
|
|
|
else
|
2012-06-13 02:01:23 +04:00
|
|
|
|
finish_workspace_change_animation(shell, from, to);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
animate_workspace_change(struct desktop_shell *shell,
|
|
|
|
|
unsigned int index,
|
|
|
|
|
struct workspace *from,
|
|
|
|
|
struct workspace *to)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
|
|
|
|
|
int dir;
|
|
|
|
|
|
|
|
|
|
if (index > shell->workspaces.current)
|
|
|
|
|
dir = -1;
|
|
|
|
|
else
|
|
|
|
|
dir = 1;
|
|
|
|
|
|
|
|
|
|
shell->workspaces.current = index;
|
|
|
|
|
|
|
|
|
|
shell->workspaces.anim_dir = dir;
|
|
|
|
|
shell->workspaces.anim_from = from;
|
|
|
|
|
shell->workspaces.anim_to = to;
|
|
|
|
|
shell->workspaces.anim_current = 0.0;
|
|
|
|
|
shell->workspaces.anim_timestamp = 0;
|
|
|
|
|
|
|
|
|
|
output = container_of(shell->compositor->output_list.next,
|
|
|
|
|
struct weston_output, link);
|
|
|
|
|
wl_list_insert(&output->animation_list,
|
|
|
|
|
&shell->workspaces.animation.link);
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
wl_list_insert(from->layer.link.prev, &to->layer.link);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
|
|
|
|
|
workspace_translate_in(to, 0);
|
|
|
|
|
|
2012-08-01 00:36:34 +04:00
|
|
|
|
restore_focus_state(shell, to);
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
2012-08-13 19:58:41 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shell->compositor);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
static void
|
|
|
|
|
update_workspace(struct desktop_shell *shell, unsigned int index,
|
|
|
|
|
struct workspace *from, struct workspace *to)
|
|
|
|
|
{
|
|
|
|
|
shell->workspaces.current = index;
|
|
|
|
|
wl_list_insert(&from->layer.link, &to->layer.link);
|
|
|
|
|
wl_list_remove(&from->layer.link);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
static void
|
|
|
|
|
change_workspace(struct desktop_shell *shell, unsigned int index)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *from;
|
|
|
|
|
struct workspace *to;
|
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 14:37:11 +04:00
|
|
|
|
struct focus_state *state;
|
2012-06-13 02:01:22 +04:00
|
|
|
|
|
|
|
|
|
if (index == shell->workspaces.current)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Don't change workspace when there is any fullscreen surfaces. */
|
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-13 07:38:11 +04:00
|
|
|
|
if (!wl_list_empty(&shell->fullscreen_layer.view_list))
|
2012-06-13 02:01:22 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
from = get_current_workspace(shell);
|
|
|
|
|
to = get_workspace(shell, index);
|
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
if (shell->workspaces.anim_from == to &&
|
|
|
|
|
shell->workspaces.anim_to == from) {
|
2012-08-30 00:13:00 +04:00
|
|
|
|
restore_focus_state(shell, to);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
reverse_workspace_change_animation(shell, index, from, to);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
broadcast_current_workspace_state(shell);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
2012-06-13 02:01:22 +04:00
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
if (shell->workspaces.anim_to != NULL)
|
|
|
|
|
finish_workspace_change_animation(shell,
|
|
|
|
|
shell->workspaces.anim_from,
|
|
|
|
|
shell->workspaces.anim_to);
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
restore_focus_state(shell, to);
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
if (shell->focus_animation_type != ANIMATION_NONE) {
|
|
|
|
|
wl_list_for_each(state, &from->focus_list, link)
|
|
|
|
|
if (state->keyboard_focus)
|
|
|
|
|
animate_focus_change(shell, from,
|
|
|
|
|
get_default_view(state->keyboard_focus), NULL);
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(state, &to->focus_list, link)
|
|
|
|
|
if (state->keyboard_focus)
|
|
|
|
|
animate_focus_change(shell, to,
|
|
|
|
|
NULL, get_default_view(state->keyboard_focus));
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
if (workspace_is_empty(to) && workspace_is_empty(from))
|
|
|
|
|
update_workspace(shell, index, from, to);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
else
|
|
|
|
|
animate_workspace_change(shell, index, from, to);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
|
|
|
|
broadcast_current_workspace_state(shell);
|
2011-12-07 13:49:52 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
static bool
|
|
|
|
|
workspace_has_only(struct workspace *ws, struct weston_surface *surface)
|
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct wl_list *list = &ws->layer.view_list;
|
2012-08-30 00:13:00 +04:00
|
|
|
|
struct wl_list *e;
|
|
|
|
|
|
|
|
|
|
if (wl_list_empty(list))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
e = list->next;
|
|
|
|
|
|
|
|
|
|
if (e->next != list)
|
|
|
|
|
return false;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
return container_of(e, struct weston_view, layer_link)->surface == surface;
|
2012-08-30 00:13:00 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:01 +04:00
|
|
|
|
static void
|
2013-11-25 22:01:36 +04:00
|
|
|
|
move_surface_to_workspace(struct desktop_shell *shell,
|
|
|
|
|
struct shell_surface *shsurf,
|
|
|
|
|
uint32_t workspace)
|
2012-08-30 00:13:01 +04:00
|
|
|
|
{
|
|
|
|
|
struct workspace *from;
|
|
|
|
|
struct workspace *to;
|
|
|
|
|
struct weston_seat *seat;
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *focus;
|
2013-11-25 22:01:36 +04:00
|
|
|
|
struct weston_view *view;
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
|
|
|
|
if (workspace == shell->workspaces.current)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-11-25 22:01:36 +04:00
|
|
|
|
view = get_default_view(shsurf->surface);
|
|
|
|
|
if (!view)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
assert(weston_surface_get_main_surface(view->surface) == view->surface);
|
|
|
|
|
|
2012-09-01 18:03:05 +04:00
|
|
|
|
if (workspace >= shell->workspaces.num)
|
|
|
|
|
workspace = shell->workspaces.num - 1;
|
|
|
|
|
|
2012-08-30 00:13:01 +04:00
|
|
|
|
from = get_current_workspace(shell);
|
|
|
|
|
to = get_workspace(shell, workspace);
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_remove(&view->layer_link);
|
|
|
|
|
wl_list_insert(&to->layer.view_list, &view->layer_link);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
2013-11-25 22:01:44 +04:00
|
|
|
|
shell_surface_update_child_surface_layers(shsurf);
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
drop_focus_state(shell, from, view->surface);
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
wl_list_for_each(seat, &shell->compositor->seat_list, link) {
|
|
|
|
|
if (!seat->keyboard)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
focus = weston_surface_get_main_surface(seat->keyboard->focus);
|
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-13 07:38:11 +04:00
|
|
|
|
if (focus == view->surface)
|
2013-05-07 07:19:49 +04:00
|
|
|
|
weston_keyboard_set_focus(seat->keyboard, NULL);
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
}
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_damage_below(view);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
static void
|
|
|
|
|
take_surface_to_workspace_by_seat(struct desktop_shell *shell,
|
2013-05-07 07:19:49 +04:00
|
|
|
|
struct weston_seat *seat,
|
2012-08-30 00:13:00 +04:00
|
|
|
|
unsigned int index)
|
|
|
|
|
{
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *surface;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-08-30 00:13:00 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
struct workspace *from;
|
|
|
|
|
struct workspace *to;
|
2012-08-30 00:13:03 +04:00
|
|
|
|
struct focus_state *state;
|
2012-08-30 00:13:00 +04:00
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
surface = weston_surface_get_main_surface(seat->keyboard->focus);
|
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-13 07:38:11 +04:00
|
|
|
|
view = get_default_view(surface);
|
|
|
|
|
if (view == NULL ||
|
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 14:37:11 +04:00
|
|
|
|
index == shell->workspaces.current ||
|
|
|
|
|
is_focus_view(view))
|
2012-08-30 00:13:00 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
from = get_current_workspace(shell);
|
|
|
|
|
to = get_workspace(shell, index);
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_remove(&view->layer_link);
|
|
|
|
|
wl_list_insert(&to->layer.view_list, &view->layer_link);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
|
2013-11-25 22:01:36 +04:00
|
|
|
|
shsurf = get_shell_surface(surface);
|
2013-11-25 22:01:44 +04:00
|
|
|
|
if (shsurf != NULL)
|
|
|
|
|
shell_surface_update_child_surface_layers(shsurf);
|
2013-11-25 22:01:36 +04:00
|
|
|
|
|
2012-08-30 00:13:01 +04:00
|
|
|
|
replace_focus_state(shell, to, seat);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
drop_focus_state(shell, from, surface);
|
|
|
|
|
|
|
|
|
|
if (shell->workspaces.anim_from == to &&
|
|
|
|
|
shell->workspaces.anim_to == from) {
|
2012-08-30 00:13:01 +04:00
|
|
|
|
wl_list_remove(&to->layer.link);
|
|
|
|
|
wl_list_insert(from->layer.link.prev, &to->layer.link);
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
reverse_workspace_change_animation(shell, index, from, to);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
broadcast_current_workspace_state(shell);
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shell->workspaces.anim_to != NULL)
|
|
|
|
|
finish_workspace_change_animation(shell,
|
|
|
|
|
shell->workspaces.anim_from,
|
|
|
|
|
shell->workspaces.anim_to);
|
|
|
|
|
|
|
|
|
|
if (workspace_is_empty(from) &&
|
|
|
|
|
workspace_has_only(to, surface))
|
|
|
|
|
update_workspace(shell, index, from, to);
|
|
|
|
|
else {
|
2013-11-25 22:01:45 +04:00
|
|
|
|
if (shsurf != NULL &&
|
|
|
|
|
wl_list_empty(&shsurf->workspace_transform.link))
|
2012-08-30 00:13:00 +04:00
|
|
|
|
wl_list_insert(&shell->workspaces.anim_sticky_list,
|
|
|
|
|
&shsurf->workspace_transform.link);
|
|
|
|
|
|
|
|
|
|
animate_workspace_change(shell, index, from, to);
|
|
|
|
|
}
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
|
|
|
|
broadcast_current_workspace_state(shell);
|
2012-08-30 00:13:03 +04:00
|
|
|
|
|
|
|
|
|
state = ensure_focus_state(shell, seat);
|
|
|
|
|
if (state != NULL)
|
2014-01-23 00:25:20 +04:00
|
|
|
|
focus_state_set_focus(state, surface);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
workspace_manager_move_surface(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *surface_resource,
|
|
|
|
|
uint32_t workspace)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
struct weston_surface *surface =
|
2013-06-14 19:07:53 +04:00
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *main_surface;
|
2013-11-25 22:01:36 +04:00
|
|
|
|
struct shell_surface *shell_surface;
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
main_surface = weston_surface_get_main_surface(surface);
|
2013-11-25 22:01:36 +04:00
|
|
|
|
shell_surface = get_shell_surface(main_surface);
|
|
|
|
|
if (shell_surface == NULL)
|
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-13 07:38:11 +04:00
|
|
|
|
return;
|
2013-11-25 22:01:36 +04:00
|
|
|
|
|
|
|
|
|
move_surface_to_workspace(shell, shell_surface, workspace);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct workspace_manager_interface workspace_manager_implementation = {
|
|
|
|
|
workspace_manager_move_surface,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
unbind_resource(struct wl_resource *resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_list_remove(wl_resource_get_link(resource));
|
2012-08-30 00:13:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bind_workspace_manager(struct wl_client *client,
|
|
|
|
|
void *data, uint32_t version, uint32_t id)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
2013-06-28 05:17:02 +04:00
|
|
|
|
resource = wl_resource_create(client,
|
|
|
|
|
&workspace_manager_interface, 1, id);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
|
|
|
|
if (resource == NULL) {
|
|
|
|
|
weston_log("couldn't add workspace manager object");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-28 05:17:02 +04:00
|
|
|
|
wl_resource_set_implementation(resource,
|
|
|
|
|
&workspace_manager_implementation,
|
|
|
|
|
shell, unbind_resource);
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_list_insert(&shell->workspaces.client_list,
|
|
|
|
|
wl_resource_get_link(resource));
|
2012-08-30 00:13:01 +04:00
|
|
|
|
|
|
|
|
|
workspace_manager_send_state(resource,
|
|
|
|
|
shell->workspaces.current,
|
|
|
|
|
shell->workspaces.num);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 20:10:08 +04:00
|
|
|
|
static void
|
|
|
|
|
touch_move_grab_down(struct weston_touch_grab *grab, uint32_t time,
|
|
|
|
|
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
touch_move_grab_up(struct weston_touch_grab *grab, uint32_t time, int touch_id)
|
|
|
|
|
{
|
2013-10-26 01:18:04 +04:00
|
|
|
|
struct weston_touch_move_grab *move =
|
|
|
|
|
(struct weston_touch_move_grab *) container_of(
|
|
|
|
|
grab, struct shell_touch_grab, grab);
|
2013-10-03 19:43:07 +04:00
|
|
|
|
|
2014-01-18 03:18:10 +04:00
|
|
|
|
if (touch_id == 0)
|
|
|
|
|
move->active = 0;
|
|
|
|
|
|
2013-12-03 01:05:03 +04:00
|
|
|
|
if (grab->touch->num_tp == 0) {
|
2013-10-26 01:18:04 +04:00
|
|
|
|
shell_touch_grab_end(&move->base);
|
|
|
|
|
free(move);
|
|
|
|
|
}
|
2013-08-15 20:10:08 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
touch_move_grab_motion(struct weston_touch_grab *grab, uint32_t time,
|
|
|
|
|
int touch_id, wl_fixed_t sx, wl_fixed_t sy)
|
|
|
|
|
{
|
|
|
|
|
struct weston_touch_move_grab *move = (struct weston_touch_move_grab *) grab;
|
|
|
|
|
struct shell_surface *shsurf = move->base.shsurf;
|
|
|
|
|
struct weston_surface *es;
|
|
|
|
|
int dx = wl_fixed_to_int(grab->touch->grab_x + move->dx);
|
|
|
|
|
int dy = wl_fixed_to_int(grab->touch->grab_y + move->dy);
|
|
|
|
|
|
2014-01-18 03:18:10 +04:00
|
|
|
|
if (!shsurf || !move->active)
|
2013-08-15 20:10:08 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
es = shsurf->surface;
|
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(shsurf->view, dx, dy);
|
2013-08-15 20:10:08 +04:00
|
|
|
|
|
|
|
|
|
weston_compositor_schedule_repaint(es->compositor);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
touch_move_grab_cancel(struct weston_touch_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
struct weston_touch_move_grab *move =
|
|
|
|
|
(struct weston_touch_move_grab *) container_of(
|
|
|
|
|
grab, struct shell_touch_grab, grab);
|
|
|
|
|
|
|
|
|
|
shell_touch_grab_end(&move->base);
|
|
|
|
|
free(move);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 20:10:08 +04:00
|
|
|
|
static const struct weston_touch_grab_interface touch_move_grab_interface = {
|
|
|
|
|
touch_move_grab_down,
|
|
|
|
|
touch_move_grab_up,
|
|
|
|
|
touch_move_grab_motion,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
touch_move_grab_cancel,
|
2013-08-15 20:10:08 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
surface_touch_move(struct shell_surface *shsurf, struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct weston_touch_move_grab *move;
|
|
|
|
|
|
|
|
|
|
if (!shsurf)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.fullscreen)
|
2013-08-15 20:10:08 +04:00
|
|
|
|
return 0;
|
2013-10-25 03:52:00 +04:00
|
|
|
|
if (shsurf->grabbed)
|
|
|
|
|
return 0;
|
2013-08-15 20:10:08 +04:00
|
|
|
|
|
|
|
|
|
move = malloc(sizeof *move);
|
|
|
|
|
if (!move)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2014-01-18 03:18:10 +04:00
|
|
|
|
move->active = 1;
|
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-13 07:38:11 +04:00
|
|
|
|
move->dx = wl_fixed_from_double(shsurf->view->geometry.x) -
|
2013-08-15 20:10:08 +04:00
|
|
|
|
seat->touch->grab_x;
|
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-13 07:38:11 +04:00
|
|
|
|
move->dy = wl_fixed_from_double(shsurf->view->geometry.y) -
|
2013-08-15 20:10:08 +04:00
|
|
|
|
seat->touch->grab_y;
|
|
|
|
|
|
|
|
|
|
shell_touch_grab_start(&move->base, &touch_move_grab_interface, shsurf,
|
|
|
|
|
seat->touch);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-05 06:30:29 +04:00
|
|
|
|
static void
|
2013-05-09 06:02:59 +04:00
|
|
|
|
noop_grab_focus(struct weston_pointer_grab *grab)
|
2012-01-05 06:30:29 +04:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-18 15:53:49 +03:00
|
|
|
|
static void
|
2013-11-15 02:42:52 +04:00
|
|
|
|
move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
|
|
|
|
|
wl_fixed_t x, wl_fixed_t y)
|
2011-01-18 15:53:49 +03:00
|
|
|
|
{
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
struct weston_move_grab *move = (struct weston_move_grab *) grab;
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_surface *shsurf = move->base.shsurf;
|
2013-11-15 02:42:52 +04:00
|
|
|
|
int dx, dy;
|
|
|
|
|
|
|
|
|
|
weston_pointer_move(pointer, x, y);
|
|
|
|
|
dx = wl_fixed_to_int(pointer->x + move->dx);
|
|
|
|
|
dy = wl_fixed_to_int(pointer->y + move->dy);
|
2012-04-04 18:48:05 +04:00
|
|
|
|
|
|
|
|
|
if (!shsurf)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(shsurf->view, dx, dy);
|
2012-06-21 20:06:22 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shsurf->surface->compositor);
|
2011-01-18 15:53:49 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
move_grab_button(struct weston_pointer_grab *grab,
|
2012-05-30 19:31:51 +04:00
|
|
|
|
uint32_t time, uint32_t button, uint32_t state_w)
|
2011-01-18 15:53:49 +03:00
|
|
|
|
{
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_grab *shell_grab = container_of(grab, struct shell_grab,
|
|
|
|
|
grab);
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2012-05-30 19:31:51 +04:00
|
|
|
|
enum wl_pointer_button_state state = state_w;
|
2011-01-18 15:53:49 +03:00
|
|
|
|
|
2012-05-30 19:31:51 +04:00
|
|
|
|
if (pointer->button_count == 0 &&
|
|
|
|
|
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_end(shell_grab);
|
2012-01-05 06:30:29 +04:00
|
|
|
|
free(grab);
|
|
|
|
|
}
|
2011-01-18 15:53:49 +03:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
move_grab_cancel(struct weston_pointer_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
struct shell_grab *shell_grab =
|
|
|
|
|
container_of(grab, struct shell_grab, grab);
|
|
|
|
|
|
|
|
|
|
shell_grab_end(shell_grab);
|
|
|
|
|
free(grab);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 06:15:05 +04:00
|
|
|
|
static const struct weston_pointer_grab_interface move_grab_interface = {
|
2012-01-05 06:30:29 +04:00
|
|
|
|
noop_grab_focus,
|
2011-01-18 15:53:49 +03:00
|
|
|
|
move_grab_motion,
|
|
|
|
|
move_grab_button,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
move_grab_cancel,
|
2011-01-18 15:53:49 +03:00
|
|
|
|
};
|
|
|
|
|
|
2012-08-01 08:08:07 +04:00
|
|
|
|
static int
|
2013-05-07 07:19:49 +04:00
|
|
|
|
surface_move(struct shell_surface *shsurf, struct weston_seat *seat)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_move_grab *move;
|
|
|
|
|
|
|
|
|
|
if (!shsurf)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2013-10-25 03:52:00 +04:00
|
|
|
|
if (shsurf->grabbed)
|
|
|
|
|
return 0;
|
2014-01-18 20:30:50 +04:00
|
|
|
|
if (shsurf->state.fullscreen || shsurf->state.maximized)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
move = malloc(sizeof *move);
|
|
|
|
|
if (!move)
|
|
|
|
|
return -1;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
move->dx = wl_fixed_from_double(shsurf->view->geometry.x) -
|
2013-05-07 07:19:49 +04:00
|
|
|
|
seat->pointer->grab_x;
|
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-13 07:38:11 +04:00
|
|
|
|
move->dy = wl_fixed_from_double(shsurf->view->geometry.y) -
|
2013-05-07 07:19:49 +04:00
|
|
|
|
seat->pointer->grab_y;
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
|
|
|
|
shell_grab_start(&move->base, &move_grab_interface, shsurf,
|
2013-05-07 07:19:49 +04:00
|
|
|
|
seat->pointer, DESKTOP_SHELL_CURSOR_MOVE);
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-12-03 21:35:45 +04:00
|
|
|
|
common_surface_move(struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource, uint32_t serial)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
{
|
2013-06-14 19:08:00 +04:00
|
|
|
|
struct weston_seat *seat = wl_resource_get_user_data(seat_resource);
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2013-04-25 14:57:45 +04:00
|
|
|
|
struct weston_surface *surface;
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
2013-08-29 10:16:20 +04:00
|
|
|
|
if (seat->pointer &&
|
2014-01-10 03:43:17 +04:00
|
|
|
|
seat->pointer->focus &&
|
2013-08-29 10:16:20 +04:00
|
|
|
|
seat->pointer->button_count > 0 &&
|
|
|
|
|
seat->pointer->grab_serial == serial) {
|
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-13 07:38:11 +04:00
|
|
|
|
surface = weston_surface_get_main_surface(seat->pointer->focus->surface);
|
2014-01-17 22:08:25 +04:00
|
|
|
|
if ((surface == shsurf->surface) &&
|
2013-08-15 20:10:08 +04:00
|
|
|
|
(surface_move(shsurf, seat) < 0))
|
|
|
|
|
wl_resource_post_no_memory(resource);
|
2013-08-29 10:16:20 +04:00
|
|
|
|
} else if (seat->touch &&
|
2014-01-10 03:43:17 +04:00
|
|
|
|
seat->touch->focus &&
|
2013-08-29 10:16:20 +04:00
|
|
|
|
seat->touch->grab_serial == serial) {
|
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-13 07:38:11 +04:00
|
|
|
|
surface = weston_surface_get_main_surface(seat->touch->focus->surface);
|
2014-01-17 22:08:25 +04:00
|
|
|
|
if ((surface == shsurf->surface) &&
|
2013-08-15 20:10:08 +04:00
|
|
|
|
(surface_touch_move(shsurf, seat) < 0))
|
|
|
|
|
wl_resource_post_no_memory(resource);
|
|
|
|
|
}
|
2012-08-01 08:08:07 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_move(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource, uint32_t serial)
|
|
|
|
|
{
|
|
|
|
|
common_surface_move(resource, seat_resource, serial);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 08:08:07 +04:00
|
|
|
|
struct weston_resize_grab {
|
|
|
|
|
struct shell_grab base;
|
|
|
|
|
uint32_t edges;
|
|
|
|
|
int32_t width, height;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-11-15 02:42:52 +04:00
|
|
|
|
resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
|
|
|
|
|
wl_fixed_t x, wl_fixed_t y)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2012-08-01 08:08:07 +04:00
|
|
|
|
struct shell_surface *shsurf = resize->base.shsurf;
|
|
|
|
|
int32_t width, height;
|
|
|
|
|
wl_fixed_t from_x, from_y;
|
|
|
|
|
wl_fixed_t to_x, to_y;
|
|
|
|
|
|
2013-11-15 02:42:52 +04:00
|
|
|
|
weston_pointer_move(pointer, x, y);
|
|
|
|
|
|
2012-08-01 08:08:07 +04:00
|
|
|
|
if (!shsurf)
|
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_from_global_fixed(shsurf->view,
|
|
|
|
|
pointer->grab_x, pointer->grab_y,
|
|
|
|
|
&from_x, &from_y);
|
|
|
|
|
weston_view_from_global_fixed(shsurf->view,
|
|
|
|
|
pointer->x, pointer->y, &to_x, &to_y);
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
|
|
|
|
width = resize->width;
|
|
|
|
|
if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) {
|
|
|
|
|
width += wl_fixed_to_int(from_x - to_x);
|
|
|
|
|
} else if (resize->edges & WL_SHELL_SURFACE_RESIZE_RIGHT) {
|
|
|
|
|
width += wl_fixed_to_int(to_x - from_x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
height = resize->height;
|
|
|
|
|
if (resize->edges & WL_SHELL_SURFACE_RESIZE_TOP) {
|
|
|
|
|
height += wl_fixed_to_int(from_y - to_y);
|
|
|
|
|
} else if (resize->edges & WL_SHELL_SURFACE_RESIZE_BOTTOM) {
|
|
|
|
|
height += wl_fixed_to_int(to_y - from_y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shsurf->client->send_configure(shsurf->surface,
|
|
|
|
|
resize->edges, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
send_configure(struct weston_surface *surface,
|
|
|
|
|
uint32_t edges, int32_t width, int32_t height)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(surface);
|
|
|
|
|
|
2014-01-17 22:08:25 +04:00
|
|
|
|
assert(shsurf);
|
|
|
|
|
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_shell_surface_send_configure(shsurf->resource,
|
2012-08-01 08:08:07 +04:00
|
|
|
|
edges, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct weston_shell_client shell_client = {
|
|
|
|
|
send_configure
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
resize_grab_button(struct weston_pointer_grab *grab,
|
2012-08-01 08:08:07 +04:00
|
|
|
|
uint32_t time, uint32_t button, uint32_t state_w)
|
|
|
|
|
{
|
|
|
|
|
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2012-08-01 08:08:07 +04:00
|
|
|
|
enum wl_pointer_button_state state = state_w;
|
|
|
|
|
|
|
|
|
|
if (pointer->button_count == 0 &&
|
|
|
|
|
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
|
|
|
|
shell_grab_end(&resize->base);
|
|
|
|
|
free(grab);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
resize_grab_cancel(struct weston_pointer_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
|
|
|
|
|
|
|
|
|
|
shell_grab_end(&resize->base);
|
|
|
|
|
free(grab);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 06:15:05 +04:00
|
|
|
|
static const struct weston_pointer_grab_interface resize_grab_interface = {
|
2012-08-01 08:08:07 +04:00
|
|
|
|
noop_grab_focus,
|
|
|
|
|
resize_grab_motion,
|
|
|
|
|
resize_grab_button,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
resize_grab_cancel,
|
2012-08-01 08:08:07 +04:00
|
|
|
|
};
|
|
|
|
|
|
2013-04-25 14:57:46 +04:00
|
|
|
|
/*
|
|
|
|
|
* Returns the bounding box of a surface and all its sub-surfaces,
|
|
|
|
|
* in the surface coordinates system. */
|
|
|
|
|
static void
|
|
|
|
|
surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x,
|
|
|
|
|
int32_t *y, int32_t *w, int32_t *h) {
|
|
|
|
|
pixman_region32_t region;
|
|
|
|
|
pixman_box32_t *box;
|
|
|
|
|
struct weston_subsurface *subsurface;
|
|
|
|
|
|
|
|
|
|
pixman_region32_init_rect(®ion, 0, 0,
|
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-13 07:38:11 +04:00
|
|
|
|
surface->width,
|
|
|
|
|
surface->height);
|
2013-04-25 14:57:46 +04:00
|
|
|
|
|
|
|
|
|
wl_list_for_each(subsurface, &surface->subsurface_list, parent_link) {
|
|
|
|
|
pixman_region32_union_rect(®ion, ®ion,
|
|
|
|
|
subsurface->position.x,
|
|
|
|
|
subsurface->position.y,
|
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-13 07:38:11 +04:00
|
|
|
|
subsurface->surface->width,
|
|
|
|
|
subsurface->surface->height);
|
2013-04-25 14:57:46 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
box = pixman_region32_extents(®ion);
|
|
|
|
|
if (x)
|
|
|
|
|
*x = box->x1;
|
|
|
|
|
if (y)
|
|
|
|
|
*y = box->y1;
|
|
|
|
|
if (w)
|
|
|
|
|
*w = box->x2 - box->x1;
|
|
|
|
|
if (h)
|
|
|
|
|
*h = box->y2 - box->y1;
|
|
|
|
|
|
|
|
|
|
pixman_region32_fini(®ion);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-01 08:08:07 +04:00
|
|
|
|
static int
|
|
|
|
|
surface_resize(struct shell_surface *shsurf,
|
2013-05-07 07:19:49 +04:00
|
|
|
|
struct weston_seat *seat, uint32_t edges)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_resize_grab *resize;
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.fullscreen || shsurf->state.maximized)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (edges == 0 || edges > 15 ||
|
|
|
|
|
(edges & 3) == 3 || (edges & 12) == 12)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
resize = malloc(sizeof *resize);
|
|
|
|
|
if (!resize)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
resize->edges = edges;
|
2013-04-25 14:57:46 +04:00
|
|
|
|
surface_subsurfaces_boundingbox(shsurf->surface, NULL, NULL,
|
|
|
|
|
&resize->width, &resize->height);
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
2014-02-06 09:36:04 +04:00
|
|
|
|
shsurf->resize_edges = edges;
|
2012-08-01 08:08:07 +04:00
|
|
|
|
shell_grab_start(&resize->base, &resize_grab_interface, shsurf,
|
2013-05-07 07:19:49 +04:00
|
|
|
|
seat->pointer, edges);
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-12-03 21:35:45 +04:00
|
|
|
|
common_surface_resize(struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource, uint32_t serial,
|
|
|
|
|
uint32_t edges)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
{
|
2013-06-14 19:08:00 +04:00
|
|
|
|
struct weston_seat *seat = wl_resource_get_user_data(seat_resource);
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2013-04-25 14:57:45 +04:00
|
|
|
|
struct weston_surface *surface;
|
2012-08-01 08:08:07 +04:00
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.fullscreen)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2013-05-07 07:19:49 +04:00
|
|
|
|
if (seat->pointer->button_count == 0 ||
|
|
|
|
|
seat->pointer->grab_serial != serial ||
|
2014-01-10 03:43:17 +04:00
|
|
|
|
seat->pointer->focus == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface = weston_surface_get_main_surface(seat->pointer->focus->surface);
|
|
|
|
|
if (surface != shsurf->surface)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2013-05-07 07:19:49 +04:00
|
|
|
|
if (surface_resize(shsurf, seat, edges) < 0)
|
2012-08-01 08:08:07 +04:00
|
|
|
|
wl_resource_post_no_memory(resource);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource, uint32_t serial,
|
|
|
|
|
uint32_t edges)
|
|
|
|
|
{
|
|
|
|
|
common_surface_resize(resource, seat_resource, serial, edges);
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-04 09:12:17 +04:00
|
|
|
|
static void
|
|
|
|
|
end_busy_cursor(struct shell_surface *shsurf, struct weston_pointer *pointer);
|
|
|
|
|
|
2012-04-18 05:06:20 +04:00
|
|
|
|
static void
|
2013-05-09 06:02:59 +04:00
|
|
|
|
busy_cursor_grab_focus(struct weston_pointer_grab *base)
|
2012-04-18 05:06:20 +04:00
|
|
|
|
{
|
2012-06-05 17:58:51 +04:00
|
|
|
|
struct shell_grab *grab = (struct shell_grab *) base;
|
2013-05-09 06:02:59 +04:00
|
|
|
|
struct weston_pointer *pointer = base->pointer;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2013-05-09 06:02:59 +04:00
|
|
|
|
wl_fixed_t sx, sy;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
view = weston_compositor_pick_view(pointer->seat->compositor,
|
|
|
|
|
pointer->x, pointer->y,
|
|
|
|
|
&sx, &sy);
|
2012-04-18 05:06:20 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (!grab->shsurf || grab->shsurf->surface != view->surface)
|
2013-07-04 09:12:17 +04:00
|
|
|
|
end_busy_cursor(grab->shsurf, pointer);
|
2012-04-18 05:06:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-11-15 02:42:52 +04:00
|
|
|
|
busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
|
|
|
|
|
wl_fixed_t x, wl_fixed_t y)
|
2012-04-18 05:06:20 +04:00
|
|
|
|
{
|
2013-11-15 02:42:52 +04:00
|
|
|
|
weston_pointer_move(grab->pointer, x, y);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
}
|
2012-04-18 05:06:20 +04:00
|
|
|
|
|
2012-06-05 17:58:51 +04:00
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
busy_cursor_grab_button(struct weston_pointer_grab *base,
|
2012-06-05 17:58:51 +04:00
|
|
|
|
uint32_t time, uint32_t button, uint32_t state)
|
|
|
|
|
{
|
2012-08-01 08:20:21 +04:00
|
|
|
|
struct shell_grab *grab = (struct shell_grab *) base;
|
2013-05-09 00:47:00 +04:00
|
|
|
|
struct shell_surface *shsurf = grab->shsurf;
|
2013-05-07 07:19:49 +04:00
|
|
|
|
struct weston_seat *seat = grab->grab.pointer->seat;
|
2012-08-01 08:20:21 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf && button == BTN_LEFT && state) {
|
|
|
|
|
activate(shsurf->shell, shsurf->surface, seat);
|
|
|
|
|
surface_move(shsurf, seat);
|
2013-02-15 06:31:44 +04:00
|
|
|
|
} else if (shsurf && button == BTN_RIGHT && state) {
|
|
|
|
|
activate(shsurf->shell, shsurf->surface, seat);
|
2013-05-07 07:19:49 +04:00
|
|
|
|
surface_rotate(shsurf, seat);
|
2012-08-01 08:20:21 +04:00
|
|
|
|
}
|
2012-06-05 17:58:51 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
busy_cursor_grab_cancel(struct weston_pointer_grab *base)
|
|
|
|
|
{
|
|
|
|
|
struct shell_grab *grab = (struct shell_grab *) base;
|
|
|
|
|
|
|
|
|
|
shell_grab_end(grab);
|
|
|
|
|
free(grab);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 06:15:05 +04:00
|
|
|
|
static const struct weston_pointer_grab_interface busy_cursor_grab_interface = {
|
2012-06-05 17:58:51 +04:00
|
|
|
|
busy_cursor_grab_focus,
|
|
|
|
|
busy_cursor_grab_motion,
|
|
|
|
|
busy_cursor_grab_button,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
busy_cursor_grab_cancel,
|
2012-06-05 17:58:51 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
set_busy_cursor(struct shell_surface *shsurf, struct weston_pointer *pointer)
|
2012-06-05 17:58:51 +04:00
|
|
|
|
{
|
|
|
|
|
struct shell_grab *grab;
|
|
|
|
|
|
|
|
|
|
grab = malloc(sizeof *grab);
|
|
|
|
|
if (!grab)
|
2012-04-18 05:06:20 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_start(grab, &busy_cursor_grab_interface, shsurf, pointer,
|
|
|
|
|
DESKTOP_SHELL_CURSOR_BUSY);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
}
|
2012-04-18 05:06:20 +04:00
|
|
|
|
|
2012-06-05 17:58:51 +04:00
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
end_busy_cursor(struct shell_surface *shsurf, struct weston_pointer *pointer)
|
2012-06-05 17:58:51 +04:00
|
|
|
|
{
|
|
|
|
|
struct shell_grab *grab = (struct shell_grab *) pointer->grab;
|
2012-04-18 05:06:20 +04:00
|
|
|
|
|
2013-05-09 00:47:00 +04:00
|
|
|
|
if (grab->grab.interface == &busy_cursor_grab_interface &&
|
|
|
|
|
grab->shsurf == shsurf) {
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_end(grab);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
free(grab);
|
2012-04-18 05:06:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-19 23:06:17 +04:00
|
|
|
|
static void
|
|
|
|
|
ping_timer_destroy(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
if (!shsurf || !shsurf->ping_timer)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (shsurf->ping_timer->source)
|
|
|
|
|
wl_event_source_remove(shsurf->ping_timer->source);
|
|
|
|
|
|
|
|
|
|
free(shsurf->ping_timer);
|
|
|
|
|
shsurf->ping_timer = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
static int
|
|
|
|
|
ping_timeout_handler(void *data)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = data;
|
2012-06-05 17:58:51 +04:00
|
|
|
|
struct weston_seat *seat;
|
2012-04-18 05:06:18 +04:00
|
|
|
|
|
2012-04-19 23:06:17 +04:00
|
|
|
|
/* Client is not responding */
|
|
|
|
|
shsurf->unresponsive = 1;
|
2012-06-05 17:58:51 +04:00
|
|
|
|
|
|
|
|
|
wl_list_for_each(seat, &shsurf->surface->compositor->seat_list, link)
|
2014-01-18 04:39:17 +04:00
|
|
|
|
if (seat->pointer && seat->pointer->focus &&
|
2013-11-22 19:21:20 +04:00
|
|
|
|
seat->pointer->focus->surface == shsurf->surface)
|
2013-05-07 07:19:49 +04:00
|
|
|
|
set_busy_cursor(shsurf, seat->pointer);
|
2012-04-18 05:06:18 +04:00
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ping_handler(struct weston_surface *surface, uint32_t serial)
|
|
|
|
|
{
|
2012-05-10 20:28:35 +04:00
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(surface);
|
2012-04-18 05:06:18 +04:00
|
|
|
|
struct wl_event_loop *loop;
|
2012-06-05 17:58:51 +04:00
|
|
|
|
int ping_timeout = 200;
|
2012-04-18 05:06:18 +04:00
|
|
|
|
|
|
|
|
|
if (!shsurf)
|
|
|
|
|
return;
|
2013-06-14 19:07:54 +04:00
|
|
|
|
if (!shsurf->resource)
|
2012-04-22 07:20:07 +04:00
|
|
|
|
return;
|
2012-04-18 05:06:18 +04:00
|
|
|
|
|
2012-07-16 15:15:48 +04:00
|
|
|
|
if (shsurf->surface == shsurf->shell->grab_surface)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
if (!shsurf->ping_timer) {
|
2012-04-27 14:55:55 +04:00
|
|
|
|
shsurf->ping_timer = malloc(sizeof *shsurf->ping_timer);
|
2012-04-18 05:06:18 +04:00
|
|
|
|
if (!shsurf->ping_timer)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
shsurf->ping_timer->serial = serial;
|
|
|
|
|
loop = wl_display_get_event_loop(surface->compositor->wl_display);
|
|
|
|
|
shsurf->ping_timer->source =
|
|
|
|
|
wl_event_loop_add_timer(loop, ping_timeout_handler, shsurf);
|
|
|
|
|
wl_event_source_timer_update(shsurf->ping_timer->source, ping_timeout);
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
if (shell_surface_is_wl_shell_surface(shsurf))
|
|
|
|
|
wl_shell_surface_send_ping(shsurf->resource, serial);
|
|
|
|
|
else if (shell_surface_is_xdg_surface(shsurf))
|
|
|
|
|
xdg_surface_send_ping(shsurf->resource, serial);
|
|
|
|
|
else if (shell_surface_is_xdg_popup(shsurf))
|
|
|
|
|
xdg_popup_send_ping(shsurf->resource, serial);
|
2012-04-18 05:06:18 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-05 17:58:51 +04:00
|
|
|
|
static void
|
|
|
|
|
handle_pointer_focus(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = data;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view = pointer->focus;
|
2012-06-05 17:58:51 +04:00
|
|
|
|
struct weston_compositor *compositor;
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
uint32_t serial;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (!view)
|
2012-06-05 17:58:51 +04:00
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
compositor = view->surface->compositor;
|
|
|
|
|
shsurf = get_shell_surface(view->surface);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
|
shell: fix a crash during 'make check'
$ abs_builddir=$PWD/tests gdb -args ./src/weston --module=$PWD/tests/.libs/event-test.so
(gdb) run
Starting program: /home/pq/git/wayland-demos/src/weston --module=/home/pq/git/wayland-demos/tests/.libs/event-test.so
[Thread debugging using libthread_db enabled]
Mesa: Initializing x86-64 optimizations
launching /home/pq/git/wayland-demos/tests/test-client
created output global 0x608f50
test-client: got create-surface
got surface 5 from client
got surface id 5
Program received signal SIGSEGV, Segmentation fault.
Mesa: Initializing x86-64 optimizations
0x00007fffeff72c7c in handle_pointer_focus (listener=0x74f5c0, data=0x6faa40) at shell.c:492
492 if (shsurf->unresponsive) {
(gdb) bt
#0 0x00007fffeff72c7c in handle_pointer_focus (listener=0x74f5c0, data=0x6faa40) at shell.c:492
#1 0x00007ffff5ed8b87 in wl_signal_emit (data=0x6faa40, signal=0x6faa88) at wayland-server.h:166
#2 wl_pointer_set_focus (pointer=0x6faa40, surface=<optimized out>, sx=12800, sy=12800) at wayland-server.c:752
#3 0x0000000000407d92 in weston_device_repick (seat=0x6fa930) at compositor.c:633
#4 0x0000000000407e49 in weston_compositor_repick (compositor=0x61c510) at compositor.c:656
#5 0x00000000004092e1 in weston_output_repaint (output=0x7b85b0, msecs=-1046834186) at compositor.c:1059
#6 0x00000000004094b4 in weston_output_finish_frame (output=0x7b85b0, msecs=-1046834186) at compositor.c:1092
#7 0x00007ffff211e3c1 in finish_frame_handler (data=0x7b85b0) at compositor-x11.c:284
#8 0x00007ffff5eda603 in wl_event_source_timer_dispatch (source=0x79ee50, ep=<optimized out>) at event-loop.c:173
#9 0x00007ffff5edaca0 in wl_event_loop_dispatch (loop=0x61b940, timeout=<optimized out>) at event-loop.c:410
#10 0x00007ffff5ed8dbd in wl_display_run (display=0x61b8f0) at wayland-server.c:1025
#11 0x000000000040ecb1 in main (argc=1, argv=0x7fffffffdd98) at compositor.c:3225
(gdb) print shsurf
$1 = (struct shell_surface *) 0x0
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-06-06 17:59:45 +04:00
|
|
|
|
if (shsurf && shsurf->unresponsive) {
|
2012-06-05 17:58:51 +04:00
|
|
|
|
set_busy_cursor(shsurf, pointer);
|
|
|
|
|
} else {
|
|
|
|
|
serial = wl_display_next_serial(compositor->wl_display);
|
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-13 07:38:11 +04:00
|
|
|
|
ping_handler(view->surface, serial);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-10 18:05:39 +04:00
|
|
|
|
static void
|
|
|
|
|
create_pointer_focus_listener(struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct wl_listener *listener;
|
|
|
|
|
|
2013-05-07 07:19:49 +04:00
|
|
|
|
if (!seat->pointer)
|
2012-08-10 18:05:39 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
listener = malloc(sizeof *listener);
|
|
|
|
|
listener->notify = handle_pointer_focus;
|
2013-05-07 07:19:49 +04:00
|
|
|
|
wl_signal_add(&seat->pointer->focus_signal, listener);
|
2012-08-10 18:05:39 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-10 02:36:28 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_lose_keyboard_focus(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
if (--shsurf->focus_count == 0)
|
|
|
|
|
if (shell_surface_is_xdg_surface(shsurf))
|
|
|
|
|
xdg_surface_send_focused_unset(shsurf->resource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_surface_gain_keyboard_focus(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
if (shsurf->focus_count++ == 0)
|
|
|
|
|
if (shell_surface_is_xdg_surface(shsurf))
|
|
|
|
|
xdg_surface_send_focused_set(shsurf->resource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
handle_keyboard_focus(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct weston_keyboard *keyboard = data;
|
|
|
|
|
struct shell_seat *seat = get_shell_seat(keyboard->seat);
|
|
|
|
|
|
|
|
|
|
if (seat->focused_surface) {
|
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(seat->focused_surface);
|
|
|
|
|
if (shsurf)
|
|
|
|
|
shell_surface_lose_keyboard_focus(shsurf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
seat->focused_surface = keyboard->focus;
|
|
|
|
|
|
|
|
|
|
if (seat->focused_surface) {
|
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(seat->focused_surface);
|
|
|
|
|
if (shsurf)
|
|
|
|
|
shell_surface_gain_keyboard_focus(shsurf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
create_keyboard_focus_listener(struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct wl_listener *listener;
|
|
|
|
|
|
|
|
|
|
if (!seat->keyboard)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
listener = malloc(sizeof *listener);
|
|
|
|
|
listener->notify = handle_keyboard_focus;
|
|
|
|
|
wl_signal_add(&seat->keyboard->focus_signal, listener);
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
static void
|
2013-12-03 21:35:45 +04:00
|
|
|
|
xdg_surface_set_transient_for(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *parent_resource)
|
2012-04-18 05:06:18 +04:00
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2013-12-07 22:49:28 +04:00
|
|
|
|
struct weston_surface *parent;
|
|
|
|
|
|
|
|
|
|
if (parent_resource)
|
|
|
|
|
parent = wl_resource_get_user_data(parent_resource);
|
|
|
|
|
else
|
|
|
|
|
parent = NULL;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
|
|
|
|
|
shell_surface_set_parent(shsurf, parent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
surface_pong(struct shell_surface *shsurf, uint32_t serial)
|
|
|
|
|
{
|
2012-06-05 17:58:51 +04:00
|
|
|
|
struct weston_compositor *ec = shsurf->surface->compositor;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
struct weston_seat *seat;
|
2012-04-18 05:06:18 +04:00
|
|
|
|
|
2012-08-12 06:39:12 +04:00
|
|
|
|
if (shsurf->ping_timer == NULL)
|
|
|
|
|
/* Just ignore unsolicited pong. */
|
|
|
|
|
return;
|
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
if (shsurf->ping_timer->serial == serial) {
|
2012-06-05 17:58:51 +04:00
|
|
|
|
shsurf->unresponsive = 0;
|
2013-05-17 20:07:41 +04:00
|
|
|
|
wl_list_for_each(seat, &ec->seat_list, link) {
|
|
|
|
|
if(seat->pointer)
|
|
|
|
|
end_busy_cursor(shsurf, seat->pointer);
|
|
|
|
|
}
|
2012-04-19 23:06:17 +04:00
|
|
|
|
ping_timer_destroy(shsurf);
|
2012-04-18 05:06:18 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
|
uint32_t serial)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
surface_pong(shsurf, serial);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-11 20:20:47 +04:00
|
|
|
|
static void
|
|
|
|
|
set_title(struct shell_surface *shsurf, const char *title)
|
|
|
|
|
{
|
|
|
|
|
free(shsurf->title);
|
|
|
|
|
shsurf->title = strdup(title);
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-02 17:47:44 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_title(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource, const char *title)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2012-05-02 17:47:44 +04:00
|
|
|
|
|
2013-09-11 20:20:47 +04:00
|
|
|
|
set_title(shsurf, title);
|
2012-05-02 17:47:44 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_class(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource, const char *class)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2012-05-02 17:47:44 +04:00
|
|
|
|
|
|
|
|
|
free(shsurf->class);
|
|
|
|
|
shsurf->class = strdup(class);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-28 18:23:39 +04:00
|
|
|
|
static void
|
|
|
|
|
restore_output_mode(struct weston_output *output)
|
|
|
|
|
{
|
2013-09-19 01:56:36 +04:00
|
|
|
|
if (output->current_mode != output->original_mode ||
|
|
|
|
|
(int32_t)output->current_scale != output->original_scale)
|
2013-05-28 18:23:39 +04:00
|
|
|
|
weston_output_switch_mode(output,
|
2013-09-19 01:56:36 +04:00
|
|
|
|
output->original_mode,
|
|
|
|
|
output->original_scale,
|
|
|
|
|
WESTON_MODE_SWITCH_RESTORE_NATIVE);
|
2013-05-28 18:23:39 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
restore_all_output_modes(struct weston_compositor *compositor)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(output, &compositor->output_list, link)
|
|
|
|
|
restore_output_mode(output);
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
static int
|
|
|
|
|
get_output_panel_height(struct desktop_shell *shell,
|
|
|
|
|
struct weston_output *output)
|
|
|
|
|
{
|
|
|
|
|
struct weston_view *view;
|
|
|
|
|
int panel_height = 0;
|
|
|
|
|
|
|
|
|
|
if (!output)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(view, &shell->panel_layer.view_list, layer_link) {
|
|
|
|
|
if (view->surface->output == output) {
|
2013-12-03 07:01:53 +04:00
|
|
|
|
panel_height = view->surface->height;
|
2013-11-25 22:01:30 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return panel_height;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:40 +04:00
|
|
|
|
/* The surface will be inserted into the list immediately after the link
|
|
|
|
|
* returned by this function (i.e. will be stacked immediately above the
|
|
|
|
|
* returned link). */
|
|
|
|
|
static struct wl_list *
|
|
|
|
|
shell_surface_calculate_layer_link (struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *ws;
|
2014-01-02 01:51:52 +04:00
|
|
|
|
struct weston_view *parent;
|
2013-11-25 22:01:40 +04:00
|
|
|
|
|
|
|
|
|
switch (shsurf->type) {
|
2014-01-02 01:51:52 +04:00
|
|
|
|
case SHELL_SURFACE_POPUP:
|
|
|
|
|
case SHELL_SURFACE_TOPLEVEL:
|
2013-12-03 21:35:43 +04:00
|
|
|
|
if (shsurf->state.fullscreen) {
|
2013-12-03 21:35:42 +04:00
|
|
|
|
return &shsurf->shell->fullscreen_layer.view_list;
|
2013-12-03 21:35:43 +04:00
|
|
|
|
} else if (shsurf->parent) {
|
2014-01-02 00:26:14 +04:00
|
|
|
|
/* Move the surface to its parent layer so
|
|
|
|
|
* that surfaces which are transient for
|
|
|
|
|
* fullscreen surfaces don't get hidden by the
|
|
|
|
|
* fullscreen surfaces. */
|
2013-12-03 21:35:43 +04:00
|
|
|
|
|
|
|
|
|
/* TODO: Handle a parent with multiple views */
|
|
|
|
|
parent = get_default_view(shsurf->parent);
|
|
|
|
|
if (parent)
|
|
|
|
|
return parent->layer_link.prev;
|
|
|
|
|
}
|
2013-12-03 21:35:42 +04:00
|
|
|
|
break;
|
2013-11-25 22:01:40 +04:00
|
|
|
|
|
|
|
|
|
case SHELL_SURFACE_XWAYLAND:
|
2013-12-06 10:43:03 +04:00
|
|
|
|
return &shsurf->shell->fullscreen_layer.view_list;
|
|
|
|
|
|
2013-11-25 22:01:40 +04:00
|
|
|
|
case SHELL_SURFACE_NONE:
|
|
|
|
|
default:
|
|
|
|
|
/* Go to the fallback, below. */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Move the surface to a normal workspace layer so that surfaces
|
|
|
|
|
* which were previously fullscreen or transient are no longer
|
|
|
|
|
* rendered on top. */
|
|
|
|
|
ws = get_current_workspace(shsurf->shell);
|
|
|
|
|
return &ws->layer.view_list;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:44 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_update_child_surface_layers (struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *child;
|
|
|
|
|
|
|
|
|
|
/* Move the child layers to the same workspace as shsurf. They will be
|
|
|
|
|
* stacked above shsurf. */
|
|
|
|
|
wl_list_for_each_reverse(child, &shsurf->children_list, children_link) {
|
|
|
|
|
if (shsurf->view->layer_link.prev != &child->view->layer_link) {
|
|
|
|
|
weston_view_geometry_dirty(child->view);
|
|
|
|
|
wl_list_remove(&child->view->layer_link);
|
|
|
|
|
wl_list_insert(shsurf->view->layer_link.prev,
|
|
|
|
|
&child->view->layer_link);
|
|
|
|
|
weston_view_geometry_dirty(child->view);
|
|
|
|
|
weston_surface_damage(child->surface);
|
|
|
|
|
|
|
|
|
|
/* Recurse. We don’t expect this to recurse very far (if
|
|
|
|
|
* at all) because that would imply we have transient
|
|
|
|
|
* (or popup) children of transient surfaces, which
|
|
|
|
|
* would be unusual. */
|
|
|
|
|
shell_surface_update_child_surface_layers(child);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:41 +04:00
|
|
|
|
/* Update the surface’s layer. Mark both the old and new views as having dirty
|
2013-11-25 22:01:44 +04:00
|
|
|
|
* geometry to ensure the changes are redrawn.
|
|
|
|
|
*
|
|
|
|
|
* If any child surfaces exist and are mapped, ensure they’re in the same layer
|
|
|
|
|
* as this surface. */
|
2013-11-25 22:01:41 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_update_layer(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct wl_list *new_layer_link;
|
|
|
|
|
|
|
|
|
|
new_layer_link = shell_surface_calculate_layer_link(shsurf);
|
|
|
|
|
|
|
|
|
|
if (new_layer_link == &shsurf->view->layer_link)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
weston_view_geometry_dirty(shsurf->view);
|
|
|
|
|
wl_list_remove(&shsurf->view->layer_link);
|
|
|
|
|
wl_list_insert(new_layer_link, &shsurf->view->layer_link);
|
|
|
|
|
weston_view_geometry_dirty(shsurf->view);
|
|
|
|
|
weston_surface_damage(shsurf->surface);
|
2013-11-25 22:01:44 +04:00
|
|
|
|
|
|
|
|
|
shell_surface_update_child_surface_layers(shsurf);
|
2013-11-25 22:01:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:38 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_parent(struct shell_surface *shsurf,
|
|
|
|
|
struct weston_surface *parent)
|
|
|
|
|
{
|
|
|
|
|
shsurf->parent = parent;
|
2013-11-25 22:01:44 +04:00
|
|
|
|
|
|
|
|
|
wl_list_remove(&shsurf->children_link);
|
|
|
|
|
wl_list_init(&shsurf->children_link);
|
|
|
|
|
|
|
|
|
|
/* Insert into the parent surface’s child list. */
|
|
|
|
|
if (parent != NULL) {
|
|
|
|
|
struct shell_surface *parent_shsurf = get_shell_surface(parent);
|
|
|
|
|
if (parent_shsurf != NULL)
|
|
|
|
|
wl_list_insert(&parent_shsurf->children_list,
|
|
|
|
|
&shsurf->children_link);
|
|
|
|
|
}
|
2013-11-25 22:01:38 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:35 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_output(struct shell_surface *shsurf,
|
|
|
|
|
struct weston_output *output)
|
|
|
|
|
{
|
|
|
|
|
struct weston_surface *es = shsurf->surface;
|
|
|
|
|
|
|
|
|
|
/* get the default output, if the client set it as NULL
|
|
|
|
|
check whether the ouput is available */
|
|
|
|
|
if (output)
|
|
|
|
|
shsurf->output = output;
|
|
|
|
|
else if (es->output)
|
|
|
|
|
shsurf->output = es->output;
|
|
|
|
|
else
|
|
|
|
|
shsurf->output = get_default_output(es->compositor);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
static void
|
|
|
|
|
surface_clear_next_states(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
shsurf->next_state.maximized = false;
|
|
|
|
|
shsurf->next_state.fullscreen = false;
|
|
|
|
|
|
|
|
|
|
if ((shsurf->next_state.maximized != shsurf->state.maximized) ||
|
|
|
|
|
(shsurf->next_state.fullscreen != shsurf->state.fullscreen))
|
|
|
|
|
shsurf->state_changed = true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
static void
|
|
|
|
|
set_toplevel(struct shell_surface *shsurf)
|
|
|
|
|
{
|
2013-12-06 10:31:25 +04:00
|
|
|
|
shell_surface_set_parent(shsurf, NULL);
|
|
|
|
|
surface_clear_next_states(shsurf);
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_TOPLEVEL;
|
2013-11-25 22:01:44 +04:00
|
|
|
|
|
|
|
|
|
/* The layer_link is updated in set_surface_type(),
|
|
|
|
|
* called from configure. */
|
2013-11-25 22:01:30 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
static void
|
2013-11-25 22:01:30 +04:00
|
|
|
|
shell_surface_set_toplevel(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *surface = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
set_toplevel(surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_transient(struct shell_surface *shsurf,
|
|
|
|
|
struct weston_surface *parent, int x, int y, uint32_t flags)
|
|
|
|
|
{
|
2013-11-25 22:01:38 +04:00
|
|
|
|
assert(parent != NULL);
|
|
|
|
|
|
2014-01-03 10:40:37 +04:00
|
|
|
|
shell_surface_set_parent(shsurf, parent);
|
|
|
|
|
|
|
|
|
|
surface_clear_next_states(shsurf);
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
shsurf->transient.x = x;
|
|
|
|
|
shsurf->transient.y = y;
|
|
|
|
|
shsurf->transient.flags = flags;
|
2013-11-25 22:01:38 +04:00
|
|
|
|
|
2013-12-03 21:35:43 +04:00
|
|
|
|
shsurf->next_state.relative = true;
|
2014-01-01 03:01:01 +04:00
|
|
|
|
shsurf->state_changed = true;
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_TOPLEVEL;
|
2013-11-25 22:01:44 +04:00
|
|
|
|
|
|
|
|
|
/* The layer_link is updated in set_surface_type(),
|
|
|
|
|
* called from configure. */
|
2013-11-25 22:01:30 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_transient(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *parent_resource,
|
|
|
|
|
int x, int y, uint32_t flags)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
struct weston_surface *parent =
|
|
|
|
|
wl_resource_get_user_data(parent_resource);
|
|
|
|
|
|
|
|
|
|
set_transient(shsurf, parent, x, y, flags);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_fullscreen(struct shell_surface *shsurf,
|
|
|
|
|
uint32_t method,
|
|
|
|
|
uint32_t framerate,
|
|
|
|
|
struct weston_output *output)
|
|
|
|
|
{
|
2013-11-25 22:01:35 +04:00
|
|
|
|
shell_surface_set_output(shsurf, output);
|
2013-11-25 22:01:30 +04:00
|
|
|
|
|
|
|
|
|
shsurf->fullscreen_output = shsurf->output;
|
|
|
|
|
shsurf->fullscreen.type = method;
|
|
|
|
|
shsurf->fullscreen.framerate = framerate;
|
2013-11-25 22:01:38 +04:00
|
|
|
|
|
2013-12-06 10:04:42 +04:00
|
|
|
|
shsurf->next_state.fullscreen = true;
|
|
|
|
|
shsurf->state_changed = true;
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_TOPLEVEL;
|
2013-11-25 22:01:30 +04:00
|
|
|
|
|
|
|
|
|
shsurf->client->send_configure(shsurf->surface, 0,
|
|
|
|
|
shsurf->output->width,
|
|
|
|
|
shsurf->output->height);
|
2013-11-25 22:01:44 +04:00
|
|
|
|
|
|
|
|
|
/* The layer_link is updated in set_surface_type(),
|
|
|
|
|
* called from configure. */
|
2013-11-25 22:01:30 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-14 00:10:57 +04:00
|
|
|
|
static void
|
|
|
|
|
weston_view_set_initial_position(struct weston_view *view,
|
|
|
|
|
struct desktop_shell *shell);
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
static void
|
|
|
|
|
unset_fullscreen(struct shell_surface *shsurf)
|
2012-03-01 08:57:46 +04:00
|
|
|
|
{
|
2013-11-25 22:01:37 +04:00
|
|
|
|
/* Unset the fullscreen output, driver configuration and transforms. */
|
2012-04-17 13:20:49 +04:00
|
|
|
|
if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER &&
|
|
|
|
|
shell_surface_is_top_fullscreen(shsurf)) {
|
2013-05-28 18:23:39 +04:00
|
|
|
|
restore_output_mode(shsurf->fullscreen_output);
|
2012-04-17 13:20:49 +04:00
|
|
|
|
}
|
2013-11-25 22:01:37 +04:00
|
|
|
|
shsurf->fullscreen_output = NULL;
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
shsurf->fullscreen.type = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
|
|
|
|
|
shsurf->fullscreen.framerate = 0;
|
2013-11-25 22:01:37 +04:00
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
wl_list_remove(&shsurf->fullscreen.transform.link);
|
|
|
|
|
wl_list_init(&shsurf->fullscreen.transform.link);
|
2013-11-25 22:01:37 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (shsurf->fullscreen.black_view)
|
|
|
|
|
weston_surface_destroy(shsurf->fullscreen.black_view->surface);
|
|
|
|
|
shsurf->fullscreen.black_view = NULL;
|
2013-11-25 22:01:37 +04:00
|
|
|
|
|
2013-12-14 00:10:57 +04:00
|
|
|
|
if (shsurf->saved_position_valid)
|
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
shsurf->saved_x, shsurf->saved_y);
|
|
|
|
|
else
|
|
|
|
|
weston_view_set_initial_position(shsurf->view, shsurf->shell);
|
|
|
|
|
|
2012-04-27 05:07:24 +04:00
|
|
|
|
if (shsurf->saved_rotation_valid) {
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_insert(&shsurf->view->geometry.transformation_list,
|
2013-11-25 22:01:30 +04:00
|
|
|
|
&shsurf->rotation.transform.link);
|
2012-04-27 05:07:24 +04:00
|
|
|
|
shsurf->saved_rotation_valid = false;
|
|
|
|
|
}
|
2012-10-07 22:25:36 +04:00
|
|
|
|
|
2013-11-25 22:01:41 +04:00
|
|
|
|
/* Layer is updated in set_surface_type(). */
|
2012-03-01 08:57:46 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-11 22:26:54 +04:00
|
|
|
|
static void
|
2013-11-25 22:01:30 +04:00
|
|
|
|
shell_surface_set_fullscreen(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
uint32_t method,
|
|
|
|
|
uint32_t framerate,
|
|
|
|
|
struct wl_resource *output_resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
|
|
|
|
|
if (output_resource)
|
|
|
|
|
output = wl_resource_get_user_data(output_resource);
|
|
|
|
|
else
|
|
|
|
|
output = NULL;
|
|
|
|
|
|
2013-12-03 21:35:44 +04:00
|
|
|
|
shell_surface_set_parent(shsurf, NULL);
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
surface_clear_next_states(shsurf);
|
2013-11-25 22:01:30 +04:00
|
|
|
|
set_fullscreen(shsurf, method, framerate, output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_popup(struct shell_surface *shsurf,
|
|
|
|
|
struct weston_surface *parent,
|
|
|
|
|
struct weston_seat *seat,
|
|
|
|
|
uint32_t serial,
|
|
|
|
|
int32_t x,
|
|
|
|
|
int32_t y)
|
|
|
|
|
{
|
2013-11-25 22:01:38 +04:00
|
|
|
|
assert(parent != NULL);
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
shsurf->popup.shseat = get_shell_seat(seat);
|
|
|
|
|
shsurf->popup.serial = serial;
|
|
|
|
|
shsurf->popup.x = x;
|
|
|
|
|
shsurf->popup.y = y;
|
2013-11-25 22:01:38 +04:00
|
|
|
|
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_POPUP;
|
2013-11-25 22:01:30 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_popup(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource,
|
|
|
|
|
uint32_t serial,
|
|
|
|
|
struct wl_resource *parent_resource,
|
|
|
|
|
int32_t x, int32_t y, uint32_t flags)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2013-12-03 21:35:44 +04:00
|
|
|
|
struct weston_surface *parent =
|
|
|
|
|
wl_resource_get_user_data(parent_resource);
|
|
|
|
|
|
|
|
|
|
shell_surface_set_parent(shsurf, parent);
|
2013-11-25 22:01:30 +04:00
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
surface_clear_next_states(shsurf);
|
2013-11-25 22:01:30 +04:00
|
|
|
|
set_popup(shsurf,
|
2013-12-03 21:35:44 +04:00
|
|
|
|
parent,
|
2013-11-25 22:01:30 +04:00
|
|
|
|
wl_resource_get_user_data(seat_resource),
|
|
|
|
|
serial, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_maximized(struct shell_surface *shsurf,
|
|
|
|
|
struct weston_output *output)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell;
|
|
|
|
|
uint32_t edges = 0, panel_height = 0;
|
|
|
|
|
|
2013-11-25 22:01:35 +04:00
|
|
|
|
shell_surface_set_output(shsurf, output);
|
2013-11-25 22:01:30 +04:00
|
|
|
|
|
|
|
|
|
shell = shell_surface_get_shell(shsurf);
|
|
|
|
|
panel_height = get_output_panel_height(shell, shsurf->output);
|
|
|
|
|
edges = WL_SHELL_SURFACE_RESIZE_TOP | WL_SHELL_SURFACE_RESIZE_LEFT;
|
|
|
|
|
|
|
|
|
|
shsurf->client->send_configure(shsurf->surface, edges,
|
|
|
|
|
shsurf->output->width,
|
|
|
|
|
shsurf->output->height - panel_height);
|
|
|
|
|
|
2013-12-06 10:00:40 +04:00
|
|
|
|
shsurf->next_state.maximized = true;
|
|
|
|
|
shsurf->state_changed = true;
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_TOPLEVEL;
|
2013-11-25 22:01:30 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
unset_maximized(struct shell_surface *shsurf)
|
2013-03-11 22:26:54 +04:00
|
|
|
|
{
|
|
|
|
|
/* undo all maximized things here */
|
|
|
|
|
shsurf->output = get_default_output(shsurf->surface->compositor);
|
2013-12-14 00:10:57 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf->saved_position_valid)
|
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
shsurf->saved_x, shsurf->saved_y);
|
|
|
|
|
else
|
|
|
|
|
weston_view_set_initial_position(shsurf->view, shsurf->shell);
|
2013-03-11 22:26:54 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf->saved_rotation_valid) {
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_insert(&shsurf->view->geometry.transformation_list,
|
|
|
|
|
&shsurf->rotation.transform.link);
|
2013-03-11 22:26:54 +04:00
|
|
|
|
shsurf->saved_rotation_valid = false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:41 +04:00
|
|
|
|
/* Layer is updated in set_surface_type(). */
|
2013-03-11 22:26:54 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_set_maximized(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *output_resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
|
|
|
|
|
if (output_resource)
|
|
|
|
|
output = wl_resource_get_user_data(output_resource);
|
|
|
|
|
else
|
|
|
|
|
output = NULL;
|
|
|
|
|
|
2013-12-03 21:35:44 +04:00
|
|
|
|
shell_surface_set_parent(shsurf, NULL);
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
surface_clear_next_states(shsurf);
|
2013-11-25 22:01:30 +04:00
|
|
|
|
set_maximized(shsurf, output);
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:41 +04:00
|
|
|
|
/* This is only ever called from set_surface_type(), so there’s no need to
|
|
|
|
|
* update layer_links here, since they’ll be updated when we return. */
|
2011-12-01 12:42:22 +04:00
|
|
|
|
static int
|
2013-11-25 22:01:30 +04:00
|
|
|
|
reset_surface_type(struct shell_surface *surface)
|
2011-12-01 12:42:22 +04:00
|
|
|
|
{
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (surface->state.fullscreen)
|
2013-11-25 22:01:30 +04:00
|
|
|
|
unset_fullscreen(surface);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (surface->state.maximized)
|
2013-11-25 22:01:30 +04:00
|
|
|
|
unset_maximized(surface);
|
2011-12-01 12:42:22 +04:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
static void
|
|
|
|
|
set_full_output(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
shsurf->saved_x = shsurf->view->geometry.x;
|
|
|
|
|
shsurf->saved_y = shsurf->view->geometry.y;
|
2013-12-03 21:35:46 +04:00
|
|
|
|
shsurf->saved_width = shsurf->surface->width;
|
|
|
|
|
shsurf->saved_height = shsurf->surface->height;
|
|
|
|
|
shsurf->saved_size_valid = true;
|
2013-12-03 21:35:42 +04:00
|
|
|
|
shsurf->saved_position_valid = true;
|
|
|
|
|
|
|
|
|
|
if (!wl_list_empty(&shsurf->rotation.transform.link)) {
|
|
|
|
|
wl_list_remove(&shsurf->rotation.transform.link);
|
|
|
|
|
wl_list_init(&shsurf->rotation.transform.link);
|
|
|
|
|
weston_view_geometry_dirty(shsurf->view);
|
|
|
|
|
shsurf->saved_rotation_valid = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-19 17:18:18 +04:00
|
|
|
|
static void
|
2012-04-28 01:20:01 +04:00
|
|
|
|
set_surface_type(struct shell_surface *shsurf)
|
2012-04-19 17:18:18 +04:00
|
|
|
|
{
|
2012-06-27 18:22:58 +04:00
|
|
|
|
struct weston_surface *pes = shsurf->parent;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *pev = get_default_view(pes);
|
2012-04-28 01:20:01 +04:00
|
|
|
|
|
2013-11-25 22:01:30 +04:00
|
|
|
|
reset_surface_type(shsurf);
|
2012-04-28 01:20:01 +04:00
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
shsurf->state = shsurf->next_state;
|
|
|
|
|
shsurf->state_changed = false;
|
2012-04-19 17:18:18 +04:00
|
|
|
|
|
2012-04-28 01:20:01 +04:00
|
|
|
|
switch (shsurf->type) {
|
|
|
|
|
case SHELL_SURFACE_TOPLEVEL:
|
2013-12-03 21:35:43 +04:00
|
|
|
|
if (shsurf->state.maximized || shsurf->state.fullscreen) {
|
2013-12-03 21:35:42 +04:00
|
|
|
|
set_full_output(shsurf);
|
2013-12-03 21:35:43 +04:00
|
|
|
|
} else if (shsurf->state.relative && pev) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
pev->geometry.x + shsurf->transient.x,
|
|
|
|
|
pev->geometry.y + shsurf->transient.y);
|
2013-12-03 21:35:43 +04:00
|
|
|
|
}
|
2013-12-05 00:37:16 +04:00
|
|
|
|
break;
|
2012-04-28 01:20:01 +04:00
|
|
|
|
|
2013-06-12 22:43:21 +04:00
|
|
|
|
case SHELL_SURFACE_XWAYLAND:
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view, shsurf->transient.x,
|
|
|
|
|
shsurf->transient.y);
|
2013-06-12 22:43:21 +04:00
|
|
|
|
break;
|
|
|
|
|
|
2013-11-25 22:01:31 +04:00
|
|
|
|
case SHELL_SURFACE_POPUP:
|
|
|
|
|
case SHELL_SURFACE_NONE:
|
2012-04-28 01:20:01 +04:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-11-25 22:01:41 +04:00
|
|
|
|
|
|
|
|
|
/* Update the surface’s layer. */
|
|
|
|
|
shell_surface_update_layer(shsurf);
|
2012-04-28 01:20:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-16 18:31:41 +04:00
|
|
|
|
static struct desktop_shell *
|
2012-02-07 04:45:41 +04:00
|
|
|
|
shell_surface_get_shell(struct shell_surface *shsurf)
|
2011-12-02 12:59:17 +04:00
|
|
|
|
{
|
2012-04-12 17:55:26 +04:00
|
|
|
|
return shsurf->shell;
|
2012-02-07 04:45:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-01 16:13:08 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy);
|
2012-04-01 16:13:08 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
static struct weston_view *
|
2012-03-01 08:57:46 +04:00
|
|
|
|
create_black_surface(struct weston_compositor *ec,
|
2012-04-01 16:13:08 +04:00
|
|
|
|
struct weston_surface *fs_surface,
|
2012-09-30 04:57:21 +04:00
|
|
|
|
float x, float y, int w, int h)
|
2012-03-01 08:57:46 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_surface *surface = NULL;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
|
|
|
|
|
surface = weston_surface_create(ec);
|
|
|
|
|
if (surface == NULL) {
|
2012-06-07 20:01:59 +04:00
|
|
|
|
weston_log("no memory\n");
|
2012-03-01 08:57:46 +04:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
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-13 07:38:11 +04:00
|
|
|
|
view = weston_view_create(surface);
|
|
|
|
|
if (surface == NULL) {
|
|
|
|
|
weston_log("no memory\n");
|
|
|
|
|
weston_surface_destroy(surface);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2012-03-01 08:57:46 +04:00
|
|
|
|
|
2012-04-01 16:13:08 +04:00
|
|
|
|
surface->configure = black_surface_configure;
|
2013-03-28 21:02:42 +04:00
|
|
|
|
surface->configure_private = fs_surface;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1);
|
2012-10-10 13:49:26 +04:00
|
|
|
|
pixman_region32_fini(&surface->opaque);
|
2012-08-04 00:31:36 +04:00
|
|
|
|
pixman_region32_init_rect(&surface->opaque, 0, 0, w, h);
|
2013-01-16 00:25:55 +04:00
|
|
|
|
pixman_region32_fini(&surface->input);
|
|
|
|
|
pixman_region32_init_rect(&surface->input, 0, 0, w, h);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
|
2014-01-02 01:58:57 +04:00
|
|
|
|
weston_surface_set_size(surface, w, h);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(view, x, y);
|
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-13 07:38:11 +04:00
|
|
|
|
|
|
|
|
|
return view;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:43 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output = shsurf->fullscreen_output;
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
assert(shsurf->state.fullscreen);
|
2013-11-25 22:01:43 +04:00
|
|
|
|
|
|
|
|
|
if (!shsurf->fullscreen.black_view)
|
|
|
|
|
shsurf->fullscreen.black_view =
|
|
|
|
|
create_black_surface(shsurf->surface->compositor,
|
|
|
|
|
shsurf->surface,
|
|
|
|
|
output->x, output->y,
|
|
|
|
|
output->width,
|
|
|
|
|
output->height);
|
|
|
|
|
|
|
|
|
|
weston_view_geometry_dirty(shsurf->fullscreen.black_view);
|
|
|
|
|
wl_list_remove(&shsurf->fullscreen.black_view->layer_link);
|
|
|
|
|
wl_list_insert(&shsurf->view->layer_link,
|
|
|
|
|
&shsurf->fullscreen.black_view->layer_link);
|
|
|
|
|
weston_view_geometry_dirty(shsurf->fullscreen.black_view);
|
|
|
|
|
weston_surface_damage(shsurf->surface);
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
/* Create black surface and append it to the associated fullscreen surface.
|
|
|
|
|
* Handle size dismatch and positioning according to the method. */
|
|
|
|
|
static void
|
|
|
|
|
shell_configure_fullscreen(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output = shsurf->fullscreen_output;
|
|
|
|
|
struct weston_surface *surface = shsurf->surface;
|
|
|
|
|
struct weston_matrix *matrix;
|
2012-07-12 20:32:31 +04:00
|
|
|
|
float scale, output_aspect, surface_aspect, x, y;
|
2013-04-25 14:57:46 +04:00
|
|
|
|
int32_t surf_x, surf_y, surf_width, surf_height;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
|
2013-05-28 18:23:39 +04:00
|
|
|
|
if (shsurf->fullscreen.type != WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER)
|
|
|
|
|
restore_output_mode(output);
|
|
|
|
|
|
2013-11-25 22:01:43 +04:00
|
|
|
|
shell_ensure_fullscreen_black_view(shsurf);
|
2012-03-01 08:57:46 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y,
|
2013-04-25 14:57:46 +04:00
|
|
|
|
&surf_width, &surf_height);
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
switch (shsurf->fullscreen.type) {
|
|
|
|
|
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT:
|
compositor: introduce weston_buffer_reference
The wl_buffer reference counting API has been inconsistent. You would
manually increment the refcount and register a destroy listener, as
opposed to calling weston_buffer_post_release(), which internally
decremented the refcount, and then removing a list item.
Replace both cases with a single function:
weston_buffer_reference(weston_buffer_reference *ref, wl_buffer *buffer)
Buffer is assigned to ref->buffer, while taking care of all the refcounting
and release posting. You take a reference by passing a non-NULL buffer, and
release a reference by passing NULL as buffer. The function uses an
internal wl_buffer destroy listener, so the pointer gets reset on
destruction automatically.
This is inspired by the pipe_resource_reference() of Mesa, and modified
by krh's suggestion to add struct weston_buffer_reference.
Additionally, when a surface gets destroyed, the associated wl_buffer
will send a release event. Often the buffer is already destroyed on
client side, so the event will be discarded by libwayland-client.
Compositor-drm.c is converted to use weston_buffer_reference.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-04 17:58:12 +04:00
|
|
|
|
if (surface->buffer_ref.buffer)
|
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-13 07:38:11 +04:00
|
|
|
|
center_on_output(shsurf->view, shsurf->fullscreen_output);
|
2012-03-01 08:57:46 +04:00
|
|
|
|
break;
|
|
|
|
|
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE:
|
2013-02-12 15:53:47 +04:00
|
|
|
|
/* 1:1 mapping between surface and output dimensions */
|
2013-04-25 14:57:46 +04:00
|
|
|
|
if (output->width == surf_width &&
|
|
|
|
|
output->height == surf_height) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
output->x - surf_x,
|
|
|
|
|
output->y - surf_y);
|
2013-02-12 15:53:47 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
matrix = &shsurf->fullscreen.transform.matrix;
|
|
|
|
|
weston_matrix_init(matrix);
|
2012-07-12 20:32:31 +04:00
|
|
|
|
|
2012-08-18 11:04:05 +04:00
|
|
|
|
output_aspect = (float) output->width /
|
|
|
|
|
(float) output->height;
|
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-13 07:38:11 +04:00
|
|
|
|
/* XXX: Use surf_width and surf_height here? */
|
|
|
|
|
surface_aspect = (float) surface->width /
|
|
|
|
|
(float) surface->height;
|
2012-07-12 20:32:31 +04:00
|
|
|
|
if (output_aspect < surface_aspect)
|
2012-08-18 11:04:05 +04:00
|
|
|
|
scale = (float) output->width /
|
2013-04-25 14:57:46 +04:00
|
|
|
|
(float) surf_width;
|
2012-07-12 20:32:31 +04:00
|
|
|
|
else
|
2012-08-18 11:04:05 +04:00
|
|
|
|
scale = (float) output->height /
|
2013-04-25 14:57:46 +04:00
|
|
|
|
(float) surf_height;
|
2012-07-12 20:32:31 +04:00
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
weston_matrix_scale(matrix, scale, scale, 1);
|
|
|
|
|
wl_list_remove(&shsurf->fullscreen.transform.link);
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_insert(&shsurf->view->geometry.transformation_list,
|
2012-03-01 08:57:46 +04:00
|
|
|
|
&shsurf->fullscreen.transform.link);
|
2013-04-25 14:57:46 +04:00
|
|
|
|
x = output->x + (output->width - surf_width * scale) / 2 - surf_x;
|
|
|
|
|
y = output->y + (output->height - surf_height * scale) / 2 - surf_y;
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view, x, y);
|
2012-07-12 20:32:31 +04:00
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
break;
|
|
|
|
|
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER:
|
2012-04-17 13:20:49 +04:00
|
|
|
|
if (shell_surface_is_top_fullscreen(shsurf)) {
|
2013-01-29 17:16:13 +04:00
|
|
|
|
struct weston_mode mode = {0,
|
2013-11-26 21:19:41 +04:00
|
|
|
|
surf_width * surface->buffer_viewport.scale,
|
|
|
|
|
surf_height * surface->buffer_viewport.scale,
|
2012-04-17 13:20:49 +04:00
|
|
|
|
shsurf->fullscreen.framerate};
|
|
|
|
|
|
2013-11-26 21:19:41 +04:00
|
|
|
|
if (weston_output_switch_mode(output, &mode, surface->buffer_viewport.scale,
|
2013-09-19 01:56:36 +04:00
|
|
|
|
WESTON_MODE_SWITCH_SET_TEMPORARY) == 0) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
output->x - surf_x,
|
|
|
|
|
output->y - surf_y);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
shsurf->fullscreen.black_view->surface->width = output->width;
|
|
|
|
|
shsurf->fullscreen.black_view->surface->height = output->height;
|
|
|
|
|
weston_view_set_position(shsurf->fullscreen.black_view,
|
|
|
|
|
output->x - surf_x,
|
|
|
|
|
output->y - surf_y);
|
2012-04-17 13:20:49 +04:00
|
|
|
|
break;
|
2013-05-28 18:23:40 +04:00
|
|
|
|
} else {
|
2013-05-28 18:23:39 +04:00
|
|
|
|
restore_output_mode(output);
|
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-13 07:38:11 +04:00
|
|
|
|
center_on_output(shsurf->view, output);
|
2013-05-28 18:23:40 +04:00
|
|
|
|
}
|
2012-04-17 13:20:49 +04:00
|
|
|
|
}
|
2012-03-01 08:57:46 +04:00
|
|
|
|
break;
|
|
|
|
|
case WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL:
|
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-13 07:38:11 +04:00
|
|
|
|
center_on_output(shsurf->view, output);
|
2012-03-01 08:57:46 +04:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_map_fullscreen(struct shell_surface *shsurf)
|
|
|
|
|
{
|
2012-04-17 13:20:49 +04:00
|
|
|
|
shell_configure_fullscreen(shsurf);
|
2012-03-01 08:57:46 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-12 22:43:21 +04:00
|
|
|
|
static void
|
|
|
|
|
set_xwayland(struct shell_surface *shsurf, int x, int y, uint32_t flags)
|
|
|
|
|
{
|
|
|
|
|
/* XXX: using the same fields for transient type */
|
2013-12-03 21:35:42 +04:00
|
|
|
|
surface_clear_next_states(shsurf);
|
2013-06-12 22:43:21 +04:00
|
|
|
|
shsurf->transient.x = x;
|
|
|
|
|
shsurf->transient.y = y;
|
|
|
|
|
shsurf->transient.flags = flags;
|
2013-11-25 22:01:38 +04:00
|
|
|
|
|
|
|
|
|
shell_surface_set_parent(shsurf, NULL);
|
|
|
|
|
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_XWAYLAND;
|
2014-01-02 10:34:49 +04:00
|
|
|
|
shsurf->state_changed = true;
|
2013-06-12 22:43:21 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 06:15:05 +04:00
|
|
|
|
static const struct weston_pointer_grab_interface popup_grab_interface;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
destroy_shell_seat(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct shell_seat *shseat =
|
|
|
|
|
container_of(listener,
|
|
|
|
|
struct shell_seat, seat_destroy_listener);
|
|
|
|
|
struct shell_surface *shsurf, *prev = NULL;
|
|
|
|
|
|
|
|
|
|
if (shseat->popup_grab.grab.interface == &popup_grab_interface) {
|
2013-05-07 06:15:05 +04:00
|
|
|
|
weston_pointer_end_grab(shseat->popup_grab.grab.pointer);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
shseat->popup_grab.client = NULL;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(shsurf, &shseat->popup_grab.surfaces_list, popup.grab_link) {
|
|
|
|
|
shsurf->popup.shseat = NULL;
|
|
|
|
|
if (prev) {
|
|
|
|
|
wl_list_init(&prev->popup.grab_link);
|
|
|
|
|
}
|
|
|
|
|
prev = shsurf;
|
|
|
|
|
}
|
|
|
|
|
wl_list_init(&prev->popup.grab_link);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&shseat->seat_destroy_listener.link);
|
|
|
|
|
free(shseat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct shell_seat *
|
|
|
|
|
create_shell_seat(struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct shell_seat *shseat;
|
|
|
|
|
|
|
|
|
|
shseat = calloc(1, sizeof *shseat);
|
|
|
|
|
if (!shseat) {
|
|
|
|
|
weston_log("no memory to allocate shell seat\n");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shseat->seat = seat;
|
|
|
|
|
wl_list_init(&shseat->popup_grab.surfaces_list);
|
|
|
|
|
|
|
|
|
|
shseat->seat_destroy_listener.notify = destroy_shell_seat;
|
|
|
|
|
wl_signal_add(&seat->destroy_signal,
|
|
|
|
|
&shseat->seat_destroy_listener);
|
|
|
|
|
|
|
|
|
|
return shseat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct shell_seat *
|
|
|
|
|
get_shell_seat(struct weston_seat *seat)
|
|
|
|
|
{
|
|
|
|
|
struct wl_listener *listener;
|
|
|
|
|
|
|
|
|
|
listener = wl_signal_get(&seat->destroy_signal, destroy_shell_seat);
|
|
|
|
|
if (listener == NULL)
|
|
|
|
|
return create_shell_seat(seat);
|
|
|
|
|
|
|
|
|
|
return container_of(listener,
|
|
|
|
|
struct shell_seat, seat_destroy_listener);
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-05 07:19:14 +04:00
|
|
|
|
static void
|
2013-05-09 06:02:59 +04:00
|
|
|
|
popup_grab_focus(struct weston_pointer_grab *grab)
|
2012-01-05 07:19:14 +04:00
|
|
|
|
{
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct shell_seat *shseat =
|
|
|
|
|
container_of(grab, struct shell_seat, popup_grab.grab);
|
|
|
|
|
struct wl_client *client = shseat->popup_grab.client;
|
2013-05-09 06:02:59 +04:00
|
|
|
|
wl_fixed_t sx, sy;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
view = weston_compositor_pick_view(pointer->seat->compositor,
|
|
|
|
|
pointer->x, pointer->y,
|
|
|
|
|
&sx, &sy);
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (view && view->surface->resource &&
|
|
|
|
|
wl_resource_get_client(view->surface->resource) == client) {
|
|
|
|
|
weston_pointer_set_focus(pointer, view, sx, sy);
|
2012-01-05 07:19:14 +04:00
|
|
|
|
} else {
|
2013-05-07 06:15:05 +04:00
|
|
|
|
weston_pointer_set_focus(pointer, NULL,
|
|
|
|
|
wl_fixed_from_int(0),
|
|
|
|
|
wl_fixed_from_int(0));
|
2012-01-05 07:19:14 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-11-15 02:42:52 +04:00
|
|
|
|
popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
|
|
|
|
|
wl_fixed_t x, wl_fixed_t y)
|
2012-01-05 07:19:14 +04:00
|
|
|
|
{
|
2013-05-09 05:03:21 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2013-09-19 20:32:00 +04:00
|
|
|
|
struct wl_resource *resource;
|
2013-05-09 05:03:21 +04:00
|
|
|
|
wl_fixed_t sx, sy;
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
2013-11-15 02:42:52 +04:00
|
|
|
|
weston_pointer_move(pointer, x, y);
|
|
|
|
|
|
2013-09-19 20:32:00 +04:00
|
|
|
|
wl_resource_for_each(resource, &pointer->focus_resource_list) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_from_global_fixed(pointer->focus,
|
|
|
|
|
pointer->x, pointer->y,
|
|
|
|
|
&sx, &sy);
|
2013-09-19 20:32:00 +04:00
|
|
|
|
wl_pointer_send_motion(resource, time, sx, sy);
|
2013-05-09 05:03:21 +04:00
|
|
|
|
}
|
2012-01-05 07:19:14 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
popup_grab_button(struct weston_pointer_grab *grab,
|
2012-05-30 19:31:51 +04:00
|
|
|
|
uint32_t time, uint32_t button, uint32_t state_w)
|
2012-01-05 07:19:14 +04:00
|
|
|
|
{
|
|
|
|
|
struct wl_resource *resource;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct shell_seat *shseat =
|
|
|
|
|
container_of(grab, struct shell_seat, popup_grab.grab);
|
2013-07-22 20:31:38 +04:00
|
|
|
|
struct wl_display *display = shseat->seat->compositor->wl_display;
|
2012-05-30 19:31:51 +04:00
|
|
|
|
enum wl_pointer_button_state state = state_w;
|
2012-04-12 06:42:15 +04:00
|
|
|
|
uint32_t serial;
|
2013-09-19 20:32:00 +04:00
|
|
|
|
struct wl_list *resource_list;
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
2013-09-19 20:32:00 +04:00
|
|
|
|
resource_list = &grab->pointer->focus_resource_list;
|
|
|
|
|
if (!wl_list_empty(resource_list)) {
|
2012-04-12 06:42:15 +04:00
|
|
|
|
serial = wl_display_get_serial(display);
|
2013-09-19 20:32:00 +04:00
|
|
|
|
wl_resource_for_each(resource, resource_list) {
|
|
|
|
|
wl_pointer_send_button(resource, serial,
|
|
|
|
|
time, button, state);
|
|
|
|
|
}
|
2012-05-30 19:31:51 +04:00
|
|
|
|
} else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
|
2013-03-26 00:42:45 +04:00
|
|
|
|
(shseat->popup_grab.initial_up ||
|
2013-05-07 07:19:49 +04:00
|
|
|
|
time - shseat->seat->pointer->grab_time > 500)) {
|
2012-10-30 22:07:27 +04:00
|
|
|
|
popup_grab_end(grab->pointer);
|
2012-01-05 07:19:14 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-30 19:31:51 +04:00
|
|
|
|
if (state == WL_POINTER_BUTTON_STATE_RELEASED)
|
2013-03-26 00:42:45 +04:00
|
|
|
|
shseat->popup_grab.initial_up = 1;
|
2012-01-05 07:19:14 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
popup_grab_cancel(struct weston_pointer_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
popup_grab_end(grab->pointer);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 06:15:05 +04:00
|
|
|
|
static const struct weston_pointer_grab_interface popup_grab_interface = {
|
2012-01-05 07:19:14 +04:00
|
|
|
|
popup_grab_focus,
|
|
|
|
|
popup_grab_motion,
|
|
|
|
|
popup_grab_button,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
popup_grab_cancel,
|
2012-01-05 07:19:14 +04:00
|
|
|
|
};
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_surface_send_popup_done(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
if (shell_surface_is_wl_shell_surface(shsurf))
|
|
|
|
|
wl_shell_surface_send_popup_done(shsurf->resource);
|
|
|
|
|
else if (shell_surface_is_xdg_popup(shsurf))
|
|
|
|
|
xdg_popup_send_popup_done(shsurf->resource,
|
|
|
|
|
shsurf->popup.serial);
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-30 22:07:27 +04:00
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
popup_grab_end(struct weston_pointer *pointer)
|
2012-10-30 22:07:27 +04:00
|
|
|
|
{
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer_grab *grab = pointer->grab;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct shell_seat *shseat =
|
|
|
|
|
container_of(grab, struct shell_seat, popup_grab.grab);
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
struct shell_surface *prev = NULL;
|
2012-10-30 22:07:27 +04:00
|
|
|
|
|
|
|
|
|
if (pointer->grab->interface == &popup_grab_interface) {
|
2013-05-07 06:15:05 +04:00
|
|
|
|
weston_pointer_end_grab(grab->pointer);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
shseat->popup_grab.client = NULL;
|
2013-04-15 23:09:54 +04:00
|
|
|
|
shseat->popup_grab.grab.interface = NULL;
|
|
|
|
|
assert(!wl_list_empty(&shseat->popup_grab.surfaces_list));
|
2013-03-26 00:42:45 +04:00
|
|
|
|
/* Send the popup_done event to all the popups open */
|
|
|
|
|
wl_list_for_each(shsurf, &shseat->popup_grab.surfaces_list, popup.grab_link) {
|
2013-12-03 21:35:45 +04:00
|
|
|
|
shell_surface_send_popup_done(shsurf);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
shsurf->popup.shseat = NULL;
|
|
|
|
|
if (prev) {
|
|
|
|
|
wl_list_init(&prev->popup.grab_link);
|
|
|
|
|
}
|
|
|
|
|
prev = shsurf;
|
|
|
|
|
}
|
|
|
|
|
wl_list_init(&prev->popup.grab_link);
|
|
|
|
|
wl_list_init(&shseat->popup_grab.surfaces_list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
add_popup_grab(struct shell_surface *shsurf, struct shell_seat *shseat)
|
|
|
|
|
{
|
2013-05-07 07:19:49 +04:00
|
|
|
|
struct weston_seat *seat = shseat->seat;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
|
|
|
|
|
if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
|
2013-06-14 19:07:54 +04:00
|
|
|
|
shseat->popup_grab.client = wl_resource_get_client(shsurf->resource);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
shseat->popup_grab.grab.interface = &popup_grab_interface;
|
2013-03-27 21:05:26 +04:00
|
|
|
|
/* We must make sure here that this popup was opened after
|
|
|
|
|
* a mouse press, and not just by moving around with other
|
|
|
|
|
* popups already open. */
|
2013-05-07 07:19:49 +04:00
|
|
|
|
if (shseat->seat->pointer->button_count > 0)
|
2013-03-27 21:05:26 +04:00
|
|
|
|
shseat->popup_grab.initial_up = 0;
|
2013-03-26 00:42:45 +04:00
|
|
|
|
|
2013-06-26 22:49:11 +04:00
|
|
|
|
wl_list_insert(&shseat->popup_grab.surfaces_list, &shsurf->popup.grab_link);
|
2013-05-07 06:15:05 +04:00
|
|
|
|
weston_pointer_start_grab(seat->pointer, &shseat->popup_grab.grab);
|
2013-06-26 22:49:11 +04:00
|
|
|
|
} else {
|
|
|
|
|
wl_list_insert(&shseat->popup_grab.surfaces_list, &shsurf->popup.grab_link);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
remove_popup_grab(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
struct shell_seat *shseat = shsurf->popup.shseat;
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&shsurf->popup.grab_link);
|
|
|
|
|
wl_list_init(&shsurf->popup.grab_link);
|
|
|
|
|
if (wl_list_empty(&shseat->popup_grab.surfaces_list)) {
|
2013-05-07 06:15:05 +04:00
|
|
|
|
weston_pointer_end_grab(shseat->popup_grab.grab.pointer);
|
2013-04-15 23:09:54 +04:00
|
|
|
|
shseat->popup_grab.grab.interface = NULL;
|
2012-10-30 22:07:27 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-05 07:19:14 +04:00
|
|
|
|
static void
|
2012-04-13 20:40:07 +04:00
|
|
|
|
shell_map_popup(struct shell_surface *shsurf)
|
2012-01-05 07:19:14 +04:00
|
|
|
|
{
|
2013-03-26 00:42:45 +04:00
|
|
|
|
struct shell_seat *shseat = shsurf->popup.shseat;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *parent_view = get_default_view(shsurf->parent);
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->surface->output = parent_view->output;
|
|
|
|
|
shsurf->view->output = parent_view->output;
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_transform_parent(shsurf->view, parent_view);
|
|
|
|
|
weston_view_set_position(shsurf->view, shsurf->popup.x, shsurf->popup.y);
|
|
|
|
|
weston_view_update_transform(shsurf->view);
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
2013-05-07 07:19:49 +04:00
|
|
|
|
if (shseat->seat->pointer->grab_serial == shsurf->popup.serial) {
|
2013-03-26 00:42:45 +04:00
|
|
|
|
add_popup_grab(shsurf, shseat);
|
2012-04-13 20:40:07 +04:00
|
|
|
|
} else {
|
2013-12-03 21:35:45 +04:00
|
|
|
|
shell_surface_send_popup_done(shsurf);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
shseat->popup_grab.client = NULL;
|
2012-04-13 20:40:07 +04:00
|
|
|
|
}
|
2012-01-05 07:19:14 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 14:09:16 +04:00
|
|
|
|
static const struct wl_shell_surface_interface shell_surface_implementation = {
|
2012-04-18 05:06:18 +04:00
|
|
|
|
shell_surface_pong,
|
2011-11-25 14:09:16 +04:00
|
|
|
|
shell_surface_move,
|
|
|
|
|
shell_surface_resize,
|
|
|
|
|
shell_surface_set_toplevel,
|
|
|
|
|
shell_surface_set_transient,
|
2012-01-05 07:19:14 +04:00
|
|
|
|
shell_surface_set_fullscreen,
|
2012-02-07 04:45:41 +04:00
|
|
|
|
shell_surface_set_popup,
|
2012-05-02 17:47:44 +04:00
|
|
|
|
shell_surface_set_maximized,
|
|
|
|
|
shell_surface_set_title,
|
|
|
|
|
shell_surface_set_class
|
2011-11-25 14:09:16 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2012-04-19 17:18:18 +04:00
|
|
|
|
destroy_shell_surface(struct shell_surface *shsurf)
|
2011-11-25 14:09:16 +04:00
|
|
|
|
{
|
2014-01-10 12:25:30 +04:00
|
|
|
|
struct shell_surface *child, *next;
|
|
|
|
|
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_signal_emit(&shsurf->destroy_signal, shsurf);
|
|
|
|
|
|
2013-03-26 00:42:45 +04:00
|
|
|
|
if (!wl_list_empty(&shsurf->popup.grab_link)) {
|
|
|
|
|
remove_popup_grab(shsurf);
|
|
|
|
|
}
|
2012-01-05 07:19:14 +04:00
|
|
|
|
|
2012-04-17 13:20:49 +04:00
|
|
|
|
if (shsurf->fullscreen.type == WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER &&
|
2013-05-28 18:23:39 +04:00
|
|
|
|
shell_surface_is_top_fullscreen(shsurf))
|
|
|
|
|
restore_output_mode (shsurf->fullscreen_output);
|
2011-11-25 14:09:16 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (shsurf->fullscreen.black_view)
|
|
|
|
|
weston_surface_destroy(shsurf->fullscreen.black_view->surface);
|
2012-03-05 07:01:40 +04:00
|
|
|
|
|
2012-04-17 13:20:49 +04:00
|
|
|
|
/* As destroy_resource() use wl_list_for_each_safe(),
|
|
|
|
|
* we can always remove the listener.
|
|
|
|
|
*/
|
|
|
|
|
wl_list_remove(&shsurf->surface_destroy_listener.link);
|
|
|
|
|
shsurf->surface->configure = NULL;
|
2012-04-19 23:06:17 +04:00
|
|
|
|
ping_timer_destroy(shsurf);
|
2013-03-07 21:15:17 +04:00
|
|
|
|
free(shsurf->title);
|
2012-04-17 13:20:49 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_destroy(shsurf->view);
|
|
|
|
|
|
2013-11-25 22:01:44 +04:00
|
|
|
|
wl_list_remove(&shsurf->children_link);
|
2014-01-28 16:54:16 +04:00
|
|
|
|
wl_list_for_each_safe(child, next, &shsurf->children_list, children_link)
|
|
|
|
|
shell_surface_set_parent(child, NULL);
|
2013-11-25 22:01:44 +04:00
|
|
|
|
|
2011-11-25 14:09:16 +04:00
|
|
|
|
wl_list_remove(&shsurf->link);
|
|
|
|
|
free(shsurf);
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-19 17:18:18 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_destroy_shell_surface(struct wl_resource *resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2012-04-19 17:18:18 +04:00
|
|
|
|
|
|
|
|
|
destroy_shell_surface(shsurf);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 14:09:16 +04:00
|
|
|
|
static void
|
2012-04-12 07:18:23 +04:00
|
|
|
|
shell_handle_surface_destroy(struct wl_listener *listener, void *data)
|
2011-11-25 14:09:16 +04:00
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = container_of(listener,
|
|
|
|
|
struct shell_surface,
|
|
|
|
|
surface_destroy_listener);
|
|
|
|
|
|
2013-06-14 19:07:54 +04:00
|
|
|
|
if (shsurf->resource)
|
|
|
|
|
wl_resource_destroy(shsurf->resource);
|
|
|
|
|
else
|
2012-04-19 17:18:18 +04:00
|
|
|
|
destroy_shell_surface(shsurf);
|
2011-11-25 14:09:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-21 20:49:02 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
shell_surface_configure(struct weston_surface *, int32_t, int32_t);
|
2012-06-21 20:49:02 +04:00
|
|
|
|
|
2013-12-04 12:20:01 +04:00
|
|
|
|
struct shell_surface *
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
get_shell_surface(struct weston_surface *surface)
|
2011-11-28 17:12:34 +04:00
|
|
|
|
{
|
2012-06-21 20:49:02 +04:00
|
|
|
|
if (surface->configure == shell_surface_configure)
|
2013-03-28 21:02:42 +04:00
|
|
|
|
return surface->configure_private;
|
2012-06-21 20:49:02 +04:00
|
|
|
|
else
|
|
|
|
|
return NULL;
|
2011-11-28 17:12:34 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static struct shell_surface *
|
|
|
|
|
create_common_surface(void *shell, struct weston_surface *surface,
|
|
|
|
|
const struct weston_shell_client *client)
|
2011-11-25 14:09:16 +04:00
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
2012-03-27 18:36:41 +04:00
|
|
|
|
if (surface->configure) {
|
2012-06-07 20:01:59 +04:00
|
|
|
|
weston_log("surface->configure already set\n");
|
2012-05-21 22:27:33 +04:00
|
|
|
|
return NULL;
|
2012-03-27 18:36:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 14:09:16 +04:00
|
|
|
|
shsurf = calloc(1, sizeof *shsurf);
|
|
|
|
|
if (!shsurf) {
|
2012-06-07 20:01:59 +04:00
|
|
|
|
weston_log("no memory to allocate shell surface\n");
|
2012-05-21 22:27:33 +04:00
|
|
|
|
return NULL;
|
2011-11-25 14:09:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->view = weston_view_create(surface);
|
|
|
|
|
if (!shsurf->view) {
|
|
|
|
|
weston_log("no memory to allocate shell surface\n");
|
|
|
|
|
free(shsurf);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-27 18:36:41 +04:00
|
|
|
|
surface->configure = shell_surface_configure;
|
2013-03-28 21:02:42 +04:00
|
|
|
|
surface->configure_private = shsurf;
|
2012-03-27 18:36:41 +04:00
|
|
|
|
|
2012-04-19 17:18:18 +04:00
|
|
|
|
shsurf->shell = (struct desktop_shell *) shell;
|
2012-04-18 05:06:18 +04:00
|
|
|
|
shsurf->unresponsive = 0;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
shsurf->saved_position_valid = false;
|
2013-12-03 21:35:46 +04:00
|
|
|
|
shsurf->saved_size_valid = false;
|
2012-04-27 05:07:24 +04:00
|
|
|
|
shsurf->saved_rotation_valid = false;
|
2011-11-25 14:09:16 +04:00
|
|
|
|
shsurf->surface = surface;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
shsurf->fullscreen.type = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
|
|
|
|
|
shsurf->fullscreen.framerate = 0;
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->fullscreen.black_view = NULL;
|
2012-04-18 05:06:18 +04:00
|
|
|
|
shsurf->ping_timer = NULL;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
wl_list_init(&shsurf->fullscreen.transform.link);
|
|
|
|
|
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_signal_init(&shsurf->destroy_signal);
|
2012-04-12 07:18:23 +04:00
|
|
|
|
shsurf->surface_destroy_listener.notify = shell_handle_surface_destroy;
|
2013-06-07 07:34:41 +04:00
|
|
|
|
wl_signal_add(&surface->destroy_signal,
|
2012-04-12 07:18:23 +04:00
|
|
|
|
&shsurf->surface_destroy_listener);
|
2011-11-25 14:09:16 +04:00
|
|
|
|
|
|
|
|
|
/* init link so its safe to always remove it in destroy_shell_surface */
|
|
|
|
|
wl_list_init(&shsurf->link);
|
2013-03-26 00:42:45 +04:00
|
|
|
|
wl_list_init(&shsurf->popup.grab_link);
|
2011-11-25 14:09:16 +04:00
|
|
|
|
|
2012-01-20 18:48:25 +04:00
|
|
|
|
/* empty when not in use */
|
|
|
|
|
wl_list_init(&shsurf->rotation.transform.link);
|
2012-01-27 22:36:13 +04:00
|
|
|
|
weston_matrix_init(&shsurf->rotation.rotation);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
2012-06-13 02:01:23 +04:00
|
|
|
|
wl_list_init(&shsurf->workspace_transform.link);
|
|
|
|
|
|
2013-11-25 22:01:44 +04:00
|
|
|
|
wl_list_init(&shsurf->children_link);
|
|
|
|
|
wl_list_init(&shsurf->children_list);
|
|
|
|
|
shsurf->parent = NULL;
|
|
|
|
|
|
2011-12-01 12:42:22 +04:00
|
|
|
|
shsurf->type = SHELL_SURFACE_NONE;
|
2011-11-25 14:09:16 +04:00
|
|
|
|
|
2012-05-23 00:05:52 +04:00
|
|
|
|
shsurf->client = client;
|
|
|
|
|
|
2012-05-21 22:27:33 +04:00
|
|
|
|
return shsurf;
|
2012-04-19 17:18:18 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static struct shell_surface *
|
|
|
|
|
create_shell_surface(void *shell, struct weston_surface *surface,
|
|
|
|
|
const struct weston_shell_client *client)
|
|
|
|
|
{
|
2013-12-06 11:20:33 +04:00
|
|
|
|
return create_common_surface(shell, surface, client);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
static struct weston_view *
|
|
|
|
|
get_primary_view(void *shell, struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
return shsurf->view;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-19 17:18:18 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_get_shell_surface(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
|
{
|
2013-06-14 19:07:53 +04:00
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2012-04-19 17:18:18 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
|
|
|
|
if (get_shell_surface(surface)) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
2012-05-21 22:28:57 +04:00
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"desktop_shell::get_shell_surface already requested");
|
2012-04-19 17:18:18 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-23 00:05:52 +04:00
|
|
|
|
shsurf = create_shell_surface(shell, surface, &shell_client);
|
2012-05-21 22:28:57 +04:00
|
|
|
|
if (!shsurf) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"surface->configure already set");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-28 05:17:02 +04:00
|
|
|
|
shsurf->resource =
|
|
|
|
|
wl_resource_create(client,
|
|
|
|
|
&wl_shell_surface_interface, 1, id);
|
|
|
|
|
wl_resource_set_implementation(shsurf->resource,
|
|
|
|
|
&shell_surface_implementation,
|
|
|
|
|
shsurf, shell_destroy_shell_surface);
|
2011-11-25 14:09:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_wl_shell_surface(struct shell_surface *shsurf)
|
|
|
|
|
{
|
2014-02-04 03:50:38 +04:00
|
|
|
|
/* A shell surface without a resource is created from xwayland
|
|
|
|
|
* and is considered a wl_shell surface for now. */
|
|
|
|
|
|
|
|
|
|
return shsurf->resource == NULL ||
|
|
|
|
|
wl_resource_instance_of(shsurf->resource,
|
|
|
|
|
&wl_shell_surface_interface,
|
|
|
|
|
&shell_surface_implementation);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 14:09:16 +04:00
|
|
|
|
static const struct wl_shell_interface shell_implementation = {
|
2011-11-29 17:49:31 +04:00
|
|
|
|
shell_get_shell_surface
|
2011-01-18 15:53:49 +03:00
|
|
|
|
};
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
/****************************
|
|
|
|
|
* xdg-shell implementation */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_destroy(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_pong(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
uint32_t serial)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
surface_pong(shsurf, serial);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_set_app_id(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
const char *app_id)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
free(shsurf->class);
|
|
|
|
|
shsurf->class = strdup(app_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_set_title(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource, const char *title)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
set_title(shsurf, title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_move(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource, uint32_t serial)
|
|
|
|
|
{
|
|
|
|
|
common_surface_move(resource, seat_resource, serial);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_resize(struct wl_client *client, struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *seat_resource, uint32_t serial,
|
|
|
|
|
uint32_t edges)
|
|
|
|
|
{
|
|
|
|
|
common_surface_resize(resource, seat_resource, serial, edges);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_set_output(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *output_resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
|
|
|
|
|
if (output_resource)
|
|
|
|
|
output = wl_resource_get_user_data(output_resource);
|
|
|
|
|
else
|
|
|
|
|
output = NULL;
|
|
|
|
|
|
2013-12-03 21:35:47 +04:00
|
|
|
|
shsurf->recommended_output = output;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_set_fullscreen(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
if (shsurf->type != SHELL_SURFACE_TOPLEVEL)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-06 10:04:42 +04:00
|
|
|
|
if (!shsurf->next_state.fullscreen)
|
2013-12-03 21:35:45 +04:00
|
|
|
|
set_fullscreen(shsurf,
|
|
|
|
|
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
|
2013-12-03 21:35:47 +04:00
|
|
|
|
0, shsurf->recommended_output);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_unset_fullscreen(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2013-12-03 21:35:46 +04:00
|
|
|
|
int32_t width, height;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf->type != SHELL_SURFACE_TOPLEVEL)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-03 21:35:46 +04:00
|
|
|
|
if (!shsurf->next_state.fullscreen)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
shsurf->next_state.fullscreen = false;
|
|
|
|
|
shsurf->state_changed = true;
|
2013-12-03 21:35:46 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf->saved_size_valid) {
|
|
|
|
|
width = shsurf->saved_width;
|
|
|
|
|
height = shsurf->saved_height;
|
|
|
|
|
shsurf->saved_size_valid = false;
|
|
|
|
|
} else {
|
|
|
|
|
width = shsurf->surface->width;
|
|
|
|
|
height = shsurf->surface->height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shsurf->client->send_configure(shsurf->surface, 0, width, height);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_set_maximized(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
if (shsurf->type != SHELL_SURFACE_TOPLEVEL)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-06 10:00:40 +04:00
|
|
|
|
if (!shsurf->next_state.maximized)
|
2013-12-03 21:35:47 +04:00
|
|
|
|
set_maximized(shsurf, NULL);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_surface_unset_maximized(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
2013-12-03 21:35:46 +04:00
|
|
|
|
int32_t width, height;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf->type != SHELL_SURFACE_TOPLEVEL)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-03 21:35:46 +04:00
|
|
|
|
if (!shsurf->next_state.maximized)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
shsurf->next_state.maximized = false;
|
|
|
|
|
shsurf->state_changed = true;
|
2013-12-03 21:35:46 +04:00
|
|
|
|
|
|
|
|
|
if (shsurf->saved_size_valid) {
|
|
|
|
|
width = shsurf->saved_width;
|
|
|
|
|
height = shsurf->saved_height;
|
|
|
|
|
shsurf->saved_size_valid = false;
|
|
|
|
|
} else {
|
|
|
|
|
width = shsurf->surface->width;
|
|
|
|
|
height = shsurf->surface->height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shsurf->client->send_configure(shsurf->surface, 0, width, height);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct xdg_surface_interface xdg_surface_implementation = {
|
|
|
|
|
xdg_surface_destroy,
|
|
|
|
|
xdg_surface_set_transient_for,
|
|
|
|
|
xdg_surface_set_title,
|
|
|
|
|
xdg_surface_set_app_id,
|
|
|
|
|
xdg_surface_pong,
|
|
|
|
|
xdg_surface_move,
|
|
|
|
|
xdg_surface_resize,
|
|
|
|
|
xdg_surface_set_output,
|
|
|
|
|
xdg_surface_set_fullscreen,
|
|
|
|
|
xdg_surface_unset_fullscreen,
|
|
|
|
|
xdg_surface_set_maximized,
|
|
|
|
|
xdg_surface_unset_maximized,
|
|
|
|
|
NULL /* set_minimized */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_send_configure(struct weston_surface *surface,
|
|
|
|
|
uint32_t edges, int32_t width, int32_t height)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(surface);
|
|
|
|
|
|
2014-01-17 22:08:25 +04:00
|
|
|
|
assert(shsurf);
|
|
|
|
|
|
2014-02-06 09:36:04 +04:00
|
|
|
|
xdg_surface_send_configure(shsurf->resource, width, height);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct weston_shell_client xdg_client = {
|
|
|
|
|
xdg_send_configure
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_use_unstable_version(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
int32_t version)
|
|
|
|
|
{
|
|
|
|
|
if (version > 1) {
|
|
|
|
|
wl_resource_post_error(resource,
|
|
|
|
|
1,
|
|
|
|
|
"xdg-shell:: version not implemented yet.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct shell_surface *
|
|
|
|
|
create_xdg_surface(void *shell, struct weston_surface *surface,
|
|
|
|
|
const struct weston_shell_client *client)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf = create_common_surface(shell, surface, client);
|
|
|
|
|
shsurf->type = SHELL_SURFACE_TOPLEVEL;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
|
|
|
|
|
return shsurf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_get_xdg_surface(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
|
{
|
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
|
|
|
|
if (get_shell_surface(surface)) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"desktop_shell::get_shell_surface already requested");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shsurf = create_xdg_surface(shell, surface, &xdg_client);
|
|
|
|
|
if (!shsurf) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"surface->configure already set");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shsurf->resource =
|
|
|
|
|
wl_resource_create(client,
|
|
|
|
|
&xdg_surface_interface, 1, id);
|
|
|
|
|
wl_resource_set_implementation(shsurf->resource,
|
|
|
|
|
&xdg_surface_implementation,
|
|
|
|
|
shsurf, shell_destroy_shell_surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_xdg_surface(struct shell_surface *shsurf)
|
|
|
|
|
{
|
2014-02-04 03:50:38 +04:00
|
|
|
|
return shsurf->resource &&
|
|
|
|
|
wl_resource_instance_of(shsurf->resource,
|
|
|
|
|
&xdg_surface_interface,
|
|
|
|
|
&xdg_surface_implementation);
|
2013-12-03 21:35:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* xdg-popup implementation */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_popup_destroy(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_popup_pong(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
uint32_t serial)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
surface_pong(shsurf, serial);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct xdg_popup_interface xdg_popup_implementation = {
|
|
|
|
|
xdg_popup_destroy,
|
|
|
|
|
xdg_popup_pong
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_popup_send_configure(struct weston_surface *surface,
|
|
|
|
|
uint32_t edges, int32_t width, int32_t height)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct weston_shell_client xdg_popup_client = {
|
|
|
|
|
xdg_popup_send_configure
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct shell_surface *
|
|
|
|
|
create_xdg_popup(void *shell, struct weston_surface *surface,
|
|
|
|
|
const struct weston_shell_client *client,
|
|
|
|
|
struct weston_surface *parent,
|
|
|
|
|
struct shell_seat *seat,
|
|
|
|
|
uint32_t serial,
|
|
|
|
|
int32_t x, int32_t y)
|
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
2013-12-06 11:20:33 +04:00
|
|
|
|
shsurf = create_common_surface(shell, surface, client);
|
|
|
|
|
shsurf->type = SHELL_SURFACE_POPUP;
|
2013-12-03 21:35:45 +04:00
|
|
|
|
shsurf->popup.shseat = seat;
|
|
|
|
|
shsurf->popup.serial = serial;
|
|
|
|
|
shsurf->popup.x = x;
|
|
|
|
|
shsurf->popup.y = y;
|
|
|
|
|
shell_surface_set_parent(shsurf, parent);
|
|
|
|
|
|
|
|
|
|
return shsurf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
xdg_get_xdg_popup(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
struct wl_resource *surface_resource,
|
|
|
|
|
struct wl_resource *parent_resource,
|
|
|
|
|
struct wl_resource *seat_resource,
|
|
|
|
|
uint32_t serial,
|
|
|
|
|
int32_t x, int32_t y, uint32_t flags)
|
|
|
|
|
{
|
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
struct weston_surface *parent;
|
|
|
|
|
struct shell_seat *seat;
|
|
|
|
|
|
|
|
|
|
if (get_shell_surface(surface)) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"desktop_shell::get_shell_surface already requested");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!parent_resource) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"xdg_shell::get_xdg_popup requires a parent shell surface");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parent = wl_resource_get_user_data(parent_resource);
|
|
|
|
|
seat = get_shell_seat(wl_resource_get_user_data(seat_resource));;
|
|
|
|
|
|
|
|
|
|
shsurf = create_xdg_popup(shell, surface, &xdg_popup_client,
|
|
|
|
|
parent, seat, serial, x, y);
|
|
|
|
|
if (!shsurf) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"surface->configure already set");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shsurf->resource =
|
|
|
|
|
wl_resource_create(client,
|
|
|
|
|
&xdg_popup_interface, 1, id);
|
|
|
|
|
wl_resource_set_implementation(shsurf->resource,
|
|
|
|
|
&xdg_popup_implementation,
|
|
|
|
|
shsurf, shell_destroy_shell_surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
shell_surface_is_xdg_popup(struct shell_surface *shsurf)
|
|
|
|
|
{
|
|
|
|
|
return wl_resource_instance_of(shsurf->resource,
|
|
|
|
|
&xdg_popup_interface,
|
|
|
|
|
&xdg_popup_implementation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct xdg_shell_interface xdg_implementation = {
|
|
|
|
|
xdg_use_unstable_version,
|
|
|
|
|
xdg_get_xdg_surface,
|
|
|
|
|
xdg_get_xdg_popup
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
xdg_shell_unversioned_dispatch(const void *implementation,
|
|
|
|
|
void *_target, uint32_t opcode,
|
|
|
|
|
const struct wl_message *message,
|
|
|
|
|
union wl_argument *args)
|
|
|
|
|
{
|
|
|
|
|
struct wl_resource *resource = _target;
|
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
|
|
|
|
|
|
|
|
|
if (opcode != 0) {
|
|
|
|
|
wl_resource_post_error(resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"must call use_unstable_version first");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define XDG_SERVER_VERSION 1
|
|
|
|
|
|
2013-12-09 10:27:11 +04:00
|
|
|
|
static_assert(XDG_SERVER_VERSION == XDG_SHELL_VERSION_CURRENT,
|
|
|
|
|
"shell implementation doesn't match protocol version");
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
if (args[0].i != XDG_SERVER_VERSION) {
|
|
|
|
|
wl_resource_post_error(resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"incompatible version, server is %d "
|
|
|
|
|
"client wants %d",
|
|
|
|
|
XDG_SERVER_VERSION, args[0].i);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl_resource_set_implementation(resource, &xdg_implementation,
|
|
|
|
|
shell, NULL);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* end of xdg-shell implementation */
|
|
|
|
|
/***********************************/
|
|
|
|
|
|
2013-02-21 20:35:21 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_fade(struct desktop_shell *shell, enum fade_type type);
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
screensaver_timeout(void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
|
|
|
|
|
shell_fade(shell, FADE_OUT);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-02 18:31:49 +04:00
|
|
|
|
static void
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
handle_screensaver_sigchld(struct weston_process *proc, int status)
|
2011-12-02 18:31:49 +04:00
|
|
|
|
{
|
2013-02-15 20:44:19 +04:00
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
|
container_of(proc, struct desktop_shell, screensaver.process);
|
|
|
|
|
|
2011-12-02 18:31:49 +04:00
|
|
|
|
proc->pid = 0;
|
2013-02-15 20:44:19 +04:00
|
|
|
|
|
|
|
|
|
if (shell->locked)
|
2013-02-22 16:16:18 +04:00
|
|
|
|
weston_compositor_sleep(shell->compositor);
|
2011-12-02 18:31:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
static void
|
2012-04-16 18:31:41 +04:00
|
|
|
|
launch_screensaver(struct desktop_shell *shell)
|
2011-11-30 18:26:35 +04:00
|
|
|
|
{
|
|
|
|
|
if (shell->screensaver.binding)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-02-22 16:16:19 +04:00
|
|
|
|
if (!shell->screensaver.path) {
|
|
|
|
|
weston_compositor_sleep(shell->compositor);
|
2011-12-07 13:49:52 +04:00
|
|
|
|
return;
|
2013-02-22 16:16:19 +04:00
|
|
|
|
}
|
2011-12-07 13:49:52 +04:00
|
|
|
|
|
2012-03-02 02:11:36 +04:00
|
|
|
|
if (shell->screensaver.process.pid != 0) {
|
2012-06-07 20:01:59 +04:00
|
|
|
|
weston_log("old screensaver still running\n");
|
2012-03-02 02:11:36 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
weston_client_launch(shell->compositor,
|
2011-12-02 18:31:49 +04:00
|
|
|
|
&shell->screensaver.process,
|
2011-12-07 13:49:52 +04:00
|
|
|
|
shell->screensaver.path,
|
2011-12-02 18:31:49 +04:00
|
|
|
|
handle_screensaver_sigchld);
|
2011-11-30 18:26:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-04-16 18:31:41 +04:00
|
|
|
|
terminate_screensaver(struct desktop_shell *shell)
|
2011-11-30 18:26:35 +04:00
|
|
|
|
{
|
2011-12-02 18:31:49 +04:00
|
|
|
|
if (shell->screensaver.process.pid == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
kill(shell->screensaver.process.pid, SIGTERM);
|
2011-11-30 18:26:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-27 00:29:50 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
configure_static_view(struct weston_view *ev, struct weston_layer *layer)
|
2012-06-27 00:29:50 +04:00
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *v, *next;
|
2012-06-27 00:29:50 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each_safe(v, next, &layer->view_list, layer_link) {
|
|
|
|
|
if (v->output == ev->output && v != ev) {
|
|
|
|
|
weston_view_unmap(v);
|
|
|
|
|
v->surface->configure = NULL;
|
2012-06-27 00:29:50 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(ev, ev->output->x, ev->output->y);
|
2012-06-27 00:29:50 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (wl_list_empty(&ev->layer_link)) {
|
|
|
|
|
wl_list_insert(&layer->view_list, &ev->layer_link);
|
|
|
|
|
weston_compositor_schedule_repaint(ev->surface->compositor);
|
2012-06-27 00:29:50 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-27 05:19:23 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
background_configure(struct weston_surface *es, int32_t sx, int32_t sy)
|
2012-06-27 05:19:23 +04:00
|
|
|
|
{
|
2013-03-28 21:02:42 +04:00
|
|
|
|
struct desktop_shell *shell = es->configure_private;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-06-27 05:19:23 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
view = container_of(es->views.next, struct weston_view, surface_link);
|
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
configure_static_view(view, &shell->background_layer);
|
2012-06-27 05:19:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-09-06 21:48:16 +04:00
|
|
|
|
static void
|
|
|
|
|
desktop_shell_set_background(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
2011-11-22 15:43:52 +04:00
|
|
|
|
struct wl_resource *output_resource,
|
2011-09-06 21:48:16 +04:00
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2013-06-14 19:07:53 +04:00
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view, *next;
|
2011-11-23 23:46:40 +04:00
|
|
|
|
|
2012-06-27 00:29:50 +04:00
|
|
|
|
if (surface->configure) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"surface role already assigned");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-11-22 15:43:52 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each_safe(view, next, &surface->views, surface_link)
|
|
|
|
|
weston_view_destroy(view);
|
|
|
|
|
view = weston_view_create(surface);
|
|
|
|
|
|
2012-06-27 00:29:50 +04:00
|
|
|
|
surface->configure = background_configure;
|
2013-03-28 21:02:42 +04:00
|
|
|
|
surface->configure_private = shell;
|
2013-06-14 19:08:01 +04:00
|
|
|
|
surface->output = wl_resource_get_user_data(output_resource);
|
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-13 07:38:11 +04:00
|
|
|
|
view->output = surface->output;
|
2012-04-12 06:42:15 +04:00
|
|
|
|
desktop_shell_send_configure(resource, 0,
|
2012-03-05 06:57:37 +04:00
|
|
|
|
surface_resource,
|
2012-08-18 11:04:05 +04:00
|
|
|
|
surface->output->width,
|
|
|
|
|
surface->output->height);
|
2011-09-06 21:48:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-27 05:19:23 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
panel_configure(struct weston_surface *es, int32_t sx, int32_t sy)
|
2012-06-27 05:19:23 +04:00
|
|
|
|
{
|
2013-03-28 21:02:42 +04:00
|
|
|
|
struct desktop_shell *shell = es->configure_private;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
|
|
|
|
|
|
|
|
|
view = container_of(es->views.next, struct weston_view, surface_link);
|
2012-06-27 05:19:23 +04:00
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
configure_static_view(view, &shell->panel_layer);
|
2012-06-27 05:19:23 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-09-06 21:48:16 +04:00
|
|
|
|
static void
|
|
|
|
|
desktop_shell_set_panel(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
2011-11-22 15:43:52 +04:00
|
|
|
|
struct wl_resource *output_resource,
|
2011-09-06 21:48:16 +04:00
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2013-06-14 19:07:53 +04:00
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view, *next;
|
2011-11-23 23:46:40 +04:00
|
|
|
|
|
2012-06-27 05:19:23 +04:00
|
|
|
|
if (surface->configure) {
|
|
|
|
|
wl_resource_post_error(surface_resource,
|
|
|
|
|
WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"surface role already assigned");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2011-09-06 21:48:16 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each_safe(view, next, &surface->views, surface_link)
|
|
|
|
|
weston_view_destroy(view);
|
|
|
|
|
view = weston_view_create(surface);
|
|
|
|
|
|
2012-06-27 05:19:23 +04:00
|
|
|
|
surface->configure = panel_configure;
|
2013-03-28 21:02:42 +04:00
|
|
|
|
surface->configure_private = shell;
|
2013-06-14 19:08:01 +04:00
|
|
|
|
surface->output = wl_resource_get_user_data(output_resource);
|
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-13 07:38:11 +04:00
|
|
|
|
view->output = surface->output;
|
2012-04-12 06:42:15 +04:00
|
|
|
|
desktop_shell_send_configure(resource, 0,
|
2012-06-27 05:19:23 +04:00
|
|
|
|
surface_resource,
|
2012-08-18 11:04:05 +04:00
|
|
|
|
surface->output->width,
|
|
|
|
|
surface->output->height);
|
2011-09-06 21:48:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-27 05:44:35 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
lock_surface_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
|
2012-06-27 05:44:35 +04:00
|
|
|
|
{
|
2013-03-28 21:02:42 +04:00
|
|
|
|
struct desktop_shell *shell = surface->configure_private;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
|
|
|
|
|
|
|
|
|
view = container_of(surface->views.next, struct weston_view, surface_link);
|
2012-06-27 05:44:35 +04:00
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
if (surface->width == 0)
|
2013-02-21 14:29:21 +04:00
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
center_on_output(view, get_default_output(shell->compositor));
|
2012-06-27 05:44:35 +04:00
|
|
|
|
|
|
|
|
|
if (!weston_surface_is_mapped(surface)) {
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_insert(&shell->lock_layer.view_list,
|
|
|
|
|
&view->layer_link);
|
|
|
|
|
weston_view_update_transform(view);
|
2013-02-21 20:35:22 +04:00
|
|
|
|
shell_fade(shell, FADE_IN);
|
2012-06-27 05:44:35 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-16 01:39:55 +04:00
|
|
|
|
static void
|
2012-04-12 07:18:23 +04:00
|
|
|
|
handle_lock_surface_destroy(struct wl_listener *listener, void *data)
|
2011-11-16 01:39:55 +04:00
|
|
|
|
{
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
|
container_of(listener, struct desktop_shell, lock_surface_listener);
|
2011-11-16 01:39:55 +04:00
|
|
|
|
|
2012-06-07 20:01:59 +04:00
|
|
|
|
weston_log("lock surface gone\n");
|
2011-11-16 01:39:55 +04:00
|
|
|
|
shell->lock_surface = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
static void
|
|
|
|
|
desktop_shell_set_lock_surface(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2013-06-14 19:07:53 +04:00
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
2011-12-01 12:42:22 +04:00
|
|
|
|
|
2011-11-15 15:34:54 +04:00
|
|
|
|
shell->prepare_event_sent = false;
|
|
|
|
|
|
|
|
|
|
if (!shell->locked)
|
|
|
|
|
return;
|
2011-11-15 15:34:49 +04:00
|
|
|
|
|
2011-12-01 12:42:22 +04:00
|
|
|
|
shell->lock_surface = surface;
|
2011-11-15 15:34:49 +04:00
|
|
|
|
|
2012-04-12 07:18:23 +04:00
|
|
|
|
shell->lock_surface_listener.notify = handle_lock_surface_destroy;
|
2013-06-14 19:07:54 +04:00
|
|
|
|
wl_signal_add(&surface->destroy_signal,
|
2012-04-12 07:18:23 +04:00
|
|
|
|
&shell->lock_surface_listener);
|
2011-11-23 18:42:16 +04:00
|
|
|
|
|
2013-10-31 02:49:45 +04:00
|
|
|
|
weston_view_create(surface);
|
2012-06-27 05:44:35 +04:00
|
|
|
|
surface->configure = lock_surface_configure;
|
2013-03-28 21:02:42 +04:00
|
|
|
|
surface->configure_private = shell;
|
2011-11-15 15:34:54 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-04-16 18:31:41 +04:00
|
|
|
|
resume_desktop(struct desktop_shell *shell)
|
2011-11-15 15:34:54 +04:00
|
|
|
|
{
|
2012-06-25 22:03:13 +04:00
|
|
|
|
struct workspace *ws = get_current_workspace(shell);
|
2011-11-30 18:26:35 +04:00
|
|
|
|
|
|
|
|
|
terminate_screensaver(shell);
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
2012-02-29 21:42:35 +04:00
|
|
|
|
wl_list_remove(&shell->lock_layer.link);
|
|
|
|
|
wl_list_insert(&shell->compositor->cursor_layer.link,
|
|
|
|
|
&shell->fullscreen_layer.link);
|
|
|
|
|
wl_list_insert(&shell->fullscreen_layer.link,
|
|
|
|
|
&shell->panel_layer.link);
|
2012-08-09 20:50:43 +04:00
|
|
|
|
if (shell->showing_input_panels) {
|
|
|
|
|
wl_list_insert(&shell->panel_layer.link,
|
|
|
|
|
&shell->input_panel_layer.link);
|
|
|
|
|
wl_list_insert(&shell->input_panel_layer.link,
|
|
|
|
|
&ws->layer.link);
|
|
|
|
|
} else {
|
|
|
|
|
wl_list_insert(&shell->panel_layer.link, &ws->layer.link);
|
|
|
|
|
}
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
2012-08-01 00:36:34 +04:00
|
|
|
|
restore_focus_state(shell, get_current_workspace(shell));
|
2012-06-13 02:01:24 +04:00
|
|
|
|
|
2011-11-15 15:34:54 +04:00
|
|
|
|
shell->locked = false;
|
2013-02-21 20:35:22 +04:00
|
|
|
|
shell_fade(shell, FADE_IN);
|
2012-02-10 17:33:10 +04:00
|
|
|
|
weston_compositor_damage_all(shell->compositor);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
desktop_shell_unlock(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
|
|
|
|
|
shell->prepare_event_sent = false;
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
|
|
|
|
if (shell->locked)
|
|
|
|
|
resume_desktop(shell);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-05 17:58:51 +04:00
|
|
|
|
static void
|
2012-06-28 19:08:05 +04:00
|
|
|
|
desktop_shell_set_grab_surface(struct wl_client *client,
|
2012-06-05 17:58:51 +04:00
|
|
|
|
struct wl_resource *resource,
|
|
|
|
|
struct wl_resource *surface_resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
|
2013-06-14 19:07:53 +04:00
|
|
|
|
shell->grab_surface = wl_resource_get_user_data(surface_resource);
|
2013-10-25 02:51:35 +04:00
|
|
|
|
weston_view_create(shell->grab_surface);
|
2012-06-05 17:58:51 +04:00
|
|
|
|
}
|
|
|
|
|
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
static void
|
|
|
|
|
desktop_shell_desktop_ready(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
|
|
|
|
|
shell_fade_startup(shell);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-06 21:48:16 +04:00
|
|
|
|
static const struct desktop_shell_interface desktop_shell_implementation = {
|
|
|
|
|
desktop_shell_set_background,
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
desktop_shell_set_panel,
|
|
|
|
|
desktop_shell_set_lock_surface,
|
2012-06-05 17:58:51 +04:00
|
|
|
|
desktop_shell_unlock,
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
desktop_shell_set_grab_surface,
|
|
|
|
|
desktop_shell_desktop_ready
|
2011-09-06 21:48:16 +04:00
|
|
|
|
};
|
|
|
|
|
|
2011-11-28 17:34:13 +04:00
|
|
|
|
static enum shell_surface_type
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
get_shell_surface_type(struct weston_surface *surface)
|
2011-11-28 17:34:13 +04:00
|
|
|
|
{
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(surface);
|
|
|
|
|
if (!shsurf)
|
2011-12-01 12:42:22 +04:00
|
|
|
|
return SHELL_SURFACE_NONE;
|
2011-11-28 17:34:13 +04:00
|
|
|
|
return shsurf->type;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-13 01:25:42 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
move_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
|
2011-04-13 01:25:42 +04:00
|
|
|
|
{
|
2014-01-05 23:04:59 +04:00
|
|
|
|
struct weston_surface *focus;
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *surface;
|
2012-05-18 21:46:27 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
2011-11-23 19:52:40 +04:00
|
|
|
|
|
2014-01-05 23:04:59 +04:00
|
|
|
|
if (seat->pointer->focus == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
focus = seat->pointer->focus->surface;
|
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
surface = weston_surface_get_main_surface(focus);
|
2011-11-22 15:43:52 +04:00
|
|
|
|
if (surface == NULL)
|
2011-09-06 21:48:16 +04:00
|
|
|
|
return;
|
2011-04-13 19:52:54 +04:00
|
|
|
|
|
2012-05-18 21:46:27 +04:00
|
|
|
|
shsurf = get_shell_surface(surface);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf == NULL || shsurf->state.fullscreen ||
|
|
|
|
|
shsurf->state.maximized)
|
2012-05-18 21:46:27 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface_move(shsurf, (struct weston_seat *) seat);
|
2011-04-13 01:25:42 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:48 +04:00
|
|
|
|
static void
|
|
|
|
|
maximize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
|
|
|
|
|
{
|
2014-01-29 14:11:12 +04:00
|
|
|
|
struct weston_surface *focus = seat->keyboard->focus;
|
2013-12-03 21:35:48 +04:00
|
|
|
|
struct weston_surface *surface;
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
|
|
|
|
surface = weston_surface_get_main_surface(focus);
|
|
|
|
|
if (surface == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(surface);
|
|
|
|
|
if (shsurf == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!shell_surface_is_xdg_surface(shsurf))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (shsurf->state.maximized)
|
|
|
|
|
xdg_surface_send_request_unset_maximized(shsurf->resource);
|
|
|
|
|
else
|
|
|
|
|
xdg_surface_send_request_set_maximized(shsurf->resource);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fullscreen_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
|
|
|
|
|
{
|
2014-01-29 14:11:12 +04:00
|
|
|
|
struct weston_surface *focus = seat->keyboard->focus;
|
2013-12-03 21:35:48 +04:00
|
|
|
|
struct weston_surface *surface;
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
|
|
|
|
surface = weston_surface_get_main_surface(focus);
|
|
|
|
|
if (surface == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(surface);
|
|
|
|
|
if (shsurf == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!shell_surface_is_xdg_surface(shsurf))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (shsurf->state.fullscreen)
|
|
|
|
|
xdg_surface_send_request_unset_fullscreen(shsurf->resource);
|
|
|
|
|
else
|
|
|
|
|
xdg_surface_send_request_set_fullscreen(shsurf->resource);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-03 19:43:05 +04:00
|
|
|
|
static void
|
|
|
|
|
touch_move_binding(struct weston_seat *seat, uint32_t time, void *data)
|
|
|
|
|
{
|
2013-10-25 03:21:39 +04:00
|
|
|
|
struct weston_surface *focus = seat->touch->focus->surface;
|
2013-10-03 19:43:05 +04:00
|
|
|
|
struct weston_surface *surface;
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
|
|
|
|
|
surface = weston_surface_get_main_surface(focus);
|
|
|
|
|
if (surface == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(surface);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf == NULL || shsurf->state.fullscreen ||
|
|
|
|
|
shsurf->state.maximized)
|
2013-10-03 19:43:05 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface_touch_move(shsurf, (struct weston_seat *) seat);
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-13 01:25:42 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
resize_binding(struct weston_seat *seat, uint32_t time, uint32_t button, void *data)
|
2011-04-13 01:25:42 +04:00
|
|
|
|
{
|
2014-01-05 23:04:59 +04:00
|
|
|
|
struct weston_surface *focus;
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *surface;
|
2011-04-13 01:25:42 +04:00
|
|
|
|
uint32_t edges = 0;
|
|
|
|
|
int32_t x, y;
|
2011-11-25 14:09:16 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
2011-11-23 19:52:40 +04:00
|
|
|
|
|
2014-01-05 23:04:59 +04:00
|
|
|
|
if (seat->pointer->focus == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
focus = seat->pointer->focus->surface;
|
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
surface = weston_surface_get_main_surface(focus);
|
2011-11-22 15:43:52 +04:00
|
|
|
|
if (surface == NULL)
|
2011-09-06 21:48:16 +04:00
|
|
|
|
return;
|
2011-11-28 17:34:13 +04:00
|
|
|
|
|
2011-11-25 14:09:16 +04:00
|
|
|
|
shsurf = get_shell_surface(surface);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf == NULL || shsurf->state.fullscreen ||
|
|
|
|
|
shsurf->state.maximized)
|
2011-11-28 17:34:13 +04:00
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_from_global(shsurf->view,
|
|
|
|
|
wl_fixed_to_int(seat->pointer->grab_x),
|
|
|
|
|
wl_fixed_to_int(seat->pointer->grab_y),
|
|
|
|
|
&x, &y);
|
2011-04-13 01:25:42 +04:00
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
if (x < shsurf->surface->width / 3)
|
2011-11-25 14:09:16 +04:00
|
|
|
|
edges |= WL_SHELL_SURFACE_RESIZE_LEFT;
|
2013-12-03 07:01:53 +04:00
|
|
|
|
else if (x < 2 * shsurf->surface->width / 3)
|
2011-04-13 01:25:42 +04:00
|
|
|
|
edges |= 0;
|
|
|
|
|
else
|
2011-11-25 14:09:16 +04:00
|
|
|
|
edges |= WL_SHELL_SURFACE_RESIZE_RIGHT;
|
2011-04-13 01:25:42 +04:00
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
if (y < shsurf->surface->height / 3)
|
2011-11-25 14:09:16 +04:00
|
|
|
|
edges |= WL_SHELL_SURFACE_RESIZE_TOP;
|
2013-12-03 07:01:53 +04:00
|
|
|
|
else if (y < 2 * shsurf->surface->height / 3)
|
2011-04-13 01:25:42 +04:00
|
|
|
|
edges |= 0;
|
|
|
|
|
else
|
2011-11-25 14:09:16 +04:00
|
|
|
|
edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
2011-08-27 01:21:20 +04:00
|
|
|
|
|
2012-05-23 00:56:23 +04:00
|
|
|
|
surface_resize(shsurf, (struct weston_seat *) seat, edges);
|
2011-04-23 21:04:11 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-22 21:01:03 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
surface_opacity_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
2012-05-30 19:31:59 +04:00
|
|
|
|
wl_fixed_t value, void *data)
|
2012-03-22 21:01:03 +04:00
|
|
|
|
{
|
2012-09-27 20:40:42 +04:00
|
|
|
|
float step = 0.005;
|
2012-03-22 21:01:03 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
2013-10-25 03:21:39 +04:00
|
|
|
|
struct weston_surface *focus = seat->pointer->focus->surface;
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *surface;
|
2012-03-22 21:01:03 +04:00
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
/* XXX: broken for windows containing sub-surfaces */
|
|
|
|
|
surface = weston_surface_get_main_surface(focus);
|
2012-03-22 21:01:03 +04:00
|
|
|
|
if (surface == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(surface);
|
|
|
|
|
if (!shsurf)
|
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->view->alpha -= wl_fixed_to_double(value) * step;
|
2012-03-22 21:01:03 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (shsurf->view->alpha > 1.0)
|
|
|
|
|
shsurf->view->alpha = 1.0;
|
|
|
|
|
if (shsurf->view->alpha < step)
|
|
|
|
|
shsurf->view->alpha = step;
|
2012-03-22 21:01:03 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_geometry_dirty(shsurf->view);
|
2012-03-22 21:01:03 +04:00
|
|
|
|
weston_surface_damage(surface);
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-23 01:21:41 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
|
2012-05-30 19:31:59 +04:00
|
|
|
|
wl_fixed_t value)
|
2012-02-23 01:21:41 +04:00
|
|
|
|
{
|
2012-05-16 21:45:18 +04:00
|
|
|
|
struct weston_seat *ws = (struct weston_seat *) seat;
|
|
|
|
|
struct weston_compositor *compositor = ws->compositor;
|
2012-02-23 01:21:41 +04:00
|
|
|
|
struct weston_output *output;
|
2012-06-11 23:07:51 +04:00
|
|
|
|
float increment;
|
2012-02-23 01:21:41 +04:00
|
|
|
|
|
|
|
|
|
wl_list_for_each(output, &compositor->output_list, link) {
|
|
|
|
|
if (pixman_region32_contains_point(&output->region,
|
2012-05-16 21:45:18 +04:00
|
|
|
|
wl_fixed_to_double(seat->pointer->x),
|
|
|
|
|
wl_fixed_to_double(seat->pointer->y),
|
2012-05-08 20:17:55 +04:00
|
|
|
|
NULL)) {
|
2012-05-30 19:31:58 +04:00
|
|
|
|
if (key == KEY_PAGEUP)
|
2012-05-22 20:55:18 +04:00
|
|
|
|
increment = output->zoom.increment;
|
2012-05-30 19:31:58 +04:00
|
|
|
|
else if (key == KEY_PAGEDOWN)
|
2012-05-22 20:55:18 +04:00
|
|
|
|
increment = -output->zoom.increment;
|
|
|
|
|
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
2012-09-27 20:40:42 +04:00
|
|
|
|
/* For every pixel zoom 20th of a step */
|
2012-05-30 19:31:59 +04:00
|
|
|
|
increment = output->zoom.increment *
|
2012-09-27 20:40:42 +04:00
|
|
|
|
-wl_fixed_to_double(value) / 20.0;
|
2012-05-22 20:55:18 +04:00
|
|
|
|
else
|
|
|
|
|
increment = 0;
|
|
|
|
|
|
|
|
|
|
output->zoom.level += increment;
|
2012-02-24 09:28:37 +04:00
|
|
|
|
|
2012-06-11 23:07:51 +04:00
|
|
|
|
if (output->zoom.level < 0.0)
|
2012-05-22 01:21:25 +04:00
|
|
|
|
output->zoom.level = 0.0;
|
2012-06-11 23:07:51 +04:00
|
|
|
|
else if (output->zoom.level > output->zoom.max_level)
|
|
|
|
|
output->zoom.level = output->zoom.max_level;
|
2012-11-16 13:48:47 +04:00
|
|
|
|
else if (!output->zoom.active) {
|
2013-11-15 02:42:51 +04:00
|
|
|
|
weston_output_activate_zoom(output);
|
2012-08-03 23:45:23 +04:00
|
|
|
|
}
|
2012-05-22 01:21:25 +04:00
|
|
|
|
|
2012-06-11 23:07:51 +04:00
|
|
|
|
output->zoom.spring_z.target = output->zoom.level;
|
2012-02-23 01:21:41 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_output_update_zoom(output);
|
2012-02-23 01:21:41 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-20 00:18:05 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
zoom_axis_binding(struct weston_seat *seat, uint32_t time, uint32_t axis,
|
2012-05-30 19:31:59 +04:00
|
|
|
|
wl_fixed_t value, void *data)
|
2012-05-30 19:31:58 +04:00
|
|
|
|
{
|
|
|
|
|
do_zoom(seat, time, 0, axis, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
zoom_key_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
2012-05-30 19:31:58 +04:00
|
|
|
|
void *data)
|
|
|
|
|
{
|
|
|
|
|
do_zoom(seat, time, key, 0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
terminate_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
2012-05-30 19:31:58 +04:00
|
|
|
|
void *data)
|
2011-12-20 00:18:05 +04:00
|
|
|
|
{
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
struct weston_compositor *compositor = data;
|
2011-12-20 00:18:05 +04:00
|
|
|
|
|
2012-05-30 19:31:58 +04:00
|
|
|
|
wl_display_terminate(compositor->wl_display);
|
2011-12-20 00:18:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-01-20 18:48:25 +04:00
|
|
|
|
static void
|
2013-11-15 02:42:52 +04:00
|
|
|
|
rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
|
|
|
|
|
wl_fixed_t x, wl_fixed_t y)
|
2012-01-20 18:48:25 +04:00
|
|
|
|
{
|
|
|
|
|
struct rotate_grab *rotate =
|
2012-04-04 18:48:05 +04:00
|
|
|
|
container_of(grab, struct rotate_grab, base.grab);
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_surface *shsurf = rotate->base.shsurf;
|
2012-09-30 04:57:21 +04:00
|
|
|
|
float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
|
2012-04-04 18:48:05 +04:00
|
|
|
|
|
2013-11-15 02:42:52 +04:00
|
|
|
|
weston_pointer_move(pointer, x, y);
|
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
if (!shsurf)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
cx = 0.5f * shsurf->surface->width;
|
|
|
|
|
cy = 0.5f * shsurf->surface->height;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
2012-05-16 21:45:18 +04:00
|
|
|
|
dx = wl_fixed_to_double(pointer->x) - rotate->center.x;
|
|
|
|
|
dy = wl_fixed_to_double(pointer->y) - rotate->center.y;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
r = sqrtf(dx * dx + dy * dy);
|
|
|
|
|
|
2012-04-04 18:48:05 +04:00
|
|
|
|
wl_list_remove(&shsurf->rotation.transform.link);
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_geometry_dirty(shsurf->view);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
|
|
|
|
if (r > 20.0f) {
|
|
|
|
|
struct weston_matrix *matrix =
|
2012-04-04 18:48:05 +04:00
|
|
|
|
&shsurf->rotation.transform.matrix;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
2012-01-27 22:36:13 +04:00
|
|
|
|
weston_matrix_init(&rotate->rotation);
|
2013-01-28 23:40:28 +04:00
|
|
|
|
weston_matrix_rotate_xy(&rotate->rotation, dx / r, dy / r);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
|
|
|
|
weston_matrix_init(matrix);
|
2012-01-30 16:16:34 +04:00
|
|
|
|
weston_matrix_translate(matrix, -cx, -cy, 0.0f);
|
2012-04-04 18:48:05 +04:00
|
|
|
|
weston_matrix_multiply(matrix, &shsurf->rotation.rotation);
|
2012-01-27 22:36:13 +04:00
|
|
|
|
weston_matrix_multiply(matrix, &rotate->rotation);
|
2012-01-30 16:16:34 +04:00
|
|
|
|
weston_matrix_translate(matrix, cx, cy, 0.0f);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
2012-01-24 11:53:37 +04:00
|
|
|
|
wl_list_insert(
|
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-13 07:38:11 +04:00
|
|
|
|
&shsurf->view->geometry.transformation_list,
|
2012-04-04 18:48:05 +04:00
|
|
|
|
&shsurf->rotation.transform.link);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
} else {
|
2012-04-04 18:48:05 +04:00
|
|
|
|
wl_list_init(&shsurf->rotation.transform.link);
|
|
|
|
|
weston_matrix_init(&shsurf->rotation.rotation);
|
2012-01-27 22:36:13 +04:00
|
|
|
|
weston_matrix_init(&rotate->rotation);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
}
|
2012-02-09 17:58:44 +04:00
|
|
|
|
|
2012-03-23 01:22:04 +04:00
|
|
|
|
/* We need to adjust the position of the surface
|
|
|
|
|
* in case it was resized in a rotated state before */
|
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-13 07:38:11 +04:00
|
|
|
|
cposx = shsurf->view->geometry.x + cx;
|
|
|
|
|
cposy = shsurf->view->geometry.y + cy;
|
2012-03-23 01:22:04 +04:00
|
|
|
|
dposx = rotate->center.x - cposx;
|
|
|
|
|
dposy = rotate->center.y - cposy;
|
|
|
|
|
if (dposx != 0.0f || dposy != 0.0f) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
shsurf->view->geometry.x + dposx,
|
|
|
|
|
shsurf->view->geometry.y + dposy);
|
2012-03-23 01:22:04 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-09 17:58:44 +04:00
|
|
|
|
/* Repaint implies weston_surface_update_transform(), which
|
|
|
|
|
* lazily applies the damage due to rotation update.
|
|
|
|
|
*/
|
2012-04-04 18:48:05 +04:00
|
|
|
|
weston_compositor_schedule_repaint(shsurf->surface->compositor);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 06:15:05 +04:00
|
|
|
|
rotate_grab_button(struct weston_pointer_grab *grab,
|
|
|
|
|
uint32_t time, uint32_t button, uint32_t state_w)
|
2012-01-20 18:48:25 +04:00
|
|
|
|
{
|
|
|
|
|
struct rotate_grab *rotate =
|
2012-04-04 18:48:05 +04:00
|
|
|
|
container_of(grab, struct rotate_grab, base.grab);
|
2013-05-07 06:15:05 +04:00
|
|
|
|
struct weston_pointer *pointer = grab->pointer;
|
2012-04-04 18:48:05 +04:00
|
|
|
|
struct shell_surface *shsurf = rotate->base.shsurf;
|
2012-05-30 19:31:51 +04:00
|
|
|
|
enum wl_pointer_button_state state = state_w;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
2012-05-30 19:31:51 +04:00
|
|
|
|
if (pointer->button_count == 0 &&
|
|
|
|
|
state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
2012-04-04 18:48:05 +04:00
|
|
|
|
if (shsurf)
|
|
|
|
|
weston_matrix_multiply(&shsurf->rotation.rotation,
|
|
|
|
|
&rotate->rotation);
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_end(&rotate->base);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
free(rotate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
rotate_grab_cancel(struct weston_pointer_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
struct rotate_grab *rotate =
|
|
|
|
|
container_of(grab, struct rotate_grab, base.grab);
|
|
|
|
|
|
|
|
|
|
shell_grab_end(&rotate->base);
|
|
|
|
|
free(rotate);
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 06:15:05 +04:00
|
|
|
|
static const struct weston_pointer_grab_interface rotate_grab_interface = {
|
2012-01-20 18:48:25 +04:00
|
|
|
|
noop_grab_focus,
|
|
|
|
|
rotate_grab_motion,
|
|
|
|
|
rotate_grab_button,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
rotate_grab_cancel,
|
2012-01-20 18:48:25 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
surface_rotate(struct shell_surface *surface, struct weston_seat *seat)
|
2012-01-20 18:48:25 +04:00
|
|
|
|
{
|
|
|
|
|
struct rotate_grab *rotate;
|
2012-09-30 04:57:21 +04:00
|
|
|
|
float dx, dy;
|
|
|
|
|
float r;
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
|
|
|
|
rotate = malloc(sizeof *rotate);
|
|
|
|
|
if (!rotate)
|
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_to_global_float(surface->view,
|
2013-12-03 07:01:53 +04:00
|
|
|
|
surface->surface->width * 0.5f,
|
|
|
|
|
surface->surface->height * 0.5f,
|
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-13 07:38:11 +04:00
|
|
|
|
&rotate->center.x, &rotate->center.y);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
|
2012-05-16 21:45:18 +04:00
|
|
|
|
dx = wl_fixed_to_double(seat->pointer->x) - rotate->center.x;
|
|
|
|
|
dy = wl_fixed_to_double(seat->pointer->y) - rotate->center.y;
|
2012-01-27 22:36:13 +04:00
|
|
|
|
r = sqrtf(dx * dx + dy * dy);
|
|
|
|
|
if (r > 20.0f) {
|
|
|
|
|
struct weston_matrix inverse;
|
|
|
|
|
|
|
|
|
|
weston_matrix_init(&inverse);
|
2013-01-28 23:40:28 +04:00
|
|
|
|
weston_matrix_rotate_xy(&inverse, dx / r, -dy / r);
|
2012-01-27 22:36:13 +04:00
|
|
|
|
weston_matrix_multiply(&surface->rotation.rotation, &inverse);
|
2012-03-23 01:22:04 +04:00
|
|
|
|
|
|
|
|
|
weston_matrix_init(&rotate->rotation);
|
2013-01-28 23:40:28 +04:00
|
|
|
|
weston_matrix_rotate_xy(&rotate->rotation, dx / r, dy / r);
|
2012-01-27 22:36:13 +04:00
|
|
|
|
} else {
|
|
|
|
|
weston_matrix_init(&surface->rotation.rotation);
|
|
|
|
|
weston_matrix_init(&rotate->rotation);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-28 19:08:05 +04:00
|
|
|
|
shell_grab_start(&rotate->base, &rotate_grab_interface, surface,
|
|
|
|
|
seat->pointer, DESKTOP_SHELL_CURSOR_ARROW);
|
2012-01-20 18:48:25 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-02-15 06:31:44 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
rotate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
|
2013-02-15 06:31:44 +04:00
|
|
|
|
void *data)
|
|
|
|
|
{
|
2014-01-05 23:04:59 +04:00
|
|
|
|
struct weston_surface *focus;
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *base_surface;
|
2013-02-15 06:31:44 +04:00
|
|
|
|
struct shell_surface *surface;
|
|
|
|
|
|
2014-01-05 23:04:59 +04:00
|
|
|
|
if (seat->pointer->focus == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
focus = seat->pointer->focus->surface;
|
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
base_surface = weston_surface_get_main_surface(focus);
|
2013-02-15 06:31:44 +04:00
|
|
|
|
if (base_surface == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface = get_shell_surface(base_surface);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (surface == NULL || surface->state.fullscreen ||
|
|
|
|
|
surface->state.maximized)
|
2013-02-15 06:31:44 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface_rotate(surface, seat);
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-25 22:01:42 +04:00
|
|
|
|
/* Move all fullscreen layers down to the current workspace in a non-reversible
|
|
|
|
|
* manner. This should be used when implementing shell-wide overlays, such as
|
|
|
|
|
* the alt-tab switcher, which need to de-promote fullscreen layers. */
|
2013-12-04 12:20:01 +04:00
|
|
|
|
void
|
2012-06-19 00:34:58 +04:00
|
|
|
|
lower_fullscreen_layer(struct desktop_shell *shell)
|
|
|
|
|
{
|
|
|
|
|
struct workspace *ws;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view, *prev;
|
2012-06-19 00:34:58 +04:00
|
|
|
|
|
|
|
|
|
ws = get_current_workspace(shell);
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each_reverse_safe(view, prev,
|
|
|
|
|
&shell->fullscreen_layer.view_list,
|
2013-11-25 22:01:42 +04:00
|
|
|
|
layer_link) {
|
|
|
|
|
wl_list_remove(&view->layer_link);
|
|
|
|
|
wl_list_insert(&ws->layer.view_list, &view->layer_link);
|
|
|
|
|
weston_view_damage_below(view);
|
|
|
|
|
weston_surface_damage(view->surface);
|
|
|
|
|
}
|
2012-06-19 00:34:58 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-04 12:20:01 +04:00
|
|
|
|
void
|
2012-04-16 18:31:41 +04:00
|
|
|
|
activate(struct desktop_shell *shell, struct weston_surface *es,
|
2012-05-16 21:45:18 +04:00
|
|
|
|
struct weston_seat *seat)
|
2011-09-06 21:48:16 +04:00
|
|
|
|
{
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *main_surface;
|
2012-08-01 00:36:34 +04:00
|
|
|
|
struct focus_state *state;
|
2012-08-30 00:13:03 +04:00
|
|
|
|
struct workspace *ws;
|
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 14:37:11 +04:00
|
|
|
|
struct weston_surface *old_es;
|
2013-12-03 21:35:42 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
2011-09-06 21:48:16 +04:00
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
main_surface = weston_surface_get_main_surface(es);
|
|
|
|
|
|
2012-05-16 21:45:18 +04:00
|
|
|
|
weston_surface_activate(es, seat);
|
2011-09-06 21:48:16 +04:00
|
|
|
|
|
2012-08-30 00:13:03 +04:00
|
|
|
|
state = ensure_focus_state(shell, seat);
|
|
|
|
|
if (state == NULL)
|
|
|
|
|
return;
|
2012-08-01 00:36:34 +04:00
|
|
|
|
|
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 14:37:11 +04:00
|
|
|
|
old_es = state->keyboard_focus;
|
2014-01-23 00:25:20 +04:00
|
|
|
|
focus_state_set_focus(state, es);
|
2012-08-01 00:36:34 +04:00
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
shsurf = get_shell_surface(main_surface);
|
2014-01-17 22:08:25 +04:00
|
|
|
|
assert(shsurf);
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.fullscreen)
|
|
|
|
|
shell_configure_fullscreen(shsurf);
|
|
|
|
|
else
|
2013-05-28 18:23:39 +04:00
|
|
|
|
restore_all_output_modes(shell->compositor);
|
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 14:37:11 +04:00
|
|
|
|
|
2014-01-30 16:49:39 +04:00
|
|
|
|
/* Update the surface’s layer. This brings it to the top of the stacking
|
|
|
|
|
* order as appropriate. */
|
|
|
|
|
shell_surface_update_layer(shsurf);
|
|
|
|
|
|
2013-11-25 22:01:42 +04:00
|
|
|
|
if (shell->focus_animation_type != ANIMATION_NONE) {
|
|
|
|
|
ws = get_current_workspace(shell);
|
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 14:37:11 +04:00
|
|
|
|
animate_focus_change(shell, ws, get_default_view(old_es), get_default_view(es));
|
2013-11-25 22:01:42 +04:00
|
|
|
|
}
|
2011-09-06 21:48:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-01 16:13:08 +04:00
|
|
|
|
/* no-op func for checking black surface */
|
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
black_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
|
2012-04-01 16:13:08 +04:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-29 17:16:13 +04:00
|
|
|
|
static bool
|
2012-04-01 16:13:08 +04:00
|
|
|
|
is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface)
|
|
|
|
|
{
|
|
|
|
|
if (es->configure == black_surface_configure) {
|
|
|
|
|
if (fs_surface)
|
2013-03-28 21:02:42 +04:00
|
|
|
|
*fs_surface = (struct weston_surface *)es->configure_private;
|
2012-04-01 16:13:08 +04:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-20 00:18:05 +04:00
|
|
|
|
static void
|
2013-10-03 19:43:04 +04:00
|
|
|
|
activate_binding(struct weston_seat *seat,
|
|
|
|
|
struct desktop_shell *shell,
|
|
|
|
|
struct weston_surface *focus)
|
2011-12-20 00:18:05 +04:00
|
|
|
|
{
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
struct weston_surface *main_surface;
|
2011-12-20 00:18:05 +04:00
|
|
|
|
|
2012-03-05 10:13:13 +04:00
|
|
|
|
if (!focus)
|
|
|
|
|
return;
|
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
if (is_black_surface(focus, &main_surface))
|
|
|
|
|
focus = main_surface;
|
2012-03-01 08:57:46 +04:00
|
|
|
|
|
shell: keyboard focus and restacking fixes for sub-surfaces
The shell needs to redirect some actions to the parent surface, when
they originally target a sub-surface. This patch implements the
following:
- Move, resize, and rotate bindings always target the parent surface.
- Opacity (full-surface alpha) binding targets the parent surface. This
is broken, because it should change the opacity of the whole compound
window, which is difficult to implement in the renderer.
- click_to_activate_binding() needs to check the shell surface type from
the main surface, because sub-surface would produce SHELL_SURFACE_NONE
and prevent activation.
- Also activate() needs to check the type from the main surface, and
restack the main surface. Keyboard focus is assigned to the original
(sub-)surface.
- focus_state_surface_destroy() needs to handle sub-surfaces: only the
main surface will be in a layer list. If the destroyed surface is
indeed a sub-surface, activate the main surface next. This way a
client that destroys a focused sub-surface still retains focus in the
same window.
- The workspace_manager.move_surface request can accept also
sub-surfaces, and it will move the corresponding main surface.
Changes in v2:
- do not special-case keyboard focus for sub-surfaces
- fix surface type checks for sub-surfaces in shell, fix restacking of
sub-surfaces in shell, fix focus_state_surface_destroy()
Changes in v3:
- Renamed weston_surface_get_parent() to
weston_surface_get_main_surface() to be more explicit that this is
about sub-surfaces
- Fixed move_surface_to_workspace() to handle keyboard focus on a
sub-surface.
- Used a temporary variable in several places to clarify code, instead
of reassigning a variable.
- Fixed workspace_manager_move_surface() to deal with sub-surfaces.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2013-04-25 14:57:44 +04:00
|
|
|
|
main_surface = weston_surface_get_main_surface(focus);
|
|
|
|
|
if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
|
2012-06-27 18:22:15 +04:00
|
|
|
|
return;
|
2012-06-22 00:49:42 +04:00
|
|
|
|
|
2013-10-03 19:43:04 +04:00
|
|
|
|
activate(shell, focus, seat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
click_to_activate_binding(struct weston_seat *seat, uint32_t time, uint32_t button,
|
|
|
|
|
void *data)
|
|
|
|
|
{
|
|
|
|
|
if (seat->pointer->grab != &seat->pointer->default_grab)
|
|
|
|
|
return;
|
2014-01-02 04:28:32 +04:00
|
|
|
|
if (seat->pointer->focus == NULL)
|
|
|
|
|
return;
|
2013-10-03 19:43:04 +04:00
|
|
|
|
|
2013-10-25 03:21:39 +04:00
|
|
|
|
activate_binding(seat, data, seat->pointer->focus->surface);
|
2013-10-03 19:43:04 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
touch_to_activate_binding(struct weston_seat *seat, uint32_t time, void *data)
|
|
|
|
|
{
|
|
|
|
|
if (seat->touch->grab != &seat->touch->default_grab)
|
|
|
|
|
return;
|
2014-01-03 11:00:11 +04:00
|
|
|
|
if (seat->touch->focus == NULL)
|
|
|
|
|
return;
|
2013-10-03 19:43:04 +04:00
|
|
|
|
|
2013-10-25 03:21:39 +04:00
|
|
|
|
activate_binding(seat, data, seat->touch->focus->surface);
|
2011-12-20 00:18:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-23 21:04:11 +04:00
|
|
|
|
static void
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
lock(struct desktop_shell *shell)
|
2011-04-23 21:04:11 +04:00
|
|
|
|
{
|
2012-06-25 22:03:13 +04:00
|
|
|
|
struct workspace *ws = get_current_workspace(shell);
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
2012-02-29 21:53:50 +04:00
|
|
|
|
if (shell->locked) {
|
2013-02-21 20:35:22 +04:00
|
|
|
|
weston_compositor_sleep(shell->compositor);
|
2011-11-15 15:34:54 +04:00
|
|
|
|
return;
|
2012-02-29 21:53:50 +04:00
|
|
|
|
}
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
|
|
|
|
|
shell->locked = true;
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
2012-02-29 21:42:35 +04:00
|
|
|
|
/* Hide all surfaces by removing the fullscreen, panel and
|
|
|
|
|
* toplevel layers. This way nothing else can show or receive
|
|
|
|
|
* input events while we are locked. */
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
2012-02-29 21:42:35 +04:00
|
|
|
|
wl_list_remove(&shell->panel_layer.link);
|
|
|
|
|
wl_list_remove(&shell->fullscreen_layer.link);
|
2012-08-09 20:50:43 +04:00
|
|
|
|
if (shell->showing_input_panels)
|
|
|
|
|
wl_list_remove(&shell->input_panel_layer.link);
|
2012-06-25 22:03:13 +04:00
|
|
|
|
wl_list_remove(&ws->layer.link);
|
2012-02-29 21:42:35 +04:00
|
|
|
|
wl_list_insert(&shell->compositor->cursor_layer.link,
|
|
|
|
|
&shell->lock_layer.link);
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
launch_screensaver(shell);
|
|
|
|
|
|
2011-11-15 15:34:54 +04:00
|
|
|
|
/* TODO: disable bindings that should not work while locked. */
|
|
|
|
|
|
|
|
|
|
/* All this must be undone in resume_desktop(). */
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
unlock(struct desktop_shell *shell)
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
{
|
2011-11-16 15:47:34 +04:00
|
|
|
|
if (!shell->locked || shell->lock_surface) {
|
2013-02-21 20:35:22 +04:00
|
|
|
|
shell_fade(shell, FADE_IN);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If desktop-shell client has gone away, unlock immediately. */
|
|
|
|
|
if (!shell->child.desktop_shell) {
|
2011-11-15 15:34:54 +04:00
|
|
|
|
resume_desktop(shell);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shell->prepare_event_sent)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-03-05 06:57:37 +04:00
|
|
|
|
desktop_shell_send_prepare_lock_surface(shell->child.desktop_shell);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
shell->prepare_event_sent = true;
|
2011-04-23 21:04:11 +04:00
|
|
|
|
}
|
|
|
|
|
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
static void
|
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-13 07:38:11 +04:00
|
|
|
|
shell_fade_done(struct weston_view_animation *animation, void *data)
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
|
|
|
|
|
shell->fade.animation = NULL;
|
|
|
|
|
|
|
|
|
|
switch (shell->fade.type) {
|
|
|
|
|
case FADE_IN:
|
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-13 07:38:11 +04:00
|
|
|
|
weston_surface_destroy(shell->fade.view->surface);
|
|
|
|
|
shell->fade.view = NULL;
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
break;
|
|
|
|
|
case FADE_OUT:
|
|
|
|
|
lock(shell);
|
|
|
|
|
break;
|
2013-11-25 22:01:32 +04:00
|
|
|
|
default:
|
|
|
|
|
break;
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
static struct weston_view *
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
shell_fade_create_surface(struct desktop_shell *shell)
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_compositor *compositor = shell->compositor;
|
|
|
|
|
struct weston_surface *surface;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
|
|
|
|
|
surface = weston_surface_create(compositor);
|
|
|
|
|
if (!surface)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
view = weston_view_create(surface);
|
|
|
|
|
if (!view) {
|
|
|
|
|
weston_surface_destroy(surface);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-05 06:32:03 +04:00
|
|
|
|
weston_surface_set_size(surface, 8192, 8192);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(view, 0, 0);
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1.0);
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_insert(&compositor->fade_layer.view_list,
|
|
|
|
|
&view->layer_link);
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
pixman_region32_init(&surface->input);
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
return view;
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_fade(struct desktop_shell *shell, enum fade_type type)
|
|
|
|
|
{
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
float tint;
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case FADE_IN:
|
|
|
|
|
tint = 0.0;
|
|
|
|
|
break;
|
|
|
|
|
case FADE_OUT:
|
|
|
|
|
tint = 1.0;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
weston_log("shell: invalid fade type\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shell->fade.type = type;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (shell->fade.view == NULL) {
|
|
|
|
|
shell->fade.view = shell_fade_create_surface(shell);
|
|
|
|
|
if (!shell->fade.view)
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
shell->fade.view->alpha = 1.0 - tint;
|
|
|
|
|
weston_view_update_transform(shell->fade.view);
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-20 09:48:10 +04:00
|
|
|
|
if (shell->fade.view->output == NULL) {
|
|
|
|
|
/* If the black view gets a NULL output, we lost the
|
|
|
|
|
* last output and we'll just cancel the fade. This
|
|
|
|
|
* happens when you close the last window under the
|
|
|
|
|
* X11 or Wayland backends. */
|
|
|
|
|
shell->locked = false;
|
|
|
|
|
weston_surface_destroy(shell->fade.view->surface);
|
|
|
|
|
shell->fade.view = NULL;
|
|
|
|
|
} else if (shell->fade.animation) {
|
2013-06-17 18:10:28 +04:00
|
|
|
|
weston_fade_update(shell->fade.animation, tint);
|
2014-01-20 09:48:10 +04:00
|
|
|
|
} else {
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
shell->fade.animation =
|
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-13 07:38:11 +04:00
|
|
|
|
weston_fade_run(shell->fade.view,
|
2013-06-17 18:10:28 +04:00
|
|
|
|
1.0 - tint, tint, 300.0,
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
shell_fade_done, shell);
|
2014-01-20 09:48:10 +04:00
|
|
|
|
}
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
static void
|
|
|
|
|
do_shell_fade_startup(void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
|
2013-10-16 22:38:24 +04:00
|
|
|
|
if (shell->startup_animation_type == ANIMATION_FADE)
|
|
|
|
|
shell_fade(shell, FADE_IN);
|
|
|
|
|
else if (shell->startup_animation_type == ANIMATION_NONE) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_surface_destroy(shell->fade.view->surface);
|
|
|
|
|
shell->fade.view = NULL;
|
2013-10-16 22:38:24 +04:00
|
|
|
|
}
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_fade_startup(struct desktop_shell *shell)
|
|
|
|
|
{
|
|
|
|
|
struct wl_event_loop *loop;
|
|
|
|
|
|
|
|
|
|
if (!shell->fade.startup_timer)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
wl_event_source_remove(shell->fade.startup_timer);
|
|
|
|
|
shell->fade.startup_timer = NULL;
|
|
|
|
|
|
|
|
|
|
loop = wl_display_get_event_loop(shell->compositor->wl_display);
|
|
|
|
|
wl_event_loop_add_idle(loop, do_shell_fade_startup, shell);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
fade_startup_timeout(void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
|
|
|
|
|
shell_fade_startup(shell);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_fade_init(struct desktop_shell *shell)
|
|
|
|
|
{
|
|
|
|
|
/* Make compositor output all black, and wait for the desktop-shell
|
|
|
|
|
* client to signal it is ready, then fade in. The timer triggers a
|
|
|
|
|
* fade-in, in case the desktop-shell client takes too long.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct wl_event_loop *loop;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (shell->fade.view != NULL) {
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
weston_log("%s: warning: fade surface already exists\n",
|
|
|
|
|
__func__);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
shell->fade.view = shell_fade_create_surface(shell);
|
|
|
|
|
if (!shell->fade.view)
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_update_transform(shell->fade.view);
|
|
|
|
|
weston_surface_damage(shell->fade.view->surface);
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
|
|
|
|
|
loop = wl_display_get_event_loop(shell->compositor->wl_display);
|
|
|
|
|
shell->fade.startup_timer =
|
|
|
|
|
wl_event_loop_add_timer(loop, fade_startup_timeout, shell);
|
|
|
|
|
wl_event_source_timer_update(shell->fade.startup_timer, 15000);
|
|
|
|
|
}
|
|
|
|
|
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
static void
|
2013-02-21 20:35:23 +04:00
|
|
|
|
idle_handler(struct wl_listener *listener, void *data)
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell =
|
2013-02-21 20:35:23 +04:00
|
|
|
|
container_of(listener, struct desktop_shell, idle_listener);
|
2014-01-18 04:22:50 +04:00
|
|
|
|
struct weston_seat *seat;
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(seat, &shell->compositor->seat_list, link)
|
|
|
|
|
if (seat->pointer)
|
|
|
|
|
popup_grab_end(seat->pointer);
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
|
|
|
|
|
shell_fade(shell, FADE_OUT);
|
|
|
|
|
/* lock() is called from shell_fade_done() */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-02-21 20:35:23 +04:00
|
|
|
|
wake_handler(struct wl_listener *listener, void *data)
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell =
|
2013-02-21 20:35:23 +04:00
|
|
|
|
container_of(listener, struct desktop_shell, wake_listener);
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
|
|
|
|
|
unlock(shell);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
static void
|
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-13 07:38:11 +04:00
|
|
|
|
center_on_output(struct weston_view *view, struct weston_output *output)
|
2011-11-30 18:26:35 +04:00
|
|
|
|
{
|
2013-04-25 14:57:46 +04:00
|
|
|
|
int32_t surf_x, surf_y, width, height;
|
2012-11-27 19:03:42 +04:00
|
|
|
|
float x, y;
|
2011-11-30 18:26:35 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
surface_subsurfaces_boundingbox(view->surface, &surf_x, &surf_y, &width, &height);
|
2013-04-25 14:57:46 +04:00
|
|
|
|
|
|
|
|
|
x = output->x + (output->width - width) / 2 - surf_x / 2;
|
|
|
|
|
y = output->y + (output->height - height) / 2 - surf_y / 2;
|
2012-11-27 19:03:42 +04:00
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(view, x, y);
|
2011-11-30 18:26:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-13 17:07:52 +04:00
|
|
|
|
static void
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_initial_position(struct weston_view *view,
|
|
|
|
|
struct desktop_shell *shell)
|
2012-08-13 17:07:52 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_compositor *compositor = shell->compositor;
|
|
|
|
|
int ix = 0, iy = 0;
|
|
|
|
|
int range_x, range_y;
|
|
|
|
|
int dx, dy, x, y, panel_height;
|
|
|
|
|
struct weston_output *output, *target_output = NULL;
|
|
|
|
|
struct weston_seat *seat;
|
|
|
|
|
|
|
|
|
|
/* As a heuristic place the new window on the same output as the
|
|
|
|
|
* pointer. Falling back to the output containing 0, 0.
|
|
|
|
|
*
|
|
|
|
|
* TODO: Do something clever for touch too?
|
|
|
|
|
*/
|
|
|
|
|
wl_list_for_each(seat, &compositor->seat_list, link) {
|
2013-05-08 07:17:41 +04:00
|
|
|
|
if (seat->pointer) {
|
2013-05-07 07:19:49 +04:00
|
|
|
|
ix = wl_fixed_to_int(seat->pointer->x);
|
|
|
|
|
iy = wl_fixed_to_int(seat->pointer->y);
|
2012-08-13 17:07:52 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl_list_for_each(output, &compositor->output_list, link) {
|
|
|
|
|
if (pixman_region32_contains_point(&output->region, ix, iy, NULL)) {
|
|
|
|
|
target_output = output;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!target_output) {
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(view, 10 + random() % 400,
|
|
|
|
|
10 + random() % 400);
|
2012-08-13 17:07:52 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Valid range within output where the surface will still be onscreen.
|
|
|
|
|
* If this is negative it means that the surface is bigger than
|
|
|
|
|
* output.
|
|
|
|
|
*/
|
|
|
|
|
panel_height = get_output_panel_height(shell, target_output);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
range_x = target_output->width - view->surface->width;
|
2012-08-18 11:04:05 +04:00
|
|
|
|
range_y = (target_output->height - panel_height) -
|
2013-12-03 07:01:53 +04:00
|
|
|
|
view->surface->height;
|
2012-08-13 17:07:52 +04:00
|
|
|
|
|
2012-08-13 18:18:44 +04:00
|
|
|
|
if (range_x > 0)
|
2012-08-13 17:07:52 +04:00
|
|
|
|
dx = random() % range_x;
|
|
|
|
|
else
|
2012-08-13 18:18:44 +04:00
|
|
|
|
dx = 0;
|
|
|
|
|
|
|
|
|
|
if (range_y > 0)
|
2012-08-13 17:07:52 +04:00
|
|
|
|
dy = panel_height + random() % range_y;
|
2012-08-13 18:18:44 +04:00
|
|
|
|
else
|
|
|
|
|
dy = panel_height;
|
2012-08-13 17:07:52 +04:00
|
|
|
|
|
|
|
|
|
x = target_output->x + dx;
|
|
|
|
|
y = target_output->y + dy;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(view, x, y);
|
2012-08-13 17:07:52 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-23 21:04:11 +04:00
|
|
|
|
static void
|
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-13 07:38:11 +04:00
|
|
|
|
map(struct desktop_shell *shell, struct shell_surface *shsurf,
|
2013-12-03 07:01:53 +04:00
|
|
|
|
int32_t sx, int32_t sy)
|
2011-04-23 21:04:11 +04:00
|
|
|
|
{
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
struct weston_compositor *compositor = shell->compositor;
|
2012-05-30 19:31:56 +04:00
|
|
|
|
struct weston_seat *seat;
|
2012-02-07 04:45:41 +04:00
|
|
|
|
int panel_height = 0;
|
2013-04-25 14:57:46 +04:00
|
|
|
|
int32_t surf_x, surf_y;
|
2011-11-23 18:42:16 +04:00
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
/* initial positioning, see also configure() */
|
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-13 07:38:11 +04:00
|
|
|
|
switch (shsurf->type) {
|
2013-12-03 21:35:43 +04:00
|
|
|
|
case SHELL_SURFACE_TOPLEVEL:
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.fullscreen) {
|
|
|
|
|
center_on_output(shsurf->view, shsurf->fullscreen_output);
|
|
|
|
|
shell_map_fullscreen(shsurf);
|
|
|
|
|
} else if (shsurf->state.maximized) {
|
|
|
|
|
/* use surface configure to set the geometry */
|
|
|
|
|
panel_height = get_output_panel_height(shell, shsurf->output);
|
|
|
|
|
surface_subsurfaces_boundingbox(shsurf->surface,
|
|
|
|
|
&surf_x, &surf_y, NULL, NULL);
|
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
shsurf->output->x - surf_x,
|
|
|
|
|
shsurf->output->y +
|
|
|
|
|
panel_height - surf_y);
|
2013-12-03 21:35:43 +04:00
|
|
|
|
} else if (!shsurf->state.relative) {
|
2013-12-03 21:35:42 +04:00
|
|
|
|
weston_view_set_initial_position(shsurf->view, shell);
|
|
|
|
|
}
|
2012-02-07 04:45:41 +04:00
|
|
|
|
break;
|
2012-02-10 18:17:23 +04:00
|
|
|
|
case SHELL_SURFACE_POPUP:
|
2012-04-13 20:40:07 +04:00
|
|
|
|
shell_map_popup(shsurf);
|
2012-12-06 16:07:48 +04:00
|
|
|
|
break;
|
2012-02-15 19:02:56 +04:00
|
|
|
|
case SHELL_SURFACE_NONE:
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_set_position(shsurf->view,
|
|
|
|
|
shsurf->view->geometry.x + sx,
|
|
|
|
|
shsurf->view->geometry.y + sy);
|
2012-02-10 18:17:23 +04:00
|
|
|
|
break;
|
2013-11-25 22:01:31 +04:00
|
|
|
|
case SHELL_SURFACE_XWAYLAND:
|
2011-11-30 18:26:35 +04:00
|
|
|
|
default:
|
|
|
|
|
;
|
|
|
|
|
}
|
2011-09-06 21:48:16 +04:00
|
|
|
|
|
2013-11-25 22:01:41 +04:00
|
|
|
|
/* Surface stacking order, see also activate(). */
|
|
|
|
|
shell_surface_update_layer(shsurf);
|
2011-11-15 15:34:54 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (shsurf->type != SHELL_SURFACE_NONE) {
|
|
|
|
|
weston_view_update_transform(shsurf->view);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.maximized) {
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->surface->output = shsurf->output;
|
|
|
|
|
shsurf->view->output = shsurf->output;
|
|
|
|
|
}
|
2012-03-05 17:39:23 +04:00
|
|
|
|
}
|
2011-12-05 00:32:59 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
switch (shsurf->type) {
|
2013-06-12 22:43:21 +04:00
|
|
|
|
/* XXX: xwayland's using the same fields for transient type */
|
|
|
|
|
case SHELL_SURFACE_XWAYLAND:
|
2012-05-23 23:06:26 +04:00
|
|
|
|
if (shsurf->transient.flags ==
|
|
|
|
|
WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
|
|
|
|
|
break;
|
|
|
|
|
case SHELL_SURFACE_TOPLEVEL:
|
2013-12-03 21:35:43 +04:00
|
|
|
|
if (shsurf->state.relative &&
|
|
|
|
|
shsurf->transient.flags == WL_SHELL_SURFACE_TRANSIENT_INACTIVE)
|
|
|
|
|
break;
|
2013-12-04 23:49:55 +04:00
|
|
|
|
if (shell->locked)
|
2013-12-03 21:35:43 +04:00
|
|
|
|
break;
|
|
|
|
|
wl_list_for_each(seat, &compositor->seat_list, link)
|
|
|
|
|
activate(shell, shsurf->surface, seat);
|
2011-12-15 20:31:51 +04:00
|
|
|
|
break;
|
2013-11-25 22:01:31 +04:00
|
|
|
|
case SHELL_SURFACE_POPUP:
|
|
|
|
|
case SHELL_SURFACE_NONE:
|
2011-12-15 20:31:51 +04:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->type == SHELL_SURFACE_TOPLEVEL &&
|
|
|
|
|
!shsurf->state.maximized && !shsurf->state.fullscreen)
|
2012-04-25 15:09:52 +04:00
|
|
|
|
{
|
|
|
|
|
switch (shell->win_animation_type) {
|
|
|
|
|
case ANIMATION_FADE:
|
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-13 07:38:11 +04:00
|
|
|
|
weston_fade_run(shsurf->view, 0.0, 1.0, 300.0, NULL, NULL);
|
2012-04-25 15:09:52 +04:00
|
|
|
|
break;
|
|
|
|
|
case ANIMATION_ZOOM:
|
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-13 07:38:11 +04:00
|
|
|
|
weston_zoom_run(shsurf->view, 0.5, 1.0, NULL, NULL);
|
2012-04-25 15:09:52 +04:00
|
|
|
|
break;
|
2013-11-25 22:01:32 +04:00
|
|
|
|
case ANIMATION_NONE:
|
2012-04-25 15:09:52 +04:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-11-09 21:07:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-04-16 18:31:41 +04:00
|
|
|
|
configure(struct desktop_shell *shell, struct weston_surface *surface,
|
2013-12-03 07:01:53 +04:00
|
|
|
|
float x, float y)
|
2011-11-09 21:07:35 +04:00
|
|
|
|
{
|
2011-11-30 18:26:35 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2013-12-03 07:01:53 +04:00
|
|
|
|
int32_t mx, my, surf_x, surf_y;
|
2011-11-09 21:07:35 +04:00
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
shsurf = get_shell_surface(surface);
|
|
|
|
|
|
2014-01-17 22:08:25 +04:00
|
|
|
|
assert(shsurf);
|
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.fullscreen)
|
2012-03-01 08:57:46 +04:00
|
|
|
|
shell_configure_fullscreen(shsurf);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
else if (shsurf->state.maximized) {
|
2012-03-01 08:57:46 +04:00
|
|
|
|
/* setting x, y and using configure to change that geometry */
|
2013-04-25 14:57:46 +04:00
|
|
|
|
surface_subsurfaces_boundingbox(shsurf->surface, &surf_x, &surf_y,
|
|
|
|
|
NULL, NULL);
|
2013-12-03 07:01:53 +04:00
|
|
|
|
mx = shsurf->output->x - surf_x;
|
|
|
|
|
my = shsurf->output->y +
|
|
|
|
|
get_output_panel_height(shell,shsurf->output) - surf_y;
|
|
|
|
|
weston_view_set_position(shsurf->view, mx, my);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
} else {
|
2013-12-03 07:01:53 +04:00
|
|
|
|
weston_view_set_position(shsurf->view, x, y);
|
2011-06-18 14:12:54 +04:00
|
|
|
|
}
|
2011-11-09 21:07:35 +04:00
|
|
|
|
|
2012-03-01 08:57:46 +04:00
|
|
|
|
/* XXX: would a fullscreen surface need the same handling? */
|
2012-02-17 08:43:59 +04:00
|
|
|
|
if (surface->output) {
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &surface->views, surface_link)
|
|
|
|
|
weston_view_update_transform(view);
|
2011-11-30 18:26:35 +04:00
|
|
|
|
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf->state.maximized)
|
2012-02-07 04:45:41 +04:00
|
|
|
|
surface->output = shsurf->output;
|
2011-11-30 18:26:35 +04:00
|
|
|
|
}
|
2011-04-13 01:25:42 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-27 18:36:41 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
shell_surface_configure(struct weston_surface *es, int32_t sx, int32_t sy)
|
2012-03-27 18:36:41 +04:00
|
|
|
|
{
|
2012-03-27 18:36:42 +04:00
|
|
|
|
struct shell_surface *shsurf = get_shell_surface(es);
|
2014-01-17 22:08:25 +04:00
|
|
|
|
struct desktop_shell *shell;
|
2012-05-07 16:23:07 +04:00
|
|
|
|
int type_changed = 0;
|
2012-03-27 18:36:41 +04:00
|
|
|
|
|
2014-01-17 22:08:25 +04:00
|
|
|
|
assert(shsurf);
|
|
|
|
|
|
|
|
|
|
shell = shsurf->shell;
|
|
|
|
|
|
2013-06-17 18:33:14 +04:00
|
|
|
|
if (!weston_surface_is_mapped(es) &&
|
|
|
|
|
!wl_list_empty(&shsurf->popup.grab_link)) {
|
2013-03-26 00:42:45 +04:00
|
|
|
|
remove_popup_grab(shsurf);
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
if (es->width == 0)
|
2013-02-21 14:29:21 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2013-12-06 11:20:33 +04:00
|
|
|
|
if (shsurf->state_changed) {
|
2012-04-28 01:20:01 +04:00
|
|
|
|
set_surface_type(shsurf);
|
2012-04-28 01:51:59 +04:00
|
|
|
|
type_changed = 1;
|
|
|
|
|
}
|
2012-04-28 01:20:01 +04:00
|
|
|
|
|
2012-03-27 18:36:41 +04:00
|
|
|
|
if (!weston_surface_is_mapped(es)) {
|
2013-12-03 07:01:53 +04:00
|
|
|
|
map(shell, shsurf, sx, sy);
|
2012-04-28 01:51:59 +04:00
|
|
|
|
} else if (type_changed || sx != 0 || sy != 0 ||
|
2013-12-03 07:01:53 +04:00
|
|
|
|
shsurf->last_width != es->width ||
|
|
|
|
|
shsurf->last_height != es->height) {
|
2012-09-30 04:57:21 +04:00
|
|
|
|
float from_x, from_y;
|
|
|
|
|
float to_x, to_y;
|
2012-03-27 18:36:41 +04:00
|
|
|
|
|
2014-02-06 09:36:04 +04:00
|
|
|
|
if (shsurf->resize_edges) {
|
|
|
|
|
sx = 0;
|
|
|
|
|
sy = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
|
|
|
|
|
sx = shsurf->last_width - es->width;
|
|
|
|
|
if (shsurf->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
|
|
|
|
|
sy = shsurf->last_height - es->height;
|
|
|
|
|
|
|
|
|
|
shsurf->last_width = es->width;
|
|
|
|
|
shsurf->last_height = es->height;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
weston_view_to_global_float(shsurf->view, 0, 0, &from_x, &from_y);
|
|
|
|
|
weston_view_to_global_float(shsurf->view, sx, sy, &to_x, &to_y);
|
2012-03-27 18:36:41 +04:00
|
|
|
|
configure(shell, es,
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->view->geometry.x + to_x - from_x,
|
2013-12-03 07:01:53 +04:00
|
|
|
|
shsurf->view->geometry.y + to_y - from_y);
|
2012-03-27 18:36:41 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-25 18:57:01 +04:00
|
|
|
|
static void launch_desktop_shell_process(void *data);
|
2012-01-17 16:36:27 +04:00
|
|
|
|
|
2011-11-03 16:11:32 +04:00
|
|
|
|
static void
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
desktop_shell_sigchld(struct weston_process *process, int status)
|
2011-11-03 16:11:32 +04:00
|
|
|
|
{
|
2012-01-17 16:36:27 +04:00
|
|
|
|
uint32_t time;
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
|
container_of(process, struct desktop_shell, child.process);
|
2011-11-03 16:11:32 +04:00
|
|
|
|
|
|
|
|
|
shell->child.process.pid = 0;
|
|
|
|
|
shell->child.client = NULL; /* already destroyed by wayland */
|
2012-01-17 16:36:27 +04:00
|
|
|
|
|
|
|
|
|
/* if desktop-shell dies more than 5 times in 30 seconds, give up */
|
|
|
|
|
time = weston_compositor_get_time();
|
2012-01-17 20:07:42 +04:00
|
|
|
|
if (time - shell->child.deathstamp > 30000) {
|
2012-01-17 16:36:27 +04:00
|
|
|
|
shell->child.deathstamp = time;
|
|
|
|
|
shell->child.deathcount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
shell->child.deathcount++;
|
|
|
|
|
if (shell->child.deathcount > 5) {
|
2013-11-20 16:22:29 +04:00
|
|
|
|
weston_log("%s died, giving up.\n", shell->client);
|
2012-01-17 16:36:27 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-20 16:22:29 +04:00
|
|
|
|
weston_log("%s died, respawning...\n", shell->client);
|
2012-01-17 16:36:27 +04:00
|
|
|
|
launch_desktop_shell_process(shell);
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
shell_fade_startup(shell);
|
2011-11-03 16:11:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-20 23:07:01 +04:00
|
|
|
|
static void
|
|
|
|
|
desktop_shell_client_destroy(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell;
|
|
|
|
|
|
|
|
|
|
shell = container_of(listener, struct desktop_shell,
|
|
|
|
|
child.client_destroy_listener);
|
|
|
|
|
|
|
|
|
|
shell->child.client = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-25 18:57:01 +04:00
|
|
|
|
static void
|
|
|
|
|
launch_desktop_shell_process(void *data)
|
2011-11-03 16:11:32 +04:00
|
|
|
|
{
|
2012-09-25 18:57:01 +04:00
|
|
|
|
struct desktop_shell *shell = data;
|
2011-11-03 16:11:32 +04:00
|
|
|
|
|
Rename wayland-compositor to weston
This rename addresses a few problems around the split between core
Wayland and the wayland-demos repository.
1) Initially, we had one big repository with protocol code, sample
compositor and sample clients. We split that repository to make it
possible to implement the protocol without pulling in the sample/demo
code. At this point, the compositor is more than just a "demo" and
wayland-demos doesn't send the right message. The sample compositor
is a useful, self-contained project in it's own right, and we want to
move away from the "demos" label.
2) Another problem is that the wayland-demos compositor is often
called "the wayland compsitor", but it's really just one possible
compositor. Existing X11 compositors are expected to add Wayland
support and then gradually phase out/modularize the X11 support, for
example. Conversely, it's hard to talk about the wayland-demos
compositor specifically as opposed to, eg, the wayland protocol or a
wayland compositor in general.
We are also renaming the repo to weston, and the compositor
subdirectory to src/, to emphasize that the main "output" is the
compositor.
2012-01-03 19:29:47 +04:00
|
|
|
|
shell->child.client = weston_client_launch(shell->compositor,
|
2011-12-02 17:30:21 +04:00
|
|
|
|
&shell->child.process,
|
2013-11-20 16:22:29 +04:00
|
|
|
|
shell->client,
|
2011-12-02 17:30:21 +04:00
|
|
|
|
desktop_shell_sigchld);
|
2011-11-03 16:11:32 +04:00
|
|
|
|
|
2011-12-02 17:30:21 +04:00
|
|
|
|
if (!shell->child.client)
|
2013-11-20 16:22:29 +04:00
|
|
|
|
weston_log("not able to start %s\n", shell->client);
|
2013-12-20 23:07:01 +04:00
|
|
|
|
|
|
|
|
|
shell->child.client_destroy_listener.notify =
|
|
|
|
|
desktop_shell_client_destroy;
|
|
|
|
|
wl_client_add_destroy_listener(shell->child.client,
|
|
|
|
|
&shell->child.client_destroy_listener);
|
2011-11-03 16:11:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-27 01:21:20 +04:00
|
|
|
|
static void
|
|
|
|
|
bind_shell(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
|
|
|
|
{
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell = data;
|
2013-06-28 05:17:02 +04:00
|
|
|
|
struct wl_resource *resource;
|
2011-08-27 01:21:20 +04:00
|
|
|
|
|
2013-06-28 05:17:02 +04:00
|
|
|
|
resource = wl_resource_create(client, &wl_shell_interface, 1, id);
|
|
|
|
|
if (resource)
|
|
|
|
|
wl_resource_set_implementation(resource, &shell_implementation,
|
|
|
|
|
shell, NULL);
|
2011-08-27 01:21:20 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
static void
|
|
|
|
|
bind_xdg_shell(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
|
|
|
|
resource = wl_resource_create(client, &xdg_shell_interface, 1, id);
|
|
|
|
|
if (resource)
|
|
|
|
|
wl_resource_set_dispatcher(resource,
|
|
|
|
|
xdg_shell_unversioned_dispatch,
|
|
|
|
|
NULL, shell, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
static void
|
|
|
|
|
unbind_desktop_shell(struct wl_resource *resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2011-11-16 01:39:55 +04:00
|
|
|
|
|
|
|
|
|
if (shell->locked)
|
|
|
|
|
resume_desktop(shell);
|
|
|
|
|
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
shell->child.desktop_shell = NULL;
|
|
|
|
|
shell->prepare_event_sent = false;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-06 21:48:16 +04:00
|
|
|
|
static void
|
|
|
|
|
bind_desktop_shell(struct wl_client *client,
|
|
|
|
|
void *data, uint32_t version, uint32_t id)
|
|
|
|
|
{
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell = data;
|
2011-11-03 16:11:33 +04:00
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
2013-06-28 05:17:02 +04:00
|
|
|
|
resource = wl_resource_create(client, &desktop_shell_interface,
|
|
|
|
|
MIN(version, 2), id);
|
2011-11-03 16:11:33 +04:00
|
|
|
|
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
if (client == shell->child.client) {
|
2013-06-28 05:17:02 +04:00
|
|
|
|
wl_resource_set_implementation(resource,
|
|
|
|
|
&desktop_shell_implementation,
|
|
|
|
|
shell, unbind_desktop_shell);
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
shell->child.desktop_shell = resource;
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
|
|
|
|
|
if (version < 2)
|
|
|
|
|
shell_fade_startup(shell);
|
|
|
|
|
|
2011-11-03 16:11:33 +04:00
|
|
|
|
return;
|
desktop-shell: screen locking protocol
Add protocol and functions for supporting screen locking, triggered by
activity timeout.
After activity timeout, compositor starts the fade to black, and then
enters SLEEPING state. At that point it calls lock() in the shell
plugin.
When input events trigger a wakeup, unlock() in the shell plugin is
called. This sends prepare_lock_surface event to the desktop-shell
client. The screen stays locked while the compositor starts fade-in.
At this point, desktop-shell client usually creates a surface for the
unlocking GUI (e.g. a password prompt), and sends it with the
set_lock_surface request. The compositor supposedly shows and allows
interaction only with the given lock surface (not yet implemented).
When desktop-shell has authenticated the user, or instead of issuing
set_lock_surface, it sends the unlock request. Upon receiving the unlock
request, the shell plugin unlocks the screen.
If desktop-shell client dies, the screen is unlocked automatically.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-15 15:34:48 +04:00
|
|
|
|
}
|
2011-09-06 21:48:16 +04:00
|
|
|
|
|
2011-11-03 16:11:33 +04:00
|
|
|
|
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"permission to bind desktop_shell denied");
|
2012-04-12 06:42:15 +04:00
|
|
|
|
wl_resource_destroy(resource);
|
2011-09-06 21:48:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-27 06:15:53 +04:00
|
|
|
|
static void
|
2013-12-03 07:01:53 +04:00
|
|
|
|
screensaver_configure(struct weston_surface *surface, int32_t sx, int32_t sy)
|
2012-06-27 06:15:53 +04:00
|
|
|
|
{
|
2013-03-28 21:02:42 +04:00
|
|
|
|
struct desktop_shell *shell = surface->configure_private;
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-06-27 06:15:53 +04:00
|
|
|
|
|
2013-12-03 07:01:53 +04:00
|
|
|
|
if (surface->width == 0)
|
2013-02-21 14:29:21 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2012-12-20 16:02:13 +04:00
|
|
|
|
/* XXX: starting weston-screensaver beforehand does not work */
|
2012-06-27 06:15:53 +04:00
|
|
|
|
if (!shell->locked)
|
|
|
|
|
return;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
view = container_of(surface->views.next, struct weston_view, surface_link);
|
|
|
|
|
center_on_output(view, surface->output);
|
2012-06-27 06:15:53 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (wl_list_empty(&view->layer_link)) {
|
|
|
|
|
wl_list_insert(shell->lock_layer.view_list.prev,
|
|
|
|
|
&view->layer_link);
|
|
|
|
|
weston_view_update_transform(view);
|
2013-02-21 20:35:21 +04:00
|
|
|
|
wl_event_source_timer_update(shell->screensaver.timer,
|
|
|
|
|
shell->screensaver.duration);
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
shell_fade(shell, FADE_IN);
|
2012-06-27 06:15:53 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
static void
|
|
|
|
|
screensaver_set_surface(struct wl_client *client,
|
|
|
|
|
struct wl_resource *resource,
|
2012-06-27 06:15:53 +04:00
|
|
|
|
struct wl_resource *surface_resource,
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
struct wl_resource *output_resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
2013-06-14 19:07:53 +04:00
|
|
|
|
struct weston_surface *surface =
|
|
|
|
|
wl_resource_get_user_data(surface_resource);
|
2013-06-14 19:08:01 +04:00
|
|
|
|
struct weston_output *output = wl_resource_get_user_data(output_resource);
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view, *next;
|
|
|
|
|
|
|
|
|
|
/* Make sure we only have one view */
|
|
|
|
|
wl_list_for_each_safe(view, next, &surface->views, surface_link)
|
|
|
|
|
weston_view_destroy(view);
|
|
|
|
|
weston_view_create(surface);
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
|
2012-06-27 06:15:53 +04:00
|
|
|
|
surface->configure = screensaver_configure;
|
2013-03-28 21:02:42 +04:00
|
|
|
|
surface->configure_private = shell;
|
2011-11-30 18:26:35 +04:00
|
|
|
|
surface->output = output;
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct screensaver_interface screensaver_implementation = {
|
|
|
|
|
screensaver_set_surface
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
unbind_screensaver(struct wl_resource *resource)
|
|
|
|
|
{
|
2013-06-14 19:07:54 +04:00
|
|
|
|
struct desktop_shell *shell = wl_resource_get_user_data(resource);
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
shell->screensaver.binding = NULL;
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bind_screensaver(struct wl_client *client,
|
|
|
|
|
void *data, uint32_t version, uint32_t id)
|
|
|
|
|
{
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell = data;
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
|
2013-06-28 05:17:02 +04:00
|
|
|
|
resource = wl_resource_create(client, &screensaver_interface, 1, id);
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
|
2011-11-30 18:26:35 +04:00
|
|
|
|
if (shell->screensaver.binding == NULL) {
|
2013-06-28 05:17:02 +04:00
|
|
|
|
wl_resource_set_implementation(resource,
|
|
|
|
|
&screensaver_implementation,
|
|
|
|
|
shell, unbind_screensaver);
|
2011-11-30 18:26:35 +04:00
|
|
|
|
shell->screensaver.binding = resource;
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
|
|
|
|
|
"interface object already bound");
|
2012-04-12 06:42:15 +04:00
|
|
|
|
wl_resource_destroy(resource);
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-20 03:52:44 +04:00
|
|
|
|
struct switcher {
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
struct weston_surface *current;
|
|
|
|
|
struct wl_listener listener;
|
2013-04-18 23:25:39 +04:00
|
|
|
|
struct weston_keyboard_grab grab;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
switcher_next(struct switcher *switcher)
|
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
struct weston_surface *first = NULL, *prev = NULL, *next = NULL;
|
2012-04-03 06:18:58 +04:00
|
|
|
|
struct shell_surface *shsurf;
|
2012-06-19 00:34:58 +04:00
|
|
|
|
struct workspace *ws = get_current_workspace(switcher->shell);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
|
2013-12-03 21:35:43 +04:00
|
|
|
|
shsurf = get_shell_surface(view->surface);
|
2013-12-06 01:01:21 +04:00
|
|
|
|
if (shsurf &&
|
|
|
|
|
shsurf->type == SHELL_SURFACE_TOPLEVEL &&
|
|
|
|
|
shsurf->parent == NULL) {
|
2012-02-20 03:52:44 +04:00
|
|
|
|
if (first == NULL)
|
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-13 07:38:11 +04:00
|
|
|
|
first = view->surface;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
if (prev == switcher->current)
|
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-13 07:38:11 +04:00
|
|
|
|
next = view->surface;
|
|
|
|
|
prev = view->surface;
|
|
|
|
|
view->alpha = 0.25;
|
|
|
|
|
weston_view_geometry_dirty(view);
|
|
|
|
|
weston_surface_damage(view->surface);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
}
|
2012-04-01 16:13:09 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
if (is_black_surface(view->surface, NULL)) {
|
|
|
|
|
view->alpha = 0.25;
|
|
|
|
|
weston_view_geometry_dirty(view);
|
|
|
|
|
weston_surface_damage(view->surface);
|
2012-04-01 16:13:09 +04:00
|
|
|
|
}
|
2012-02-20 03:52:44 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (next == NULL)
|
|
|
|
|
next = first;
|
|
|
|
|
|
2012-03-12 12:06:01 +04:00
|
|
|
|
if (next == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-02-20 03:52:44 +04:00
|
|
|
|
wl_list_remove(&switcher->listener.link);
|
2013-06-07 07:34:41 +04:00
|
|
|
|
wl_signal_add(&next->destroy_signal, &switcher->listener);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
|
|
|
|
|
switcher->current = next;
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &next->views, surface_link)
|
|
|
|
|
view->alpha = 1.0;
|
2012-04-01 16:13:09 +04:00
|
|
|
|
|
2012-04-03 06:18:58 +04:00
|
|
|
|
shsurf = get_shell_surface(switcher->current);
|
2013-12-03 21:35:42 +04:00
|
|
|
|
if (shsurf && shsurf->state.fullscreen)
|
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-13 07:38:11 +04:00
|
|
|
|
shsurf->fullscreen.black_view->alpha = 1.0;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-04-12 07:18:23 +04:00
|
|
|
|
switcher_handle_surface_destroy(struct wl_listener *listener, void *data)
|
2012-02-20 03:52:44 +04:00
|
|
|
|
{
|
|
|
|
|
struct switcher *switcher =
|
|
|
|
|
container_of(listener, struct switcher, listener);
|
|
|
|
|
|
|
|
|
|
switcher_next(switcher);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2012-05-31 23:27:47 +04:00
|
|
|
|
switcher_destroy(struct switcher *switcher)
|
2012-02-20 03:52:44 +04:00
|
|
|
|
{
|
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-13 07:38:11 +04:00
|
|
|
|
struct weston_view *view;
|
2013-04-18 23:25:39 +04:00
|
|
|
|
struct weston_keyboard *keyboard = switcher->grab.keyboard;
|
2012-06-19 00:34:58 +04:00
|
|
|
|
struct workspace *ws = get_current_workspace(switcher->shell);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
wl_list_for_each(view, &ws->layer.view_list, layer_link) {
|
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 14:37:11 +04:00
|
|
|
|
if (is_focus_view(view))
|
|
|
|
|
continue;
|
|
|
|
|
|
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-13 07:38:11 +04:00
|
|
|
|
view->alpha = 1.0;
|
|
|
|
|
weston_surface_damage(view->surface);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-12 12:06:01 +04:00
|
|
|
|
if (switcher->current)
|
2012-05-16 21:45:18 +04:00
|
|
|
|
activate(switcher->shell, switcher->current,
|
|
|
|
|
(struct weston_seat *) keyboard->seat);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
wl_list_remove(&switcher->listener.link);
|
2013-04-18 23:25:39 +04:00
|
|
|
|
weston_keyboard_end_grab(keyboard);
|
|
|
|
|
if (keyboard->input_method_resource)
|
|
|
|
|
keyboard->grab = &keyboard->input_method_grab;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
free(switcher);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-04-18 23:25:39 +04:00
|
|
|
|
switcher_key(struct weston_keyboard_grab *grab,
|
2012-05-30 19:31:52 +04:00
|
|
|
|
uint32_t time, uint32_t key, uint32_t state_w)
|
2012-02-20 03:52:44 +04:00
|
|
|
|
{
|
|
|
|
|
struct switcher *switcher = container_of(grab, struct switcher, grab);
|
2012-05-30 19:31:52 +04:00
|
|
|
|
enum wl_keyboard_key_state state = state_w;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
|
2012-05-30 19:31:52 +04:00
|
|
|
|
if (key == KEY_TAB && state == WL_KEYBOARD_KEY_STATE_PRESSED)
|
2012-02-20 03:52:44 +04:00
|
|
|
|
switcher_next(switcher);
|
2012-05-31 23:27:47 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-04-18 23:25:39 +04:00
|
|
|
|
switcher_modifier(struct weston_keyboard_grab *grab, uint32_t serial,
|
2012-05-31 23:27:47 +04:00
|
|
|
|
uint32_t mods_depressed, uint32_t mods_latched,
|
|
|
|
|
uint32_t mods_locked, uint32_t group)
|
|
|
|
|
{
|
|
|
|
|
struct switcher *switcher = container_of(grab, struct switcher, grab);
|
|
|
|
|
struct weston_seat *seat = (struct weston_seat *) grab->keyboard->seat;
|
|
|
|
|
|
|
|
|
|
if ((seat->modifier_state & switcher->shell->binding_modifier) == 0)
|
|
|
|
|
switcher_destroy(switcher);
|
2012-05-10 20:28:35 +04:00
|
|
|
|
}
|
2012-02-20 03:52:44 +04:00
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
switcher_cancel(struct weston_keyboard_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
struct switcher *switcher = container_of(grab, struct switcher, grab);
|
|
|
|
|
|
|
|
|
|
switcher_destroy(switcher);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-18 23:25:39 +04:00
|
|
|
|
static const struct weston_keyboard_grab_interface switcher_grab = {
|
2012-05-31 23:27:47 +04:00
|
|
|
|
switcher_key,
|
|
|
|
|
switcher_modifier,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
switcher_cancel,
|
2012-02-20 03:52:44 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
switcher_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
2012-05-30 19:31:58 +04:00
|
|
|
|
void *data)
|
2012-02-20 03:52:44 +04:00
|
|
|
|
{
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell = data;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
struct switcher *switcher;
|
|
|
|
|
|
|
|
|
|
switcher = malloc(sizeof *switcher);
|
2012-04-12 17:55:26 +04:00
|
|
|
|
switcher->shell = shell;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
switcher->current = NULL;
|
2012-04-12 07:18:23 +04:00
|
|
|
|
switcher->listener.notify = switcher_handle_surface_destroy;
|
2012-02-20 03:52:44 +04:00
|
|
|
|
wl_list_init(&switcher->listener.link);
|
|
|
|
|
|
2013-05-28 18:23:39 +04:00
|
|
|
|
restore_all_output_modes(shell->compositor);
|
2012-06-19 00:34:58 +04:00
|
|
|
|
lower_fullscreen_layer(switcher->shell);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
switcher->grab.interface = &switcher_grab;
|
2013-04-18 23:25:39 +04:00
|
|
|
|
weston_keyboard_start_grab(seat->keyboard, &switcher->grab);
|
|
|
|
|
weston_keyboard_set_focus(seat->keyboard, NULL);
|
2012-02-20 03:52:44 +04:00
|
|
|
|
switcher_next(switcher);
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-29 21:53:50 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
backlight_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
2012-05-30 19:31:58 +04:00
|
|
|
|
void *data)
|
2012-02-29 21:53:50 +04:00
|
|
|
|
{
|
|
|
|
|
struct weston_compositor *compositor = data;
|
|
|
|
|
struct weston_output *output;
|
2012-03-13 02:40:09 +04:00
|
|
|
|
long backlight_new = 0;
|
2012-02-29 21:53:50 +04:00
|
|
|
|
|
|
|
|
|
/* TODO: we're limiting to simple use cases, where we assume just
|
|
|
|
|
* control on the primary display. We'd have to extend later if we
|
|
|
|
|
* ever get support for setting backlights on random desktop LCD
|
|
|
|
|
* panels though */
|
|
|
|
|
output = get_default_output(compositor);
|
|
|
|
|
if (!output)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!output->set_backlight)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-03-13 02:40:09 +04:00
|
|
|
|
if (key == KEY_F9 || key == KEY_BRIGHTNESSDOWN)
|
|
|
|
|
backlight_new = output->backlight_current - 25;
|
|
|
|
|
else if (key == KEY_F10 || key == KEY_BRIGHTNESSUP)
|
|
|
|
|
backlight_new = output->backlight_current + 25;
|
2012-02-29 21:53:50 +04:00
|
|
|
|
|
2012-03-13 02:40:09 +04:00
|
|
|
|
if (backlight_new < 5)
|
|
|
|
|
backlight_new = 5;
|
|
|
|
|
if (backlight_new > 255)
|
|
|
|
|
backlight_new = 255;
|
|
|
|
|
|
|
|
|
|
output->backlight_current = backlight_new;
|
2012-02-29 21:53:50 +04:00
|
|
|
|
output->set_backlight(output, output->backlight_current);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-08 19:20:45 +04:00
|
|
|
|
struct debug_binding_grab {
|
2013-04-18 23:25:39 +04:00
|
|
|
|
struct weston_keyboard_grab grab;
|
2012-11-08 19:20:45 +04:00
|
|
|
|
struct weston_seat *seat;
|
|
|
|
|
uint32_t key[2];
|
|
|
|
|
int key_released[2];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-04-18 23:25:39 +04:00
|
|
|
|
debug_binding_key(struct weston_keyboard_grab *grab, uint32_t time,
|
2012-11-08 19:20:45 +04:00
|
|
|
|
uint32_t key, uint32_t state)
|
|
|
|
|
{
|
|
|
|
|
struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
|
2013-07-22 20:31:38 +04:00
|
|
|
|
struct weston_compositor *ec = db->seat->compositor;
|
|
|
|
|
struct wl_display *display = ec->wl_display;
|
2012-11-08 19:20:45 +04:00
|
|
|
|
struct wl_resource *resource;
|
|
|
|
|
uint32_t serial;
|
|
|
|
|
int send = 0, terminate = 0;
|
|
|
|
|
int check_binding = 1;
|
|
|
|
|
int i;
|
2013-09-19 20:32:00 +04:00
|
|
|
|
struct wl_list *resource_list;
|
2012-11-08 19:20:45 +04:00
|
|
|
|
|
|
|
|
|
if (state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
|
|
|
|
/* Do not run bindings on key releases */
|
|
|
|
|
check_binding = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
|
if (key == db->key[i])
|
|
|
|
|
db->key_released[i] = 1;
|
|
|
|
|
|
|
|
|
|
if (db->key_released[0] && db->key_released[1]) {
|
|
|
|
|
/* All key releases been swalled so end the grab */
|
|
|
|
|
terminate = 1;
|
|
|
|
|
} else if (key != db->key[0] && key != db->key[1]) {
|
|
|
|
|
/* Should not swallow release of other keys */
|
|
|
|
|
send = 1;
|
|
|
|
|
}
|
|
|
|
|
} else if (key == db->key[0] && !db->key_released[0]) {
|
|
|
|
|
/* Do not check bindings for the first press of the binding
|
|
|
|
|
* key. This allows it to be used as a debug shortcut.
|
|
|
|
|
* We still need to swallow this event. */
|
|
|
|
|
check_binding = 0;
|
|
|
|
|
} else if (db->key[1]) {
|
|
|
|
|
/* If we already ran a binding don't process another one since
|
|
|
|
|
* we can't keep track of all the binding keys that were
|
|
|
|
|
* pressed in order to swallow the release events. */
|
|
|
|
|
send = 1;
|
|
|
|
|
check_binding = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (check_binding) {
|
|
|
|
|
if (weston_compositor_run_debug_binding(ec, db->seat, time,
|
|
|
|
|
key, state)) {
|
|
|
|
|
/* We ran a binding so swallow the press and keep the
|
|
|
|
|
* grab to swallow the released too. */
|
|
|
|
|
send = 0;
|
|
|
|
|
terminate = 0;
|
|
|
|
|
db->key[1] = key;
|
|
|
|
|
} else {
|
|
|
|
|
/* Terminate the grab since the key pressed is not a
|
|
|
|
|
* debug binding key. */
|
|
|
|
|
send = 1;
|
|
|
|
|
terminate = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (send) {
|
2013-09-19 20:32:00 +04:00
|
|
|
|
serial = wl_display_next_serial(display);
|
|
|
|
|
resource_list = &grab->keyboard->focus_resource_list;
|
|
|
|
|
wl_resource_for_each(resource, resource_list) {
|
2012-11-08 19:20:45 +04:00
|
|
|
|
wl_keyboard_send_key(resource, serial, time, key, state);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (terminate) {
|
2013-04-18 23:25:39 +04:00
|
|
|
|
weston_keyboard_end_grab(grab->keyboard);
|
|
|
|
|
if (grab->keyboard->input_method_resource)
|
|
|
|
|
grab->keyboard->grab = &grab->keyboard->input_method_grab;
|
2012-11-08 19:20:45 +04:00
|
|
|
|
free(db);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-04-18 23:25:39 +04:00
|
|
|
|
debug_binding_modifiers(struct weston_keyboard_grab *grab, uint32_t serial,
|
2012-11-08 19:20:45 +04:00
|
|
|
|
uint32_t mods_depressed, uint32_t mods_latched,
|
|
|
|
|
uint32_t mods_locked, uint32_t group)
|
|
|
|
|
{
|
|
|
|
|
struct wl_resource *resource;
|
2013-09-19 20:32:00 +04:00
|
|
|
|
struct wl_list *resource_list;
|
2012-11-08 19:20:45 +04:00
|
|
|
|
|
2013-09-19 20:32:00 +04:00
|
|
|
|
resource_list = &grab->keyboard->focus_resource_list;
|
2012-11-08 19:20:45 +04:00
|
|
|
|
|
2013-09-19 20:32:00 +04:00
|
|
|
|
wl_resource_for_each(resource, resource_list) {
|
|
|
|
|
wl_keyboard_send_modifiers(resource, serial, mods_depressed,
|
|
|
|
|
mods_latched, mods_locked, group);
|
|
|
|
|
}
|
2012-11-08 19:20:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-26 01:18:05 +04:00
|
|
|
|
static void
|
|
|
|
|
debug_binding_cancel(struct weston_keyboard_grab *grab)
|
|
|
|
|
{
|
|
|
|
|
struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
|
|
|
|
|
|
|
|
|
|
weston_keyboard_end_grab(grab->keyboard);
|
|
|
|
|
free(db);
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-18 23:25:39 +04:00
|
|
|
|
struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
|
2012-11-08 19:20:45 +04:00
|
|
|
|
debug_binding_key,
|
2013-10-26 01:18:05 +04:00
|
|
|
|
debug_binding_modifiers,
|
|
|
|
|
debug_binding_cancel,
|
2012-11-08 19:20:45 +04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
debug_binding(struct weston_seat *seat, uint32_t time, uint32_t key, void *data)
|
2012-11-08 19:20:45 +04:00
|
|
|
|
{
|
|
|
|
|
struct debug_binding_grab *grab;
|
|
|
|
|
|
|
|
|
|
grab = calloc(1, sizeof *grab);
|
|
|
|
|
if (!grab)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
grab->seat = (struct weston_seat *) seat;
|
|
|
|
|
grab->key[0] = key;
|
|
|
|
|
grab->grab.interface = &debug_binding_keyboard_grab;
|
2013-04-18 23:25:39 +04:00
|
|
|
|
weston_keyboard_start_grab(seat->keyboard, &grab->grab);
|
2012-11-08 19:20:45 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-26 21:41:06 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
force_kill_binding(struct weston_seat *seat, uint32_t time, uint32_t key,
|
2012-05-30 19:31:58 +04:00
|
|
|
|
void *data)
|
2012-05-26 21:41:06 +04:00
|
|
|
|
{
|
2013-05-08 17:54:37 +04:00
|
|
|
|
struct weston_surface *focus_surface;
|
2012-05-26 21:41:06 +04:00
|
|
|
|
struct wl_client *client;
|
2012-09-27 18:48:36 +04:00
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
struct weston_compositor *compositor = shell->compositor;
|
2012-05-26 21:41:06 +04:00
|
|
|
|
pid_t pid;
|
|
|
|
|
|
2012-08-13 23:27:27 +04:00
|
|
|
|
focus_surface = seat->keyboard->focus;
|
|
|
|
|
if (!focus_surface)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-09-27 18:48:36 +04:00
|
|
|
|
wl_signal_emit(&compositor->kill_signal, focus_surface);
|
|
|
|
|
|
2013-06-07 07:34:41 +04:00
|
|
|
|
client = wl_resource_get_client(focus_surface->resource);
|
2012-09-27 18:48:35 +04:00
|
|
|
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* Skip clients that we launched ourselves (the credentials of
|
|
|
|
|
* the socketpair is ours) */
|
|
|
|
|
if (pid == getpid())
|
|
|
|
|
return;
|
2012-05-26 21:41:06 +04:00
|
|
|
|
|
2012-05-30 19:31:58 +04:00
|
|
|
|
kill(pid, SIGKILL);
|
2012-05-26 21:41:06 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
workspace_up_binding(struct weston_seat *seat, uint32_t time,
|
2012-06-13 02:01:22 +04:00
|
|
|
|
uint32_t key, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
unsigned int new_index = shell->workspaces.current;
|
|
|
|
|
|
2012-06-26 05:35:29 +04:00
|
|
|
|
if (shell->locked)
|
2012-06-25 22:03:13 +04:00
|
|
|
|
return;
|
2012-06-13 02:01:22 +04:00
|
|
|
|
if (new_index != 0)
|
|
|
|
|
new_index--;
|
|
|
|
|
|
|
|
|
|
change_workspace(shell, new_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
workspace_down_binding(struct weston_seat *seat, uint32_t time,
|
2012-06-13 02:01:22 +04:00
|
|
|
|
uint32_t key, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
unsigned int new_index = shell->workspaces.current;
|
|
|
|
|
|
2012-06-26 05:35:29 +04:00
|
|
|
|
if (shell->locked)
|
2012-06-25 22:03:13 +04:00
|
|
|
|
return;
|
2012-06-13 02:01:22 +04:00
|
|
|
|
if (new_index < shell->workspaces.num - 1)
|
|
|
|
|
new_index++;
|
|
|
|
|
|
|
|
|
|
change_workspace(shell, new_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
workspace_f_binding(struct weston_seat *seat, uint32_t time,
|
2012-06-13 02:01:22 +04:00
|
|
|
|
uint32_t key, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
unsigned int new_index;
|
|
|
|
|
|
2012-06-26 05:35:29 +04:00
|
|
|
|
if (shell->locked)
|
2012-06-25 22:03:13 +04:00
|
|
|
|
return;
|
2012-06-13 02:01:22 +04:00
|
|
|
|
new_index = key - KEY_F1;
|
|
|
|
|
if (new_index >= shell->workspaces.num)
|
|
|
|
|
new_index = shell->workspaces.num - 1;
|
|
|
|
|
|
|
|
|
|
change_workspace(shell, new_index);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
workspace_move_surface_up_binding(struct weston_seat *seat, uint32_t time,
|
2012-08-30 00:13:00 +04:00
|
|
|
|
uint32_t key, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
unsigned int new_index = shell->workspaces.current;
|
|
|
|
|
|
|
|
|
|
if (shell->locked)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (new_index != 0)
|
|
|
|
|
new_index--;
|
|
|
|
|
|
|
|
|
|
take_surface_to_workspace_by_seat(shell, seat, new_index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-05-07 07:19:49 +04:00
|
|
|
|
workspace_move_surface_down_binding(struct weston_seat *seat, uint32_t time,
|
2012-08-30 00:13:00 +04:00
|
|
|
|
uint32_t key, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = data;
|
|
|
|
|
unsigned int new_index = shell->workspaces.current;
|
|
|
|
|
|
|
|
|
|
if (shell->locked)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (new_index < shell->workspaces.num - 1)
|
|
|
|
|
new_index++;
|
|
|
|
|
|
|
|
|
|
take_surface_to_workspace_by_seat(shell, seat, new_index);
|
|
|
|
|
}
|
2012-06-13 02:01:22 +04:00
|
|
|
|
|
2014-01-29 20:47:54 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_reposition_view_on_output_destroy(struct weston_view *view)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output, *first_output;
|
|
|
|
|
struct weston_compositor *ec = view->surface->compositor;
|
|
|
|
|
struct shell_surface *shsurf;
|
|
|
|
|
float x, y;
|
|
|
|
|
int visible;
|
|
|
|
|
|
|
|
|
|
x = view->geometry.x;
|
|
|
|
|
y = view->geometry.y;
|
|
|
|
|
|
|
|
|
|
/* At this point the destroyed output is not in the list anymore.
|
|
|
|
|
* If the view is still visible somewhere, we leave where it is,
|
|
|
|
|
* otherwise, move it to the first output. */
|
|
|
|
|
visible = 0;
|
|
|
|
|
wl_list_for_each(output, &ec->output_list, link) {
|
|
|
|
|
if (pixman_region32_contains_point(&output->region,
|
|
|
|
|
x, y, NULL)) {
|
|
|
|
|
visible = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!visible) {
|
|
|
|
|
first_output = container_of(ec->output_list.next,
|
|
|
|
|
struct weston_output, link);
|
|
|
|
|
|
|
|
|
|
x = first_output->x + first_output->width / 4;
|
|
|
|
|
y = first_output->y + first_output->height / 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
weston_view_set_position(view, x, y);
|
|
|
|
|
|
|
|
|
|
shsurf = get_shell_surface(view->surface);
|
|
|
|
|
|
|
|
|
|
if (shsurf) {
|
|
|
|
|
shsurf->saved_position_valid = false;
|
|
|
|
|
shsurf->next_state.maximized = false;
|
|
|
|
|
shsurf->next_state.fullscreen = false;
|
|
|
|
|
shsurf->state_changed = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
shell_reposition_views_on_output_destroy(struct shell_output *shell_output)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell = shell_output->shell;
|
|
|
|
|
struct weston_output *output = shell_output->output;
|
|
|
|
|
struct weston_layer *layer;
|
|
|
|
|
struct weston_view *view;
|
|
|
|
|
|
|
|
|
|
/* Move all views in the layers owned by the shell */
|
|
|
|
|
wl_list_for_each(layer, shell->fullscreen_layer.link.prev, link) {
|
|
|
|
|
wl_list_for_each(view, &layer->view_list, layer_link) {
|
|
|
|
|
if (view->output != output)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
shell_reposition_view_on_output_destroy(view);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We don't start from the beggining of the layer list, so
|
|
|
|
|
* make sure we don't wrap around it. */
|
|
|
|
|
if (layer == &shell->background_layer)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 09:58:32 +04:00
|
|
|
|
static void
|
|
|
|
|
handle_output_destroy(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct shell_output *output_listener =
|
|
|
|
|
container_of(listener, struct shell_output, destroy_listener);
|
|
|
|
|
|
2014-01-29 20:47:54 +04:00
|
|
|
|
shell_reposition_views_on_output_destroy(output_listener);
|
|
|
|
|
|
2013-10-23 09:58:32 +04:00
|
|
|
|
wl_list_remove(&output_listener->destroy_listener.link);
|
|
|
|
|
wl_list_remove(&output_listener->link);
|
|
|
|
|
free(output_listener);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
create_shell_output(struct desktop_shell *shell,
|
|
|
|
|
struct weston_output *output)
|
|
|
|
|
{
|
|
|
|
|
struct shell_output *shell_output;
|
|
|
|
|
|
|
|
|
|
shell_output = zalloc(sizeof *shell_output);
|
|
|
|
|
if (shell_output == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
shell_output->output = output;
|
|
|
|
|
shell_output->shell = shell;
|
|
|
|
|
shell_output->destroy_listener.notify = handle_output_destroy;
|
|
|
|
|
wl_signal_add(&output->destroy_signal,
|
|
|
|
|
&shell_output->destroy_listener);
|
2013-10-24 10:36:04 +04:00
|
|
|
|
wl_list_insert(shell->output_list.prev, &shell_output->link);
|
2013-10-23 09:58:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
handle_output_create(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
|
container_of(listener, struct desktop_shell, output_create_listener);
|
|
|
|
|
struct weston_output *output = (struct weston_output *)data;
|
|
|
|
|
|
|
|
|
|
create_shell_output(shell, output);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 20:47:52 +04:00
|
|
|
|
static void
|
|
|
|
|
handle_output_move(struct wl_listener *listener, void *data)
|
|
|
|
|
{
|
|
|
|
|
struct desktop_shell *shell;
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
struct weston_layer *layer;
|
|
|
|
|
struct weston_view *view;
|
|
|
|
|
float x, y;
|
|
|
|
|
|
|
|
|
|
shell = container_of(listener, struct desktop_shell,
|
|
|
|
|
output_move_listener);
|
|
|
|
|
output = data;
|
|
|
|
|
|
|
|
|
|
/* Move all views in the layers owned by the shell */
|
|
|
|
|
wl_list_for_each(layer, shell->fullscreen_layer.link.prev, link) {
|
|
|
|
|
wl_list_for_each(view, &layer->view_list, layer_link) {
|
|
|
|
|
if (view->output != output)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
x = view->geometry.x + output->move_x;
|
|
|
|
|
y = view->geometry.y + output->move_y;
|
|
|
|
|
weston_view_set_position(view, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We don't start from the beggining of the layer list, so
|
|
|
|
|
* make sure we don't wrap around it. */
|
|
|
|
|
if (layer == &shell->background_layer)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 09:58:32 +04:00
|
|
|
|
static void
|
|
|
|
|
setup_output_destroy_handler(struct weston_compositor *ec,
|
|
|
|
|
struct desktop_shell *shell)
|
|
|
|
|
{
|
|
|
|
|
struct weston_output *output;
|
|
|
|
|
|
|
|
|
|
wl_list_init(&shell->output_list);
|
|
|
|
|
wl_list_for_each(output, &ec->output_list, link)
|
|
|
|
|
create_shell_output(shell, output);
|
|
|
|
|
|
|
|
|
|
shell->output_create_listener.notify = handle_output_create;
|
|
|
|
|
wl_signal_add(&ec->output_created_signal,
|
|
|
|
|
&shell->output_create_listener);
|
2014-01-29 20:47:52 +04:00
|
|
|
|
|
|
|
|
|
shell->output_move_listener.notify = handle_output_move;
|
|
|
|
|
wl_signal_add(&ec->output_moved_signal, &shell->output_move_listener);
|
2013-10-23 09:58:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-22 15:43:43 +04:00
|
|
|
|
static void
|
2012-04-12 17:55:26 +04:00
|
|
|
|
shell_destroy(struct wl_listener *listener, void *data)
|
2011-12-22 15:43:43 +04:00
|
|
|
|
{
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell =
|
|
|
|
|
container_of(listener, struct desktop_shell, destroy_listener);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
struct workspace **ws;
|
2013-10-23 09:58:32 +04:00
|
|
|
|
struct shell_output *shell_output, *tmp;
|
2011-12-22 15:43:43 +04:00
|
|
|
|
|
2014-01-17 04:46:28 +04:00
|
|
|
|
/* Force state to unlocked so we don't try to fade */
|
|
|
|
|
shell->locked = false;
|
2012-01-02 18:00:24 +04:00
|
|
|
|
if (shell->child.client)
|
|
|
|
|
wl_client_destroy(shell->child.client);
|
|
|
|
|
|
2013-02-21 20:35:23 +04:00
|
|
|
|
wl_list_remove(&shell->idle_listener.link);
|
|
|
|
|
wl_list_remove(&shell->wake_listener.link);
|
2013-12-04 23:00:19 +04:00
|
|
|
|
|
|
|
|
|
input_panel_destroy(shell);
|
2012-05-16 16:04:19 +04:00
|
|
|
|
|
2013-10-23 09:58:32 +04:00
|
|
|
|
wl_list_for_each_safe(shell_output, tmp, &shell->output_list, link) {
|
|
|
|
|
wl_list_remove(&shell_output->destroy_listener.link);
|
|
|
|
|
wl_list_remove(&shell_output->link);
|
|
|
|
|
free(shell_output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&shell->output_create_listener.link);
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
wl_array_for_each(ws, &shell->workspaces.array)
|
|
|
|
|
workspace_destroy(*ws);
|
|
|
|
|
wl_array_release(&shell->workspaces.array);
|
|
|
|
|
|
2011-12-22 15:43:43 +04:00
|
|
|
|
free(shell->screensaver.path);
|
2013-11-20 16:22:29 +04:00
|
|
|
|
free(shell->client);
|
2011-12-22 15:43:43 +04:00
|
|
|
|
free(shell);
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-20 19:54:25 +04:00
|
|
|
|
static void
|
|
|
|
|
shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
|
|
|
|
|
{
|
|
|
|
|
uint32_t mod;
|
2012-06-13 02:01:22 +04:00
|
|
|
|
int i, num_workspace_bindings;
|
2012-04-20 19:54:25 +04:00
|
|
|
|
|
|
|
|
|
/* fixed bindings */
|
2012-05-30 19:31:58 +04:00
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_BACKSPACE,
|
|
|
|
|
MODIFIER_CTRL | MODIFIER_ALT,
|
|
|
|
|
terminate_binding, ec);
|
|
|
|
|
weston_compositor_add_button_binding(ec, BTN_LEFT, 0,
|
|
|
|
|
click_to_activate_binding,
|
|
|
|
|
shell);
|
2013-10-03 19:43:04 +04:00
|
|
|
|
weston_compositor_add_touch_binding(ec, 0,
|
|
|
|
|
touch_to_activate_binding,
|
|
|
|
|
shell);
|
2012-05-30 19:31:58 +04:00
|
|
|
|
weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL,
|
|
|
|
|
MODIFIER_SUPER | MODIFIER_ALT,
|
|
|
|
|
surface_opacity_binding, NULL);
|
|
|
|
|
weston_compositor_add_axis_binding(ec, WL_POINTER_AXIS_VERTICAL_SCROLL,
|
|
|
|
|
MODIFIER_SUPER, zoom_axis_binding,
|
|
|
|
|
NULL);
|
2012-04-20 19:54:25 +04:00
|
|
|
|
|
|
|
|
|
/* configurable bindings */
|
|
|
|
|
mod = shell->binding_modifier;
|
2012-05-30 19:31:58 +04:00
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_PAGEUP, mod,
|
|
|
|
|
zoom_key_binding, NULL);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_PAGEDOWN, mod,
|
|
|
|
|
zoom_key_binding, NULL);
|
2014-01-12 01:10:21 +04:00
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_M, mod | MODIFIER_SHIFT,
|
|
|
|
|
maximize_binding, NULL);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_F, mod | MODIFIER_SHIFT,
|
|
|
|
|
fullscreen_binding, NULL);
|
2012-05-30 19:31:58 +04:00
|
|
|
|
weston_compositor_add_button_binding(ec, BTN_LEFT, mod, move_binding,
|
|
|
|
|
shell);
|
2013-10-03 19:43:05 +04:00
|
|
|
|
weston_compositor_add_touch_binding(ec, mod, touch_move_binding, shell);
|
2012-05-30 19:31:58 +04:00
|
|
|
|
weston_compositor_add_button_binding(ec, BTN_MIDDLE, mod,
|
|
|
|
|
resize_binding, shell);
|
2014-01-20 22:35:26 +04:00
|
|
|
|
weston_compositor_add_button_binding(ec, BTN_LEFT,
|
|
|
|
|
mod | MODIFIER_SHIFT,
|
|
|
|
|
resize_binding, shell);
|
2013-05-22 19:03:04 +04:00
|
|
|
|
|
|
|
|
|
if (ec->capabilities & WESTON_CAP_ROTATION_ANY)
|
|
|
|
|
weston_compositor_add_button_binding(ec, BTN_RIGHT, mod,
|
|
|
|
|
rotate_binding, NULL);
|
|
|
|
|
|
2012-05-30 19:31:58 +04:00
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_TAB, mod, switcher_binding,
|
|
|
|
|
shell);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_F9, mod, backlight_binding,
|
|
|
|
|
ec);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSDOWN, 0,
|
|
|
|
|
backlight_binding, ec);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_F10, mod, backlight_binding,
|
|
|
|
|
ec);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_BRIGHTNESSUP, 0,
|
|
|
|
|
backlight_binding, ec);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_K, mod,
|
|
|
|
|
force_kill_binding, shell);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_UP, mod,
|
|
|
|
|
workspace_up_binding, shell);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_DOWN, mod,
|
|
|
|
|
workspace_down_binding, shell);
|
2012-08-30 00:13:00 +04:00
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_UP, mod | MODIFIER_SHIFT,
|
|
|
|
|
workspace_move_surface_up_binding,
|
|
|
|
|
shell);
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_DOWN, mod | MODIFIER_SHIFT,
|
|
|
|
|
workspace_move_surface_down_binding,
|
|
|
|
|
shell);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
|
2014-01-17 04:51:52 +04:00
|
|
|
|
if (shell->exposay_modifier)
|
|
|
|
|
weston_compositor_add_modifier_binding(ec, shell->exposay_modifier,
|
|
|
|
|
exposay_binding, shell);
|
2013-11-19 14:37:14 +04:00
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
/* Add bindings for mod+F[1-6] for workspace 1 to 6. */
|
|
|
|
|
if (shell->workspaces.num > 1) {
|
|
|
|
|
num_workspace_bindings = shell->workspaces.num;
|
|
|
|
|
if (num_workspace_bindings > 6)
|
|
|
|
|
num_workspace_bindings = 6;
|
|
|
|
|
for (i = 0; i < num_workspace_bindings; i++)
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_F1 + i, mod,
|
|
|
|
|
workspace_f_binding,
|
|
|
|
|
shell);
|
|
|
|
|
}
|
2012-11-08 19:20:45 +04:00
|
|
|
|
|
|
|
|
|
/* Debug bindings */
|
|
|
|
|
weston_compositor_add_key_binding(ec, KEY_SPACE, mod | MODIFIER_SHIFT,
|
|
|
|
|
debug_binding, shell);
|
2012-04-20 19:54:25 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-05-03 06:09:20 +04:00
|
|
|
|
WL_EXPORT int
|
2013-02-21 00:37:49 +04:00
|
|
|
|
module_init(struct weston_compositor *ec,
|
2013-05-14 20:48:26 +04:00
|
|
|
|
int *argc, char *argv[])
|
2011-01-18 15:53:49 +03:00
|
|
|
|
{
|
2012-08-10 18:05:39 +04:00
|
|
|
|
struct weston_seat *seat;
|
2012-04-16 18:31:41 +04:00
|
|
|
|
struct desktop_shell *shell;
|
2012-06-13 02:01:22 +04:00
|
|
|
|
struct workspace **pws;
|
|
|
|
|
unsigned int i;
|
2012-09-25 18:57:01 +04:00
|
|
|
|
struct wl_event_loop *loop;
|
2011-04-23 21:04:11 +04:00
|
|
|
|
|
2013-08-08 05:57:05 +04:00
|
|
|
|
shell = zalloc(sizeof *shell);
|
2011-04-23 21:04:11 +04:00
|
|
|
|
if (shell == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2011-09-06 21:48:16 +04:00
|
|
|
|
shell->compositor = ec;
|
2012-04-12 17:55:26 +04:00
|
|
|
|
|
|
|
|
|
shell->destroy_listener.notify = shell_destroy;
|
|
|
|
|
wl_signal_add(&ec->destroy_signal, &shell->destroy_listener);
|
2013-02-21 20:35:23 +04:00
|
|
|
|
shell->idle_listener.notify = idle_handler;
|
|
|
|
|
wl_signal_add(&ec->idle_signal, &shell->idle_listener);
|
|
|
|
|
shell->wake_listener.notify = wake_handler;
|
|
|
|
|
wl_signal_add(&ec->wake_signal, &shell->wake_listener);
|
2013-12-04 23:00:19 +04:00
|
|
|
|
|
2012-04-18 05:06:18 +04:00
|
|
|
|
ec->ping_handler = ping_handler;
|
2012-07-19 22:02:00 +04:00
|
|
|
|
ec->shell_interface.shell = shell;
|
2012-04-19 17:18:18 +04:00
|
|
|
|
ec->shell_interface.create_shell_surface = create_shell_surface;
|
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-13 07:38:11 +04:00
|
|
|
|
ec->shell_interface.get_primary_view = get_primary_view;
|
2012-04-19 17:18:18 +04:00
|
|
|
|
ec->shell_interface.set_toplevel = set_toplevel;
|
2012-05-19 00:37:43 +04:00
|
|
|
|
ec->shell_interface.set_transient = set_transient;
|
2013-02-13 05:07:05 +04:00
|
|
|
|
ec->shell_interface.set_fullscreen = set_fullscreen;
|
2013-06-12 22:43:21 +04:00
|
|
|
|
ec->shell_interface.set_xwayland = set_xwayland;
|
2012-05-18 21:46:27 +04:00
|
|
|
|
ec->shell_interface.move = surface_move;
|
2012-05-23 00:56:23 +04:00
|
|
|
|
ec->shell_interface.resize = surface_resize;
|
2013-09-11 20:20:47 +04:00
|
|
|
|
ec->shell_interface.set_title = set_title;
|
2011-01-18 15:53:49 +03:00
|
|
|
|
|
2012-02-29 21:42:35 +04:00
|
|
|
|
weston_layer_init(&shell->fullscreen_layer, &ec->cursor_layer.link);
|
|
|
|
|
weston_layer_init(&shell->panel_layer, &shell->fullscreen_layer.link);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
weston_layer_init(&shell->background_layer, &shell->panel_layer.link);
|
|
|
|
|
weston_layer_init(&shell->lock_layer, NULL);
|
2012-08-09 20:50:43 +04:00
|
|
|
|
weston_layer_init(&shell->input_panel_layer, NULL);
|
2012-06-13 02:01:22 +04:00
|
|
|
|
|
|
|
|
|
wl_array_init(&shell->workspaces.array);
|
2012-08-30 00:13:01 +04:00
|
|
|
|
wl_list_init(&shell->workspaces.client_list);
|
2012-02-29 21:42:35 +04:00
|
|
|
|
|
2013-12-04 23:00:19 +04:00
|
|
|
|
if (input_panel_setup(shell) < 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2013-05-27 05:48:14 +04:00
|
|
|
|
shell_configuration(shell);
|
2011-12-07 13:49:52 +04:00
|
|
|
|
|
2013-11-19 14:37:14 +04:00
|
|
|
|
shell->exposay.state_cur = EXPOSAY_LAYOUT_INACTIVE;
|
|
|
|
|
shell->exposay.state_target = EXPOSAY_TARGET_CANCEL;
|
|
|
|
|
|
2012-06-13 02:01:22 +04:00
|
|
|
|
for (i = 0; i < shell->workspaces.num; i++) {
|
|
|
|
|
pws = wl_array_add(&shell->workspaces.array, sizeof *pws);
|
|
|
|
|
if (pws == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
*pws = workspace_create();
|
|
|
|
|
if (*pws == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
activate_workspace(shell, 0);
|
|
|
|
|
|
2012-08-30 00:13:00 +04:00
|
|
|
|
wl_list_init(&shell->workspaces.anim_sticky_list);
|
2012-06-13 02:01:23 +04:00
|
|
|
|
wl_list_init(&shell->workspaces.animation.link);
|
|
|
|
|
shell->workspaces.animation.frame = animate_workspace_change_frame;
|
|
|
|
|
|
2013-07-09 03:03:57 +04:00
|
|
|
|
if (wl_global_create(ec->wl_display, &wl_shell_interface, 1,
|
2011-08-27 01:21:20 +04:00
|
|
|
|
shell, bind_shell) == NULL)
|
2011-01-18 15:53:49 +03:00
|
|
|
|
return -1;
|
|
|
|
|
|
2013-12-03 21:35:45 +04:00
|
|
|
|
if (wl_global_create(ec->wl_display, &xdg_shell_interface, 1,
|
|
|
|
|
shell, bind_xdg_shell) == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2013-07-09 03:03:57 +04:00
|
|
|
|
if (wl_global_create(ec->wl_display,
|
|
|
|
|
&desktop_shell_interface, 2,
|
|
|
|
|
shell, bind_desktop_shell) == NULL)
|
2011-09-06 21:48:16 +04:00
|
|
|
|
return -1;
|
|
|
|
|
|
2013-07-09 03:03:57 +04:00
|
|
|
|
if (wl_global_create(ec->wl_display, &screensaver_interface, 1,
|
|
|
|
|
shell, bind_screensaver) == NULL)
|
protocol: add screensaver interface
Add the screensaver interface to the desktop-shell protocol file. Also
add stubs for it in the compositor, and make wscreensaver to bind to the
screensaver interface. Wscreensaver gets a new option --demo to retain
the current behaviour as a regular wayland client.
When a screensaver application starts, it should bind to the screensaver
interface, enumerate all outputs, create a surface per output, and
register those surfaces via screensaver::set_surface request. Then it
continues with the usual animation loop, waiting for frame events. The
compositor will decide, when the given screensaver surfaces are
displayed. A screensaver application should respond to outputs coming
and going away by creating and destroying surfaces.
The compositor is supposed to activate a screensaver by exec'ing it, and
stop the screensaver by killing the client process. Only one client may
be bound to the screensaver interface at a time. If there already is a
client, the compositor could either kill it first, or not exec a new
one.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2011-11-24 13:34:05 +04:00
|
|
|
|
return -1;
|
|
|
|
|
|
2013-07-09 03:03:57 +04:00
|
|
|
|
if (wl_global_create(ec->wl_display, &workspace_manager_interface, 1,
|
|
|
|
|
shell, bind_workspace_manager) == NULL)
|
2012-08-30 00:13:01 +04:00
|
|
|
|
return -1;
|
|
|
|
|
|
2012-01-17 20:07:42 +04:00
|
|
|
|
shell->child.deathstamp = weston_compositor_get_time();
|
2012-09-25 18:57:01 +04:00
|
|
|
|
|
2013-10-23 09:58:32 +04:00
|
|
|
|
setup_output_destroy_handler(ec, shell);
|
|
|
|
|
|
2012-09-25 18:57:01 +04:00
|
|
|
|
loop = wl_display_get_event_loop(ec->wl_display);
|
|
|
|
|
wl_event_loop_add_idle(loop, launch_desktop_shell_process, shell);
|
2011-11-03 16:11:32 +04:00
|
|
|
|
|
2013-02-21 20:35:21 +04:00
|
|
|
|
shell->screensaver.timer =
|
|
|
|
|
wl_event_loop_add_timer(loop, screensaver_timeout, shell);
|
|
|
|
|
|
2013-12-10 02:36:28 +04:00
|
|
|
|
wl_list_for_each(seat, &ec->seat_list, link) {
|
2012-08-10 18:05:39 +04:00
|
|
|
|
create_pointer_focus_listener(seat);
|
2013-12-10 02:36:28 +04:00
|
|
|
|
create_keyboard_focus_listener(seat);
|
|
|
|
|
}
|
2012-06-05 17:58:51 +04:00
|
|
|
|
|
2012-04-20 19:54:25 +04:00
|
|
|
|
shell_add_bindings(ec, shell);
|
2011-04-13 01:25:42 +04:00
|
|
|
|
|
shell: wait for desktop-shell init before fade in
On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.
To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.
If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.
shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 19:03:09 +04:00
|
|
|
|
shell_fade_init(shell);
|
compositor: Move fade animation out of core Weston into shell
Previously, it was impossible to override the fade in/out behavior of
Weston using a different shell, since this was implemented in core
Weston. This also led to complicated interaction between the shell and
the core when displaying lock surfaces and screensavers.
This patch starts to solve this issue by moving the fade animation out
of the core. On compositor.c, besides deleting the fade code, the idle
handler had to be changed to emit the lock signal, since it was called
from the fade_frame() function before. This causes a slight change of
behavior, since before the fade would happen with the compositor being
active, while now it is already in the idle state. That leads to the
dpms state being set when cancelling the fade with mouse movement, and
in turn, to a slight freeze with drm compositor. This problem will be
fixed in a follow up patch.
On the shell side, the fade was re-implemented in a slightly different
manner. Instead of using a custom frame function, the fade animation
from animation.c is used. The interface for starting the fade was also
changed to take the value of an enum instead of a float alpha value,
in order to improve readability.
2013-02-21 20:35:20 +04:00
|
|
|
|
|
2011-01-18 15:53:49 +03:00
|
|
|
|
return 0;
|
|
|
|
|
}
|