aioxlib 0.6.0__tar.gz → 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aioxlib-0.6.0 → aioxlib-0.7.1}/PKG-INFO +1 -1
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/__init__.py +1 -1
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/constants.py +87 -33
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/display.py +90 -18
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/glx.py +7 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/present.py +2 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/protocol.py +787 -58
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/randr.py +8 -3
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/shm.py +3 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib.egg-info/PKG-INFO +1 -1
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_display.py +1 -1
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_protocol.py +465 -18
- {aioxlib-0.6.0 → aioxlib-0.7.1}/LICENSE +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/README.md +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/_extensions.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/api.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/authority.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/bigreq.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/connection.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/dbe.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/dri3.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/render.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib/widgets.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib.egg-info/SOURCES.txt +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib.egg-info/dependency_links.txt +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/aioxlib.egg-info/top_level.txt +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/pyproject.toml +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/setup.cfg +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_api.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_authority.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_bigreq.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_connection.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_constants.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_dbe.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_dri3.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_examples.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_extensions.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_glx.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_present.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_randr.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_render.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_shm.py +0 -0
- {aioxlib-0.6.0 → aioxlib-0.7.1}/tests/test_widgets.py +0 -0
|
@@ -540,28 +540,6 @@ InputOutput = 1
|
|
|
540
540
|
|
|
541
541
|
InputOnly = 2
|
|
542
542
|
|
|
543
|
-
ForgetGravity = 0
|
|
544
|
-
|
|
545
|
-
NorthWestGravity = 1
|
|
546
|
-
|
|
547
|
-
NorthGravity = 2
|
|
548
|
-
|
|
549
|
-
NorthEastGravity = 3
|
|
550
|
-
|
|
551
|
-
WestGravity = 4
|
|
552
|
-
|
|
553
|
-
CenterGravity = 5
|
|
554
|
-
|
|
555
|
-
EastGravity = 6
|
|
556
|
-
|
|
557
|
-
SouthWestGravity = 7
|
|
558
|
-
|
|
559
|
-
SouthGravity = 8
|
|
560
|
-
|
|
561
|
-
SouthEastGravity = 9
|
|
562
|
-
|
|
563
|
-
StaticGravity = 10
|
|
564
|
-
|
|
565
543
|
UnmapGravity = 0
|
|
566
544
|
|
|
567
545
|
NotUseful = 0
|
|
@@ -865,6 +843,88 @@ class VisualClass(enum.IntEnum):
|
|
|
865
843
|
DirectColor = 5
|
|
866
844
|
|
|
867
845
|
|
|
846
|
+
# Atom name / type used by the Motif specification
|
|
847
|
+
MOTIF_WM_HINTS_ATOM = "_MOTIF_WM_HINTS"
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
class MotifHintsFlag(enum.IntFlag):
|
|
851
|
+
"""Bits for the ``flags`` field — which of the following fields are valid."""
|
|
852
|
+
|
|
853
|
+
FUNCTIONS = 1 << 0
|
|
854
|
+
DECORATIONS = 1 << 1
|
|
855
|
+
INPUT_MODE = 1 << 2
|
|
856
|
+
STATUS = 1 << 3
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
class MotifFunc(enum.IntFlag):
|
|
860
|
+
"""Bits for the ``functions`` field — operations the user may perform."""
|
|
861
|
+
|
|
862
|
+
ALL = 1 << 0
|
|
863
|
+
RESIZE = 1 << 1
|
|
864
|
+
MOVE = 1 << 2
|
|
865
|
+
MINIMIZE = 1 << 3
|
|
866
|
+
MAXIMIZE = 1 << 4
|
|
867
|
+
CLOSE = 1 << 5
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
class MotifDecor(enum.IntFlag):
|
|
871
|
+
"""Bits for the ``decorations`` field — chrome drawn by the WM."""
|
|
872
|
+
|
|
873
|
+
ALL = 1 << 0
|
|
874
|
+
BORDER = 1 << 1
|
|
875
|
+
RESIZEH = 1 << 2
|
|
876
|
+
TITLE = 1 << 3
|
|
877
|
+
MENU = 1 << 4
|
|
878
|
+
MINIMIZE = 1 << 5
|
|
879
|
+
MAXIMIZE = 1 << 6
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
class MotifInputMode(enum.IntEnum):
|
|
883
|
+
"""Values for the ``input_mode`` field."""
|
|
884
|
+
|
|
885
|
+
MODELESS = 0
|
|
886
|
+
PRIMARY_APPLICATION_MODAL = 1
|
|
887
|
+
SYSTEM_MODAL = 2
|
|
888
|
+
FULL_APPLICATION_MODAL = 3
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
XSIZE_HINTS_LEN = 18
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
class SizeHintsFlag(enum.IntFlag):
|
|
895
|
+
"""Bits for the ``flags`` field — which of the following fields are valid.
|
|
896
|
+
|
|
897
|
+
Values match the ICCCM / Xlib ``XSizeHints`` definition.
|
|
898
|
+
"""
|
|
899
|
+
|
|
900
|
+
USPosition = 1 << 0 # user-specified x, y
|
|
901
|
+
USSize = 1 << 1 # user-specified width, height
|
|
902
|
+
PPosition = 1 << 2 # program-specified position
|
|
903
|
+
PSize = 1 << 3 # program-specified size
|
|
904
|
+
PMinSize = 1 << 4 # program-specified minimum size
|
|
905
|
+
PMaxSize = 1 << 5 # program-specified maximum size
|
|
906
|
+
PResizeInc = 1 << 6 # program-specified resize increments
|
|
907
|
+
PAspect = 1 << 7 # program-specified min/max aspect ratios
|
|
908
|
+
PBaseSize = 1 << 8 # program-specified base size
|
|
909
|
+
PWinGravity = 1 << 9 # program-specified window gravity
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
class WinGravity(enum.IntEnum):
|
|
913
|
+
"""Window gravity values used with ``PWinGravity``."""
|
|
914
|
+
|
|
915
|
+
Forget = 0
|
|
916
|
+
NorthWest = 1
|
|
917
|
+
North = 2
|
|
918
|
+
NorthEast = 3
|
|
919
|
+
West = 4
|
|
920
|
+
Center = 5
|
|
921
|
+
East = 6
|
|
922
|
+
SouthWest = 7
|
|
923
|
+
South = 8
|
|
924
|
+
SouthEast = 9
|
|
925
|
+
Static = 10
|
|
926
|
+
|
|
927
|
+
|
|
868
928
|
LSBFirst = 0
|
|
869
929
|
|
|
870
930
|
MSBFirst = 1
|
|
@@ -977,17 +1037,6 @@ __all__ = [
|
|
|
977
1037
|
"LastExtensionError",
|
|
978
1038
|
"InputOutput",
|
|
979
1039
|
"InputOnly",
|
|
980
|
-
"ForgetGravity",
|
|
981
|
-
"NorthWestGravity",
|
|
982
|
-
"NorthGravity",
|
|
983
|
-
"NorthEastGravity",
|
|
984
|
-
"WestGravity",
|
|
985
|
-
"CenterGravity",
|
|
986
|
-
"EastGravity",
|
|
987
|
-
"SouthWestGravity",
|
|
988
|
-
"SouthGravity",
|
|
989
|
-
"SouthEastGravity",
|
|
990
|
-
"StaticGravity",
|
|
991
1040
|
"UnmapGravity",
|
|
992
1041
|
"NotUseful",
|
|
993
1042
|
"WhenMapped",
|
|
@@ -1094,6 +1143,11 @@ __all__ = [
|
|
|
1094
1143
|
"EnableAccess",
|
|
1095
1144
|
"DisableAccess",
|
|
1096
1145
|
"VisualClass",
|
|
1146
|
+
"MOTIF_WM_HINTS_ATOM",
|
|
1147
|
+
"MotifHintsFlag",
|
|
1148
|
+
"MotifFunc",
|
|
1149
|
+
"MotifDecor",
|
|
1150
|
+
"MotifInputMode",
|
|
1097
1151
|
"LSBFirst",
|
|
1098
1152
|
"MSBFirst",
|
|
1099
1153
|
"GenericEventCode",
|
|
@@ -22,6 +22,7 @@ from .constants import (
|
|
|
22
22
|
BYTE_ORDER_TEXT,
|
|
23
23
|
DEFAULT_STRING_ENCODING,
|
|
24
24
|
DISPLAY_RE,
|
|
25
|
+
MOTIF_WM_HINTS_ATOM,
|
|
25
26
|
NONE,
|
|
26
27
|
Allocate,
|
|
27
28
|
AnyPropertyType,
|
|
@@ -34,10 +35,13 @@ from .constants import (
|
|
|
34
35
|
PropMode,
|
|
35
36
|
StackMode,
|
|
36
37
|
Status,
|
|
38
|
+
WinGravity,
|
|
37
39
|
)
|
|
38
40
|
from .protocol import (
|
|
39
41
|
X11Error,
|
|
40
42
|
build_font,
|
|
43
|
+
build_motif_wm_hints,
|
|
44
|
+
build_size_hints,
|
|
41
45
|
pack_change_property,
|
|
42
46
|
pack_clear_area,
|
|
43
47
|
pack_configure_window,
|
|
@@ -76,10 +80,8 @@ from .protocol import (
|
|
|
76
80
|
pack_set_input_focus,
|
|
77
81
|
pack_setup,
|
|
78
82
|
pack_unmap_window,
|
|
79
|
-
unpack_client_message,
|
|
80
83
|
unpack_error,
|
|
81
84
|
unpack_event,
|
|
82
|
-
unpack_expose_event,
|
|
83
85
|
unpack_get_atom_name,
|
|
84
86
|
unpack_get_font_path,
|
|
85
87
|
unpack_get_geometry,
|
|
@@ -315,20 +317,11 @@ class Window(Drawable):
|
|
|
315
317
|
display = self.display
|
|
316
318
|
protocols = []
|
|
317
319
|
if delete_on_close or take_focus:
|
|
318
|
-
# Atoms are normally cached in Display.__aenter__; fall back to
|
|
319
|
-
# get_atom so create_window still works before the context is entered.
|
|
320
|
-
async def _atom(attr, name):
|
|
321
|
-
value = getattr(display, attr, None)
|
|
322
|
-
if value is None:
|
|
323
|
-
value = await display.get_atom(name)
|
|
324
|
-
setattr(display, attr, value)
|
|
325
|
-
return value
|
|
326
|
-
|
|
327
320
|
if delete_on_close:
|
|
328
|
-
protocols.append(
|
|
321
|
+
protocols.append(display.WM_DELETE_WINDOW)
|
|
329
322
|
if take_focus:
|
|
330
|
-
protocols.append(
|
|
331
|
-
wm_protocols =
|
|
323
|
+
protocols.append(display.WM_TAKE_FOCUS)
|
|
324
|
+
wm_protocols = display.WM_PROTOCOLS
|
|
332
325
|
payload += pack_change_property(wid, wm_protocols, Atom.ATOM, 32, protocols, PropMode.Replace)
|
|
333
326
|
self.display.connection.write(payload)
|
|
334
327
|
return Window(self.display, wid)
|
|
@@ -337,6 +330,88 @@ class Window(Drawable):
|
|
|
337
330
|
"""Set name."""
|
|
338
331
|
await self.change_text_property(Atom.WM_NAME, name)
|
|
339
332
|
|
|
333
|
+
async def set_motif_hints(self, functions=None, decorations=None, input_mode=None, status=None):
|
|
334
|
+
data = build_motif_wm_hints(
|
|
335
|
+
functions=functions,
|
|
336
|
+
decorations=decorations,
|
|
337
|
+
input_mode=input_mode,
|
|
338
|
+
status=status,
|
|
339
|
+
)
|
|
340
|
+
atom = await self.display.get_atom(MOTIF_WM_HINTS_ATOM)
|
|
341
|
+
await self.change_property(atom, atom, 32, list(data))
|
|
342
|
+
|
|
343
|
+
async def set_size_hints(
|
|
344
|
+
self,
|
|
345
|
+
x: int | None = None,
|
|
346
|
+
y: int | None = None,
|
|
347
|
+
width: int | None = None,
|
|
348
|
+
height: int | None = None,
|
|
349
|
+
min_width: int | None = None,
|
|
350
|
+
min_height: int | None = None,
|
|
351
|
+
max_width: int | None = None,
|
|
352
|
+
max_height: int | None = None,
|
|
353
|
+
width_inc: int | None = None,
|
|
354
|
+
height_inc: int | None = None,
|
|
355
|
+
min_aspect: tuple[int, int] | None = None,
|
|
356
|
+
max_aspect: tuple[int, int] | None = None,
|
|
357
|
+
base_width: int | None = None,
|
|
358
|
+
base_height: int | None = None,
|
|
359
|
+
win_gravity: WinGravity | int | None = None,
|
|
360
|
+
user_position: bool = False,
|
|
361
|
+
user_size: bool = False,
|
|
362
|
+
) -> None:
|
|
363
|
+
"""Apply ICCCM size hints to *window*.
|
|
364
|
+
|
|
365
|
+
Pass individual fields, or supply a pre-built 18-element list via *data*.
|
|
366
|
+
When *data* is given it takes precedence over the keyword fields.
|
|
367
|
+
|
|
368
|
+
Examples
|
|
369
|
+
--------
|
|
370
|
+
Fixed size (non-resizable)::
|
|
371
|
+
|
|
372
|
+
await set_size_hints(wnd, min_width=400, min_height=300,
|
|
373
|
+
max_width=400, max_height=300)
|
|
374
|
+
|
|
375
|
+
Minimum size only::
|
|
376
|
+
|
|
377
|
+
await set_size_hints(wnd, min_width=200, min_height=150)
|
|
378
|
+
|
|
379
|
+
Character-cell style increments (e.g. terminal)::
|
|
380
|
+
|
|
381
|
+
await set_size_hints(
|
|
382
|
+
wnd,
|
|
383
|
+
base_width=10, base_height=20,
|
|
384
|
+
width_inc=8, height_inc=16,
|
|
385
|
+
min_width=10 + 8 * 20, min_height=20 + 16 * 5,
|
|
386
|
+
)
|
|
387
|
+
"""
|
|
388
|
+
data = build_size_hints(
|
|
389
|
+
x=x,
|
|
390
|
+
y=y,
|
|
391
|
+
width=width,
|
|
392
|
+
height=height,
|
|
393
|
+
min_width=min_width,
|
|
394
|
+
min_height=min_height,
|
|
395
|
+
max_width=max_width,
|
|
396
|
+
max_height=max_height,
|
|
397
|
+
width_inc=width_inc,
|
|
398
|
+
height_inc=height_inc,
|
|
399
|
+
min_aspect=min_aspect,
|
|
400
|
+
max_aspect=max_aspect,
|
|
401
|
+
base_width=base_width,
|
|
402
|
+
base_height=base_height,
|
|
403
|
+
win_gravity=win_gravity,
|
|
404
|
+
user_position=user_position,
|
|
405
|
+
user_size=user_size,
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
await self.change_property(
|
|
409
|
+
Atom.WM_NORMAL_HINTS,
|
|
410
|
+
Atom.WM_SIZE_HINTS,
|
|
411
|
+
32,
|
|
412
|
+
list(data),
|
|
413
|
+
)
|
|
414
|
+
|
|
340
415
|
async def change_text_property(self, property, data, property_type=Atom.STRING, mode=PropMode.Replace):
|
|
341
416
|
"""Change text property."""
|
|
342
417
|
if not isinstance(data, bytes):
|
|
@@ -574,10 +649,7 @@ class Display:
|
|
|
574
649
|
self.commands = {cmd: cmd.name for cmd in Command}
|
|
575
650
|
self.requests = asyncio.Queue()
|
|
576
651
|
self.listeners = set()
|
|
577
|
-
self._events = {
|
|
578
|
-
EventType.ClientMessage: unpack_client_message,
|
|
579
|
-
EventType.Expose: unpack_expose_event,
|
|
580
|
-
}
|
|
652
|
+
self._events = {}
|
|
581
653
|
self._atom_cache = {}
|
|
582
654
|
self._extensions_cache = None
|
|
583
655
|
self._task = None
|
|
@@ -935,6 +935,7 @@ def pack_glx_create_context_attribs_arb(
|
|
|
935
935
|
def unpack_glx_pbuffer_clobber(data, offset=0):
|
|
936
936
|
"""Unpack a glx pbuffer clobber reply or event from *data* starting at *offset*."""
|
|
937
937
|
raw = data[offset : offset + 32]
|
|
938
|
+
raw_event_type = data[offset]
|
|
938
939
|
event_type, draw_type = struct.unpack_from("HH", raw, 4)
|
|
939
940
|
drawable, b_mask = struct.unpack_from("II", raw, 8)
|
|
940
941
|
aux, x, y, w, h, count = struct.unpack_from("HHHHHH", raw, 16)
|
|
@@ -950,12 +951,15 @@ def unpack_glx_pbuffer_clobber(data, offset=0):
|
|
|
950
951
|
"width": w,
|
|
951
952
|
"height": h,
|
|
952
953
|
"count": count,
|
|
954
|
+
"code": raw_event_type & 0x7F,
|
|
955
|
+
"from_send": bool(raw_event_type & 0x80),
|
|
953
956
|
}, offset + 32
|
|
954
957
|
|
|
955
958
|
|
|
956
959
|
def unpack_glx_buffer_swap_complete(data, offset=0):
|
|
957
960
|
"""Unpack a glx buffer swap complete reply or event from *data* starting at *offset*."""
|
|
958
961
|
raw = data[offset : offset + 32]
|
|
962
|
+
raw_event_type = data[offset]
|
|
959
963
|
(event_type,) = struct.unpack_from("H", raw, 4)
|
|
960
964
|
drawable = struct.unpack_from("I", raw, 8)[0]
|
|
961
965
|
ust_hi, ust_lo, msc_hi, msc_lo, sbc = struct.unpack_from("IIIII", raw, 12)
|
|
@@ -966,6 +970,9 @@ def unpack_glx_buffer_swap_complete(data, offset=0):
|
|
|
966
970
|
"ust": (ust_hi << 32) | ust_lo,
|
|
967
971
|
"msc": (msc_hi << 32) | msc_lo,
|
|
968
972
|
"sbc": sbc,
|
|
973
|
+
"raw_code": raw_event_type,
|
|
974
|
+
"code": raw_event_type & 0x7F,
|
|
975
|
+
"from_send": bool(raw_event_type & 0x80),
|
|
969
976
|
}, offset + 32
|
|
970
977
|
|
|
971
978
|
|