Skip to content

Invalid windowstate could make the app invisible  #52

Open
@kittaakos

Description

@kittaakos

Describe the problem

We use electron-store to store data such as the coordinates of the Arduino IDE window position on the user's screen. For example:

{
	"windowstate": {
		"isMaximized": false,
		"width": 968,
		"height": 781,
		"x": -20,
		"y": 1394
	}
}

The window is positioned at the stored coordinates when it is opened in subsequent IDE sessions. This is done blindly without any validation of whether the coordinates are within the actual dimensions of the display.

🐛 If the stored window coordinates are at a position outside the current display's dimensions, the IDE window will not be visible to the user.

To reproduce

  1. Select File > Quit from the Arduino IDE menus if it is running.
  2. Use any text editor to open the file at the following path:
    • If you are using Windows:
      C:\Users\<username>\AppData\Roaming\arduino-ide\config.json
      
    • If you are using Linux:
      /home/<username>/.config/arduino-ide/config.json
      
    • If you are using macOS:
      /Users/<username>/Library/Application Support/arduino-ide/config.json
      
  3. Delete the workspaces key and all the data it contained.
    This is done for the sake of making the demonstration easier to perform, but the fault will also occur if the data in the workspaces contains invalid coordinate data.
  4. Change the value of isMaximized to false
  5. Change the value of windowstate.x to 9999
  6. Change the value of windowstate.y to 9999
  7. Save the file.
  8. Start Arduino IDE.

🐛 The IDE window is not visible.

Expected behavior

Arduino IDE window is always placed at a location within the active display dimensions on startup.

Arduino IDE version

Original report

Arduino Pro IDE 0.1.4

Last verified with

e17472e

Operating system

Windows 10

Additional context

It is not known how the invalid configuration is produced in real world usage. It might occur if the user changes their display configuration in a way that makes a previously valid window coordinate no longer valid. That might either be caused by a reduction of the display resolution:

  • Changing the resolution setting (e.g., change magnification as described here)
  • Changing to a lower resolution monitor (e.g., switching from using a large external monitor to the built-in monitor of a laptop)
  • Switching from using multiple monitors to using a single monitor

Originally reported at arduino/arduino-pro-ide#444 (comment)

Workaround

Delete the file at the following location (where <username> is the username of your operating system account):

  • If you are using Windows:
    C:\Users\<username>\AppData\Roaming\arduino-ide\config.json
    
  • If you are using Linux:
    /home/<username>/.config/arduino-ide/config.json
    
  • If you are using macOS:
    /Users/<username>/Library/Application Support/arduino-ide/config.json
    

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details### Describe the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions