Skip to content

Commit

Permalink
move capture object to root window base class
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@19177 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 3, 2018
1 parent fa8f9ee commit 77cb74c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
32 changes: 5 additions & 27 deletions src/xpra/platform/win32/shadow_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,15 @@ def init_capture(pixel_depth=32):

class Win32RootWindowModel(RootWindowModel):

def __init__(self, root, pixel_depth=32):
RootWindowModel.__init__(self, root)
self.pixel_depth = pixel_depth
self.capture = init_capture(pixel_depth)
log("Win32RootWindowModel(%s, %i) capture=%s", root, pixel_depth, self.capture)
def __init__(self, root, capture):
RootWindowModel.__init__(self, root, capture)
log("Win32RootWindowModel(%s, %s) SEAMLESS=%s", root, capture, SEAMLESS)
if SEAMLESS:
self.property_names.append("shape")
self.dynamic_property_names.append("shape")
self.rectangles = self.get_shape_rectangles(logit=True)
self.shape_notify = []

def cleanup(self):
RootWindowModel.cleanup(self)
self.cleanup_capture()

def cleanup_capture(self):
c = self.capture
if c:
self.capture = None
c.clean()

def get_info(self):
c = self.capture
info = {}
if c:
info["capture"] = c.get_info()
info["pixel-depth"] = self.pixel_depth
return info


def refresh_shape(self):
rectangles = self.get_shape_rectangles()
if rectangles==self.rectangles:
Expand Down Expand Up @@ -249,8 +228,6 @@ def get_root_window_size(self):
return w, h

def get_image(self, x, y, width, height):
if not self.capture:
self.capture = init_capture(self.pixel_depth)
try:
return self.capture.get_image(x, y, width, height)
except CodecStateException as e:
Expand Down Expand Up @@ -336,7 +313,8 @@ def make_tray_widget(self):


def makeRootWindowModels(self):
return (Win32RootWindowModel(self.root, self.pixel_depth),)
self.capture = init_capture(self.pixel_depth)
return (Win32RootWindowModel(self.root, self.capture),)


def refresh(self):
Expand Down
9 changes: 7 additions & 2 deletions src/xpra/server/shadow/root_window_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@

class RootWindowModel(object):

def __init__(self, root_window):
def __init__(self, root_window, capture=None):
self.window = root_window
self.capture = capture
self.property_names = ["title", "class-instance", "client-machine", "window-type", "size-hints", "icon", "shadow"]
self.dynamic_property_names = []
self.internal_property_names = ["content-type"]

def get_info(self):
return {}
info = {}
c = self.capture
if c:
info["capture"] = c.get_info()
return info

def cleanup(self):
pass
Expand Down

0 comments on commit 77cb74c

Please sign in to comment.