Hello Guest

[FIXED] Minor: Linux Center Problem

  • 4 Replies
  • 9421 Views
[FIXED] Minor: Linux Center Problem
« on: December 13, 2010, 02:20:18 »
Minor bug (if you can even call it that).  On Windows, the window is centered with location set to (-1,-1).  On Linux, it just places it at the top left corner.
cool story, bro

*

Offline kappa

  • *****
  • 1319
Re: [BUG] Minor: Linux Center Problem
« Reply #1 on: January 19, 2011, 15:21:21 »
Basically what is LWJGL's Default behaviour when using Display.setLocation(-1, -1)?

The JavaDoc says if no location is set or if it is set to (-1,-1) the window will be centred.

Accordingly, I'll have a look soon to see if it can be changed and made the default behaviour on Linux.
« Last Edit: January 22, 2011, 22:28:12 by kappa »

*

Offline kappa

  • *****
  • 1319
Re: [BUG] Minor: Linux Center Problem
« Reply #2 on: July 04, 2011, 23:07:23 »
I finally got a chance to have a look at this bug. The issue is that the Display window isn't centered when created on linux although Display.setLocation() works fine.

The LWJGL code seems to be providing the correct values and probably worked as expected when it was written. The correct window position values are fed on window creation to XCreateWindow (window centered). However it seems some "modern" window managers override this behaviour and prefer to set their own window positions thus creating the window at (0, 0). Haven't come across an elegant solution to fix this problem without manually moving the window when its created. Quoting someone from the xorg channel when enquiring about a workaround:

Quote
You don't. If I (as a user) have set a specific window manager policy for where windows go, I'm going to be very annoyed at you for even attempting to work round it.

Once the window is created though it can be moved to where you want using Display.setLocation() and you can even center it using the (-1, -1) values. So users who want to center the Display on linux can do it manually.

Did attempt an initial fix, by adding a line of code at the end of the window creation method that moved it to the center. This works nicely but has a small quirk in that the contents of the desktop from 0,0 appears for a second or so on it before the Display fully initialises (i.e. the window background not being cleared), can be reproduced by creating a Display and then immediately calling Display.setLocation(-1,-1). Not sure if this is acceptable but will try see if it can be ironed out.
« Last Edit: July 04, 2011, 23:35:29 by kappa »

*

Offline kappa

  • *****
  • 1319
Re: [BUG] Minor: Linux Center Problem
« Reply #3 on: August 29, 2011, 21:32:44 »
this issue should be fixed now.

Re: [FIXED] Minor: Linux Center Problem
« Reply #4 on: August 30, 2011, 03:46:56 »
Sweet thanx  8)
cool story, bro