mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 11:16:30 +00:00
simplify setting the border color of clients
This commit is contained in:
parent
72a7d78a1a
commit
a18c528300
2 changed files with 13 additions and 13 deletions
8
client.h
8
client.h
|
@ -323,6 +323,14 @@ client_send_close(Client *c)
|
||||||
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
|
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
client_set_border_color(Client *c, const float color[static 4])
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < 4; i++)
|
||||||
|
wlr_scene_rect_set_color(c->border[i], color);
|
||||||
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
client_set_fullscreen(Client *c, int fullscreen)
|
client_set_fullscreen(Client *c, int fullscreen)
|
||||||
{
|
{
|
||||||
|
|
18
dwl.c
18
dwl.c
|
@ -1199,7 +1199,7 @@ void
|
||||||
focusclient(Client *c, int lift)
|
focusclient(Client *c, int lift)
|
||||||
{
|
{
|
||||||
struct wlr_surface *old = seat->keyboard_state.focused_surface;
|
struct wlr_surface *old = seat->keyboard_state.focused_surface;
|
||||||
int i, unused_lx, unused_ly, old_client_type;
|
int unused_lx, unused_ly, old_client_type;
|
||||||
Client *old_c = NULL;
|
Client *old_c = NULL;
|
||||||
LayerSurface *old_l = NULL;
|
LayerSurface *old_l = NULL;
|
||||||
|
|
||||||
|
@ -1230,8 +1230,7 @@ focusclient(Client *c, int lift)
|
||||||
/* Don't change border color if there is an exclusive focus or we are
|
/* Don't change border color if there is an exclusive focus or we are
|
||||||
* handling a drag operation */
|
* handling a drag operation */
|
||||||
if (!exclusive_focus && !seat->drag)
|
if (!exclusive_focus && !seat->drag)
|
||||||
for (i = 0; i < 4; i++)
|
client_set_border_color(c, focuscolor);
|
||||||
wlr_scene_rect_set_color(c->border[i], focuscolor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deactivate old client if focus is changing */
|
/* Deactivate old client if focus is changing */
|
||||||
|
@ -1248,8 +1247,7 @@ focusclient(Client *c, int lift)
|
||||||
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
|
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
|
||||||
* and probably other clients */
|
* and probably other clients */
|
||||||
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
||||||
for (i = 0; i < 4; i++)
|
client_set_border_color(old_c, bordercolor);
|
||||||
wlr_scene_rect_set_color(old_c->border[i], bordercolor);
|
|
||||||
|
|
||||||
client_activate_surface(old, 0);
|
client_activate_surface(old, 0);
|
||||||
}
|
}
|
||||||
|
@ -2589,14 +2587,11 @@ urgent(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct wlr_xdg_activation_v1_request_activate_event *event = data;
|
struct wlr_xdg_activation_v1_request_activate_event *event = data;
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
int i;
|
|
||||||
toplevel_from_wlr_surface(event->surface, &c, NULL);
|
toplevel_from_wlr_surface(event->surface, &c, NULL);
|
||||||
if (!c || c == focustop(selmon))
|
if (!c || c == focustop(selmon))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
client_set_border_color(c, urgentcolor);
|
||||||
wlr_scene_rect_set_color(c->border[i], urgentcolor);
|
|
||||||
|
|
||||||
c->isurgent = 1;
|
c->isurgent = 1;
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
@ -2756,13 +2751,10 @@ void
|
||||||
sethints(struct wl_listener *listener, void *data)
|
sethints(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
Client *c = wl_container_of(listener, c, set_hints);
|
Client *c = wl_container_of(listener, c, set_hints);
|
||||||
int i;
|
|
||||||
if (c == focustop(selmon))
|
if (c == focustop(selmon))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
client_set_border_color(c, urgentcolor);
|
||||||
wlr_scene_rect_set_color(c->border[i], urgentcolor);
|
|
||||||
|
|
||||||
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
|
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue