mirror of
https://github.com/vale981/bspwm
synced 2025-03-05 18:01:37 -05:00
Window dragging: transfer node to underlying monitor
This commit is contained in:
parent
5c5405e3d4
commit
fe1cd3b233
3 changed files with 23 additions and 0 deletions
5
events.c
5
events.c
|
@ -362,6 +362,11 @@ void button_release(void)
|
|||
|
||||
xcb_ungrab_pointer(dpy, XCB_CURRENT_TIME);
|
||||
update_floating_rectangle(frozen_pointer->node->client);
|
||||
monitor_t *m = underlying_monitor(frozen_pointer->node->client);
|
||||
if (m != NULL && m != frozen_pointer->monitor) {
|
||||
transfer_node(frozen_pointer->monitor, frozen_pointer->desktop, m, m->desk, frozen_pointer->node);
|
||||
select_monitor(m);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_state(monitor_t *m, desktop_t *d, node_t *n, xcb_atom_t state, unsigned int action)
|
||||
|
|
16
window.c
16
window.c
|
@ -39,6 +39,22 @@ bool locate_desktop(char *name, desktop_location_t *loc)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool is_inside(monitor_t *m, xcb_point_t p)
|
||||
{
|
||||
xcb_rectangle_t r = m->rectangle;
|
||||
return (r.x <= p.x && p.x < (r.x + r.width)
|
||||
&& r.y <= p.y && p.y < (r.y + r.height));
|
||||
}
|
||||
|
||||
monitor_t *underlying_monitor(client_t *c)
|
||||
{
|
||||
xcb_point_t p = (xcb_point_t) {c->floating_rectangle.x, c->floating_rectangle.y};
|
||||
for (monitor_t *m = mon_head; m != NULL; m = m->next)
|
||||
if (is_inside(m, p))
|
||||
return m;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void manage_window(monitor_t *m, desktop_t *d, xcb_window_t win)
|
||||
{
|
||||
window_location_t loc;
|
||||
|
|
2
window.h
2
window.h
|
@ -8,6 +8,8 @@
|
|||
|
||||
bool locate_window(xcb_window_t, window_location_t *);
|
||||
bool locate_desktop(char *, desktop_location_t *);
|
||||
bool is_inside(monitor_t *, xcb_point_t);
|
||||
monitor_t *underlying_monitor(client_t *);
|
||||
void manage_window(monitor_t *, desktop_t *, xcb_window_t);
|
||||
void adopt_orphans(void);
|
||||
void window_draw_border(node_t *, bool, bool);
|
||||
|
|
Loading…
Add table
Reference in a new issue