Skip to content

Commit

Permalink
move KeyEvent to keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Apr 13, 2024
1 parent f54134b commit 04465ef
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 23 deletions.
3 changes: 2 additions & 1 deletion xpra/client/gtk3/window_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@
from xpra.gtk.pixbuf import get_pixbuf_from_data
from xpra.gtk.keymap import KEY_TRANSLATIONS
from xpra.common import (
KeyEvent, MoveResize,
MoveResize,
MOVERESIZE_DIRECTION_STRING, SOURCE_INDICATION_STRING, WORKSPACE_UNSET,
WORKSPACE_ALL, WORKSPACE_NAMES,
)
from xpra.keyboard.common import KeyEvent
from xpra.client.gui.window_base import ClientWindowBase
from xpra.platform.gui import (
set_fullscreen_monitors, set_shaded,
Expand Down
2 changes: 1 addition & 1 deletion xpra/client/gui/keyboard_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any
from collections.abc import Callable

from xpra.common import KeyEvent
from xpra.keyboard.common import KeyEvent
from xpra.client.gui.keyboard_shortcuts_parser import parse_shortcut_modifiers, parse_shortcuts, get_modifier_names
from xpra.util.str_fn import std, csv, ellipsizer, bytestostr
from xpra.util.env import envbool
Expand Down
18 changes: 0 additions & 18 deletions xpra/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
except ImportError: # pragma: no cover
StrEnum = Enum # type: ignore

from xpra.util.str_fn import csv
from xpra.util.env import envint, envbool

RESOLUTION_ALIASES: dict[str, tuple[int, int]] = {
Expand Down Expand Up @@ -239,23 +238,6 @@ def noop(*_args, **_kwargs) -> None:
ScreenshotData = tuple[int,int,str,int,bytes]


class KeyEvent:
__slots__ = ("modifiers", "keyname", "keyval", "keycode", "group", "string", "pressed")

def __init__(self):
self.modifiers: list[str] = []
self.keyname: str = ""
self.keyval: int = 0
self.keycode: int = 0
self.group: int = 0
self.string: str = ""
self.pressed: bool = True

def __repr__(self):
strattrs = csv(f"{k}="+str(getattr(self, k)) for k in KeyEvent.__slots__)
return f"KeyEvent({strattrs})"


def get_refresh_rate_for_value(refresh_rate_str, invalue: int) -> int:
def i(value) -> int:
try:
Expand Down
2 changes: 1 addition & 1 deletion xpra/platform/keyboard_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import Any
from collections.abc import Callable

from xpra.common import KeyEvent
from xpra.keyboard.common import KeyEvent
from xpra.keyboard.mask import mask_to_names, MODIFIER_MAP
from xpra.log import Logger
from xpra.util.str_fn import bytestostr
Expand Down
2 changes: 1 addition & 1 deletion xpra/platform/win32/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
GetMonitorInfo,
GetKeyboardLayoutName,
)
from xpra.common import KeyEvent
from xpra.keyboard.common import KeyEvent
from xpra.os_util import gi_import
from xpra.util.objects import typedict
from xpra.util.str_fn import csv
Expand Down
2 changes: 1 addition & 1 deletion xpra/platform/win32/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
from xpra.platform.win32 import constants as win32con
from xpra.platform.keyboard_base import KeyboardBase
from xpra.common import KeyEvent
from xpra.keyboard.common import KeyEvent
from xpra.keyboard.layouts import WIN32_LAYOUTS, WIN32_KEYBOARDS
from xpra.gtk.keymap import KEY_TRANSLATIONS
from xpra.util.str_fn import csv, bytestostr
Expand Down

0 comments on commit 04465ef

Please sign in to comment.