Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kotoezh opened this issue Oct 29, 2024 · 11 comments
Open

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

kotoezh opened this issue Oct 29, 2024 · 11 comments

Comments

@kotoezh
Copy link

kotoezh commented Oct 29, 2024

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.

@AdamCooman
Copy link

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

@j6t
Copy link
Owner

j6t commented Nov 28, 2024

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.

@AdamCooman
Copy link

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

@j6t
Copy link
Owner

j6t commented Nov 29, 2024

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.

@kotoezh
Copy link
Author

kotoezh commented Nov 29, 2024

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.

@kotoezh
Copy link
Author

kotoezh commented Nov 29, 2024

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.

@j6t
Copy link
Owner

j6t commented Nov 29, 2024

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?

@kotoezh
Copy link
Author

kotoezh commented Nov 30, 2024

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.

@kotoezh
Copy link
Author

kotoezh commented Nov 30, 2024

May be just filtering -32000 will be alright

@kotoezh
Copy link
Author

kotoezh commented Nov 30, 2024

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

@j6t
Copy link
Owner

j6t commented Nov 30, 2024

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants