Merge pull request #2703 from RyanDwyer/csd-border

Add CSD to border modes
This commit is contained in:
Drew DeVault 2018-10-03 13:03:06 +02:00 committed by GitHub
commit 06c214a800
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 301 additions and 142 deletions

View file

@ -28,6 +28,7 @@ enum sway_container_border {
B_NONE,
B_PIXEL,
B_NORMAL,
B_CSD,
};
struct sway_root;
@ -63,7 +64,6 @@ struct sway_container_state {
bool border_bottom;
bool border_left;
bool border_right;
bool using_csd;
};
struct sway_container {

View file

@ -11,6 +11,7 @@
#include "sway/input/seat.h"
struct sway_container;
struct sway_xdg_decoration;
enum sway_view_type {
SWAY_VIEW_XDG_SHELL_V6,
@ -44,7 +45,6 @@ struct sway_view_impl {
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);
bool (*has_client_side_decorations)(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,
@ -60,6 +60,7 @@ struct sway_view {
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;
@ -75,13 +76,24 @@ struct sway_view {
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;
bool using_csd;
struct timespec urgent;
bool allow_request_urgent;
@ -127,8 +139,6 @@ struct sway_view {
struct sway_xdg_shell_v6_view {
struct sway_view view;
enum wlr_server_decoration_manager_mode deco_mode;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
@ -145,8 +155,6 @@ struct sway_xdg_shell_v6_view {
struct sway_xdg_shell_view {
struct sway_view view;
enum wlr_server_decoration_manager_mode deco_mode;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
@ -175,6 +183,7 @@ struct sway_xwayland_view {
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;
@ -275,6 +284,17 @@ void view_set_activated(struct sway_view *view, bool activated);
*/
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);