Skip to content

Commit

Permalink
#420: use threads_enter / threads_leave with gtk2 client
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@4794 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Nov 25, 2013
1 parent 075fef5 commit 7e79621
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/xpra/client/gtk2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def init(self, opts):
self.ClientWindowClass = ClientWindow
log("init(..) ClientWindowClass=%s", self.ClientWindowClass)

def gtk_main(self):
if gtk.main_level()==0:
gtk.threads_enter()
gtk.main()
gtk.threads_leave()

def client_type(self):
return "Python/Gtk2"

Expand Down
3 changes: 3 additions & 0 deletions src/xpra/client/gtk3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class XpraClient(GTKXpraClient):
INPUT_ONLY = None #got moved again???? Gtk.WindowWindowClass.INPUT_ONLY
ClientWindowClass = ClientWindow

def gtk_main(self):
Gtk.main()

def make_hello(self):
capabilities = GTKXpraClient.make_hello(self)
if xor_str is not None:
Expand Down
6 changes: 4 additions & 2 deletions src/xpra/client/gtk_base/gtk_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ def init(self, opts):
def run(self):
UIXpraClient.run(self)
gtk_main_quit_on_fatal_exceptions_enable()
if gtk.main_level()==0:
gtk.main()
self.gtk_main()
log("GTKXpraClient.run_main_loop() main loop ended, returning exit_code=%s", self.exit_code)
return self.exit_code

def gtk_main(self):
raise NotImplementedError()

def quit(self, exit_code=0):
log("GTKXpraClient.quit(%s) current exit_code=%s", exit_code, self.exit_code)
if self.exit_code is None:
Expand Down

0 comments on commit 7e79621

Please sign in to comment.