mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-20 01:40:18 -05:00
opt: make x11 unmanaged window coordinate auto ajust the monitor change
This commit is contained in:
parent
53ee82a726
commit
bc52b95c1e
1 changed files with 27 additions and 6 deletions
33
src/mango.c
33
src/mango.c
|
|
@ -944,6 +944,7 @@ static struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor = {
|
|||
.notify = handle_keyboard_shortcuts_inhibit_new_inhibitor};
|
||||
|
||||
#ifdef XWAYLAND
|
||||
static void fix_xwayland_unmanaged_coordinate(struct wlr_box *box);
|
||||
static int32_t synckeymap(void *data);
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void configurex11(struct wl_listener *listener, void *data);
|
||||
|
|
@ -3914,18 +3915,19 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||
*/
|
||||
if (client_is_unmanaged(c)) {
|
||||
/* Unmanaged clients always are floating */
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
fix_xwayland_unmanaged_coordinate(&c->geom);
|
||||
LISTEN(&c->surface.xwayland->events.set_geometry, &c->set_geometry,
|
||||
setgeometrynotify);
|
||||
}
|
||||
#endif
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrOverlay]);
|
||||
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
|
||||
if (client_wants_focus(c)) {
|
||||
focusclient(c, 1);
|
||||
exclusive_focus = c;
|
||||
}
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
LISTEN(&c->surface.xwayland->events.set_geometry, &c->set_geometry,
|
||||
setgeometrynotify);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -6072,6 +6074,25 @@ void virtualpointer(struct wl_listener *listener, void *data) {
|
|||
}
|
||||
|
||||
#ifdef XWAYLAND
|
||||
void fix_xwayland_unmanaged_coordinate(struct wlr_box *box) {
|
||||
if (!selmon)
|
||||
return;
|
||||
if (box->x >= selmon->m.x && box->x <= selmon->m.x + selmon->m.width &&
|
||||
box->y >= selmon->m.y && box->y <= selmon->m.y + selmon->m.height)
|
||||
return;
|
||||
|
||||
Monitor *source_monitor = xytomon(box->x, box->y);
|
||||
|
||||
if (!source_monitor)
|
||||
return;
|
||||
|
||||
int xoffset = box->x - source_monitor->m.x;
|
||||
int yoffset = box->y - source_monitor->m.y;
|
||||
|
||||
box->x = selmon->m.x + xoffset;
|
||||
box->y = selmon->m.y + yoffset;
|
||||
}
|
||||
|
||||
int32_t synckeymap(void *data) {
|
||||
reset_keyboard_layout();
|
||||
// we only need to sync keymap once
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue