diff --git a/src/xpra/server/dbus_server.py b/src/xpra/server/dbus_server.py index fc566f6f72..e5998e3792 100755 --- a/src/xpra/server/dbus_server.py +++ b/src/xpra/server/dbus_server.py @@ -6,7 +6,7 @@ from xpra.dbus.helper import dbus_to_native from xpra.dbus.common import init_session_bus -from xpra.util import parse_scaling_value, from0to100 +from xpra.util import parse_scaling_value, from0to100, AdHocStruct import dbus.service from xpra.log import Logger, add_debug_category, remove_debug_category, disable_debug_for, enable_debug_for @@ -120,6 +120,31 @@ def KeyPress(self, keycode): def KeyRelease(self, keycode): self.server.control_command_key(keycode, press=False) + @dbus.service.method(INTERFACE) + def ClearKeysPressed(self): + self.server._clear_keys_pressed() + + @dbus.service.method(INTERFACE, in_signature='ii') + def SetKeyboardRepeat(self, repeat_delay, repeat_interval): + self.server.set_keyboard_repeat(repeat_delay, repeat_interval) + + + @dbus.service.method(INTERFACE, in_signature='iii') + def MovePointer(self, wid, x, y): + self.server._move_pointer(wid, (x, y)) + + @dbus.service.method(INTERFACE, in_signature='iibiias') + def MouseClick(self, wid, button, pressed, x, y, modifiers): + packet = [wid, button, pressed, (x, y), modifiers] + self.server._process_button_action(None, packet) + + + @dbus.service.method(INTERFACE, in_signature='iiii') + def SetWorkarea(self, x, y, w, h): + workarea = AdHocStruct() + workarea.x, workarea.y, workarea.width, workarea.height = x, y, w, h + self.server.set_workarea(workarea) + @dbus.service.method(INTERFACE, in_signature='', out_signature='v') def ListWindows(self): diff --git a/src/xpra/x11/server.py b/src/xpra/x11/server.py index 33ce260c46..65e6d019a6 100644 --- a/src/xpra/x11/server.py +++ b/src/xpra/x11/server.py @@ -1239,4 +1239,15 @@ def root_set(p): root_set("PULSE_SERVER") + def init_dbus_server(self): + if not self.dbus_control: + return + try: + from xpra.x11.x11_dbus_server import X11_DBUS_Server + self.dbus_server = X11_DBUS_Server(self, os.environ.get("DISPLAY", "").lstrip(":")) + except Exception as e: + log.error("Error setting up our dbus server:") + log.error(" %s", e) + + gobject.type_register(XpraServer) diff --git a/src/xpra/x11/x11_dbus_server.py b/src/xpra/x11/x11_dbus_server.py new file mode 100755 index 0000000000..70aea8b96c --- /dev/null +++ b/src/xpra/x11/x11_dbus_server.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# This file is part of Xpra. +# Copyright (C) 2015 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.server.dbus_server import DBUS_Server, INTERFACE +import dbus.service + +from xpra.log import Logger +log = Logger("dbus", "server") + + +class X11_DBUS_Server(DBUS_Server): + + @dbus.service.method(INTERFACE) + def SyncVfb(self): + self.server.do_repaint_root_overlay() + + @dbus.service.method(INTERFACE) + def ResetXSettings(self): + self.server.update_all_server_settings(True) + + @dbus.service.method(INTERFACE, in_signature='ii') + def SetDPI(self, xdpi, ydpi): + self.server.set_dpi() + + @dbus.service.method(INTERFACE, in_signature='ii', out_signature='ii') + def SetScreenSize(self, width, height): + return self.server.set_screen_size(width, height) diff --git a/src/xpra/x11/x11_server_base.py b/src/xpra/x11/x11_server_base.py index a060cd8b41..3a2a473fb5 100644 --- a/src/xpra/x11/x11_server_base.py +++ b/src/xpra/x11/x11_server_base.py @@ -466,16 +466,15 @@ def _move_pointer(self, wid, pos): X11Keyboard.xtest_fake_motion(self.screen_number, x, y) def _process_mouse_common(self, proto, wid, pointer, modifiers): - ss = self._server_sources.get(proto) - if ss is None: - return pos = self.root_window.get_pointer()[:2] if pos!=pointer: with xswallow: self._move_pointer(wid, pointer) - ss.make_keymask_match(modifiers) - if wid==self.get_focus(): - ss.user_event() + ss = self._server_sources.get(proto) + if ss: + ss.make_keymask_match(modifiers) + if wid==self.get_focus(): + ss.user_event() def _process_button_action(self, proto, packet): ss = self._server_sources.get(proto)