emacinnes's picture

LINUX X, Y, Width, Height not being updated.

Project:The Open Toolkit library
Category:bug report

Taking the same OpenTK.dll that was just fixed and then applying this to the Linux build, I now get a very different size updating bug. Now the X, Y don't change, and the Width.Height reduce to ~32x32 pixels regardless of the Width/Height setting.

To reproduce bug, create the gamewindow, then once it's up, move and resize the window. I'm setting X, Y, Width and Height at the same time.

This is on Fedora Core 11 64 bit.


Comment viewing options

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


Are you using KDE, Gnome or something else entirely?

X/Y/Width/Height seem to be updating correctly when you move the window here (Ubuntu 9.10, Gnome), but I am getting nasty crashes when trying to move or resize the window programmatically (see #1598: GameWindow states sample crashes on Ubuntu and #1599: GameWindow.X or Y don't work correctly on Linux ). I'm pretty sure these issues are linked somehow, but I haven't been able to find the cause yet.

emacinnes's picture


I did a Console.Write on the Size parameter, like so:

public Size Size
get { return Bounds.Size; }
int width = value.Width - border_width;
int height = value.Height - border_width;
width = width < 0 ? 1 : width;
height = height < 0 ? 1 : height;

Console.WriteLn("Setting Size to " + width.ToString() + " x " + height.ToString());

Functions.XResizeWindow(window.Display, window.WindowHandle, width, height);

And I got these results:

Setting Size to 999 x 0
Setting Size to 0 x 801

I think the width = line should be:

width = width <= 0 ? 1 : width;
width = height <= 0 ? 1 : height;

it must be >1, not >=0, the =0 is causing my BadValue.

However that's not the only issue here, as I'm not setting the width or height to be 0, what I'm doing is a Width = 999 followed by a Height = 801.

I'm not getting the "correct" result yet, the bounds update event isn't occuring inbetween the width and height value, so the "current" value for width or height isn't updated, and the following Height call is causing the width to be reset to 1. The height does look like it was correctly updated.

I think therefore each Width and Height then must manually update the bounds value with the change, so that it's internally consistent.

the Fiddler's picture


Version:1.x-dev» 0.9.x-dev
Status:open» need info

I still can't confirm this on my Ubuntu installation. Setting Width or Height shouldn't (and doesn't) reset the other member to 0.

In other words, this works correctly:

this.Width = 999;
this.Height = 801;

Are you using KDE by any chance? All my testing so far has been on Gnome but it wouldn't be the first time some incompatibility like this would arise.

Edit: I have fixed a couple of issues in r2609 which might indirectly affect this problem. Might be useful to run an update and try again.

emacinnes's picture


No, it is definitely GNome. I'm updating and will test it.

emacinnes's picture


I've tested it, Fedora Core 11, GNome, Mono 2.4, OpenTK 2606. it isn't working. X and Y are continuing to not do anything, and Width/Height current values keep returning 0, so the set Width = 45; Height = 64 results in a window that is 1 x 64 pixels.

If I put in a SetBounds function that does a single call to XSizeWindow, then this works as-expected for me.

EDIT: The X and Y still don't do anything, I'll try an additional single XMoveWindow function call, SetPosition, to see if that actually works on Fedora. the single value at a time approach doens't seem to want to work properly.

the Fiddler's picture


Priority:normal» critical
Status:need info» open

Bumping priority, this should be resolved before the release candidate. I will try to reproduce on the livecd for Fedora 11.

the Fiddler's picture


Version:0.9.x-dev» 1.0-beta-3

I still cannot reproduce the Width/Height issue on Fedora LiveCD / VirtualBox / Mesa 7.5. They seem to behave exactly like on my Ubuntu and Arch installations.

X and Y properties are completely buggy on all platforms. I'm still trying to work out the cause, but I think these issues may be linked somehow.

the Fiddler's picture


Status:open» in progress

Alright, I have managed to reproduce the issue and I am working on a fix. So far, I have gotten Width and Height to work correctly, but I am still having problems with X and Y.

the Fiddler's picture


And as always, the X and Y issue was caused by something completely dumb: XMoveWindow was p/invoking XResizeWindow. Ugh, at least it's working now.

I'll tie up some loose ends and commit the fix.

the Fiddler's picture


Status:in progress» fixed

Alright, fixed in r2628, thanks for the bug report!

There's still a small issue regarding the Bounds property with WindowBorder.Hidden (#1625: NativeWindow.Bounds do not reflect border size on Linux), but the rest should now work correctly.