diff --git a/src/tests/xpra/test_apps/test_window_initiatemoveresize.py b/src/tests/xpra/test_apps/test_window_initiatemoveresize.py index ecb70ad38c..4fc79460c0 100755 --- a/src/tests/xpra/test_apps/test_window_initiatemoveresize.py +++ b/src/tests/xpra/test_apps/test_window_initiatemoveresize.py @@ -2,32 +2,10 @@ import gtk -MOVERESIZE_SIZE_TOPLEFT = 0 -MOVERESIZE_SIZE_TOP = 1 -MOVERESIZE_SIZE_TOPRIGHT = 2 -MOVERESIZE_SIZE_RIGHT = 3 -MOVERESIZE_SIZE_BOTTOMRIGHT = 4 -MOVERESIZE_SIZE_BOTTOM = 5 -MOVERESIZE_SIZE_BOTTOMLEFT = 6 -MOVERESIZE_SIZE_LEFT = 7 -MOVERESIZE_MOVE = 8 -MOVERESIZE_SIZE_KEYBOARD = 9 -MOVERESIZE_MOVE_KEYBOARD = 10 -MOVERESIZE_CANCEL = 11 -MOVERESIZE_DIRECTION_STRING = { - MOVERESIZE_SIZE_TOPLEFT : "SIZE_TOPLEFT", - MOVERESIZE_SIZE_TOP : "SIZE_TOP", - MOVERESIZE_SIZE_TOPRIGHT : "SIZE_TOPRIGHT", - MOVERESIZE_SIZE_RIGHT : "SIZE_RIGHT", - MOVERESIZE_SIZE_BOTTOMRIGHT : "SIZE_BOTTOMRIGHT", - MOVERESIZE_SIZE_BOTTOM : "SIZE_BOTTOM", - MOVERESIZE_SIZE_BOTTOMLEFT : "SIZE_BOTTOMLEFT", - MOVERESIZE_SIZE_LEFT : "SIZE_LEFT", - MOVERESIZE_MOVE : "MOVE", - MOVERESIZE_SIZE_KEYBOARD : "SIZE_KEYBOARD", - MOVERESIZE_MOVE_KEYBOARD : "MOVE_KEYBOARD", - MOVERESIZE_CANCEL : "CANCEL", - } +from xpra.util import MOVERESIZE_DIRECTION_STRING, MOVERESIZE_SIZE_TOPLEFT, MOVERESIZE_SIZE_TOP, \ + MOVERESIZE_SIZE_TOPRIGHT, MOVERESIZE_SIZE_RIGHT, MOVERESIZE_SIZE_BOTTOMRIGHT, \ + MOVERESIZE_SIZE_BOTTOM, MOVERESIZE_SIZE_BOTTOMLEFT, MOVERESIZE_SIZE_LEFT, \ + MOVERESIZE_MOVE, MOVERESIZE_CANCEL width = 400 height = 200 diff --git a/src/xpra/client/gtk_base/gtk_client_window_base.py b/src/xpra/client/gtk_base/gtk_client_window_base.py index 702ca80fc4..22d6ed2224 100644 --- a/src/xpra/client/gtk_base/gtk_client_window_base.py +++ b/src/xpra/client/gtk_base/gtk_client_window_base.py @@ -26,7 +26,7 @@ from xpra.os_util import memoryview_to_bytes, bytestostr -from xpra.util import AdHocStruct, typedict, envint, WORKSPACE_UNSET, WORKSPACE_ALL, WORKSPACE_NAMES +from xpra.util import AdHocStruct, typedict, envint, WORKSPACE_UNSET, WORKSPACE_ALL, WORKSPACE_NAMES, MOVERESIZE_DIRECTION_STRING, SOURCE_INDICATION_STRING from xpra.gtk_common.gobject_compat import import_gtk, import_gdk, import_cairo, import_pixbufloader, get_xid from xpra.gtk_common.gobject_util import no_arg_signal from xpra.gtk_common.gtk_util import get_pixbuf_from_data, get_default_root_window, is_realized, WINDOW_POPUP, WINDOW_TOPLEVEL, GRAB_STATUS_STRING, GRAB_SUCCESS @@ -904,9 +904,8 @@ def call_action(self, action_type, action, state, pdata): except Exception as e: log.error("Error: failed to send %s menu rpc request for %s", action_type, action, exc_info=True) - def initiate_moveresize(self, x_root, y_root, direction, button, source_indication): - statelog("initiate_moveresize%s", (x_root, y_root, direction, button, source_indication)) + statelog("initiate_moveresize%s", (x_root, y_root, MOVERESIZE_DIRECTION_STRING.get(direction, direction), button, SOURCE_INDICATION_STRING.get(source_indication, source_indication))) assert HAS_X11_BINDINGS, "cannot handle initiate-moveresize without X11 bindings" event_mask = SubstructureNotifyMask | SubstructureRedirectMask root = self.get_window().get_screen().get_root_window() diff --git a/src/xpra/util.py b/src/xpra/util.py index 0609114597..10f350cb4f 100644 --- a/src/xpra/util.py +++ b/src/xpra/util.py @@ -57,6 +57,43 @@ "role", "opacity", "xid", "group-leader") +#initiate-moveresize X11 constants +MOVERESIZE_SIZE_TOPLEFT = 0 +MOVERESIZE_SIZE_TOP = 1 +MOVERESIZE_SIZE_TOPRIGHT = 2 +MOVERESIZE_SIZE_RIGHT = 3 +MOVERESIZE_SIZE_BOTTOMRIGHT = 4 +MOVERESIZE_SIZE_BOTTOM = 5 +MOVERESIZE_SIZE_BOTTOMLEFT = 6 +MOVERESIZE_SIZE_LEFT = 7 +MOVERESIZE_MOVE = 8 +MOVERESIZE_SIZE_KEYBOARD = 9 +MOVERESIZE_MOVE_KEYBOARD = 10 +MOVERESIZE_CANCEL = 11 +MOVERESIZE_DIRECTION_STRING = { + MOVERESIZE_SIZE_TOPLEFT : "SIZE_TOPLEFT", + MOVERESIZE_SIZE_TOP : "SIZE_TOP", + MOVERESIZE_SIZE_TOPRIGHT : "SIZE_TOPRIGHT", + MOVERESIZE_SIZE_RIGHT : "SIZE_RIGHT", + MOVERESIZE_SIZE_BOTTOMRIGHT : "SIZE_BOTTOMRIGHT", + MOVERESIZE_SIZE_BOTTOM : "SIZE_BOTTOM", + MOVERESIZE_SIZE_BOTTOMLEFT : "SIZE_BOTTOMLEFT", + MOVERESIZE_SIZE_LEFT : "SIZE_LEFT", + MOVERESIZE_MOVE : "MOVE", + MOVERESIZE_SIZE_KEYBOARD : "SIZE_KEYBOARD", + MOVERESIZE_MOVE_KEYBOARD : "MOVE_KEYBOARD", + MOVERESIZE_CANCEL : "CANCEL", + } +SOURCE_INDICATION_UNSET = 0 +SOURCE_INDICATION_NORMAL = 1 +SOURCE_INDICATION_PAGER = 2 +SOURCE_INDICATION_STRING = { + SOURCE_INDICATION_UNSET : "UNSET", + SOURCE_INDICATION_NORMAL : "NORMAL", + SOURCE_INDICATION_PAGER : "PAGER", + } + + #convenience method based on the strings above: def disconnect_is_an_error(reason): return reason.find("error")>=0 or (reason.find("timeout")>=0 and reason!=IDLE_TIMEOUT)