-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor all root window models so they all use a capture class
git-svn-id: https://xpra.org/svn/Xpra/trunk@19178 3bb7dfac-3a0b-4e04-842a-767bc560f471
- Loading branch information
Showing
6 changed files
with
34 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
|
@@ -19,7 +19,6 @@ | |
from collections import namedtuple | ||
from xpra.util import XPRA_APP_ID, XPRA_IDLE_NOTIFICATION_ID | ||
from xpra.scripts.config import InitException | ||
from xpra.codecs.codec_constants import CodecStateException, TransientCodecException | ||
from xpra.server.gtk_server_base import GTKServerBase | ||
from xpra.server.shadow.gtk_shadow_server_base import GTKShadowServerBase | ||
from xpra.server.shadow.root_window_model import RootWindowModel | ||
|
@@ -227,24 +226,6 @@ def get_root_window_size(self): | |
h = GetSystemMetrics(win32con.SM_CYVIRTUALSCREEN) | ||
return w, h | ||
|
||
def get_image(self, x, y, width, height): | ||
try: | ||
return self.capture.get_image(x, y, width, height) | ||
except CodecStateException as e: | ||
log("%s.get_image%s", self.capture, (x, y, width, height), exc_info=True) | ||
#maybe we should exit here? | ||
log.warn("Warning: %s", e) | ||
del e | ||
except TransientCodecException as e: | ||
log("%s.get_image%s", self.capture, (x, y, width, height), exc_info=True) | ||
log.warn("Warning: %s", e) | ||
del e | ||
self.cleanup_capture() | ||
return None | ||
|
||
def take_screenshot(self): | ||
return self.capture.take_screenshot() | ||
|
||
|
||
class ShadowServer(GTKShadowServerBase): | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
|
@@ -11,7 +11,6 @@ | |
from xpra.os_util import monotonic_time, strtobytes | ||
from xpra.codecs.image_wrapper import ImageWrapper | ||
from xpra.gtk_common.gtk_util import get_pixbuf_from_window, is_gtk3 | ||
from xpra.server.shadow.root_window_model import RootWindowModel | ||
|
||
|
||
def get_rgb_rawdata(window, x, y, width, height): | ||
|
@@ -54,10 +53,18 @@ def save_to_memory(data, *_args, **_kwargs): | |
return w, h, "png", rowstride, b"".join(buf) | ||
|
||
|
||
class GTKRootWindowModel(RootWindowModel): | ||
class GTKImageCapture(object): | ||
def __init__(self, window): | ||
self.window = window | ||
|
||
def __repr__(self): | ||
return "GTKRootWindowModel(%s)" % self.window | ||
return "GTKImageCapture(%s)" % self.window | ||
|
||
def clean(self): | ||
pass | ||
|
||
def refresh(self): | ||
return True | ||
|
||
def get_image(self, x, y, width, height): | ||
v = get_rgb_rawdata(self.window, x, y, width, height) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters