mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 18:01:37 -05:00
Handle clients outside of every monitors
This commit is contained in:
parent
15a60b8982
commit
7df593f4e8
3 changed files with 16 additions and 1 deletions
12
monitor.c
12
monitor.c
|
@ -71,6 +71,18 @@ monitor_t *get_monitor_by_id(xcb_randr_output_t id)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void embrace_client(monitor_t *m, client_t *c)
|
||||
{
|
||||
if ((c->floating_rectangle.x + c->floating_rectangle.width) <= m->rectangle.x)
|
||||
c->floating_rectangle.x = m->rectangle.x;
|
||||
else if (c->floating_rectangle.x >= (m->rectangle.x + m->rectangle.width))
|
||||
c->floating_rectangle.x = (m->rectangle.x + m->rectangle.width) - c->floating_rectangle.width;
|
||||
if ((c->floating_rectangle.y + c->floating_rectangle.height) <= m->rectangle.y)
|
||||
c->floating_rectangle.y = m->rectangle.y;
|
||||
else if (c->floating_rectangle.y >= (m->rectangle.y + m->rectangle.height))
|
||||
c->floating_rectangle.y = (m->rectangle.y + m->rectangle.height) - c->floating_rectangle.height;
|
||||
}
|
||||
|
||||
void translate_client(monitor_t *ms, monitor_t *md, client_t *c)
|
||||
{
|
||||
if (frozen_pointer->action != ACTION_NONE || ms == md)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
monitor_t *make_monitor(xcb_rectangle_t rect);
|
||||
monitor_t *find_monitor(char *name);
|
||||
monitor_t *get_monitor_by_id(xcb_randr_output_t id);
|
||||
void embrace_client(monitor_t *m, client_t *c);
|
||||
void translate_client(monitor_t *ms, monitor_t *md, client_t *c);
|
||||
void update_root(monitor_t *m);
|
||||
void focus_monitor(monitor_t *m);
|
||||
|
|
4
window.c
4
window.c
|
@ -82,7 +82,9 @@ void manage_window(xcb_window_t win, rule_consequence_t *csq, int fd)
|
|||
|
||||
client_t *c = make_client(win);
|
||||
update_floating_rectangle(c);
|
||||
translate_client(monitor_from_client(c), m, c);
|
||||
monitor_t *mm = monitor_from_client(c);
|
||||
embrace_client(mm, c);
|
||||
translate_client(mm, m, c);
|
||||
if (csq->center)
|
||||
window_center(m, c);
|
||||
c->frame = csq->frame;
|
||||
|
|
Loading…
Add table
Reference in a new issue