Skip to content

Commit

Permalink
Fix xwayland fullscreen crash (#135)
Browse files Browse the repository at this point in the history
Introduces a trivial fix for a crash in xwayland that could be triggered when a
view with NULL size hints tried to go fullscreen
  • Loading branch information
flaviozavan authored Sep 17, 2023
1 parent 586e3b8 commit 1ffa436
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/viv_xwayland_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,20 @@ static void implementation_grow_and_center_fullscreen(struct viv_view *view) {
}

int width = output->wlr_output->width;
if ((hints->max_width > 0) && ((int) hints->max_width < width)) {
width = hints->max_width;
} else if ((hints->min_width > 0) && ((int) hints->min_width > width)) {
width = hints->min_width;
}

int height = output->wlr_output->height;
if ((hints->max_height > 0) && ((int) hints->max_height < height)) {
height = hints->max_height;
} else if ((hints->min_height > 0) && ((int) hints->min_height > height)) {
height = hints->min_height;

if (hints) {
if ((hints->max_width > 0) && ((int) hints->max_width < width)) {
width = hints->max_width;
} else if ((hints->min_width > 0) && ((int) hints->min_width > width)) {
width = hints->min_width;
}

if ((hints->max_height > 0) && ((int) hints->max_height < height)) {
height = hints->max_height;
} else if ((hints->min_height > 0) && ((int) hints->min_height > height)) {
height = hints->min_height;
}
}

int x = (output->wlr_output->width - width) / 2;
Expand Down

0 comments on commit 1ffa436

Please sign in to comment.