Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8365201

Restoring the maximized state of a window makes it exceed the screen's bounds

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      System:
        Kernel: 6.8.0-71-generic arch: x86_64 bits: 64 compiler: gcc v: 13.3.0 clocksource: tsc
        Desktop: Cinnamon v: 6.4.8 tk: GTK v: 3.24.41 wm: Muffin v: 6.4.1 vt: 7 dm: LightDM v: 1.30.0
          Distro: Linux Mint 22.1 Xia base: Ubuntu 24.04 noble

        Monitor-1: HDMI-A-1 mapped: HDMI-1 pos: right model: HP V27ie G5 serial: <filter>
          res: 1920x1080 hz: 60 dpi: 82 size: 597x336mm (23.5x13.23") diag: 685mm (27") modes:
          max: 1920x1080 min: 720x400
        Monitor-2: eDP-1 pos: primary,left model: AU Optronics 0x61ed res: 1920x1080 hz: 60 dpi: 142
          size: 344x194mm (13.54x7.64") diag: 395mm (15.5") modes: 1920x1080

      Java:
      openjdk version "21.0.8" 2025-07-15 LTS
      OpenJDK Runtime Environment (build 21.0.8+12-LTS)
      OpenJDK 64-Bit Server VM (build 21.0.8+12-LTS, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      In my application, I store the main window state somewhere so that when the user restarts it I can restore the position, size as well as maximized state.
      There seems to be an issue on Linux for systems that have more than one monitor. If the window is maximized on the second monitor (in my case it's 1920x1080), the app is restarted and the state restored, the window will exceed the monitor's bounds (in my case the saved height is 1112px) hiding the decorations and making it impossible to resize the app or close it.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Download the MRE at <dropbox link>
      2) Run 'gradle run' or './gradlew run'
      3) Move the window to the second monitor, maximize it and close
      4) Re-run the app again
      5) The window's decoration should not be visible anymore and the label's text should highlight the fact that the height exceeds the screen's limits


            tsayao Thiago Sayao
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: