getting the location of the native display?

Started by gareth, March 27, 2006, 16:44:24

Previous topic - Next topic

gareth


Fool Running

What exactly do you mean by "the location of" the display?
Do you mean if the top, left of the screen is (0, 0) for primary and (1281, 30) for the secondary?
If so, you can do that in Java by getting the displays:
       GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] devices = env.getScreenDevices();
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

gareth

I mean the location of the native window, that you can set with Display.setLocation(...)

Fool Running

Oh :lol:
It doesn't look like it :?
Someone else can chime in here :D

Out of curiosity, why do you need it?
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

elias4444

Sorry... I've been a slacker and haven't been hanging around the forums lately. :P

Here's what I use to center an lwjgl window on the screen:

int tempxloc = (Display.getDisplayMode().getWidth() - WIDTH)/2;
int tempyloc = (Display.getDisplayMode().getHeight() - HEIGHT)/2;
Display.setLocation(tempxloc,tempyloc);


I should note however, that I've never been able to get this to work on Linux - although it does work great on Windows.
=-=-=-=-=-======-=-=-=-=-=-
http://www.tommytwisters.com

Romain33

Hi all !

I also need to know if there is way to get the location of the native display.

I would like to know this data to save it and create the window at the same position the next time I run my program.

Thanks :)

Aivi

At start you load data, which is empty, because it wasnt create never before.So you set default position and save somewhere (to file maybe), and every next set you save position again and next start you read this data. Its simple.

Romain33

Hi Aivi !

I well understood the main way to do this  :)

My question is how can I get the location of the display as I did not see any "getLocation()" method (only getWidth() or getHeight() in DisplayMode class :-\ )

I hope my problem is a clearer for you now  ;D

Jerome


Hello everybody,

Is there a solution for this problem??
When the user moves the window by clicking on it top bar, can we receive the mouse events somewhere? How can we know that the window has moved??

Is it impossible to do that with LWJGL?  :'(

Thanks in advance for your answer !  ;)

Jerome


wolf_m

Quote from: Blobby on January 02, 2009, 16:23:23


Could someone please help us??

:'(


Currently, you can only get the location of the native window with your own code or workarounds, as I understand it.

For example, you could use an AWTGLCanvas in a Swing window and use Swing's capability of reporting where the window is. Or you could write native code to fetch window dragging operations and / or the window location at shutdown. I'm sure there are multiple other ways.

I totally agree that it's a useful feature; however, it's not an OpenGL feature. OpenGL doesn't bother with window locations, the mouse and so forth. So this is a feature that belongs to the utilities portion of LWJGL at max.

The last time I checked, windowed mode isn't supported anyway, so you'll just have to pray or bug the core team on IRC.