LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: tomb on March 25, 2005, 12:56:44

Title: What happened with Window.getX() and Window.gety()?
Post by: tomb on March 25, 2005, 12:56:44
I can't find a way to get the position of the frame after Window and Display was merged. Is it possible to add getX() and getY() to the Display class?

Also think isVSyncEnabled() is missing.
Title: What happened with Window.getX() and Window.gety()?
Post by: Matzon on March 25, 2005, 14:04:26
there is an api call for positioning the window (so you can choose to track that yourself) - however a layout manager may choose to place it somewhere else, and noone thought of adding a way of getting the position of the window.

isVSyncEnabled was removed, afaik, because it really didn't work anyway. And enabling vsync is only suggestive.
Title: What happened with Window.getX() and Window.gety()?
Post by: tomb on March 25, 2005, 21:19:11
Quote from: "Matzon"there is an api call for positioning the window (so you can choose to track that yourself) - however a layout manager may choose to place it somewhere else, and noone thought of adding a way of getting the position of the window.
I know about Display.setLocation(int, int). But the user can move the window around. I need the position of the frame when I do mode switching to make sure position is preserved and that the frame fits the screen etc. I hope you can put it back in.

Quote from: "Matzon"isVSyncEnabled was removed, afaik, because it really didn't work anyway. And enabling vsync is only suggestive.
Yeah, I assumed as much.
Title: Re: What happened with Window.getX() and Window.gety()?
Post by: gima on April 15, 2010, 11:53:50
Functionality I need:
I beg of the coders to implements the functionality that I can get the following information via a method call(s):

Definitions:
"the window" = The window, that Display.create() creates, when not in fullscreen-mode.
"client area" = The area of a window that doesn't encompass windows' title bar and borders. In LWJGL it the area that OpenGL surface inhabits.

Reasoning:
I need this in a project with multi-touch (TUIO) input handling. I cannot map the input coordinates inside my application, without manually moving the window to correct position, which (if required) would be brain-dead stupid.

Example:

Now a touch-input arrives at the monitor's pixel coordinates 10,10. How do I know to ignore it, since I don't know where the LWJGL OpenGL window is at?
Same thing if the touch arrives on top of the window, where it should interact with the application somehow. No way to know that it hit the window. Don't suggest that I preset the position inside my code and have the window moved to the correct position on the screen.



It is disturbing to read that it "couldn't be done".

Pointers to more or less complete code fragments and/or reference material:

Windows:
It's dead-simple in Windows:
GetClientRect function: http://msdn.microsoft.com/en-us/library/ms633503%28v=VS.85%29.aspx (http://msdn.microsoft.com/en-us/library/ms633503%28v=VS.85%29.aspx)

X Window System:
I don't know for sure, but I think that the decorating window created by a window manager has another window handle, and thus the following function will return just the "client area", when used on the LWJGL window's handle.

You can get the information via this function:
http://www.xfree86.org/4.4.0/XGetWindowAttributes.3.html (http://www.xfree86.org/4.4.0/XGetWindowAttributes.3.html)

Mac:
I'm sorry about this area's lack of knowledge on my part, but I have no personal experience about coding for Mac. I have tried my best to look up possible solutions to this. I think they pretty much cover it.





I wouldn't mind some input on this. Especially on whether the powers-that-be think this is worth implementing, so I don't wait in vain.

Title: Re: What happened with Window.getX() and Window.gety()?
Post by: Matzon on April 15, 2010, 12:36:36
I am sure that we could add it quickly, if a patch was supplied - other than that it would be prioritized somehow
Title: Re: What happened with Window.getX() and Window.gety()?
Post by: basil on December 23, 2010, 10:57:19
any news on that topic ?
Title: Re: What happened with Window.getX() and Window.gety()?
Post by: Matthias on December 25, 2010, 12:56:10
basil: you could use an AWT Frame + Canvas and Display.setParent - the bounds of the canvas will match 1:1 with the size of your OpenGL display then. This will also allow you to resize your app dynamically. But beware of threading issues when you use listeners.
Title: Re: What happened with Window.getX() and Window.gety()?
Post by: basil on December 25, 2010, 20:51:55
cheers, that's the way I go too atm.

just wondering if it can work with a native window.