Bug 205597 - XSetWMNormalHints ( .. PResizeInc ) shrinks the window
Summary: XSetWMNormalHints ( .. PResizeInc ) shrinks the window
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kwin
Classification: Plasma
Component: compatibility (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-29 17:48 UTC by Werner Heisch
Modified: 2023-07-06 11:03 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Werner Heisch 2009-08-29 17:48:09 UTC
Version:            (using KDE 4.3.0)
Compiler:          gcc 4.3.34 
OS:                Linux
Installed from:    SuSE RPMs

If XSetWMNormalHints  manipulate  PResizeInc, the window shrinks.
Normally, it should not change, onla the grif for next manual resize should be set.

This is a demonstration program:

// List:       kwin
// kore of this example was stolen from
// Subject:    [Bug 120353] New: XSetWMNormalHints / PMaxSize doesn't work correctly
// From:       dmitry from spb <hail () pochtamt ! ru>
// Version:           KWin 3.0 (using KDE 3.5.10)
// Installed from:    Opensuse 11.1
// OS:                Linux

// Please, run the attached test case.

// 1. You will see the simple window.
// 2. You will see, how the window. is shrinking.

// SOURCE CODE
// ===============================
// gcc X11-Grid.c -L /usr/X11R6/lib -l X11

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#define BORDER_WIDTH 2


/* Program wide globals */
Display *theDisplay;
int theScreen;
int theDepth;

XSizeHints theSizeHints;



Window OpenWindow(int x, int y, int width, int height, int flag) {

        XSetWindowAttributes theWindowAttributes;
        unsigned long theWindowMask;
        XWMHints theWMHints;
        Window theNewWindow;

long supplied_return;

        /*Setting the attributes*/
        theWindowAttributes.border_pixel
                =BlackPixel(theDisplay,theScreen);
        theWindowAttributes.background_pixel
                = WhitePixel(theDisplay,theScreen);
        theWindowAttributes.override_redirect = False;

        theWindowMask = CWBackPixel|CWBorderPixel|CWOverrideRedirect;

        theNewWindow = XCreateWindow( theDisplay,
                        RootWindow(theDisplay,theScreen),
                        x,y,width,height,
                        BORDER_WIDTH,theDepth,
                        InputOutput,
                        CopyFromParent,
                        theWindowMask,
                        &theWindowAttributes);


        theWMHints.initial_state = NormalState;
        theWMHints.flags = StateHint;


        XSetWMHints(theDisplay,theNewWindow,&theWMHints);


	theSizeHints.flags = PPosition | PSize | PMaxSize | PResizeInc;

        theSizeHints.x = x;
        theSizeHints.y = y;
        theSizeHints.width = width;
        theSizeHints.height = height;

	theSizeHints.max_width = 1000;
	theSizeHints.max_height = 800;
	theSizeHints.width_inc = 10;
	theSizeHints.height_inc = 10;

        XSetWMNormalHints(theDisplay,theNewWindow,&theSizeHints);

        XMapWindow(theDisplay,theNewWindow);
        XFlush(theDisplay);

        return theNewWindow;
}


int main(void){

        Window theWindow;

        int i;

        theDisplay = XOpenDisplay(NULL);

        theScreen = DefaultScreen(theDisplay);
        theDepth = DefaultDepth(theDisplay,theScreen);

        theWindow = OpenWindow(150,150,500,500,0);
        XFlush(theDisplay);

/* here, the window is shrinking  */

        for (i=0;i<20;i++) {

		usleep(100000L);
		theSizeHints.flags |= PResizeInc;
		theSizeHints.width_inc = 10+i;
		theSizeHints.height_inc = 10+i;
        	XSetWMNormalHints(theDisplay,theWindow,&theSizeHints);

        	XMapWindow(theDisplay,theWindow);
        	XFlush(theDisplay);
        }

        sleep(2);
        XDestroyWindow(theDisplay,theWindow);
}
Comment 1 Thomas Lübking 2012-03-17 22:42:00 UTC
Moving to core for discussion, this is likely the source of our emacs issue ;-)
The X11 progr. manual indeed only says "on map and on resize attempts" (though this is actually pointless because if a window has a ratio preference and signals that it should as well enter this preferred ratio - before telling others that it likes it)

No idea, fix -ie. change- is to simply not update geometry in getWmNormalHints - ie remove the final "if (isManaged())" block.
Comment 2 Thomas Lübking 2012-03-17 22:43:44 UTC
meh, 'm stupid - there's a compat section =)
Comment 3 Justin Zobel 2021-03-10 00:12:41 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.