Skip to content

Commit

Permalink
#385: when trying to instantiate window classes, use other options as…
Browse files Browse the repository at this point in the history
… fallback

git-svn-id: https://xpra.org/svn/Xpra/trunk@4883 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Dec 8, 2013
1 parent 185181a commit 790fd41
Showing 2 changed files with 17 additions and 13 deletions.
13 changes: 4 additions & 9 deletions src/xpra/client/gtk2/client.py
Original file line number Diff line number Diff line change
@@ -441,20 +441,15 @@ def destroy_window(self, wid, window):
group_leader.destroy()


def get_client_window_class(self, metadata, override_redirect):
def get_client_window_classes(self, metadata, override_redirect):
#only enable GL for normal windows:
window_types = metadata.get("window-type", ())
log("get_client_window_class(%s, %s) GLClientWindowClass=%s, opengl_enabled=%s, mmap_enabled=%s, window_types=%s, encoding=%s", metadata, override_redirect, self.GLClientWindowClass, self.opengl_enabled, self.mmap_enabled, window_types, self.encoding)
if self.GLClientWindowClass is None or not self.opengl_enabled or override_redirect:
return self.ClientWindowClass
if metadata.get("has-alpha", False):
#GL cannot do transparency yet:
return self.ClientWindowClass
if self.mmap_enabled or self.encoding not in ("h264", "vpx"):
return self.ClientWindowClass
return [self.ClientWindowClass]
if ("NORMAL" not in window_types) and ("_NET_WM_WINDOW_TYPE_NORMAL" not in window_types):
return self.ClientWindowClass
return self.GLClientWindowClass
return [self.ClientWindowClass, self.GLClientWindowClass]
return [self.GLClientWindowClass, self.ClientWindowClass]

def toggle_opengl(self, *args):
assert self.window_unmap, "server support for 'window_unmap' is required for toggling opengl at runtime"
17 changes: 13 additions & 4 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
@@ -1364,9 +1364,18 @@ def _process_new_common(self, packet, override_redirect):
self.make_new_window(wid, x, y, w, h, metadata, override_redirect, client_properties, auto_refresh_delay)

def make_new_window(self, wid, x, y, w, h, metadata, override_redirect, client_properties, auto_refresh_delay):
ClientWindowClass = self.get_client_window_class(metadata, override_redirect)
client_window_classes = self.get_client_window_classes(metadata, override_redirect)
group_leader_window = self.get_group_leader(metadata, override_redirect)
window = ClientWindowClass(self, group_leader_window, wid, x, y, w, h, metadata, override_redirect, client_properties, auto_refresh_delay)
window = None
for cwc in client_window_classes:
try:
window = cwc(self, group_leader_window, wid, x, y, w, h, metadata, override_redirect, client_properties, auto_refresh_delay)
break
except Exception, e:
log.warn("failed to instantiate %s: %s", cwc, e)
if window is None:
log.warn("no more options.. this window will not be shown, sorry")
return
self._id_to_window[wid] = window
self._window_to_id[window] = wid
window.show()
@@ -1377,8 +1386,8 @@ def get_group_leader(self, metadata, override_redirect):
return None


def get_client_window_class(self, metadata, override_redirect):
return self.ClientWindowClass
def get_client_window_classes(self, metadata, override_redirect):
return [self.ClientWindowClass]

def _process_new_window(self, packet):
self._process_new_common(packet, False)

0 comments on commit 790fd41

Please sign in to comment.