Store geometry in the view and handle any floating view resizing

This commit is contained in:
Ryan Dwyer 2018-08-18 15:10:06 +10:00
parent 4e755c4b12
commit b0a5f3a25f
11 changed files with 144 additions and 112 deletions

View file

@ -1,8 +1,13 @@
#include <wlr/types/wlr_surface.h>
struct sway_container;
struct sway_view;
void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
bool whole);
void desktop_damage_whole_container(struct sway_container *con);
void desktop_damage_box(struct wlr_box *box);
void desktop_damage_view(struct sway_view *view);

View file

@ -38,7 +38,6 @@ struct sway_view_impl {
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);
void (*get_geometry)(struct sway_view *view, struct wlr_box *box);
uint32_t (*configure)(struct sway_view *view, double lx, double ly,
int width, int height);
void (*set_activated)(struct sway_view *view, bool activated);
@ -88,7 +87,14 @@ struct sway_view {
struct wlr_buffer *saved_buffer;
int saved_buffer_width, saved_buffer_height;
struct wlr_box saved_geometry; // The "old" geometry during a transaction
// 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;
bool destroying;
@ -243,8 +249,6 @@ 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);
void view_get_geometry(struct sway_view *view, struct wlr_box *box);
uint32_t view_configure(struct sway_view *view, double lx, double ly, int width,
int height);
@ -289,6 +293,8 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface);
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);