|
|
|
#ifndef _SWAY_VIEW_H
|
|
|
|
#define _SWAY_VIEW_H
|
|
|
|
#include <wayland-server.h>
|
|
|
|
#include <wlr/types/wlr_surface.h>
|
|
|
|
#include <wlr/types/wlr_xdg_shell_v6.h>
|
|
|
|
#include "config.h"
|
|
|
|
#ifdef HAVE_XWAYLAND
|
|
|
|
#include <wlr/xwayland.h>
|
|
|
|
#endif
|
|
|
|
#include "sway/input/input-manager.h"
|
|
|
|
#include "sway/input/seat.h"
|
|
|
|
|
|
|
|
struct sway_container;
|
|
|
|
struct sway_xdg_decoration;
|
|
|
|
|
|
|
|
enum sway_view_type {
|
|
|
|
SWAY_VIEW_XDG_SHELL_V6,
|
|
|
|
SWAY_VIEW_XDG_SHELL,
|
|
|
|
#ifdef HAVE_XWAYLAND
|
|
|
|
SWAY_VIEW_XWAYLAND,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
enum sway_view_prop {
|
|
|
|
VIEW_PROP_TITLE,
|
|
|
|
VIEW_PROP_APP_ID,
|
|
|
|
VIEW_PROP_CLASS,
|
|
|
|
VIEW_PROP_INSTANCE,
|
|
|
|
VIEW_PROP_WINDOW_TYPE,
|
|
|
|
VIEW_PROP_WINDOW_ROLE,
|
|
|
|
#ifdef HAVE_XWAYLAND
|
|
|
|
VIEW_PROP_X11_WINDOW_ID,
|
|
|
|
VIEW_PROP_X11_PARENT_ID,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_view_impl {
|
|
|
|
void (*get_constraints)(struct sway_view *view, double *min_width,
|
|
|
|
double *max_width, double *min_height, double *max_height);
|
|
|
|
const char *(*get_string_prop)(struct sway_view *view,
|
|
|
|
enum sway_view_prop prop);
|
|
|
|
uint32_t (*get_int_prop)(struct sway_view *view, enum sway_view_prop prop);
|
|
|
|
uint32_t (*configure)(struct sway_view *view, double lx, double ly,
|
|
|
|
int width, int height);
|
|
|
|
void (*set_activated)(struct sway_view *view, bool activated);
|
|
|
|
void (*set_tiled)(struct sway_view *view, bool tiled);
|
|
|
|
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
|
|
|
|
bool (*wants_floating)(struct sway_view *view);
|
|
|
|
void (*for_each_surface)(struct sway_view *view,
|
|
|
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
|
|
void (*for_each_popup)(struct sway_view *view,
|
|
|
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
|
|
bool (*is_transient_for)(struct sway_view *child,
|
|
|
|
struct sway_view *ancestor);
|
|
|
|
void (*close)(struct sway_view *view);
|
|
|
|
void (*close_popups)(struct sway_view *view);
|
|
|
|
void (*destroy)(struct sway_view *view);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_view {
|
|
|
|
enum sway_view_type type;
|
|
|
|
const struct sway_view_impl *impl;
|
|
|
|
|
Implement type safe arguments and demote sway_container
This commit changes the meaning of sway_container so that it only refers
to layout containers and view containers. Workspaces, outputs and the
root are no longer known as containers. Instead, root, outputs,
workspaces and containers are all a type of node, and containers come in
two types: layout containers and view containers.
In addition to the above, this implements type safe variables. This
means we use specific types such as sway_output and sway_workspace
instead of generic containers or nodes. However, it's worth noting that
in a few places places (eg. seat focus and transactions) referring to
them in a generic way is unavoidable which is why we still use nodes in
some places.
If you want a TL;DR, look at node.h, as well as the struct definitions
for root, output, workspace and container. Note that sway_output now
contains a workspaces list, and workspaces now contain a tiling and
floating list, and containers now contain a pointer back to the
workspace.
There are now functions for seat_get_focused_workspace and
seat_get_focused_container. The latter will return NULL if a workspace
itself is focused. Most other seat functions like seat_get_focus and
seat_set_focus now accept and return nodes.
In the config->handler_context struct, current_container has been
replaced with three pointers: node, container and workspace. node is the
same as what current_container was, while workspace is the workspace
that the node resides on and container is the actual container, which
may be NULL if a workspace itself is focused.
The global root_container variable has been replaced with one simply
called root, which is a pointer to the sway_root instance.
The way outputs are created, enabled, disabled and destroyed has
changed. Previously we'd wrap the sway_output in a container when it is
enabled, but as we don't have containers any more it needs a different
approach. The output_create and output_destroy functions previously
created/destroyed the container, but now they create/destroy the
sway_output. There is a new function output_disable to disable an output
without destroying it.
Containers have a new view property. If this is populated then the
container is a view container, otherwise it's a layout container. Like
before, this property is immutable for the life of the container.
Containers have both a `sway_container *parent` and
`sway_workspace *workspace`. As we use specific types now, parent cannot
point to a workspace so it'll be NULL for containers which are direct
children of the workspace. The workspace property is set for all
containers, except those which are hidden in the scratchpad as they have
no workspace.
In some cases we need to refer to workspaces in a container-like way.
For example, workspaces have layout and children, but when using
specific types this makes it difficult. Likewise, it's difficult for a
container to get its parent's layout when the parent could be another
container or a workspace. To make it easier, some helper functions have
been created: container_parent_layout and container_get_siblings.
container_remove_child has been renamed to container_detach and
container_replace_child has been renamed to container_replace.
`container_handle_fullscreen_reparent(con, old_parent)` has had the
old_parent removed. We now unfullscreen the workspace when detaching the
container, so this function is simplified and only needs one argument
now.
container_notify_subtree_changed has been renamed to
container_update_representation. This is more descriptive of its
purpose. I also wanted to be able to call it with whatever container was
changed rather than the container's parent, which makes bubbling up to
the workspace easier.
There are now state structs per node thing. ie. sway_output_state,
sway_workspace_state and sway_container_state.
The focus, move and layout commands have been completely refactored to
work with the specific types. I considered making these a separate PR,
but I'd be backporting my changes only to replace them again, and it's
easier just to test everything at once.
6 years ago
|
|
|
struct sway_container *container; // NULL if unmapped and transactions finished
|
|
|
|
struct wlr_surface *surface; // NULL for unmapped views
|
|
|
|
struct sway_xdg_decoration *xdg_decoration;
|
|
|
|
|
|
|
|
pid_t pid;
|
|
|
|
|
|
|
|
// Geometry of the view itself (excludes borders) in layout coordinates
|
|
|
|
double x, y;
|
|
|
|
int width, height;
|
|
|
|
|
|
|
|
double saved_x, saved_y;
|
|
|
|
int saved_width, saved_height;
|
|
|
|
|
|
|
|
// The size the view would want to be if it weren't tiled.
|
|
|
|
// Used when changing a view from tiled to floating.
|
|
|
|
int natural_width, natural_height;
|
|
|
|
|
|
|
|
char *title_format;
|
|
|
|
|
|
|
|
// Our border types are B_NONE, B_PIXEL, B_NORMAL and B_CSD. We normally
|
|
|
|
// just assign this to the border property and ignore the other two.
|
|
|
|
// However, when a view using CSD is tiled, we want to render our own
|
|
|
|
// borders as well. So in this case the border property becomes one of the
|
|
|
|
// first three, and using_csd is true.
|
|
|
|
// Lastly, views can change their decoration mode at any time. When an SSD
|
|
|
|
// view becomes CSD without our approval, we save the SSD border type so it
|
|
|
|
// can be restored if/when the view returns from CSD to SSD.
|
|
|
|
enum sway_container_border border;
|
|
|
|
enum sway_container_border saved_border;
|
|
|
|
bool using_csd;
|
|
|
|
|
|
|
|
int border_thickness;
|
|
|
|
bool border_top;
|
|
|
|
bool border_bottom;
|
|
|
|
bool border_left;
|
|
|
|
bool border_right;
|
|
|
|
|
|
|
|
struct timespec urgent;
|
|
|
|
bool allow_request_urgent;
|
|
|
|
struct wl_event_source *urgent_timer;
|
|
|
|
|
Correctly track saved surfaces during multiple transactions
Fixes #2364.
Suppose a view is 600px wide, and we tell it to resize to 601px during a
resize operation. We create a transaction, save the 600px buffer and
send the configure. This buffer is saved into the associated
instruction, and is rendered while we wait for the view to commit a
601px buffer.
Before the view commits the 601px buffer, suppose we tell it to resize
to 602px. The new transaction will also save the buffer, but it's still
the 600px buffer because we haven't received a new one yet.
Then suppose the view commits its original 601px buffer. This completes
the first transaction, so we apply the 601px width to the container.
There's still the second (now only) transaction remaining, so we render
the saved buffer from that. But this is still the 600px buffer, and we
believe it's 601px. Whoops.
The problem here is we can't stack buffers like this. So this commit
removes the saved buffer from the instructions, places it in the view
instead, and re-saves the latest buffer every time the view completes a
transaction and still has further pending transactions.
As saved buffers are now specific to views rather than instructions, the
functions for saving and removing the saved buffer have been moved to
view.c.
The calls to save and restore the buffer have been relocated to more
appropriate functions too, favouring transaction_commit and
transaction_apply rather than transaction_add_container and
transaction_destroy.
6 years ago
|
|
|
struct wlr_buffer *saved_buffer;
|
|
|
|
int saved_buffer_width, saved_buffer_height;
|
|
|
|
|
|
|
|
// The geometry for whatever the client is committing, regardless of
|
|
|
|
// transaction state. Updated on every commit.
|
|
|
|
struct wlr_box geometry;
|
|
|
|
|
|
|
|
// The "old" geometry during a transaction. Used to damage the old location
|
|
|
|
// when a transaction is applied.
|
|
|
|
struct wlr_box saved_geometry;
|
Correctly track saved surfaces during multiple transactions
Fixes #2364.
Suppose a view is 600px wide, and we tell it to resize to 601px during a
resize operation. We create a transaction, save the 600px buffer and
send the configure. This buffer is saved into the associated
instruction, and is rendered while we wait for the view to commit a
601px buffer.
Before the view commits the 601px buffer, suppose we tell it to resize
to 602px. The new transaction will also save the buffer, but it's still
the 600px buffer because we haven't received a new one yet.
Then suppose the view commits its original 601px buffer. This completes
the first transaction, so we apply the 601px width to the container.
There's still the second (now only) transaction remaining, so we render
the saved buffer from that. But this is still the 600px buffer, and we
believe it's 601px. Whoops.
The problem here is we can't stack buffers like this. So this commit
removes the saved buffer from the instructions, places it in the view
instead, and re-saves the latest buffer every time the view completes a
transaction and still has further pending transactions.
As saved buffers are now specific to views rather than instructions, the
functions for saving and removing the saved buffer have been moved to
view.c.
The calls to save and restore the buffer have been relocated to more
appropriate functions too, favouring transaction_commit and
transaction_apply rather than transaction_add_container and
transaction_destroy.
6 years ago
|
|
|
|
|
|
|
bool destroying;
|
|
|
|
|
|
|
|
list_t *executed_criteria; // struct criteria *
|
|
|
|
list_t *marks; // char *
|
|
|
|
|
|
|
|
struct wlr_texture *marks_focused;
|
|
|
|
struct wlr_texture *marks_focused_inactive;
|
|
|
|
struct wlr_texture *marks_unfocused;
|
|
|
|
struct wlr_texture *marks_urgent;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
|
|
|
|
struct wlr_xdg_surface *wlr_xdg_surface;
|
|
|
|
#ifdef HAVE_XWAYLAND
|
|
|
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
|
|
|
#endif
|
|
|
|
struct wlr_wl_shell_surface *wlr_wl_shell_surface;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct wl_signal unmap;
|
|
|
|
} events;
|
|
|
|
|
|
|
|
struct wl_listener surface_new_subsurface;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_xdg_shell_v6_view {
|
|
|
|
struct sway_view view;
|
|
|
|
|
|
|
|
struct wl_listener commit;
|
|
|
|
struct wl_listener request_move;
|
|
|
|
struct wl_listener request_resize;
|
|
|
|
struct wl_listener request_maximize;
|
|
|
|
struct wl_listener request_fullscreen;
|
|
|
|
struct wl_listener set_title;
|
|
|
|
struct wl_listener set_app_id;
|
|
|
|
struct wl_listener new_popup;
|
|
|
|
struct wl_listener map;
|
|
|
|
struct wl_listener unmap;
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_xdg_shell_view {
|
|
|
|
struct sway_view view;
|
|
|
|
|
|
|
|
struct wl_listener commit;
|
|
|
|
struct wl_listener request_move;
|
|
|
|
struct wl_listener request_resize;
|
|
|
|
struct wl_listener request_maximize;
|
|
|
|
struct wl_listener request_fullscreen;
|
|
|
|
struct wl_listener set_title;
|
|
|
|
struct wl_listener set_app_id;
|
|
|
|
struct wl_listener new_popup;
|
|
|
|
struct wl_listener map;
|
|
|
|
struct wl_listener unmap;
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
#ifdef HAVE_XWAYLAND
|
|
|
|
struct sway_xwayland_view {
|
|
|
|
struct sway_view view;
|
|
|
|
|
|
|
|
struct wl_listener commit;
|
|
|
|
struct wl_listener request_move;
|
|
|
|
struct wl_listener request_resize;
|
|
|
|
struct wl_listener request_maximize;
|
|
|
|
struct wl_listener request_configure;
|
|
|
|
struct wl_listener request_fullscreen;
|
|
|
|
struct wl_listener request_activate;
|
|
|
|
struct wl_listener set_title;
|
|
|
|
struct wl_listener set_class;
|
|
|
|
struct wl_listener set_role;
|
|
|
|
struct wl_listener set_window_type;
|
|
|
|
struct wl_listener set_hints;
|
|
|
|
struct wl_listener set_decorations;
|
|
|
|
struct wl_listener map;
|
|
|
|
struct wl_listener unmap;
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_xwayland_unmanaged {
|
|
|
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
|
|
|
struct wl_list link;
|
|
|
|
|
|
|
|
int lx, ly;
|
|
|
|
|
|
|
|
struct wl_listener request_configure;
|
|
|
|
struct wl_listener request_fullscreen;
|
|
|
|
struct wl_listener commit;
|
|
|
|
struct wl_listener map;
|
|
|
|
struct wl_listener unmap;
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
struct sway_view_child;
|
|
|
|
|
|
|
|
struct sway_view_child_impl {
|
|
|
|
void (*get_root_coords)(struct sway_view_child *child, int *sx, int *sy);
|
|
|
|
void (*destroy)(struct sway_view_child *child);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A view child is a surface in the view tree, such as a subsurface or a popup.
|
|
|
|
*/
|
|
|
|
struct sway_view_child {
|
|
|
|
const struct sway_view_child_impl *impl;
|
|
|
|
|
|
|
|
struct sway_view *view;
|
|
|
|
struct wlr_surface *surface;
|
|
|
|
|
|
|
|
struct wl_listener surface_commit;
|
|
|
|
struct wl_listener surface_new_subsurface;
|
|
|
|
struct wl_listener surface_map;
|
|
|
|
struct wl_listener surface_unmap;
|
|
|
|
struct wl_listener surface_destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_xdg_popup_v6 {
|
|
|
|
struct sway_view_child child;
|
|
|
|
|
|
|
|
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6;
|
|
|
|
|
|
|
|
struct wl_listener new_popup;
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sway_xdg_popup {
|
|
|
|
struct sway_view_child child;
|
|
|
|
|
|
|
|
struct wlr_xdg_surface *wlr_xdg_surface;
|
|
|
|
|
|
|
|
struct wl_listener new_popup;
|
|
|
|
struct wl_listener destroy;
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *view_get_title(struct sway_view *view);
|
|
|
|
|
|
|
|
const char *view_get_app_id(struct sway_view *view);
|
|
|
|
|
|
|
|
const char *view_get_class(struct sway_view *view);
|
|
|
|
|
|
|
|
const char *view_get_instance(struct sway_view *view);
|
|
|
|
|
|
|
|
uint32_t view_get_x11_window_id(struct sway_view *view);
|
|
|
|
|
|
|
|
uint32_t view_get_x11_parent_id(struct sway_view *view);
|
|
|
|
|
|
|
|
const char *view_get_window_role(struct sway_view *view);
|
|
|
|
|
|
|
|
uint32_t view_get_window_type(struct sway_view *view);
|
|
|
|
|
|
|
|
const char *view_get_shell(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_get_constraints(struct sway_view *view, double *min_width,
|
|
|
|
double *max_width, double *min_height, double *max_height);
|
|
|
|
|
|
|
|
uint32_t view_configure(struct sway_view *view, double lx, double ly, int width,
|
|
|
|
int height);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the view is the only visible view in its tree. If the view
|
|
|
|
* is tiling, there may be floating views. If the view is floating, there may
|
|
|
|
* be tiling views or views in a different floating container.
|
|
|
|
*/
|
|
|
|
bool view_is_only_visible(struct sway_view *view);
|
|
|
|
|
|
|
|
/**
|
Implement type safe arguments and demote sway_container
This commit changes the meaning of sway_container so that it only refers
to layout containers and view containers. Workspaces, outputs and the
root are no longer known as containers. Instead, root, outputs,
workspaces and containers are all a type of node, and containers come in
two types: layout containers and view containers.
In addition to the above, this implements type safe variables. This
means we use specific types such as sway_output and sway_workspace
instead of generic containers or nodes. However, it's worth noting that
in a few places places (eg. seat focus and transactions) referring to
them in a generic way is unavoidable which is why we still use nodes in
some places.
If you want a TL;DR, look at node.h, as well as the struct definitions
for root, output, workspace and container. Note that sway_output now
contains a workspaces list, and workspaces now contain a tiling and
floating list, and containers now contain a pointer back to the
workspace.
There are now functions for seat_get_focused_workspace and
seat_get_focused_container. The latter will return NULL if a workspace
itself is focused. Most other seat functions like seat_get_focus and
seat_set_focus now accept and return nodes.
In the config->handler_context struct, current_container has been
replaced with three pointers: node, container and workspace. node is the
same as what current_container was, while workspace is the workspace
that the node resides on and container is the actual container, which
may be NULL if a workspace itself is focused.
The global root_container variable has been replaced with one simply
called root, which is a pointer to the sway_root instance.
The way outputs are created, enabled, disabled and destroyed has
changed. Previously we'd wrap the sway_output in a container when it is
enabled, but as we don't have containers any more it needs a different
approach. The output_create and output_destroy functions previously
created/destroyed the container, but now they create/destroy the
sway_output. There is a new function output_disable to disable an output
without destroying it.
Containers have a new view property. If this is populated then the
container is a view container, otherwise it's a layout container. Like
before, this property is immutable for the life of the container.
Containers have both a `sway_container *parent` and
`sway_workspace *workspace`. As we use specific types now, parent cannot
point to a workspace so it'll be NULL for containers which are direct
children of the workspace. The workspace property is set for all
containers, except those which are hidden in the scratchpad as they have
no workspace.
In some cases we need to refer to workspaces in a container-like way.
For example, workspaces have layout and children, but when using
specific types this makes it difficult. Likewise, it's difficult for a
container to get its parent's layout when the parent could be another
container or a workspace. To make it easier, some helper functions have
been created: container_parent_layout and container_get_siblings.
container_remove_child has been renamed to container_detach and
container_replace_child has been renamed to container_replace.
`container_handle_fullscreen_reparent(con, old_parent)` has had the
old_parent removed. We now unfullscreen the workspace when detaching the
container, so this function is simplified and only needs one argument
now.
container_notify_subtree_changed has been renamed to
container_update_representation. This is more descriptive of its
purpose. I also wanted to be able to call it with whatever container was
changed rather than the container's parent, which makes bubbling up to
the workspace easier.
There are now state structs per node thing. ie. sway_output_state,
sway_workspace_state and sway_container_state.
The focus, move and layout commands have been completely refactored to
work with the specific types. I considered making these a separate PR,
but I'd be backporting my changes only to replace them again, and it's
easier just to test everything at once.
6 years ago
|
|
|
* Configure the view's position and size based on the container's position and
|
|
|
|
* size, taking borders into consideration.
|
|
|
|
*/
|
|
|
|
void view_autoconfigure(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_set_activated(struct sway_view *view, bool activated);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when the view requests to be focused.
|
|
|
|
*/
|
|
|
|
void view_request_activate(struct sway_view *view);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If possible, instructs the client to change their decoration mode.
|
|
|
|
*/
|
|
|
|
void view_set_csd_from_server(struct sway_view *view, bool enabled);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the view's border setting when the client unexpectedly changes their
|
|
|
|
* decoration mode.
|
|
|
|
*/
|
|
|
|
void view_update_csd_from_client(struct sway_view *view, bool enabled);
|
|
|
|
|
|
|
|
void view_set_tiled(struct sway_view *view, bool tiled);
|
|
|
|
|
|
|
|
void view_close(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_close_popups(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_damage_from(struct sway_view *view);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterate all surfaces of a view (toplevels + popups).
|
|
|
|
*/
|
|
|
|
void view_for_each_surface(struct sway_view *view,
|
|
|
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Iterate all popups recursively.
|
|
|
|
*/
|
|
|
|
void view_for_each_popup(struct sway_view *view,
|
|
|
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
|
|
|
|
|
|
// view implementation
|
|
|
|
|
|
|
|
void view_init(struct sway_view *view, enum sway_view_type type,
|
|
|
|
const struct sway_view_impl *impl);
|
|
|
|
|
|
|
|
void view_destroy(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_begin_destroy(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
|
|
|
bool fullscreen, bool decoration);
|
|
|
|
|
|
|
|
void view_unmap(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_update_size(struct sway_view *view, int width, int height);
|
|
|
|
|
|
|
|
void view_child_init(struct sway_view_child *child,
|
|
|
|
const struct sway_view_child_impl *impl, struct sway_view *view,
|
|
|
|
struct wlr_surface *surface);
|
|
|
|
|
|
|
|
void view_child_destroy(struct sway_view_child *child);
|
|
|
|
|
|
|
|
|
|
|
|
struct sway_view *view_from_wlr_xdg_surface(
|
|
|
|
struct wlr_xdg_surface *xdg_surface);
|
|
|
|
struct sway_view *view_from_wlr_xdg_surface_v6(
|
|
|
|
struct wlr_xdg_surface_v6 *xdg_surface_v6);
|
|
|
|
#ifdef HAVE_XWAYLAND
|
|
|
|
struct sway_view *view_from_wlr_xwayland_surface(
|
|
|
|
struct wlr_xwayland_surface *xsurface);
|
|
|
|
#endif
|
|
|
|
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Re-read the view's title property and update any relevant title bars.
|
|
|
|
* The force argument makes it recreate the title bars even if the title hasn't
|
|
|
|
* changed.
|
|
|
|
*/
|
|
|
|
void view_update_title(struct sway_view *view, bool force);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run any criteria that match the view and haven't been run on this view
|
|
|
|
* before.
|
|
|
|
*/
|
|
|
|
void view_execute_criteria(struct sway_view *view);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find any view that has the given mark and return it.
|
|
|
|
*/
|
|
|
|
struct sway_view *view_find_mark(char *mark);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find any view that has the given mark and remove the mark from the view.
|
|
|
|
* Returns true if it matched a view.
|
|
|
|
*/
|
|
|
|
bool view_find_and_unmark(char *mark);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all marks from the view.
|
|
|
|
*/
|
|
|
|
void view_clear_marks(struct sway_view *view);
|
|
|
|
|
|
|
|
bool view_has_mark(struct sway_view *view, char *mark);
|
|
|
|
|
|
|
|
void view_add_mark(struct sway_view *view, char *mark);
|
|
|
|
|
|
|
|
void view_update_marks_textures(struct sway_view *view);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if there's a possibility the view may be rendered on screen.
|
|
|
|
* Intended for damage tracking.
|
|
|
|
*/
|
|
|
|
bool view_is_visible(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_set_urgent(struct sway_view *view, bool enable);
|
|
|
|
|
|
|
|
bool view_is_urgent(struct sway_view *view);
|
|
|
|
|
Correctly track saved surfaces during multiple transactions
Fixes #2364.
Suppose a view is 600px wide, and we tell it to resize to 601px during a
resize operation. We create a transaction, save the 600px buffer and
send the configure. This buffer is saved into the associated
instruction, and is rendered while we wait for the view to commit a
601px buffer.
Before the view commits the 601px buffer, suppose we tell it to resize
to 602px. The new transaction will also save the buffer, but it's still
the 600px buffer because we haven't received a new one yet.
Then suppose the view commits its original 601px buffer. This completes
the first transaction, so we apply the 601px width to the container.
There's still the second (now only) transaction remaining, so we render
the saved buffer from that. But this is still the 600px buffer, and we
believe it's 601px. Whoops.
The problem here is we can't stack buffers like this. So this commit
removes the saved buffer from the instructions, places it in the view
instead, and re-saves the latest buffer every time the view completes a
transaction and still has further pending transactions.
As saved buffers are now specific to views rather than instructions, the
functions for saving and removing the saved buffer have been moved to
view.c.
The calls to save and restore the buffer have been relocated to more
appropriate functions too, favouring transaction_commit and
transaction_apply rather than transaction_add_container and
transaction_destroy.
6 years ago
|
|
|
void view_remove_saved_buffer(struct sway_view *view);
|
|
|
|
|
|
|
|
void view_save_buffer(struct sway_view *view);
|
|
|
|
|
|
|
|
bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
|
|
|
|
|
|
|
|
#endif
|