Exemple #1
0
 def x11_bell():
     global device_bell
     if device_bell is None:
         #try to load it:
         from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings       #@UnresolvedImport
         device_bell = X11KeyboardBindings().device_bell
     device_bell(get_xid(window), device, bell_class, bell_id, percent, bell_name)
Exemple #2
0
 def __init__(self):
     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()
Exemple #3
0
 def test_unicode(self):
     from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
     keyboard_bindings = X11KeyboardBindings()
     for x in (
             "2030",
             "0005",
             "0010",
             "220F",
             "2039",
             "2211",
             "2248",
             "FB01",
             "F8FF",
             "203A",
             "FB02",
             "02C6",
             "02DA",
             "02DC",
             "2206",
             "2044",
             "25CA",
     ):
         #hex form:
         hk = keyboard_bindings.parse_keysym("0x" + x)
         #osx U+ form:
         uk = keyboard_bindings.parse_keysym("U+" + x)
         log("keysym(U+%s)=%#x, keysym(0x%s)=%#x", x, uk, x, hk)
         assert hk and uk
         assert uk == hk, "failed to get unicode keysym %s" % x
Exemple #4
0
 def __init__(self):
     KeyboardBase.__init__(self)
     try:
         from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
         self.keyboard_bindings = X11KeyboardBindings()
     except Exception as e:
         log.warn("failed load posix keyboard bindings: %s", e)
         self.keyboard_bindings = None
Exemple #5
0
 def __init__(self):
     super().__init__()
     if not is_Wayland():
         try:
             from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
             self.keyboard_bindings = X11KeyboardBindings()
         except Exception as e:
             log.error("Error: failed to load posix keyboard bindings")
             log.error(" %s", str(e) or type(e))
Exemple #6
0
 def __init__(self):
     KeyboardBase.__init__(self)
     self.keymap_modifiers = None
     try:
         from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
         self.keyboard_bindings = X11KeyboardBindings()
     except Exception as e:
         log.error("Error: failed to load posix keyboard bindings")
         log.error(" %s", str(e) or type(e))
         self.keyboard_bindings = None
Exemple #7
0
def test_large_dict():
    try:
        from xpra.x11.gtk_x11 import gdk_display_source             #@UnusedImport
        from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings        #@UnresolvedImport
        keyboard_bindings = X11KeyboardBindings()
        mappings = keyboard_bindings.get_keycode_mappings()
        b = bencode(mappings)
        print("bencode(%s)=%s" % (mappings, b))
        d = bdecode(b)
        print("bdecode(%s)=%s" % (b, d))
    except ImportError, e:
        print("test_large_dict() skipped because of: %s" % e)
Exemple #8
0
 def test_unicode(self):
     display = self.find_free_display()
     xvfb = self.start_Xvfb(display)
     from xpra.x11.bindings.posix_display_source import X11DisplayContext    #@UnresolvedImport
     with X11DisplayContext(display):
         from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings        #@UnresolvedImport
         keyboard_bindings = X11KeyboardBindings()
         for x in ("2030", "0005", "0010", "220F", "2039", "2211", "2248", "FB01", "F8FF", "203A", "FB02", "02C6", "02DA", "02DC", "2206", "2044", "25CA"):
             #hex form:
             hk = keyboard_bindings.parse_keysym("0x"+x)
             #osx U+ form:
             uk = keyboard_bindings.parse_keysym("U+"+x)
             log("keysym(U+%s)=%#x, keysym(0x%s)=%#x", x, uk, x, hk)
             assert hk and uk
             assert uk == hk, "failed to get unicode keysym %s" % x
     xvfb.terminate()
Exemple #9
0
 def test_unicode(self):
     if not os.name == "posix":
         #can only work with an X11 server
         return
     try:
         from xpra.x11.bindings import posix_display_source  #@UnusedImport
     except Exception as e:
         print("failed to initialize the display source: %s" % e)
         print("no X11 server available for this test? (skipped)")
         return
     from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
     keyboard_bindings = X11KeyboardBindings()
     for x in ("2030", "0005", "0010", "220F", "2039", "2211", "2248",
               "FB01", "F8FF", "203A", "FB02", "02C6", "02DA", "02DC",
               "2206", "2044", "25CA"):
         #hex form:
         hk = keyboard_bindings.parse_keysym("0x" + x)
         #print("keysym(0x%s)=%s" % (x, hk))
         #osx U+ form:
         uk = keyboard_bindings.parse_keysym("U+" + x)
         #print("keysym(U+%s)=%s" % (x, uk))
         assert hk and uk
         assert uk == hk, "failed to get unicode keysym %s" % x
Exemple #10
0
    add_event_receiver,  #@UnresolvedImport
    add_fallback_receiver,
    remove_fallback_receiver,  #@UnresolvedImport
    get_children,  #@UnresolvedImport
)
from xpra.x11.bindings.window_bindings import constants, X11WindowBindings  #@UnresolvedImport
from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
from xpra.gtk_common.gobject_compat import import_gobject, is_gtk3
from xpra.log import Logger

log = Logger("x11", "window")

gobject = import_gobject()

X11Window = X11WindowBindings()
X11Keyboard = X11KeyboardBindings()

focuslog = Logger("x11", "window", "focus")
screenlog = Logger("x11", "window", "screen")
framelog = Logger("x11", "window", "frame")

CWX = constants["CWX"]
CWY = constants["CWY"]
CWWidth = constants["CWWidth"]
CWHeight = constants["CWHeight"]

NotifyPointerRoot = constants["NotifyPointerRoot"]
NotifyDetailNone = constants["NotifyDetailNone"]

LOG_MANAGE_FAILURES = envbool("XPRA_LOG_MANAGE_FAILURES", False)
Exemple #11
0
# This file is part of Xpra.
# Copyright (C) 2010 Nathaniel Smith <*****@*****.**>
# Copyright (C) 2011-2013 Antoine Martin <*****@*****.**>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

from xpra.platform.keyboard_base import KeyboardBase
from xpra.keyboard.mask import MODIFIER_MAP
from xpra.log import Logger
log = Logger()

try:
    from xpra.x11.bindings.keyboard_bindings import X11KeyboardBindings  #@UnresolvedImport
    keyboard_bindings = X11KeyboardBindings()
except:
    keyboard_bindings = None


class Keyboard(KeyboardBase):
    def exec_get_keyboard_data(self, cmd):
        # Find the client's current keymap so we can send it to the server:
        try:
            from xpra.scripts.exec_util import safe_exec
            returncode, out, _ = safe_exec(cmd)
            if returncode == 0:
                return out.decode('utf-8')
            log.error("'%s' failed with exit code %s", cmd, returncode)
        except Exception, e:
            log.error("error running '%s': %s", cmd, e)
        return None