elisee's picture

Programmatically resizing a non-user-resizable window on Linux fails (patch included)

Project:The Open Toolkit library
Version:1.1-2014-01-02
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Using the latest OpenTK trunk (r3125) on Linux, setting a non-user-resizable (WindowBorder == Fixed) window's ClientRectangle fails to change the window size.

From what I've gathered by searching online [1], This is because WindowBorder.Fixed is implemented by setting the window min and max size to the current window size and XResizeWindow events are clamped to those min & max sizes.

The bug can be fixed by changing the ClientRectangle setter (in X11GLNative.cs) from:

set
{
    using (new XLock(window.Display))
    {
        Functions.XResizeWindow(window.Display, window.WindowHandle,
            value.Width, value.Height);
    }
    ProcessEvents();
}

to

set
{
    if( IsWindowBorderResizable )
    {
        using (new XLock(window.Display))
        {
            Functions.XResizeWindow(window.Display, window.WindowHandle,
                value.Width, value.Height);
        }
    }
    else
    {
        SetWindowMinMax( (short)value.Width, (short)value.Height, (short)value.Width, (short)value.Height );
    }
    ProcessEvents();
}

I have found no direct way to submit a patch but feel free to point me to the right place if there is one.

EDIT: I haven't had a chance to look into it yet, but I just realized other setters like Bounds and Size most likely require a similar change since they use XResizeWindow / XMoveResizeWindow.

[1] http://lists.libsdl.org/pipermail/commits-libsdl.org/2011-April/004122.h...


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

#1

Version:1.x-dev» 1.1-2014-01-02
Status:open» closed

Thank you for the bug report, this was fixed in 1.1-beta4.