Skip to content

Commit

Permalink
#1838: skip rfb base class unless enabled
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@20282 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Sep 3, 2018
1 parent b7c172e commit 1739547
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/xpra/scripts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ def impcheck(*modules):
#server_features.network_state = ??
server_features.display = opts.windows
server_features.windows = opts.windows and impcheck("codecs")
server_features.rfb = b(opts.rfb_upgrade) and impcheck("server.rfb")

kill_dbus = None
if shadowing:
Expand Down
9 changes: 9 additions & 0 deletions src/xpra/server/rfb/rfb_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from xpra.server.rfb.rfb_protocol import RFBProtocol
from xpra.server.rfb.rfb_source import RFBSource
from xpra.server import server_features
from xpra.scripts.config import parse_bool, parse_number

from xpra.log import Logger
log = Logger("rfb")
Expand All @@ -23,13 +24,21 @@ class RFBServer(object):

def __init__(self):
self._window_to_id = {}
self._rfb_upgrade = 0
self.readonly = False
self.rfb_buttons = 0
self.x11_keycodes_for_keysym = {}
if POSIX and not OSX:
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings #@UnresolvedImport
self.X11Keyboard = X11KeyboardBindings()

def init(self, opts):
if not parse_bool("rfb-upgrade", opts.rfb_upgrade):
self._rfb_upgrade = 0
else:
self._rfb_upgrade = parse_number(int, "rfb-upgrade", opts.rfb_upgrade, 0)
log("init(..) rfb-upgrade=%i", self._rfb_upgrade)


def _get_rfb_desktop_model(self):
models = tuple(self._window_to_id.keys())
Expand Down
1 change: 1 addition & 0 deletions src/xpra/server/server_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
network_state = True
display = True
windows = True
rfb = True
17 changes: 12 additions & 5 deletions src/xpra/server/shadow/shadow_server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from xpra.server.window.batch_config import DamageBatchConfig
from xpra.server.shadow.root_window_model import RootWindowModel
from xpra.server.rfb.rfb_server import RFBServer
from xpra.notifications.common import parse_image_path
from xpra.platform.gui import get_native_notifier_classes, get_wm_name
from xpra.platform.paths import get_icon_dir
Expand All @@ -28,10 +27,17 @@
SAVE_CURSORS = envbool("XPRA_SAVE_CURSORS", False)


class ShadowServerBase(RFBServer):
SHADOWSERVER_BASE_CLASS = object
from xpra.server import server_features
if server_features.rfb:
from xpra.server.rfb.rfb_server import RFBServer
SHADOWSERVER_BASE_CLASS = RFBServer


class ShadowServerBase(SHADOWSERVER_BASE_CLASS):

def __init__(self, root_window, capture=None):
RFBServer.__init__(self)
SHADOWSERVER_BASE_CLASS.__init__(self)
self.capture = capture
self.root = root_window
self.mapped = []
Expand All @@ -48,7 +54,9 @@ def __init__(self, root_window, capture=None):
DamageBatchConfig.MIN_DELAY = 50 #never lower than 50ms

def init(self, opts):
self._rfb_upgrade = int(opts.rfb_upgrade)
if SHADOWSERVER_BASE_CLASS!=object:
#RFBServer:
SHADOWSERVER_BASE_CLASS.init(self, opts)
self.notifications = bool(opts.notifications)
if self.notifications:
self.make_notifier()
Expand Down Expand Up @@ -210,7 +218,6 @@ def get_pointer_position(self):
raise NotImplementedError()

def start_poll_pointer(self):
from xpra.server import server_features
if server_features.input_devices and POLL_POINTER>0:
self.pointer_poll_timer = self.timeout_add(POLL_POINTER, self.poll_pointer)

Expand Down
30 changes: 18 additions & 12 deletions src/xpra/x11/desktop_server.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) 2016-2017 Antoine Martin <antoine@devloop.org.uk>
# Copyright (C) 2016-2018 Antoine Martin <antoine@devloop.org.uk>
# 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 @@ -13,11 +13,9 @@
if PYTHON3:
raise ImportError("desktop server needs porting to python3 / gtk3")
from xpra.util import updict, log_screen_sizes
from xpra.scripts.config import parse_bool, parse_number
from xpra.platform.paths import get_icon
from xpra.platform.gui import get_wm_name
from xpra.server import server_features
from xpra.server.rfb.rfb_server import RFBServer
from xpra.gtk_common.gobject_util import one_arg_signal, no_arg_signal
from xpra.gtk_common.gobject_compat import import_glib
from xpra.gtk_common.error import xswallow
Expand Down Expand Up @@ -253,31 +251,39 @@ def do_xpra_damage_event(self, event):
gobject.type_register(DesktopModel)



DESKTOPSERVER_BASES = [gobject.GObject]
if server_features.rfb:
from xpra.server.rfb.rfb_server import RFBServer
DESKTOPSERVER_BASES.append(RFBServer)
DESKTOPSERVER_BASES.append(X11ServerBase)
DESKTOPSERVER_BASES = tuple(DESKTOPSERVER_BASES)
DesktopServerBaseClass = type('DesktopServerBaseClass', DESKTOPSERVER_BASES, {})
log("DesktopServerBaseClass%s", DESKTOPSERVER_BASES)


"""
A server class for RFB / VNC-like desktop displays,
used with the "start-desktop" subcommand.
"""
class XpraDesktopServer(gobject.GObject, RFBServer, X11ServerBase):
class XpraDesktopServer(DesktopServerBaseClass):
__gsignals__ = {
"xpra-xkb-event" : one_arg_signal,
"xpra-cursor-event" : one_arg_signal,
"xpra-motion-event" : one_arg_signal,
}

def __init__(self):
gobject.GObject.__init__(self)
RFBServer.__init__(self)
X11ServerBase.__init__(self)
for c in DESKTOPSERVER_BASES:
c.__init__(self)
self.session_type = "desktop"
self.resize_timer = None
self.resize_value = None

def init(self, opts):
X11ServerBase.init(self, opts)
if not parse_bool("rfb-upgrade", opts.rfb_upgrade):
self._rfb_upgrade = 0
else:
self._rfb_upgrade = parse_number(int, "rfb-upgrade", opts.rfb_upgrade, 0)
for c in DESKTOPSERVER_BASES:
if c!=gobject.GObject:
c.init(self, opts)

def x11_init(self):
X11ServerBase.x11_init(self)
Expand Down

0 comments on commit 1739547

Please sign in to comment.