Skip to content

Commit

Permalink
ensure all capture implementations have a refresh and clean method, u…
Browse files Browse the repository at this point in the history
…se the new capture class in the bug report tool, never instantiate capture from the model

git-svn-id: https://xpra.org/svn/Xpra/trunk@19179 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 3, 2018
1 parent 5fa14f0 commit 32e2ae2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/xpra/client/gtk_base/bug_report.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# This file is part of Xpra.
# Copyright (C) 2014 Antoine Martin <[email protected]>
# Copyright (C) 2014-2018 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

Expand All @@ -18,7 +18,7 @@
pango = import_pango()

from xpra.gtk_common.gtk_util import window_defaults, gtk_main, add_close_accel, scaled_image, pixbuf_new_from_file, get_display_info, get_default_root_window, \
JUSTIFY_LEFT, WIN_POS_CENTER, STATE_NORMAL, FILE_CHOOSER_ACTION_SAVE, choose_file, get_gtk_version_info
JUSTIFY_LEFT, WIN_POS_CENTER, FILE_CHOOSER_ACTION_SAVE, choose_file, get_gtk_version_info
from xpra.util import nonl, envint, repr_ellipsized
from xpra.os_util import strtobytes
from xpra.log import Logger
Expand Down Expand Up @@ -161,8 +161,8 @@ def pillow_imagegrab_screenshot():
if not take_screenshot_fn:
#default: gtk screen capture
try:
from xpra.server.shadow.gtk_root_window_model import GTKRootWindowModel
rwm = GTKRootWindowModel(get_default_root_window())
from xpra.server.shadow.gtk_root_window_model import GTKImageCapture
rwm = GTKImageCapture(get_default_root_window())
take_screenshot_fn = rwm.take_screenshot
except:
log.warn("Warning: failed to load gtk screenshot code", exc_info=True)
Expand Down
6 changes: 6 additions & 0 deletions src/xpra/platform/darwin/shadow_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ def pixels_to_bytes(v):

class OSXRootCapture(object):

def refresh(self):
return True

def clean(self):
pass

def get_image(self, x, y, width, height):
rect = (x, y, width, height)
return get_CG_imagewrapper(rect)
Expand Down
3 changes: 3 additions & 0 deletions src/xpra/platform/win32/gdi_screen_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def get_info(self):
"depth" : self.bit_depth,
}

def refresh(self):
return True

def clean(self):
if self.disabled_dwm_composition:
set_dwm_composition(DWM_EC_ENABLECOMPOSITION)
Expand Down
2 changes: 1 addition & 1 deletion src/xpra/server/shadow/root_window_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# This file is part of Xpra.
# Copyright (C) 2012-2017 Antoine Martin <[email protected]>
# Copyright (C) 2012-2018 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

Expand Down
8 changes: 2 additions & 6 deletions src/xpra/x11/shadow_x11_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def setup_capture(window):

class GTKX11RootWindowModel(RootWindowModel):

def __init__(self, root_window, capture=None):
def __init__(self, root_window, capture):
RootWindowModel.__init__(self, root_window, capture)
self.geometry = root_window.get_geometry()[:4]

Expand All @@ -138,12 +138,8 @@ def get_dimensions(self):
return self.geometry[2:4]

def get_image(self, x, y, width, height):
image = None
if not self.capture:
self.capture = setup_capture(self.window)
assert self.capture, "no capture method available"
ox, oy = self.geometry[:2]
image = image or self.capture.get_image(ox+x, oy+y, width, height)
image = self.capture.get_image(ox+x, oy+y, width, height)
if ox>0 or oy>0:
#adjust x and y of where the image is displayed on the client (target_x and target_y)
#not where the image lives within the current buffer (x and y)
Expand Down

0 comments on commit 32e2ae2

Please sign in to comment.