Skip to content

GUI Window stops appearing due to odd geometry values in config #4

Open

Description

@kotoezh

Using version 0.21 Windows 64:
In one of my repositories GitGUI window stopped appearing (just showed a taskbar icon ). In other repositories it was alright.
Found no problems in repository with git bash and TortoiseGit
Then found that the issue was caused by odd values in the config file:

[gui]
	wmstate = normal
	geometry = 144x1+-32000+-32000 0 0

After I replaced geometry values with the screen coordinates from a "healthy" repository, window appeared.
Suppose this is a bug and such numbers should not be written in the config at all or should be checked on load.

Activity

  1. AdamCooman commented on Nov 11, 2024

    @AdamCooman

    I encounter the same issue, It seems that the weird geometry values get written to the config when I work on a setup with several screens. When I disconnect the other screens from my laptop, the gui still goes to wherever it was on the multiple screens, which is outside of the current screen.

    On windows 10, I could shift+right-click on the program in the task bar to maximize the gui and it would reappear. They removed this option in windows 11, so now I'm stuck

  2. j6t commented on Nov 28, 2024

    @j6t
    Owner

    I cannot test the situation. A possible solution could be to ignore any excessive position values. But what is excessive? May be it is sufficient to only reject the position +-32000+-32000? The geometry is queried in function do_quit, around line 2360 in git-gui.sh.

  3. AdamCooman commented on Nov 29, 2024

    @AdamCooman

    is there no way to check whether the current position is at least on one of the screens?

  4. j6t commented on Nov 29, 2024

    @j6t
    Owner

    I don't know. But if we catch bad values before they are written into the config and if these bad values are easy to identify, we are good. +-32000+-32000 would be easy to identify. Of course, I assume that these are values that are actually seen, and not something made up.

  5. kotoezh commented on Nov 29, 2024

    @kotoezh
    Author

    I don't know. But if we catch bad values before they are written into the config and if these bad values are easy to identify, we are good. +-32000+-32000 would be easy to identify. Of course, I assume that these are values that are actually seen, and not something made up.

    I confirm the values were actually seen (copy-pasted from the broken config file). Also I was not using any additional displays - all on one laptop. So yes, it seems like some special numbers and may be it is enough to filter them.

  6. kotoezh commented on Nov 29, 2024

    @kotoezh
    Author

    I asked ChatGPT where 32000 may come from and its reply was:

    The -32000 values you're seeing are commonly associated with a window being minimized on Windows. Here's why and how this happens:
    What’s Happening

    Windows Coordinates for Minimized Windows:
        When a window is minimized in Windows, its coordinates are often set to -32000, -32000. This is a convention used by the operating system to indicate that the window is minimized and doesn't have a visible position on the screen.
    
    Application Behavior:
        If the program saves its geometry when closing and it happens to be minimized at that moment, it will record those minimized coordinates instead of the actual screen position.
    
  7. j6t commented on Nov 29, 2024

    @j6t
    Owner

    I confirm the values were actually seen (copy-pasted from the broken config file). Also I was not using any additional displays - all on one laptop. So yes, it seems like some special numbers and may be it is enough to filter them.

    I tested on my Windows box (Window 10), but the geometry is stored correctly when I close a minimized git gui application. No -32000. Can you reproduce this?

  8. kotoezh commented on Nov 30, 2024

    @kotoezh
    Author

    I confirm the values were actually seen (copy-pasted from the broken config file). Also I was not using any additional displays - all on one laptop. So yes, it seems like some special numbers and may be it is enough to filter them.

    I tested on my Windows box (Window 10), but the geometry is stored correctly when I close a minimized git gui application. No -32000. Can you reproduce this?

    I cannot reproduce - it was single time I observed this behavior. Sometimes I have many GUI windows open, maybe it matters somehow, but I tried multi windows (minimized and not), but still was unable to reproduce.

  9. kotoezh commented on Nov 30, 2024

    @kotoezh
    Author

    May be just filtering -32000 will be alright

  10. kotoezh commented on Nov 30, 2024

    @kotoezh
    Author

    But something surely works different when a minimized window is closed:
    Closing I:

    1. Maximize GUI window.
    2. Close with top right button
    3. Open GUI again - it appears maximized

    Closing II:

    1. Maximize GUI window.
    2. Minimize it
    3. Close from right click tray menu
    4. Open GUI again - it appears having the size of the screen but not in the corner (not maximized)

    Also I noted when performing Cllosing I - before closing the window for a short time becomes not maximized and shifted - seems in the same way as it would appear after Closing II

  11. j6t commented on Nov 30, 2024

    @j6t
    Owner

    Here are the guidelines for a patch that I would accept:

    • The patch must be small (that means, the resulting code must be easy to follow).
    • The resulting behavior should be convenient for people who operate Git GUI in one mode most of the time (always maximized or always in normal mode).
    • Those people can be inconvenienced for the rare times that they use a different mode.
    • If the patch is small and also helps people who roam between modes frequently, all the better.
    • But a "large" patch to help the latter people will have a hard time to pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions