1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Cleanup focus handling code on propagation

Signed-off-by: Tin <tin.svagelj@live.com>
This commit is contained in:
Tin 2023-11-10 03:20:18 +01:00 committed by Brenden Matthews
parent 965d7dc0a4
commit a3fc61b078
No known key found for this signature in database
GPG Key ID: 137B7AC2BDFD8DF0

View File

@ -1371,12 +1371,16 @@ void propagate_x11_event(XEvent &ev) {
i_ev->common.y = i_ev->common.y_root; i_ev->common.y = i_ev->common.y_root;
} }
XSendEvent(display, window.desktop, False, window.event_mask, &ev); XSendEvent(display, window.desktop, False, window.event_mask, &ev);
// FIXME (before-merge): Should we be setting input focus after forwarding
// events? int _revert_to;
if (false && ev.type == ButtonPress) { Window focused;
XSetInputFocus(display, window.desktop, RevertToNone, i_ev->common.time); XGetInputFocus(display, &focused, &_revert_to);
} else if (false && ev.type == MotionNotify) { if (focused == window.window) {
XSetInputFocus(display, window.window, RevertToParent, i_ev->common.time); Time time = CurrentTime;
if (i_ev != nullptr) {
time = i_ev->common.time;
}
XSetInputFocus(display, window.desktop, RevertToPointerRoot, time);
} }
} }
@ -1384,12 +1388,12 @@ void propagate_x11_event(XEvent &ev) {
// Assuming parent has a simple linear stack of descendants, this function // Assuming parent has a simple linear stack of descendants, this function
// returns the last leaf on the graph. // returns the last leaf on the graph.
inline Window last_descendant(Display* display, Window parent) { inline Window last_descendant(Display* display, Window parent) {
Window ignored, *children; Window _ignored, *children;
uint32_t count; uint32_t count;
Window current = parent; Window current = parent;
while (XQueryTree(display, current, &ignored, &ignored, &children, &count) && count != 0) { while (XQueryTree(display, current, &_ignored, &_ignored, &children, &count) && count != 0) {
current = children[count - 1]; current = children[count - 1];
XFree(children); XFree(children);
} }