Modify

Opened 15 years ago

Closed 15 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 Milestone:
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 15 years ago.
josm-save-geometry-fix.patch (2.0 KB ) - added by anonymous 15 years ago.
geometry-fix-2.patch (2.0 KB ) - added by anonymous 15 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by torstiko, 15 years ago

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)

comment:2 by xeen, 15 years ago

Priority: minormajor
Summary: Program starts full screen overwriting tool bar at top of screenJOSM 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 by xeen, 15 years ago

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 by anonymous, 15 years ago

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

comment:5 by anonymous, 15 years ago

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.

by anonymous, 15 years ago

comment:6 by xeen, 15 years ago

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 by anonymous, 15 years ago

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)?

by anonymous, 15 years ago

Attachment: geometry-fix-2.patch added

comment:8 by anonymous, 15 years ago

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 by xeen, 15 years ago

  • 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 by anonymous, 15 years ago

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

comment:11 by anonymous, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in r1356.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain framm.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.