Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def x11_init(self):
X11ServerBase.x11_init(self)
init_x11_filter()
self._has_focus = 0
# Do this before creating the Wm object, to avoid clobbering its
# selecting SubstructureRedirect.
root = gtk.gdk.get_default_root_window()
root.set_events(root.get_events() | gtk.gdk.SUBSTRUCTURE_MASK)
root.property_change(gtk.gdk.atom_intern("XPRA_SERVER", False),
gtk.gdk.atom_intern("STRING", False),
8,
gtk.gdk.PROP_MODE_REPLACE,
xpra.__version__)
add_event_receiver(root, self)
### Create the WM object
self._wm = Wm(self.clobber)
self._wm.connect("new-window", self._new_window_signaled)
self._wm.connect("bell", self._bell_signaled)
self._wm.connect("quit", lambda _: self.quit(True))
self.default_cursor_data = None
self.last_cursor_serial = None
self.send_cursor_pending = False
self.cursor_data = None
def get_default_cursor():
self.default_cursor_data = X11Keyboard.get_cursor_image()
log("get_default_cursor=%s", self.default_cursor_data)
trap.swallow_synced(get_default_cursor)
def send_version_info(self, proto):
response = {"version" : xpra.__version__}
proto.send_now(("hello", response))
self.timeout_add(5*1000, self.send_disconnect, proto, "version sent")
##
## NOTE NOTE NOTE
#################################################################
if XPRA_LOCAL_SERVERS_SUPPORTED:
start_str = "\t%prog start DISPLAY\n"
list_str = "\t%prog list\n"
upgrade_str = "\t%prog upgrade DISPLAY"
note_str = ""
stop_str = "\t%prog stop [DISPLAY]\n"
else:
start_str = ""
list_str = ""
upgrade_str = ""
note_str = "(This xpra installation does not support starting local servers.)"
stop_str = ""
parser = OptionParser(version="xpra v%s" % xpra.__version__,
usage="".join(["\n",
start_str,
"\t%prog attach [DISPLAY]\n",
"\t%prog detach [DISPLAY]\n",
"\t%prog screenshot filename [DISPLAY]\n",
"\t%prog info [DISPLAY]\n",
"\t%prog version [DISPLAY]\n",
stop_str,
list_str,
upgrade_str,
note_str]))
if XPRA_LOCAL_SERVERS_SUPPORTED:
group = OptionGroup(parser, "Server Options",
"These options are only relevant on the server when using the 'start' or 'upgrade' mode.")
group.add_option("--start-child", action="append",
dest="children", metavar="CMD",
##############################################################################
# WARNING: please try to keep line numbers unchanged when modifying this file
# a number of patches will break otherwise.
# FIXME: Cython.Distutils.build_ext leaves crud in the source directory. (So
# does the make-constants-pxi.py hack.)
import glob
from distutils.core import setup
from distutils.extension import Extension
import subprocess, sys, traceback
import os.path
import stat
import wimpiggy
import xpra
assert wimpiggy.__version__ == xpra.__version__
print(" ".join(sys.argv))
from xpra.platform import XPRA_LOCAL_SERVERS_SUPPORTED
#*******************************************************************************
#NOTE: these variables are defined here to make it easier
#to keep their line number unchanged.
#There are 3 empty lines in between each var so patches
#cannot cause further patches to fail to apply due to context changes.
#*******************************************************************************
clipboard_ENABLED = True
return
from xpra.platform.paths import get_icon
xpra_icon = get_icon("xpra.png")
dialog = gtk.AboutDialog()
if not is_gtk3():
def on_website_hook(dialog, web, *args):
''' called when the website item is selected '''
webbrowser.open(SITE_URL)
def on_email_hook(dialog, mail, *args):
webbrowser.open("mailto://shifter-users@lists.devloop.org.uk")
gtk.about_dialog_set_url_hook(on_website_hook)
gtk.about_dialog_set_email_hook(on_email_hook)
if xpra_icon:
dialog.set_icon(xpra_icon)
dialog.set_name("Xpra")
dialog.set_version(__version__)
dialog.set_authors(('Antoine Martin ',
'Nathaniel Smith ',
'Serviware - Arthur Huillet '))
_license = load_license()
dialog.set_license(_license or "Your installation may be corrupted,"
+ " the license text for GPL version 2 could not be found,"
+ "\nplease refer to:\nhttp://www.gnu.org/licenses/gpl-2.0.txt")
dialog.set_comments("\n".join(get_build_info()))
dialog.set_website(SITE_URL)
dialog.set_website_label(SITE_DOMAIN)
if xpra_icon:
dialog.set_logo(xpra_icon)
if hasattr(dialog, "set_program_name"):
dialog.set_program_name(APPLICATION_NAME)
def close(*args):
close_about()
def _process_hello(self, proto, packet):
(_, client_capabilities) = packet
print "Handshake complete; enabling connection"
capabilities = self._calculate_capabilities(client_capabilities)
if capabilities.get("__prerelease_version") != xpra.__version__:
print ("Sorry, this pre-release server only works with clients "
+ "of exactly the same version (v%s)" % xpra.__version__)
proto.close()
return
# Okay, things are okay, so let's boot out any existing connection and
# set this as our new one:
if self._protocol is not None:
self._protocol.close()
self._protocol = proto
ServerSource(self._protocol)
self._send(["hello", capabilities])
if "deflate" in capabilities:
self._protocol.enable_deflate(capabilities["deflate"])
for window in self._window_to_id.keys():
if isinstance(window, OverrideRedirectWindowModel):
self._send_new_or_window_packet(window)
def _process_hello(self, proto, packet):
capabilities = packet[1]
log("process_hello: capabilities=%s", capabilities)
if capabilities.get("version_request", False):
response = {"version" : xpra.__version__}
packet = ["hello", response]
proto._add_packet_to_queue(packet)
gobject.timeout_add(5*1000, self.send_disconnect, proto, "version sent")
return
screenshot_req = capabilities.get("screenshot_request", False)
info_req = capabilities.get("info_request", False)
if not screenshot_req and not info_req:
log.info("Handshake complete; enabling connection")
remote_version = capabilities.get("version")
if not is_compatible_with(remote_version):
proto.close()
return
if self.password_file:
log("password auth required")
def add_version_info(self, props):
props["version"] = xpra.__version__
if hasattr(gtk, "pygtk_version"):
props["pygtk_version"] = gtk.pygtk_version
props["gtk_version"] = gtk.gtk_version
try:
from xpra.build_info import LOCAL_MODIFICATIONS, BUILD_DATE, BUILT_BY, BUILT_ON, BUILD_BIT, BUILD_CPU, REVISION
props["local_modifications"] = LOCAL_MODIFICATIONS
props["build_date"] = BUILD_DATE
props["built_by"] = BUILT_BY
props["built_on"] = BUILT_ON
props["build_bit"] = BUILD_BIT
props["build_cpu"] = BUILD_CPU
props["revision"] = REVISION
except:
pass
def make_hello(self, challenge_response=None):
capabilities = {"version": xpra.__version__}
if challenge_response:
capabilities["challenge_response"] = challenge_response
if self.encoding:
capabilities["encoding"] = self.encoding
capabilities["encodings"] = ENCODINGS
if self.jpegquality:
capabilities["jpeg"] = self.jpegquality
capabilities["raw_packets"] = True
return capabilities
STATIC_INCLUDE_DIRS = ["/usr/local/include"]
STATIC_LIB_DIRS = ["/usr/local/lib"]
STATIC_COMMON_DEFS = {'include_dirs': STATIC_INCLUDE_DIRS,
'library_dirs': STATIC_LIB_DIRS}
#*******************************************************************************
# build options, these may get modified further down..
#
setup_options = {}
setup_options["name"] = "xpra-all"
setup_options["author"] = "Antoine Martin"
setup_options["author_email"] = "antoine@devloop.org.uk"
setup_options["version"] = xpra.__version__
setup_options["url"] = "http://xpra.org/"
setup_options["download_url"] = "http://xpra.org/src/"
setup_options["description"] = "Xpra: 'screen for X' utility"
xpra_desc = "'screen for X' -- a tool to detach/reattach running X programs"
setup_options["long_description"] = xpra_desc
data_files = []
setup_options["data_files"] = data_files
packages = [
"xpra", "xpra.scripts", "xpra.keyboard",
"xpra.net", "xpra.codecs", "xpra.codecs.xor",
]
setup_options["packages"] = packages
py2exe_excludes = [] #only used on win32
py2exe_includes = [] #only used on win32
ext_modules = []