Skip to content

Commit

Permalink
close the splash screen if it loses top level focus
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 25, 2022
1 parent 0dfde47 commit 9fd53b6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xpra/client/gtk3/splash_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def __init__(self):
signal.signal(SIGPIPE, self.handle_signal)
self.opacity = 100
self.pct = 0
self.had_top_level_focus = False
self.connect("notify::has-toplevel-focus", self._focus_change)


def run(self):
Expand All @@ -113,6 +115,15 @@ def crash():
Gtk.main()
return self.exit_code or 0

def _focus_change(self, *args):
has = self.has_toplevel_focus()
had = self.had_top_level_focus
log(f"_focus_change{args} had={had}, has={has}")
if had and not has:
self.exit()
elif has:
self.had_top_level_focus = True

def timeout(self):
log("timeout()")
self.timeout_timer = None
Expand Down

1 comment on commit 9fd53b6

@totaam
Copy link
Collaborator Author

@totaam totaam commented on 9fd53b6 Aug 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is causing problems on MS Windows which issues a pair of focus-in + focus-out and the splash screen disappears immediately.

Please sign in to comment.