fire-eggs / YAIV

"Yet Another Image Viewer"
MIT License
3 stars 0 forks source link

Fixing borderless windows for KDE Plasma #117

Open fire-eggs opened 1 year ago

fire-eggs commented 1 year ago

Borderless windows currently doesn't work on KDE plasma. The following chunks of code, pulled from feh is how it implements borderless windows, and it works on KDE.

typedef struct _mwmhints {
    unsigned long flags;
    unsigned long functions;
    unsigned long decorations;
    long input_mode;
    unsigned long status;
} MWMHints;

...
    memset(&mwmhints, 0, sizeof(mwmhints));
    if (opt.borderless || ret->full_screen) {
        prop = XInternAtom(disp, "_MOTIF_WM_HINTS", True);
        if (prop == None) {
            weprintf
                ("Window Manager does not support MWM hints. "
                 "To get a borderless window I have to bypass your wm.");
            attr.override_redirect = True;
            mwmhints.flags = 0;
        } else {
            mwmhints.flags = MWM_HINTS_DECORATIONS;
            mwmhints.decorations = 0;
        }
    }

...

    // ret->win is the result from XCreateWindow - a Window
    if (mwmhints.flags) {
        XChangeProperty(disp, ret->win, prop, prop, 32,
                PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS);
    }