Modify

Opened 4 years ago

Closed 4 years ago

#2083 closed defect (fixed)

[PATCH] JOSM does not remember window size/state. Ignores taskbar (on windows) when determining size

Reported by: BroadwayLamb Owned by: framm
Priority: major Component: unspecified
Version: latest Keywords:
Cc:

Description

MS Windows: Screen size ist not recorded. Not a problem but JOSM always starts full screen disregarding any existing tool/status-bars at the top of the screen. The same happens when maximizing the window.

Attachments (3)

Vollbildaufzeichnung 26.01.2009 105224.jpg (254.1 KB) - added by anonymous 4 years ago.
josm-save-geometry-fix.patch (2.0 KB) - added by anonymous 4 years ago.
geometry-fix-2.patch (2.0 KB) - added by anonymous 4 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 4 years ago by torstiko

Bei mir ist es genau so.

Oberer Fensterrahmen von Josm nicht sichtbar, selbst wenn es bei letzten Programmstart geändert wurde, wenn die Taskleiste oben ist. (siehe Sceenshot)

Changed 4 years ago by anonymous

comment:2 Changed 4 years ago by xeen

  • Priority changed from minor to major
  • Summary changed from Program starts full screen overwriting tool bar at top of screen to JOSM does not remember window size/state. Ignores taskbar (on windows) when determining size

This has probably been introduced by #1984 and is really annoying. This:

Index: src/org/openstreetmap/josm/gui/MainApplication.java

  • if (!args.containsKey("no-fullscreen") && !args.containsKey("geometry") && Main.pref.get("gui.geometry") == null && Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH)) + if (!args.containsKey("no-fullscreen") && !args.containsKey("geometry") && Main.pref.get("gui.geometry") == "" && Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH))

makes JOSM remember its window size, but fails when the window was maximized.
("Ignoring malformed geometry 1163x808+121+-4" on my system).

This is actually two bugs:

  • Fix remembering window size
  • if no/malformed geometry available, either start maximized or at least do respect windows taskbar

comment:3 Changed 4 years ago by xeen

Meh, Trac doesn't like patches.
Well open

src/org/openstreetmap/josm/gui/MainApplication.java

then replace

Main.pref.get("gui.geometry") == null

with

Main.pref.get("gui.geometry") == ""

but as mentioned: this doesn't work for maximized windows.

comment:4 Changed 4 years ago by anonymous

Shouldn't strings be tested for equality using equals()?

comment:5 Changed 4 years ago by anonymous

Sorry my original patch isn't perfect. I have attached a new patch that (I think)
addresses (some of) your gripes. I don't use Windoze so I can't test it on that
platform - please test and report back.

Changed 4 years ago by anonymous

comment:6 Changed 4 years ago by xeen

Thanks for the fast fix! Here's what I found:

The patch fixes the "invalid geometry" thing when being exited while maximized. It does not restore maximized state though, but at least it's not placed under the task bar and it remembers all other features (size/position) when not maximized.

A fix that makes JOSM remember maximized state would be superb. It "fails" though when an invalid geometry is provided (i.e. placed under the task bar, like in the screenshot). Maybe defaulting to maximize, which was the previous behaviour iirc, would get rid of this, too. Users that don't resize the window thus won't even be bothered by it.

Keep up the good work, no need to be sorry :)

comment:7 Changed 4 years ago by anonymous

Good, that's progress. I will work on restoring to the maximised state. I think that
is a matter of detecting that the window is maximised and removing the gui.geometry
from the prefs.

Tell me, if the gui geometry is invalid, isn't the open behaviour the same
as it was before these patches were introduced (i.e. full screen size)?

Changed 4 years ago by anonymous

comment:8 Changed 4 years ago by anonymous

Ok, I have added a further patch that (when combined with yesterday's patch) should
do the "right thing" if the window is maximised. Specifically, if the window is
maximised, the geometry in the preferences file is cleared on program exit
and so the next time the program is run it will have no geometry (unless the --geometry option is specified).

comment:9 Changed 4 years ago by xeen

  • Resizing it to a non-maximized state is remembered
  • Maximized state is "remembered"
  • If I provide an invalid geometry via --geometry it still 'hides' under the taskbar, but I guess that's acceptable (after all it's /me/ who provides the wrong geometry)

A random idea I had would be to replace if(x > 0) x=blah; with Math.max and Math.min which would chop of some lines of code :)

Great work!

comment:10 Changed 4 years ago by anonymous

  • Summary changed from JOSM does not remember window size/state. Ignores taskbar (on windows) when determining size to [PATCH] JOSM does not remember window size/state. Ignores taskbar (on windows) when determining size

comment:11 Changed 4 years ago by anonymous

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r1356.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.