mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-11-04 13:29:56 -05:00
opt:Optimize click-to-focus strategies
This commit is contained in:
parent
67eb70a822
commit
65b7174487
1 changed files with 10 additions and 4 deletions
14
main.c
14
main.c
|
|
@ -1579,11 +1579,11 @@ buttonpress(struct wl_listener *listener, void *data) {
|
||||||
uint32_t mods;
|
uint32_t mods;
|
||||||
Client *c;
|
Client *c;
|
||||||
const Button *b;
|
const Button *b;
|
||||||
|
double sx, sy;
|
||||||
|
struct wlr_surface *surface = NULL;
|
||||||
|
|
||||||
// without this when change focus from x11 app to wayland app
|
|
||||||
// it will still focus to the last x11 app after click
|
|
||||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
|
||||||
// IDLE_NOTIFY_ACTIVITY;
|
// IDLE_NOTIFY_ACTIVITY;
|
||||||
|
|
||||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
|
||||||
switch (event->state) {
|
switch (event->state) {
|
||||||
|
|
@ -1594,7 +1594,7 @@ buttonpress(struct wl_listener *listener, void *data) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Change focus if the button was _pressed_ over a client */
|
/* Change focus if the button was _pressed_ over a client */
|
||||||
xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL);
|
xytonode(cursor->x, cursor->y, NULL, &c, NULL, &sx, &sy);
|
||||||
if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
|
if (c && (!client_is_unmanaged(c) || client_wants_focus(c)))
|
||||||
focusclient(c, 1);
|
focusclient(c, 1);
|
||||||
|
|
||||||
|
|
@ -1635,6 +1635,10 @@ buttonpress(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
/* If the event wasn't handled by the compositor, notify the client with
|
/* If the event wasn't handled by the compositor, notify the client with
|
||||||
* pointer focus that a button press has occurred */
|
* pointer focus that a button press has occurred */
|
||||||
|
surface = c ? client_surface(c) : NULL;
|
||||||
|
if(surface && c == selmon->sel) {
|
||||||
|
wlr_seat_pointer_notify_enter(seat, surface, sx, sy);
|
||||||
|
}
|
||||||
wlr_seat_pointer_notify_button(seat, event->time_msec, event->button,
|
wlr_seat_pointer_notify_button(seat, event->time_msec, event->button,
|
||||||
event->state);
|
event->state);
|
||||||
}
|
}
|
||||||
|
|
@ -2626,6 +2630,8 @@ void focusclient(Client *c, int lift) {
|
||||||
selmon = c->mon;
|
selmon = c->mon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wlr_seat_pointer_notify_clear_focus(seat);
|
||||||
|
|
||||||
if (selmon && selmon->sel && selmon->sel->foreign_toplevel) {
|
if (selmon && selmon->sel && selmon->sel->foreign_toplevel) {
|
||||||
wlr_foreign_toplevel_handle_v1_set_activated(selmon->sel->foreign_toplevel,
|
wlr_foreign_toplevel_handle_v1_set_activated(selmon->sel->foreign_toplevel,
|
||||||
false);
|
false);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue