Skip to content

Commit

Permalink
fix: dont crash if fullscreennotify called before map
Browse files Browse the repository at this point in the history
  • Loading branch information
Frewacom committed Dec 26, 2021
1 parent f01d933 commit 89395f9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dwl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,13 @@ void
fullscreennotify(struct wl_listener *listener, void *data)
{
Client *c = wl_container_of(listener, c, fullscreen);
setfullscreen(c, !c->isfullscreen);
struct wlr_xdg_toplevel_set_fullscreen_event *event = data;
if (!c->mon) {
/* if the client is not mapped yet, let mapnotify() call setfullscreen() */
c->isfullscreen = event->fullscreen;
return;
}
setfullscreen(c, event->fullscreen);
}

Monitor *
Expand Down Expand Up @@ -1513,6 +1519,9 @@ mapnotify(struct wl_listener *listener, void *data)
/* Set initial monitor, tags, floating status, and focus */
applyrules(c);

if (c->isfullscreen)
setfullscreen(c, 1);

// Damage the whole screen
wlr_output_damage_add_whole(c->mon->damage);

Expand Down

0 comments on commit 89395f9

Please sign in to comment.