Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
conform the xdg-protocol with fullscreen translucent clients
Browse files Browse the repository at this point in the history
see `setfullscreen()` for more info
  • Loading branch information
sevz17 committed Jul 23, 2022
1 parent 90a12c9 commit 8cdb997
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.def.h
Expand Up @@ -5,6 +5,8 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscree
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};

/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
Expand Down
14 changes: 14 additions & 0 deletions dwl.c
Expand Up @@ -98,6 +98,7 @@ typedef struct {
struct wlr_scene_node *scene;
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
struct wlr_scene_node *scene_surface;
struct wlr_scene_rect *fullscreen_bg; /* See setfullscreen() for info */
struct wl_list link;
struct wl_list flink;
union {
Expand Down Expand Up @@ -1869,10 +1870,23 @@ setfullscreen(Client *c, int fullscreen)
if (fullscreen) {
c->prev = c->geom;
resize(c, c->mon->m, 0);
/* The xdg-protocol specifies:
*
* If the fullscreened surface is not opaque, the compositor must make
* sure that other screen content not part of the same surface tree (made
* up of subsurfaces, popups or similarly coupled surfaces) are not
* visible below the fullscreened surface.
*
* For brevity we set a black background for all clients
*/
c->fullscreen_bg = wlr_scene_rect_create(c->scene,
c->geom.width, c->geom.height, fullscreen_bg);
wlr_scene_node_lower_to_bottom(&c->fullscreen_bg->node);
} else {
/* restore previous size instead of arrange for floating windows since
* client positions are set by the user and cannot be recalculated */
resize(c, c->prev, 0);
wlr_scene_node_destroy(&c->fullscreen_bg->node);
}
arrange(c->mon);
printstatus();
Expand Down

3 comments on commit 8cdb997

@Manfred-Knick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since today, I get a compile error:

wl.c: In function ‘setfullscreen’:
dwl.c:1884:64: error: ‘fullscreen_bg’ undeclared (first use in this function); did you mean ‘fullscreen’?
1884 | c->geom.width, c->geom.height, fullscreen_bg);
| ^~~~~~~~~~~~~
| fullscreen

Kind regards

@sevz17
Copy link
Collaborator Author

@sevz17 sevz17 commented on 8cdb997 Jul 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update config.h

@Manfred-Knick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - missed those two lines ... Thanks!

Please sign in to comment.