This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206077 - Main window size not retained on Oneiric Unity
Summary: Main window size not retained on Oneiric Unity
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-07 12:59 UTC by Jesse Glick
Modified: 2012-10-04 09:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-12-07 12:59:38 UTC
After upgrading to Ubuntu Oneiric (11.10), using the Unity desktop, the NetBeans main window size and position is not correctly remembered across sessions.

For my regular development IDE (JDK 7u1), I always keep the main window maximized. Yet after an IDE restart it is often not maximized.

For a test IDE (6u29), I will frequently keep it using near 100% horizontal space, and maybe 75% vertical and shifted toward the top of the screen (so I can see log messages from the development IDE's Output Window below). After a restart, it has usually moved down and to the right, with the right part of the window offscreen.

Possibly a JRE or Unity bug, not sure. If you do not have Oneiric to test with I can help investigate if you give me some clues what APIs to look at.
Comment 1 Jesse Glick 2011-12-07 13:00:07 UTC
Irritating enough to be worth fixing in a 7.1 patch, I think.
Comment 2 Stanislav Aubrecht 2011-12-09 11:25:31 UTC
(In reply to comment #0)

> Possibly a JRE or Unity bug, not sure. If you do not have Oneiric to test with
> I can help investigate if you give me some clues what APIs to look at.
that would be great, thanks!

the last main window bounds are stored in WindowManager.wswmgr in Windows2Local folder in user dir.
when the window system is being loaded, the bounds are checked and possibly updated in org.netbeans.core.windows.PersistenceHandler.computeBounds()
Comment 3 Jesse Glick 2011-12-09 14:13:33 UTC
So Utilities.getUsableScreenBounds() returns 1440x900, my LCD resolution, and the main window starts out (on a fresh user dir) maximized. After shutdown, WindowManager.wswmgr says

  <joined-properties
   x="72"
   y="45"
   width="1296"
   height="810"
.../>
  <separated-properties
   x="144"
   y="90"
   width="1152"
   height="72"
.../>
...
    <screen width="1440" height="900"/>

After a restart, PersistenceHandler.load calls computeBounds with the values from joined-properties above, and returns the same; ditto for separated-properties. Now the window appears centered (not maximized). I restart and the window reappears in the same place. But if after a restart I maximize the main window and shut down, it nonetheless appears centered after a restart. If I move it to the top of the screen, near-maximum width but only half height, after I restart it again appears centered and mostly full-height; the XML has not changed.

But then on one startup, for no clear reason (the XML is still as above), the window is not centered but partially offscreen on both the bottom and right.

DefaultView.userResizedMainWindow is called when I resize the window, but does nothing because hierarchy.getMainWindow().getExtendedState() == Frame.MAXIMIZED_BOTH, even though the window is clearly not maximized.
Comment 4 Jesse Glick 2011-12-09 14:26:55 UTC
Note that when I run a simple j2seproject displaying a JFrame which records its bounds and extended state on exit, then maximize and close it, I get

frame bounds: java.awt.Rectangle[x=-8,y=-5,width=1456,height=913]
frame state: 6

on JDK 6u29 and

frame bounds: java.awt.Rectangle[x=-1,y=-5,width=1442,height=906]
frame state: 6

on 7u1.

Similar results if I use a Timer to record bounds & state every second, and if I do not set Nimbus L&F.
Comment 5 Jesse Glick 2011-12-09 14:35:20 UTC
Using GNOME 3 Shell rather than Unity/compiz, the results are completely different when maximized:

frame bounds: java.awt.Rectangle[x=-9,y=269,width=1460,height=892]
frame state: 6

and NB main window state, size, and position is retained across sessions without apparent issue. So this has something to do with the interaction between AWT and the window manager.
Comment 6 Jesse Glick 2011-12-09 14:48:36 UTC
Also broken on Unity 2D, i.e. metacity.
Comment 7 Stanislav Aubrecht 2012-09-21 13:56:37 UTC
Jesse, is this issue still valid?
Comment 8 Jesse Glick 2012-09-21 15:23:26 UTC
Not sure, I am running GNOME 3 Shell these days.
Comment 9 Stanislav Aubrecht 2012-10-01 14:32:18 UTC
This could be a duplicate of #218895

Please reopen if still reproducible in recent builds, thanks.
Comment 10 Jesse Glick 2012-10-01 21:42:52 UTC
Not a duplicate; I only ever use one monitor.
Comment 11 Jesse Glick 2012-10-01 21:44:29 UTC
Probably WONTFIX rather than WORKSFORME, since it does not sound like you tried to reproduce.
Comment 12 Stanislav Aubrecht 2012-10-04 09:23:00 UTC
Cannot reproduce in

Product Version: NetBeans IDE Dev (Build 20121002-039f809f68c7)
Java: 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01
System: Linux version 3.2.0-23-generic-pae running on i386; UTF-8; en_US (nb)