Bug 120353 - XSetWMNormalHints / PMaxSize doesn't work correctly
Summary: XSetWMNormalHints / PMaxSize doesn't work correctly
Status: RESOLVED DUPLICATE of bug 67577
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-17 23:20 UTC by dmitry cherepanov
Modified: 2006-01-20 11:45 UTC (History)
1 user (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 dmitry cherepanov 2006-01-17 23:20:03 UTC
Version:           KWin 3.0 (using KDE KDE 3.4.2)
Installed from:    Slackware Packages
OS:                Linux

Please, run the attached test case.

1. You will see the simple window.
2. Try to maximize this window.
BUT no maximize button available.

In this test I'm using XSetWMNormalHints / PMaxSize in order to specify maximum size.
This leads to removing _NET_WM_ACTION_MAXIMIZE_XXX from _NET_WM_ALLOWED_ACTIONS.

This behaviour is different from others window managers (metacity / wmaker).

SOURCE CODE
===============================
// gcc test.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;

Window OpenWindow(int x, int y, int width, int height, int flag){
        XSetWindowAttributes theWindowAttributes;
        unsigned long theWindowMask;
        XSizeHints theSizeHints;
        XWMHints theWMHints;
        Window theNewWindow;

        /*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);

	// PMaxSize doesn't work
	theSizeHints.flags = PPosition | PSize | PMaxSize | PResizeInc;
        theSizeHints.x = x;
        theSizeHints.y = y;
        theSizeHints.width = width;
        theSizeHints.height = height;
	theSizeHints.max_width = 200;
	theSizeHints.max_height = 200;
	theSizeHints.width_inc = 10;
	theSizeHints.height_inc = 10;

        XSetWMNormalHints(theDisplay,theNewWindow,&theSizeHints);

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


        return theNewWindow;
}


int main(void){
        Window theWindow;

        theDisplay = XOpenDisplay(NULL);

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

        theWindow = OpenWindow(50,50,100,100,0);
        XFlush(theDisplay);

        sleep(100);
        XDestroyWindow(theDisplay,theWindow);
}
Comment 1 Lubos Lunak 2006-01-19 09:41:33 UTC
The window says the maximum size is 200x200. Maximizing would make the window larger than that.


*** This bug has been marked as a duplicate of 67577 ***
Comment 2 Oleg Sukhodolsky 2006-01-20 11:04:24 UTC
I thought that PMaxSize hints are supposed to control size for maximized window 
too.  Is there any other way to specify maximum size and keep the window 
maximizable?
Comment 3 Lubos Lunak 2006-01-20 11:45:32 UTC
KWin currently interprets "maximized" as "as large as the workarea".