Conky: Mouse right click does not work for me on Linux after a0d4393

Created on 18 Dec 2018  路  4Comments  路  Source: brndnmtthws/conky

Hi. Mouse right click does not work for me on Linux after a0d4393, and worked with this patch. Why?

bug

Most helpful comment

If you want XShape functionality to reliably work under all window managers, it should be called after the application receives MapNotify. Also, some WMs (Openbox) have an invisible parent window even when _NET_WM_WINDOW_TYPE is set to _NET_WM_WINDOW_TYPE_DESKTOP, and thus should apply the same code to the parent. For example:

while (XPending(display) > 0) {
    XEvent ev;
    XNextEvent(display, &ev);
    switch (ev.type) {
        /* ... */
        case MapNotify: {
            Window root = DefaultRootWindow(display);
            Window win = w->w;
            while (win != None) {
                Region region;
                if ((region = XCreateRegion())) {
                    XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet);
                    XDestroyRegion(region);
                }
                Window parent;
                find_parent(win, &parent);
                win = (parent == root ? None : parent);
            }
            XFlush(display);
            break;
        }
    }
}

Sincerely, someone who spent far too long debugging this in a separate project.

All 4 comments

Unfortunately having the XShape stuff in main_loop() causes a crash in some cases. I wasn't able to find the correct magic incantation to make Xlib happy in that case.

If you want XShape functionality to reliably work under all window managers, it should be called after the application receives MapNotify. Also, some WMs (Openbox) have an invisible parent window even when _NET_WM_WINDOW_TYPE is set to _NET_WM_WINDOW_TYPE_DESKTOP, and thus should apply the same code to the parent. For example:

while (XPending(display) > 0) {
    XEvent ev;
    XNextEvent(display, &ev);
    switch (ev.type) {
        /* ... */
        case MapNotify: {
            Window root = DefaultRootWindow(display);
            Window win = w->w;
            while (win != None) {
                Region region;
                if ((region = XCreateRegion())) {
                    XShapeCombineRegion(display, w->w, ShapeInput, 0, 0, region, ShapeSet);
                    XDestroyRegion(region);
                }
                Window parent;
                find_parent(win, &parent);
                win = (parent == root ? None : parent);
            }
            XFlush(display);
            break;
        }
    }
}

Sincerely, someone who spent far too long debugging this in a separate project.

@wacossusca34 good to know, thanks for the input.

@brndnmtthws is the suggestion made above good to merge? It seems like it should work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moyamo picture moyamo  路  3Comments

ghost picture ghost  路  4Comments

akorop picture akorop  路  3Comments

sdban picture sdban  路  4Comments

zero77 picture zero77  路  3Comments