What happened with Window.getX() and Window.gety()?

Started by tomb, March 25, 2005, 12:56:44

Previous topic - Next topic

tomb

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.

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.

isVSyncEnabled was removed, afaik, because it really didn't work anyway. And enabling vsync is only suggestive.

tomb

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.

gima

Functionality I need:
I beg of the coders to implements the functionality that I can get the following information via a method call(s):

  • Bounding rectancle (in pixels?) of the window's client area.

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:

  • My monitor's resolution is 1280 x 1024.
  • The LWJGL window has a size of 640 x 480 and resides somewhere near the center of the screen, say, at pixel coordinates 400, 250.

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

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

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.


Matzon

I am sure that we could add it quickly, if a patch was supplied - other than that it would be prioritized somehow

basil


Matthias

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.

basil

cheers, that's the way I go too atm.

just wondering if it can work with a native window.