aioxlib 0.6.0__tar.gz → 0.7.0__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.
Files changed (43) hide show
  1. {aioxlib-0.6.0 → aioxlib-0.7.0}/PKG-INFO +1 -1
  2. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/__init__.py +1 -1
  3. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/constants.py +87 -33
  4. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/display.py +87 -6
  5. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/glx.py +7 -0
  6. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/present.py +2 -0
  7. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/protocol.py +787 -58
  8. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/randr.py +8 -3
  9. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/shm.py +3 -0
  10. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib.egg-info/PKG-INFO +1 -1
  11. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_protocol.py +465 -18
  12. {aioxlib-0.6.0 → aioxlib-0.7.0}/LICENSE +0 -0
  13. {aioxlib-0.6.0 → aioxlib-0.7.0}/README.md +0 -0
  14. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/_extensions.py +0 -0
  15. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/api.py +0 -0
  16. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/authority.py +0 -0
  17. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/bigreq.py +0 -0
  18. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/connection.py +0 -0
  19. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/dbe.py +0 -0
  20. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/dri3.py +0 -0
  21. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/render.py +0 -0
  22. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib/widgets.py +0 -0
  23. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib.egg-info/SOURCES.txt +0 -0
  24. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib.egg-info/dependency_links.txt +0 -0
  25. {aioxlib-0.6.0 → aioxlib-0.7.0}/aioxlib.egg-info/top_level.txt +0 -0
  26. {aioxlib-0.6.0 → aioxlib-0.7.0}/pyproject.toml +0 -0
  27. {aioxlib-0.6.0 → aioxlib-0.7.0}/setup.cfg +0 -0
  28. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_api.py +0 -0
  29. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_authority.py +0 -0
  30. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_bigreq.py +0 -0
  31. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_connection.py +0 -0
  32. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_constants.py +0 -0
  33. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_dbe.py +0 -0
  34. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_display.py +0 -0
  35. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_dri3.py +0 -0
  36. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_examples.py +0 -0
  37. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_extensions.py +0 -0
  38. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_glx.py +0 -0
  39. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_present.py +0 -0
  40. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_randr.py +0 -0
  41. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_render.py +0 -0
  42. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_shm.py +0 -0
  43. {aioxlib-0.6.0 → aioxlib-0.7.0}/tests/test_widgets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioxlib
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Human friendly interface to XLib subsystems using asyncio python
5
5
  Author-email: Jose Tiago Macara Coutinho <coutinhotiago@gmail.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -16,7 +16,7 @@ Types and protocol helpers live in submodules::
16
16
  from aioxlib.protocol import pack_create_window
17
17
  """
18
18
 
19
- __version__ = "0.6.0"
19
+ __version__ = "0.7.0"
20
20
 
21
21
  from . import api, constants
22
22
  from .api import * # noqa: F403
@@ -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,
@@ -337,6 +339,88 @@ class Window(Drawable):
337
339
  """Set name."""
338
340
  await self.change_text_property(Atom.WM_NAME, name)
339
341
 
342
+ async def set_motif_hints(self, functions=None, decorations=None, input_mode=None, status=None):
343
+ data = build_motif_wm_hints(
344
+ functions=functions,
345
+ decorations=decorations,
346
+ input_mode=input_mode,
347
+ status=status,
348
+ )
349
+ atom = await self.display.get_atom(MOTIF_WM_HINTS_ATOM)
350
+ await self.change_property(atom, atom, 32, list(data))
351
+
352
+ async def set_size_hints(
353
+ self,
354
+ x: int | None = None,
355
+ y: int | None = None,
356
+ width: int | None = None,
357
+ height: int | None = None,
358
+ min_width: int | None = None,
359
+ min_height: int | None = None,
360
+ max_width: int | None = None,
361
+ max_height: int | None = None,
362
+ width_inc: int | None = None,
363
+ height_inc: int | None = None,
364
+ min_aspect: tuple[int, int] | None = None,
365
+ max_aspect: tuple[int, int] | None = None,
366
+ base_width: int | None = None,
367
+ base_height: int | None = None,
368
+ win_gravity: WinGravity | int | None = None,
369
+ user_position: bool = False,
370
+ user_size: bool = False,
371
+ ) -> None:
372
+ """Apply ICCCM size hints to *window*.
373
+
374
+ Pass individual fields, or supply a pre-built 18-element list via *data*.
375
+ When *data* is given it takes precedence over the keyword fields.
376
+
377
+ Examples
378
+ --------
379
+ Fixed size (non-resizable)::
380
+
381
+ await set_size_hints(wnd, min_width=400, min_height=300,
382
+ max_width=400, max_height=300)
383
+
384
+ Minimum size only::
385
+
386
+ await set_size_hints(wnd, min_width=200, min_height=150)
387
+
388
+ Character-cell style increments (e.g. terminal)::
389
+
390
+ await set_size_hints(
391
+ wnd,
392
+ base_width=10, base_height=20,
393
+ width_inc=8, height_inc=16,
394
+ min_width=10 + 8 * 20, min_height=20 + 16 * 5,
395
+ )
396
+ """
397
+ data = build_size_hints(
398
+ x=x,
399
+ y=y,
400
+ width=width,
401
+ height=height,
402
+ min_width=min_width,
403
+ min_height=min_height,
404
+ max_width=max_width,
405
+ max_height=max_height,
406
+ width_inc=width_inc,
407
+ height_inc=height_inc,
408
+ min_aspect=min_aspect,
409
+ max_aspect=max_aspect,
410
+ base_width=base_width,
411
+ base_height=base_height,
412
+ win_gravity=win_gravity,
413
+ user_position=user_position,
414
+ user_size=user_size,
415
+ )
416
+
417
+ await self.change_property(
418
+ Atom.WM_NORMAL_HINTS,
419
+ Atom.WM_SIZE_HINTS,
420
+ 32,
421
+ list(data),
422
+ )
423
+
340
424
  async def change_text_property(self, property, data, property_type=Atom.STRING, mode=PropMode.Replace):
341
425
  """Change text property."""
342
426
  if not isinstance(data, bytes):
@@ -574,10 +658,7 @@ class Display:
574
658
  self.commands = {cmd: cmd.name for cmd in Command}
575
659
  self.requests = asyncio.Queue()
576
660
  self.listeners = set()
577
- self._events = {
578
- EventType.ClientMessage: unpack_client_message,
579
- EventType.Expose: unpack_expose_event,
580
- }
661
+ self._events = {}
581
662
  self._atom_cache = {}
582
663
  self._extensions_cache = None
583
664
  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
 
@@ -178,6 +178,8 @@ def unpack_present_complete_notify(data, offset=0):
178
178
  "event_type": etype,
179
179
  "serial": serial,
180
180
  "uid": uid,
181
+ "code": data[offset] & 0x7F,
182
+ "from_send": data[offset] & 0x80,
181
183
  }, offset + 32
182
184
 
183
185