mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-15 05:34:17 -04:00
opt: better x11 coordinate adjust
This commit is contained in:
parent
9343874a22
commit
ca89e07be8
1 changed files with 9 additions and 16 deletions
25
src/mango.c
25
src/mango.c
|
|
@ -954,7 +954,7 @@ static struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor = {
|
||||||
.notify = handle_keyboard_shortcuts_inhibit_new_inhibitor};
|
.notify = handle_keyboard_shortcuts_inhibit_new_inhibitor};
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
static void fix_xwayland_unmanaged_coordinate(struct wlr_box *box);
|
static void fix_xwayland_unmanaged_coordinate(Client *c);
|
||||||
static int32_t synckeymap(void *data);
|
static int32_t synckeymap(void *data);
|
||||||
static void activatex11(struct wl_listener *listener, void *data);
|
static void activatex11(struct wl_listener *listener, void *data);
|
||||||
static void configurex11(struct wl_listener *listener, void *data);
|
static void configurex11(struct wl_listener *listener, void *data);
|
||||||
|
|
@ -1386,7 +1386,7 @@ void applyrules(Client *c) {
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (c->isfloating && client_is_x11(c)) {
|
if (c->isfloating && client_is_x11(c)) {
|
||||||
fix_xwayland_unmanaged_coordinate(&c->geom);
|
fix_xwayland_unmanaged_coordinate(c);
|
||||||
c->float_geom = c->geom;
|
c->float_geom = c->geom;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3859,7 +3859,7 @@ mapnotify(struct wl_listener *listener, void *data) {
|
||||||
/* Unmanaged clients always are floating */
|
/* Unmanaged clients always are floating */
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
if (client_is_x11(c)) {
|
if (client_is_x11(c)) {
|
||||||
fix_xwayland_unmanaged_coordinate(&c->geom);
|
fix_xwayland_unmanaged_coordinate(c);
|
||||||
LISTEN(&c->surface.xwayland->events.set_geometry, &c->set_geometry,
|
LISTEN(&c->surface.xwayland->events.set_geometry, &c->set_geometry,
|
||||||
setgeometrynotify);
|
setgeometrynotify);
|
||||||
}
|
}
|
||||||
|
|
@ -6037,23 +6037,16 @@ void virtualpointer(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
void fix_xwayland_unmanaged_coordinate(struct wlr_box *box) {
|
void fix_xwayland_unmanaged_coordinate(Client *c) {
|
||||||
if (!selmon)
|
if (!selmon)
|
||||||
return;
|
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)
|
// 1. 如果窗口已经在当前活动显示器内,直接返回
|
||||||
|
if (c->geom.x >= selmon->m.x && c->geom.x < selmon->m.x + selmon->m.width &&
|
||||||
|
c->geom.y >= selmon->m.y && c->geom.y < selmon->m.y + selmon->m.height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Monitor *source_monitor = xytomon(box->x, box->y);
|
c->geom = setclient_coordinate_center(c, selmon, c->geom, 0, 0);
|
||||||
|
|
||||||
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) {
|
int32_t synckeymap(void *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue