rootston: fix artifacts when un-maximizing a view

master
emersion 7 years ago
parent ddafcb86a2
commit bc001e90e9
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -298,6 +298,10 @@ void view_damage_whole(struct roots_view *view) {
} }
void view_update_position(struct roots_view *view, double x, double y) { void view_update_position(struct roots_view *view, double x, double y) {
if (view->x == x && view->y == y) {
return;
}
view_damage_whole(view); view_damage_whole(view);
view->x = x; view->x = x;
view->y = y; view->y = y;

@ -88,22 +88,23 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
struct roots_view *view = roots_surface->view; struct roots_view *view = roots_surface->view;
struct wlr_surface *wlr_surface = view->wlr_surface; struct wlr_surface *wlr_surface = view->wlr_surface;
view_apply_damage(view);
int width = wlr_surface->current->width; int width = wlr_surface->current->width;
int height = wlr_surface->current->height; int height = wlr_surface->current->height;
double x = view->x;
double y = view->y;
if (view->pending_move_resize.update_x) { if (view->pending_move_resize.update_x) {
double x = view->pending_move_resize.x + x = view->pending_move_resize.x + view->pending_move_resize.width -
view->pending_move_resize.width - width; width;
view_update_position(view, x, view->y);
view->pending_move_resize.update_x = false; view->pending_move_resize.update_x = false;
} }
if (view->pending_move_resize.update_y) { if (view->pending_move_resize.update_y) {
double y = view->pending_move_resize.y + y = view->pending_move_resize.y + view->pending_move_resize.height -
view->pending_move_resize.height - height; height;
view_update_position(view, view->x, y);
view->pending_move_resize.update_y = false; view->pending_move_resize.update_y = false;
} }
view_update_position(view, x, y);
view_apply_damage(view);
} }
static void handle_destroy(struct wl_listener *listener, void *data) { static void handle_destroy(struct wl_listener *listener, void *data) {

@ -197,29 +197,30 @@ static void handle_commit(struct wl_listener *listener, void *data) {
struct roots_view *view = roots_surface->view; struct roots_view *view = roots_surface->view;
struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6; struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6;
view_apply_damage(view);
uint32_t pending_serial = uint32_t pending_serial =
roots_surface->pending_move_resize_configure_serial; roots_surface->pending_move_resize_configure_serial;
if (pending_serial > 0 && pending_serial >= surface->configure_serial) { if (pending_serial > 0 && pending_serial >= surface->configure_serial) {
struct wlr_box size; struct wlr_box size;
get_size(view, &size); get_size(view, &size);
double x = view->x;
double y = view->y;
if (view->pending_move_resize.update_x) { if (view->pending_move_resize.update_x) {
double x = view->pending_move_resize.x + x = view->pending_move_resize.x + view->pending_move_resize.width -
view->pending_move_resize.width - size.width; size.width;
view_update_position(view, x, view->y);
} }
if (view->pending_move_resize.update_y) { if (view->pending_move_resize.update_y) {
double y = view->pending_move_resize.y + y = view->pending_move_resize.y + view->pending_move_resize.height -
view->pending_move_resize.height - size.height; size.height;
view_update_position(view, view->x, y);
} }
view_update_position(view, x, y);
if (pending_serial == surface->configure_serial) { if (pending_serial == surface->configure_serial) {
roots_surface->pending_move_resize_configure_serial = 0; roots_surface->pending_move_resize_configure_serial = 0;
} }
} }
view_apply_damage(view);
} }
static void handle_destroy(struct wl_listener *listener, void *data) { static void handle_destroy(struct wl_listener *listener, void *data) {

@ -204,23 +204,23 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) {
struct roots_view *view = roots_surface->view; struct roots_view *view = roots_surface->view;
struct wlr_surface *wlr_surface = view->wlr_surface; struct wlr_surface *wlr_surface = view->wlr_surface;
view_apply_damage(view);
int width = wlr_surface->current->width; int width = wlr_surface->current->width;
int height = wlr_surface->current->height; int height = wlr_surface->current->height;
double x = view->x;
double y = view->y;
if (view->pending_move_resize.update_x) { if (view->pending_move_resize.update_x) {
double x = view->pending_move_resize.x + x = view->pending_move_resize.x + view->pending_move_resize.width -
view->pending_move_resize.width - width; width;
view_update_position(view, x, view->y);
view->pending_move_resize.update_x = false; view->pending_move_resize.update_x = false;
} }
if (view->pending_move_resize.update_y) { if (view->pending_move_resize.update_y) {
double y = view->pending_move_resize.y + y = view->pending_move_resize.y + view->pending_move_resize.height -
view->pending_move_resize.height - height; height;
view_update_position(view, view->x, y);
view->pending_move_resize.update_y = false; view->pending_move_resize.update_y = false;
} }
view_update_position(view, x, y);
view_apply_damage(view);
} }
static void handle_map_notify(struct wl_listener *listener, void *data) { static void handle_map_notify(struct wl_listener *listener, void *data) {

Loading…
Cancel
Save