Bug 54495

Summary: Not resizable windows can be resized
Product: [Plasma] kwin Reporter: russell
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description russell 2003-02-11 20:21:16 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Compiled From Sources
Compiler:          gcc 3.2 
OS:          Linux

One request and one Bug report in kwin.

The request; would it be possible to have a mechanism to disable resizing for certain classes of window. Other WM's allow this; for example in fvwm a system.fvwmrc entry of the form:

Style "MyApp" NoHandles

which causes fvwm to not provide window resize handles on windows of the class "MyApp".

Second, the bug report (found as I resorted to trying the MWM hints to provide the functionality requested above; if anyone can suggest a way of telling kwin not to allow user-resizing I'd love to hear it).

If you set MWM_FUNC_RESIZE off then Kwin lowlights the "Size" option in the pulldown menu and does not change the cursor when the mouse hovers over the borders or corners. This is Good.

However, one can still resize the window by dragging on the border or corners. This is Not Good :-(

I realise (from the comments in the source) that support for the MWM hints is somewhat reluctant but it *is* broken in this respect.

A sample program top illustrate is provided below. Compile with
(for me) gcc -I/usr/X11R6/include breakkwin.c -L/usr/X11R6/lib -lX11

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <Xm/MwmUtil.h>

main(argc, argv)
int argc;
char *argv[];
{
    Display *Xdisplay;  /* X display connection */
    Window window;      /* X window identifier */
    XEvent event;       /* holds X server events */
    XWMHints *xwmh;     /* Window state hints for window manager */
    XSizeHints *xsh;    /* Size hints for window manager */
    XClassHint class_hints;     /* Class hints for window manager */
    char *name = "Decor";
    XTextProperty window_name;
    XTextProperty icon_name;
    PropMotifWmHints mwm_hints;
    Atom xa_MOTIF_WM_HINTS;

    if ((Xdisplay = XOpenDisplay(NULL)) == NULL) {
        fprintf(stderr, "Can't open %s\n", XDisplayName(NULL));
        return(1);
    }

    xwmh = XAllocWMHints();
    xwmh->flags = InputHint|StateHint;
    xwmh->input = True;
    xwmh->initial_state = NormalState;

    xsh = XAllocSizeHints();
    xsh->flags = (PSize | PMinSize);
    xsh->height = 150;
    xsh->width = 150;
    xsh->min_height = 100;
    xsh->min_width = 100;

    class_hints.res_class = "Decor";
    if (strrchr(argv[0], '/') == NULL)
        class_hints.res_name = argv[0];
    else
        class_hints.res_name = strrchr(argv[0], '/') + 1;

    window = XCreateSimpleWindow(Xdisplay,
        DefaultRootWindow(Xdisplay),
        xsh->x, xsh->y,   xsh->width, xsh->height,   2,
        WhitePixel(Xdisplay, DefaultScreen(Xdisplay)),
        BlackPixel(Xdisplay, DefaultScreen(Xdisplay)));

    XStringListToTextProperty( &name, 1, &window_name );
    XStringListToTextProperty( &name, 1, &icon_name );



    XSetWMProperties(Xdisplay, window, &window_name, &icon_name, argv,
        argc, xsh, xwmh, &class_hints);

    mwm_hints.flags = MWM_HINTS_FUNCTIONS;
    mwm_hints.functions = MWM_FUNC_ALL;
    mwm_hints.functions |= MWM_FUNC_RESIZE;
    xa_MOTIF_WM_HINTS = XInternAtom(Xdisplay, _XA_MOTIF_WM_HINTS, False);
    XChangeProperty(Xdisplay, window,
        xa_MOTIF_WM_HINTS, xa_MOTIF_WM_HINTS, 32, PropModeReplace,
        (unsigned char *) &mwm_hints, 5);

    XSelectInput(Xdisplay, window, StructureNotifyMask | ButtonPressMask);

    XMapWindow(Xdisplay, window);
    XSync(Xdisplay, 0);

    for (;;) {
        XNextEvent(Xdisplay, &event);
        switch (event.type) {
        case ButtonPress:
        case DestroyNotify:
            XCloseDisplay(Xdisplay);
            return(0);
        }
    }
}
Comment 1 Lubos Lunak 2003-02-12 11:14:15 UTC
*** Bug 54523 has been marked as a duplicate of this bug. ***
Comment 2 Stephan Binner 2003-02-15 00:04:23 UTC
>  One request and one Bug report in kwin. 
 
Please file separate reports for such things. 
Comment 3 Lubos Lunak 2003-04-14 16:37:37 UTC
Confirming. Windows with Client::isResizable() == true can be still actually resized. 
 
Comment 4 Lubos Lunak 2003-06-17 19:25:58 UTC
It should be fixed in KDE-3.1.3.