Kalyax 2 years ago
parent
commit
d331d306f6
  1. 123
      Xlib/ChangeLog
  2. 424
      Xlib/X.py
  3. 89
      Xlib/XK.py
  4. 90
      Xlib/Xatom.py
  5. 99
      Xlib/Xcursorfont.py
  6. 81
      Xlib/Xutil.py
  7. 39
      Xlib/__init__.py
  8. BIN
      Xlib/__pycache__/X.cpython-38.pyc
  9. BIN
      Xlib/__pycache__/XK.cpython-38.pyc
  10. BIN
      Xlib/__pycache__/Xatom.cpython-38.pyc
  11. BIN
      Xlib/__pycache__/Xutil.cpython-38.pyc
  12. BIN
      Xlib/__pycache__/__init__.cpython-38.pyc
  13. BIN
      Xlib/__pycache__/display.cpython-38.pyc
  14. BIN
      Xlib/__pycache__/error.cpython-38.pyc
  15. BIN
      Xlib/__pycache__/threaded.cpython-38.pyc
  16. BIN
      Xlib/__pycache__/xauth.cpython-38.pyc
  17. 951
      Xlib/display.py
  18. 160
      Xlib/error.py
  19. 46
      Xlib/ext/__init__.py
  20. BIN
      Xlib/ext/__pycache__/__init__.cpython-38.pyc
  21. BIN
      Xlib/ext/__pycache__/composite.cpython-38.pyc
  22. BIN
      Xlib/ext/__pycache__/damage.cpython-38.pyc
  23. BIN
      Xlib/ext/__pycache__/dpms.cpython-38.pyc
  24. BIN
      Xlib/ext/__pycache__/ge.cpython-38.pyc
  25. BIN
      Xlib/ext/__pycache__/randr.cpython-38.pyc
  26. BIN
      Xlib/ext/__pycache__/record.cpython-38.pyc
  27. BIN
      Xlib/ext/__pycache__/res.cpython-38.pyc
  28. BIN
      Xlib/ext/__pycache__/screensaver.cpython-38.pyc
  29. BIN
      Xlib/ext/__pycache__/security.cpython-38.pyc
  30. BIN
      Xlib/ext/__pycache__/shape.cpython-38.pyc
  31. BIN
      Xlib/ext/__pycache__/xfixes.cpython-38.pyc
  32. BIN
      Xlib/ext/__pycache__/xinerama.cpython-38.pyc
  33. BIN
      Xlib/ext/__pycache__/xinput.cpython-38.pyc
  34. BIN
      Xlib/ext/__pycache__/xtest.cpython-38.pyc
  35. 272
      Xlib/ext/composite.py
  36. 182
      Xlib/ext/damage.py
  37. 233
      Xlib/ext/dpms.py
  38. 112
      Xlib/ext/ge.py
  39. 5393
      Xlib/ext/nvcontrol.py
  40. 1197
      Xlib/ext/randr.py
  41. 283
      Xlib/ext/record.py
  42. 288
      Xlib/ext/res.py
  43. 198
      Xlib/ext/screensaver.py
  44. 139
      Xlib/ext/security.py
  45. 297
      Xlib/ext/shape.py
  46. 201
      Xlib/ext/xfixes.py
  47. 223
      Xlib/ext/xinerama.py
  48. 777
      Xlib/ext/xinput.py
  49. 122
      Xlib/ext/xtest.py
  50. 42
      Xlib/keysymdef/__init__.py
  51. BIN
      Xlib/keysymdef/__pycache__/__init__.cpython-38.pyc
  52. BIN
      Xlib/keysymdef/__pycache__/apl.cpython-38.pyc
  53. BIN
      Xlib/keysymdef/__pycache__/arabic.cpython-38.pyc
  54. BIN
      Xlib/keysymdef/__pycache__/cyrillic.cpython-38.pyc
  55. BIN
      Xlib/keysymdef/__pycache__/greek.cpython-38.pyc
  56. BIN
      Xlib/keysymdef/__pycache__/hebrew.cpython-38.pyc
  57. BIN
      Xlib/keysymdef/__pycache__/katakana.cpython-38.pyc
  58. BIN
      Xlib/keysymdef/__pycache__/korean.cpython-38.pyc
  59. BIN
      Xlib/keysymdef/__pycache__/latin1.cpython-38.pyc
  60. BIN
      Xlib/keysymdef/__pycache__/latin2.cpython-38.pyc
  61. BIN
      Xlib/keysymdef/__pycache__/latin3.cpython-38.pyc
  62. BIN
      Xlib/keysymdef/__pycache__/latin4.cpython-38.pyc
  63. BIN
      Xlib/keysymdef/__pycache__/miscellany.cpython-38.pyc
  64. BIN
      Xlib/keysymdef/__pycache__/publishing.cpython-38.pyc
  65. BIN
      Xlib/keysymdef/__pycache__/special.cpython-38.pyc
  66. BIN
      Xlib/keysymdef/__pycache__/technical.cpython-38.pyc
  67. BIN
      Xlib/keysymdef/__pycache__/thai.cpython-38.pyc
  68. BIN
      Xlib/keysymdef/__pycache__/xf86.cpython-38.pyc
  69. BIN
      Xlib/keysymdef/__pycache__/xk3270.cpython-38.pyc
  70. BIN
      Xlib/keysymdef/__pycache__/xkb.cpython-38.pyc
  71. 19
      Xlib/keysymdef/apl.py
  72. 50
      Xlib/keysymdef/arabic.py
  73. 107
      Xlib/keysymdef/cyrillic.py
  74. 74
      Xlib/keysymdef/greek.py
  75. 40
      Xlib/keysymdef/hebrew.py
  76. 70
      Xlib/keysymdef/katakana.py
  77. 107
      Xlib/keysymdef/korean.py
  78. 195
      Xlib/keysymdef/latin1.py
  79. 57
      Xlib/keysymdef/latin2.py
  80. 22
      Xlib/keysymdef/latin3.py
  81. 36
      Xlib/keysymdef/latin4.py
  82. 169
      Xlib/keysymdef/miscellany.py
  83. 83
      Xlib/keysymdef/publishing.py
  84. 24
      Xlib/keysymdef/special.py
  85. 49
      Xlib/keysymdef/technical.py
  86. 84
      Xlib/keysymdef/thai.py
  87. 202
      Xlib/keysymdef/xf86.py
  88. 30
      Xlib/keysymdef/xk3270.py
  89. 100
      Xlib/keysymdef/xkb.py
  90. 124
      Xlib/protocol/ChangeLog
  91. 28
      Xlib/protocol/__init__.py
  92. BIN
      Xlib/protocol/__pycache__/__init__.cpython-38.pyc
  93. BIN
      Xlib/protocol/__pycache__/display.cpython-38.pyc
  94. BIN
      Xlib/protocol/__pycache__/event.cpython-38.pyc
  95. BIN
      Xlib/protocol/__pycache__/request.cpython-38.pyc
  96. BIN
      Xlib/protocol/__pycache__/rq.cpython-38.pyc
  97. BIN
      Xlib/protocol/__pycache__/structs.cpython-38.pyc
  98. 1075
      Xlib/protocol/display.py
  99. 434
      Xlib/protocol/event.py
  100. 1900
      Xlib/protocol/request.py

123
Xlib/ChangeLog

@ -0,0 +1,123 @@
2007-06-10 Mike Grant <mgg@nobodymuch.org>
* (many files): (mgg) Converted tabs to spaces throughout the
codebase, using reindent.py (SF id: 1559082)
2007-03-18 Mike Grant <mgg@nobodymuch.org>
* Xlib/display.py: (mgg) Added a get_atom alias that uses the
internal cache
* Xlib/xobject/drawable.py: (mgg) Added a raise_window() alias
to the Window class
2007-02-15 Mike Grant <mgg@nobodymuch.org>
* Xlib/xauth.py: (mgg) Python 2.5 didn't like the way the buffer
type was used, resulting in X authorisation failure, so
reverted to using slices
2006-11-22 Mike Grant <mgg@nobodymuch.org>
* Xlib/ext/record.py: Addition of RECORD extension by Alex Badea
<decampos@users.sourceforge.net>, SF patch id #1538663 (demo
program in python-xlib/examples/record_demo.py)
2006-09-20 Mike Meyer <mwm@mired.org>
* Xlib/ext/xinerama.py: (mwm) Addition of Xinerama extension
2006-07-22 Mike Grant <mgg@nobodymuch.org>
Various typo fixes, general updates.
Changelog hasn't been maintained since 2002, but some of the more
significant comments from cvs logs follow:
* Xlib/display.py: (petli) Fix bug in refresh_keyboard_mapping:
ignore modifier and pointer remappings. Plays nice with pydoc.
Copied some text from the docs to __doc__ strings in
Xlib/display.py so that they appear when you use pydoc.
Completed documentation for Display objects.
* Xlib/XK.py: (calroc99) Minor doc string changes. Called
load_keysym_group() for miscellany and latin1 keysyms, rather
than importing the modules.
* Xlib/keysymdef/*: (calroc99) Small change to keysym loading.
Works the same way.
* Xlib/support/*, Xlib/xauth.py, Xlib/error.py: (petli) Added
~/.Xauthority parsing by Python code instead of relying on
/usr/X11R6/bin/xauth. Not activated yet in all cases yet?
Activated in unix_support.py.
* Xlib/xobject/drawable.py: (petli) Fix bugs in definition and
method of GrabButton/Pointer
* Xlib/xobject/icccm.py: (petli) Add WithdrawnState to WMHints
* doc/*: (petli) documentation updates, typos and completing
documentation for Display objects
2002-03-30 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* support/unix_connect.py: Handle fcntl/FCNTL changes in Python
2.2.
2002-03-11 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* xobject/drawable.py (Drawable.fill_arc): This should be a
PolyFillArc.
Fri Jan 19 17:49:45 2001 Peter Liljenberg <petli@cendio.se>
* XK.py: Moved all keysyms into separate modules, based on their
category. By default only the miscellany and latin1 keysyms are
loaded, and other have to be loaded by importing the
Xlib.keysymdef.<category> module, or calling
load_keysym_group('category').
* display.py (Display.lookup_string):
(Display.rebind_string):
Functions to translate keysyms to strings, and binding keysyms to
new strings.
2001-01-16 <petli@cendio.se>
* xobject/drawable.py (Window.send_event):
* display.py (Display.send_event): Changed the order of the
event_mask and propagate arguments.
2001-01-10 <petli@cendio.se>
* display.py (Display._update_keymap): The first half of the
update algorithm operated on an earlier type of code->sym map than
the second half. Stupid, stupid. It would have been nice with a
type-checker now.
Tue Jan 9 13:03:19 2001 Peter Liljenberg <petli@cendio.se>
* display.py (Display._update_keymap): Fixed call to append with
1.5.2 semantics, broke in newer Pythons.
2000-12-22 <petli@cendio.se>
* display.py (Display.keycode_to_keysym):
(Display.keysym_to_keycode):
(Display.keysym_to_keycodes):
(Display.refresh_keyboard_mapping):
(Display._update_keymap):
Added keymap cache implementation.
2000-12-21 <petli@cendio.se>
* xobject/colormap.py (Colormap.alloc_named_color): Extended to
handle #000000 style color specifications.
* xobject/drawable.py (Window.reparent): Renamed from
reparent_window.
* display.py (Display.set_error_handler): Added.
2000-12-20 <petli@cendio.se>
* display.py (_BaseDisplay):
Implement a cache of atom names.

424
Xlib/X.py

@ -0,0 +1,424 @@
# Xlib.X -- basic X constants
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
# Avoid overwriting None if doing "from Xlib.X import *"
NONE = 0
ParentRelative = 1 # background pixmap in CreateWindow
# and ChangeWindowAttributes
CopyFromParent = 0 # border pixmap in CreateWindow
# and ChangeWindowAttributes
# special VisualID and special window
# class passed to CreateWindow
PointerWindow = 0 # destination window in SendEvent
InputFocus = 1 # destination window in SendEvent
PointerRoot = 1 # focus window in SetInputFocus
AnyPropertyType = 0 # special Atom, passed to GetProperty
AnyKey = 0 # special Key Code, passed to GrabKey
AnyButton = 0 # special Button Code, passed to GrabButton
AllTemporary = 0 # special Resource ID passed to KillClient
CurrentTime = 0 # special Time
NoSymbol = 0 # special KeySym
#-----------------------------------------------------------------------
# Event masks:
#
NoEventMask = 0
KeyPressMask = (1<<0)
KeyReleaseMask = (1<<1)
ButtonPressMask = (1<<2)
ButtonReleaseMask = (1<<3)
EnterWindowMask = (1<<4)
LeaveWindowMask = (1<<5)
PointerMotionMask = (1<<6)
PointerMotionHintMask = (1<<7)
Button1MotionMask = (1<<8)
Button2MotionMask = (1<<9)
Button3MotionMask = (1<<10)
Button4MotionMask = (1<<11)
Button5MotionMask = (1<<12)
ButtonMotionMask = (1<<13)
KeymapStateMask = (1<<14)
ExposureMask = (1<<15)
VisibilityChangeMask = (1<<16)
StructureNotifyMask = (1<<17)
ResizeRedirectMask = (1<<18)
SubstructureNotifyMask = (1<<19)
SubstructureRedirectMask = (1<<20)
FocusChangeMask = (1<<21)
PropertyChangeMask = (1<<22)
ColormapChangeMask = (1<<23)
OwnerGrabButtonMask = (1<<24)
#-----------------------------------------------------------------------
# Event names:
#
# Used in "type" field in XEvent structures. Not to be confused with event
# masks above. They start from 2 because 0 and 1 are reserved in the
# protocol for errors and replies.
#
KeyPress = 2
KeyRelease = 3
ButtonPress = 4
ButtonRelease = 5
MotionNotify = 6
EnterNotify = 7
LeaveNotify = 8
FocusIn = 9
FocusOut = 10
KeymapNotify = 11
Expose = 12
GraphicsExpose = 13
NoExpose = 14
VisibilityNotify = 15
CreateNotify = 16
DestroyNotify = 17
UnmapNotify = 18
MapNotify = 19
MapRequest = 20
ReparentNotify = 21
ConfigureNotify = 22
ConfigureRequest = 23
GravityNotify = 24
ResizeRequest = 25
CirculateNotify = 26
CirculateRequest = 27
PropertyNotify = 28
SelectionClear = 29
SelectionRequest = 30
SelectionNotify = 31
ColormapNotify = 32
ClientMessage = 33
MappingNotify = 34
LASTEvent = 35 # must be bigger than any event
#-----------------------------------------------------------------------
# Key masks:
#
# Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
# state in various key-, mouse-, and button-related events.
#
ShiftMask = (1<<0)
LockMask = (1<<1)
ControlMask = (1<<2)
Mod1Mask = (1<<3)
Mod2Mask = (1<<4)
Mod3Mask = (1<<5)
Mod4Mask = (1<<6)
Mod5Mask = (1<<7)
#-----------------------------------------------------------------------
# Modifier names:
#
# Used to build a SetModifierMapping request or to read a
# GetModifierMapping request. These correspond to the masks defined above.
#
ShiftMapIndex = 0
LockMapIndex = 1
ControlMapIndex = 2
Mod1MapIndex = 3
Mod2MapIndex = 4
Mod3MapIndex = 5
Mod4MapIndex = 6
Mod5MapIndex = 7
#-----------------------------------------------------------------------
# Button masks:
#
# Used in same manner as Key masks above. Not to be confused with button
# names below. Note that 0 is already defined above as "AnyButton".
#
Button1Mask = (1<<8)
Button2Mask = (1<<9)
Button3Mask = (1<<10)
Button4Mask = (1<<11)
Button5Mask = (1<<12)
AnyModifier = (1<<15) # used in GrabButton, GrabKey
#-----------------------------------------------------------------------
# Button names:
#
# Used as arguments to GrabButton and as detail in ButtonPress and
# ButtonRelease events. Not to be confused with button masks above.
# Note that 0 is already defined above as "AnyButton".
#
Button1 = 1
Button2 = 2
Button3 = 3
Button4 = 4
Button5 = 5
#-----------------------------------------------------------------------
# XXX These still need documentation -- for now, read <X11/X.h>
#
NotifyNormal = 0
NotifyGrab = 1
NotifyUngrab = 2
NotifyWhileGrabbed = 3
NotifyHint = 1
NotifyAncestor = 0
NotifyVirtual = 1
NotifyInferior = 2
NotifyNonlinear = 3
NotifyNonlinearVirtual = 4
NotifyPointer = 5
NotifyPointerRoot = 6
NotifyDetailNone = 7
VisibilityUnobscured = 0
VisibilityPartiallyObscured = 1
VisibilityFullyObscured = 2
PlaceOnTop = 0
PlaceOnBottom = 1
FamilyInternet = 0
FamilyDECnet = 1
FamilyChaos = 2
FamilyServerInterpreted = 5
FamilyInternetV6 = 6
PropertyNewValue = 0
PropertyDelete = 1
ColormapUninstalled = 0
ColormapInstalled = 1
GrabModeSync = 0
GrabModeAsync = 1
GrabSuccess = 0
AlreadyGrabbed = 1
GrabInvalidTime = 2
GrabNotViewable = 3
GrabFrozen = 4
AsyncPointer = 0
SyncPointer = 1
ReplayPointer = 2
AsyncKeyboard = 3
SyncKeyboard = 4
ReplayKeyboard = 5
AsyncBoth = 6
SyncBoth = 7
RevertToNone = 0
RevertToPointerRoot = PointerRoot
RevertToParent = 2
Success = 0
BadRequest = 1
BadValue = 2
BadWindow = 3
BadPixmap = 4
BadAtom = 5
BadCursor = 6
BadFont = 7
BadMatch = 8
BadDrawable = 9
BadAccess = 10
BadAlloc = 11
BadColor = 12
BadGC = 13
BadIDChoice = 14
BadName = 15
BadLength = 16
BadImplementation = 17
FirstExtensionError = 128
LastExtensionError = 255
InputOutput = 1
InputOnly = 2
CWBackPixmap = (1<<0)
CWBackPixel = (1<<1)
CWBorderPixmap = (1<<2)
CWBorderPixel = (1<<3)
CWBitGravity = (1<<4)
CWWinGravity = (1<<5)
CWBackingStore = (1<<6)
CWBackingPlanes = (1<<7)
CWBackingPixel = (1<<8)
CWOverrideRedirect = (1<<9)
CWSaveUnder = (1<<10)
CWEventMask = (1<<11)
CWDontPropagate = (1<<12)
CWColormap = (1<<13)
CWCursor = (1<<14)
CWX = (1<<0)
CWY = (1<<1)
CWWidth = (1<<2)
CWHeight = (1<<3)
CWBorderWidth = (1<<4)
CWSibling = (1<<5)
CWStackMode = (1<<6)
ForgetGravity = 0
NorthWestGravity = 1
NorthGravity = 2
NorthEastGravity = 3
WestGravity = 4
CenterGravity = 5
EastGravity = 6
SouthWestGravity = 7
SouthGravity = 8
SouthEastGravity = 9
StaticGravity = 10
UnmapGravity = 0
NotUseful = 0
WhenMapped = 1
Always = 2
IsUnmapped = 0
IsUnviewable = 1
IsViewable = 2
SetModeInsert = 0
SetModeDelete = 1
DestroyAll = 0
RetainPermanent = 1
RetainTemporary = 2
Above = 0
Below = 1
TopIf = 2
BottomIf = 3
Opposite = 4
RaiseLowest = 0
LowerHighest = 1
PropModeReplace = 0
PropModePrepend = 1
PropModeAppend = 2
GXclear = 0x0
GXand = 0x1
GXandReverse = 0x2
GXcopy = 0x3
GXandInverted = 0x4
GXnoop = 0x5
GXxor = 0x6
GXor = 0x7
GXnor = 0x8
GXequiv = 0x9
GXinvert = 0xa
GXorReverse = 0xb
GXcopyInverted = 0xc
GXorInverted = 0xd
GXnand = 0xe
GXset = 0xf
LineSolid = 0
LineOnOffDash = 1
LineDoubleDash = 2
CapNotLast = 0
CapButt = 1
CapRound = 2
CapProjecting = 3
JoinMiter = 0
JoinRound = 1
JoinBevel = 2
FillSolid = 0
FillTiled = 1
FillStippled = 2
FillOpaqueStippled = 3
EvenOddRule = 0
WindingRule = 1
ClipByChildren = 0
IncludeInferiors = 1
Unsorted = 0
YSorted = 1
YXSorted = 2
YXBanded = 3
CoordModeOrigin = 0
CoordModePrevious = 1
Complex = 0
Nonconvex = 1
Convex = 2
ArcChord = 0
ArcPieSlice = 1
GCFunction = (1<<0)
GCPlaneMask = (1<<1)
GCForeground = (1<<2)
GCBackground = (1<<3)
GCLineWidth = (1<<4)
GCLineStyle = (1<<5)
GCCapStyle = (1<<6)
GCJoinStyle = (1<<7)
GCFillStyle = (1<<8)
GCFillRule = (1<<9)
GCTile = (1<<10)
GCStipple = (1<<11)
GCTileStipXOrigin = (1<<12)
GCTileStipYOrigin = (1<<13)
GCFont = (1<<14)
GCSubwindowMode = (1<<15)
GCGraphicsExposures = (1<<16)
GCClipXOrigin = (1<<17)
GCClipYOrigin = (1<<18)
GCClipMask = (1<<19)
GCDashOffset = (1<<20)
GCDashList = (1<<21)
GCArcMode = (1<<22)
GCLastBit = 22
FontLeftToRight = 0
FontRightToLeft = 1
FontChange = 255
XYBitmap = 0
XYPixmap = 1
ZPixmap = 2
AllocNone = 0
AllocAll = 1
DoRed = (1<<0)
DoGreen = (1<<1)
DoBlue = (1<<2)
CursorShape = 0
TileShape = 1
StippleShape = 2
AutoRepeatModeOff = 0
AutoRepeatModeOn = 1
AutoRepeatModeDefault = 2
LedModeOff = 0
LedModeOn = 1
KBKeyClickPercent = (1<<0)
KBBellPercent = (1<<1)
KBBellPitch = (1<<2)
KBBellDuration = (1<<3)
KBLed = (1<<4)
KBLedMode = (1<<5)
KBKey = (1<<6)
KBAutoRepeatMode = (1<<7)
MappingSuccess = 0
MappingBusy = 1
MappingFailed = 2
MappingModifier = 0
MappingKeyboard = 1
MappingPointer = 2
DontPreferBlanking = 0
PreferBlanking = 1
DefaultBlanking = 2
DisableScreenSaver = 0
DisableScreenInterval = 0
DontAllowExposures = 0
AllowExposures = 1
DefaultExposures = 2
ScreenSaverReset = 0
ScreenSaverActive = 1
HostInsert = 0
HostDelete = 1
EnableAccess = 1
DisableAccess = 0
StaticGray = 0
GrayScale = 1
StaticColor = 2
PseudoColor = 3
TrueColor = 4
DirectColor = 5
LSBFirst = 0
MSBFirst = 1

89
Xlib/XK.py

@ -0,0 +1,89 @@
# Xlib.XK -- X keysym defs
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
#
# This module defines some functions for working with X keysyms as well
# as a modular keysym definition and loading mechanism. See the keysym
# definition modules in the Xlib/keysymdef directory.
from Xlib.X import NoSymbol
def string_to_keysym(keysym):
'''Return the (16 bit) numeric code of keysym.
Given the name of a keysym as a string, return its numeric code.
Don't include the 'XK_' prefix, just use the base, i.e. 'Delete'
instead of 'XK_Delete'.'''
return globals().get('XK_' + keysym, NoSymbol)
def load_keysym_group(group):
'''Load all the keysyms in group.
Given a group name such as 'latin1' or 'katakana' load the keysyms
defined in module 'Xlib.keysymdef.group-name' into this XK module.'''
if '.' in group:
raise ValueError('invalid keysym group name: %s' % group)
G = globals() #Get a reference to XK.__dict__ a.k.a. globals
#Import just the keysyms module.
mod = __import__('Xlib.keysymdef.%s' % group, G, locals(), [group])
#Extract names of just the keysyms.
keysyms = [n for n in dir(mod) if n.startswith('XK_')]
#Copy the named keysyms into XK.__dict__
for keysym in keysyms:
## k = mod.__dict__[keysym]; assert k == int(k) #probably too much.
G[keysym] = mod.__dict__[keysym]
#And get rid of the keysym module.
del mod
def _load_keysyms_into_XK(mod):
'''keysym definition modules need no longer call Xlib.XK._load_keysyms_into_XK().
You should remove any calls to that function from your keysym modules.'''
pass
# Always import miscellany and latin1 keysyms
load_keysym_group('miscellany')
load_keysym_group('latin1')
def keysym_to_string(keysym):
'''Translate a keysym (16 bit number) into a python string.
This will pass 0 to 0xff as well as XK_BackSpace, XK_Tab, XK_Clear,
XK_Return, XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete. For other
values it returns None.'''
# ISO latin 1, LSB is the code
if keysym & 0xff00 == 0:
return chr(keysym & 0xff)
if keysym in [XK_BackSpace, XK_Tab, XK_Clear, XK_Return,
XK_Pause, XK_Scroll_Lock, XK_Escape, XK_Delete]:
return chr(keysym & 0xff)
# We should be able to do these things quite automatically
# for latin2, latin3, etc, in Python 2.0 using the Unicode,
# but that will have to wait.
return None

90
Xlib/Xatom.py

@ -0,0 +1,90 @@
# Xlib.Xatom -- Standard X atoms
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
PRIMARY = 1
SECONDARY = 2
ARC = 3
ATOM = 4
BITMAP = 5
CARDINAL = 6
COLORMAP = 7
CURSOR = 8
CUT_BUFFER0 = 9
CUT_BUFFER1 = 10
CUT_BUFFER2 = 11
CUT_BUFFER3 = 12
CUT_BUFFER4 = 13
CUT_BUFFER5 = 14
CUT_BUFFER6 = 15
CUT_BUFFER7 = 16
DRAWABLE = 17
FONT = 18
INTEGER = 19
PIXMAP = 20
POINT = 21
RECTANGLE = 22
RESOURCE_MANAGER = 23
RGB_COLOR_MAP = 24
RGB_BEST_MAP = 25
RGB_BLUE_MAP = 26
RGB_DEFAULT_MAP = 27
RGB_GRAY_MAP = 28
RGB_GREEN_MAP = 29
RGB_RED_MAP = 30
STRING = 31
VISUALID = 32
WINDOW = 33
WM_COMMAND = 34
WM_HINTS = 35
WM_CLIENT_MACHINE = 36
WM_ICON_NAME = 37
WM_ICON_SIZE = 38
WM_NAME = 39
WM_NORMAL_HINTS = 40
WM_SIZE_HINTS = 41
WM_ZOOM_HINTS = 42
MIN_SPACE = 43
NORM_SPACE = 44
MAX_SPACE = 45
END_SPACE = 46
SUPERSCRIPT_X = 47
SUPERSCRIPT_Y = 48
SUBSCRIPT_X = 49
SUBSCRIPT_Y = 50
UNDERLINE_POSITION = 51
UNDERLINE_THICKNESS = 52
STRIKEOUT_ASCENT = 53
STRIKEOUT_DESCENT = 54
ITALIC_ANGLE = 55
X_HEIGHT = 56
QUAD_WIDTH = 57
WEIGHT = 58
POINT_SIZE = 59
RESOLUTION = 60
COPYRIGHT = 61
NOTICE = 62
FONT_NAME = 63
FAMILY_NAME = 64
FULL_NAME = 65
CAP_HEIGHT = 66
WM_CLASS = 67
WM_TRANSIENT_FOR = 68
LAST_PREDEFINED = 68

99
Xlib/Xcursorfont.py

@ -0,0 +1,99 @@
# Xlib.Xcursorfont -- standard cursors
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
num_glyphs = 154
X_cursor = 0
arrow = 2
based_arrow_down = 4
based_arrow_up = 6
boat = 8
bogosity = 10
bottom_left_corner = 12
bottom_right_corner = 14
bottom_side = 16
bottom_tee = 18
box_spiral = 20
center_ptr = 22
circle = 24
clock = 26
coffee_mug = 28
cross = 30
cross_reverse = 32
crosshair = 34
diamond_cross = 36
dot = 38
dotbox = 40
double_arrow = 42
draft_large = 44
draft_small = 46
draped_box = 48
exchange = 50
fleur = 52
gobbler = 54
gumby = 56
hand1 = 58
hand2 = 60
heart = 62
icon = 64
iron_cross = 66
left_ptr = 68
left_side = 70
left_tee = 72
leftbutton = 74
ll_angle = 76
lr_angle = 78
man = 80
middlebutton = 82
mouse = 84
pencil = 86
pirate = 88
plus = 90
question_arrow = 92
right_ptr = 94
right_side = 96
right_tee = 98
rightbutton = 100
rtl_logo = 102
sailboat = 104
sb_down_arrow = 106
sb_h_double_arrow = 108
sb_left_arrow = 110
sb_right_arrow = 112
sb_up_arrow = 114
sb_v_double_arrow = 116
shuttle = 118
sizing = 120
spider = 122
spraycan = 124
star = 126
target = 128
tcross = 130
top_left_arrow = 132
top_left_corner = 134
top_right_corner = 136
top_side = 138
top_tee = 140
trek = 142
ul_angle = 144
umbrella = 146
ur_angle = 148
watch = 150
xterm = 152

81
Xlib/Xutil.py

@ -0,0 +1,81 @@
# Xlib.Xutil -- ICCCM definitions and similar stuff
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
NoValue = 0x0000
XValue = 0x0001
YValue = 0x0002
WidthValue = 0x0004
HeightValue = 0x0008
AllValues = 0x000F
XNegative = 0x0010
YNegative = 0x0020
USPosition = (1 << 0)
USSize = (1 << 1)
PPosition = (1 << 2)
PSize = (1 << 3)
PMinSize = (1 << 4)
PMaxSize = (1 << 5)
PResizeInc = (1 << 6)
PAspect = (1 << 7)
PBaseSize = (1 << 8)
PWinGravity = (1 << 9)
PAllHints = (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
InputHint = (1 << 0)
StateHint = (1 << 1)
IconPixmapHint = (1 << 2)
IconWindowHint = (1 << 3)
IconPositionHint = (1 << 4)
IconMaskHint = (1 << 5)
WindowGroupHint = (1 << 6)
MessageHint = (1 << 7)
UrgencyHint = (1 << 8)
AllHints = (InputHint|StateHint|IconPixmapHint|IconWindowHint|
IconPositionHint|IconMaskHint|WindowGroupHint|MessageHint|
UrgencyHint)
WithdrawnState = 0
NormalState = 1
IconicState = 3
DontCareState = 0
ZoomState = 2
InactiveState = 4
RectangleOut = 0
RectangleIn = 1
RectanglePart = 2
VisualNoMask = 0x0
VisualIDMask = 0x1
VisualScreenMask = 0x2
VisualDepthMask = 0x4
VisualClassMask = 0x8
VisualRedMaskMask = 0x10
VisualGreenMaskMask = 0x20
VisualBlueMaskMask = 0x40
VisualColormapSizeMask = 0x80
VisualBitsPerRGBMask = 0x100
VisualAllMask = 0x1FF
ReleaseByFreeingColormap = 1
BitmapSuccess = 0
BitmapOpenFailed = 1
BitmapFileInvalid = 2
BitmapNoMemory = 3
XCSUCCESS = 0
XCNOMEM = 1
XCNOENT = 2

39
Xlib/__init__.py

@ -0,0 +1,39 @@
# Xlib.__init__ -- glue for Xlib package
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
__version__ = (0, 31)
__version_extra__ = ''
__version_string__ = '.'.join(map(str, __version__)) + __version_extra__
__all__ = [
'X',
'XK',
'Xatom',
'Xcursorfont',
'Xutil',
'display',
'error',
'rdb',
# Explicitly exclude threaded, so that it isn't imported by
# from Xlib import *
]

BIN
Xlib/__pycache__/X.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/XK.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/Xatom.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/Xutil.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/__init__.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/display.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/error.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/threaded.cpython-38.pyc

Binary file not shown.

BIN
Xlib/__pycache__/xauth.cpython-38.pyc

Binary file not shown.

951
Xlib/display.py

@ -0,0 +1,951 @@
# Xlib.display -- high level display object
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
# Python modules
import types
# Python 2/3 compatibility.
from six import create_unbound_method
# Xlib modules
from . import error
from . import ext
from . import X
# Xlib.protocol modules
from .protocol import display as protocol_display
from .protocol import request, event, rq
# Xlib.xobjects modules
from .xobject import resource
from .xobject import drawable
from .xobject import fontable
from .xobject import colormap
from .xobject import cursor
_resource_baseclasses = {
'resource': resource.Resource,
'drawable': drawable.Drawable,
'window': drawable.Window,
'pixmap': drawable.Pixmap,
'fontable': fontable.Fontable,
'font': fontable.Font,
'gc': fontable.GC,
'colormap': colormap.Colormap,
'cursor': cursor.Cursor,
}
_resource_hierarchy = {
'resource': ('drawable', 'window', 'pixmap',
'fontable', 'font', 'gc',
'colormap', 'cursor'),
'drawable': ('window', 'pixmap'),
'fontable': ('font', 'gc')
}
class _BaseDisplay(protocol_display.Display):
# Implement a cache of atom names, used by Window objects when
# dealing with some ICCCM properties not defined in Xlib.Xatom
def __init__(self, *args, **keys):
self.resource_classes = _resource_baseclasses.copy()
protocol_display.Display.__init__(self, *args, **keys)
self._atom_cache = {}
def get_atom(self, atomname, only_if_exists=0):
if atomname in self._atom_cache:
return self._atom_cache[atomname]
r = request.InternAtom(display = self, name = atomname, only_if_exists = only_if_exists)
# don't cache NONE responses in case someone creates this later
if r.atom != X.NONE:
self._atom_cache[atomname] = r.atom
return r.atom
class Display(object):
def __init__(self, display = None):
self.display = _BaseDisplay(display)
# Create the keymap cache
self._keymap_codes = [()] * 256
self._keymap_syms = {}
self._update_keymap(self.display.info.min_keycode,
(self.display.info.max_keycode
- self.display.info.min_keycode + 1))
# Translations for keysyms to strings.
self.keysym_translations = {}
# Find all supported extensions
self.extensions = []
self.class_extension_dicts = {}
self.display_extension_methods = {}
# a dict that maps the event name to the code
# or, when it's an event with a subcode, to a tuple of (event,subcode)
# note this wraps the dict so you address it as
# extension_event.EXTENSION_EVENT_NAME rather than
# extension_event["EXTENSION_EVENT_NAME"]
self.extension_event = rq.DictWrapper({})
exts = self.list_extensions()
# Go through all extension modules
for extname, modname in ext.__extensions__:
if extname in exts:
# Import the module and fetch it
__import__('Xlib.ext.' + modname)
mod = getattr(ext, modname)
info = self.query_extension(extname)
self.display.set_extension_major(extname, info.major_opcode)
# Call initialiasation function
mod.init(self, info)
self.extensions.append(extname)
# Finalize extensions by creating new classes
for class_name, dictionary in self.class_extension_dicts.items():
origcls = self.display.resource_classes[class_name]
self.display.resource_classes[class_name] = type(origcls.__name__,
(origcls,),
dictionary)
# Problem: we have already created some objects without the
# extensions: the screen roots and default colormaps.
# Fix that by reinstantiating them.
for screen in self.display.info.roots:
screen.root = self.display.resource_classes['window'](self.display, screen.root.id)
screen.default_colormap = self.display.resource_classes['colormap'](self.display, screen.default_colormap.id)
def get_display_name(self):
"""Returns the name used to connect to the server, either
provided when creating the Display object, or fetched from the
environmental variable $DISPLAY."""
return self.display.get_display_name()
def fileno(self):
"""Returns the file descriptor number of the underlying socket.
This method is provided to allow Display objects to be passed
select.select()."""
return self.display.fileno()
def close(self):
"""Close the display, freeing the resources that it holds."""
self.display.close()
def set_error_handler(self, handler):
"""Set the default error handler which will be called for all
unhandled errors. handler should take two arguments as a normal
request error handler, but the second argument (the request) will
be None. See section Error Handling."""
self.display.set_error_handler(handler)
def flush(self):
"""Flush the request queue, building and sending the queued
requests. This can be necessary in applications that never wait
for events, and in threaded applications."""
self.display.flush()
def sync(self):
"""Flush the queue and wait until the server has processed all
the queued requests. Use this e.g. when it is important that
errors caused by a certain request is trapped."""
# Do a light-weight replyrequest to sync. There must
# be a better way to do it...
self.get_pointer_control()
def next_event(self):
"""Return the next event. If there are no events queued, it will
block until the next event is fetched from the server."""
return self.display.next_event()
def pending_events(self):
"""Return the number of events queued, i.e. the number of times
that Display.next_event() can be called without blocking."""
return self.display.pending_events()
def has_extension(self, extension):
"""Check if both the server and the client library support the X
extension named extension."""
return extension in self.extensions
def create_resource_object(self, type, id):
"""Create a resource object of type for the integer id. type
should be one of the following strings:
resource
drawable
window
pixmap
fontable
font
gc
colormap
cursor
This function can be used when a resource ID has been fetched
e.g. from an resource or a command line argument. Resource
objects should never be created by instantiating the appropriate
class directly, since any X extensions dynamically added by the
library will not be available.
"""
return self.display.resource_classes[type](self.display, id)
# We need this to handle display extension methods
def __getattr__(self, attr):
try:
function = self.display_extension_methods[attr]
return types.MethodType(function, self)
except KeyError:
raise AttributeError(attr)
###
### display information retrieval
###
def screen(self, sno = None):
if sno is None:
return self.display.info.roots[self.display.default_screen]
else:
return self.display.info.roots[sno]
def screen_count(self):
"""Return the total number of screens on the display."""
return len(self.display.info.roots)
def get_default_screen(self):
"""Return the number of the default screen, extracted from the
display name."""
return self.display.get_default_screen()
###
### Extension module interface
###
def extension_add_method(self, object, name, function):
"""extension_add_method(object, name, function)
Add an X extension module method. OBJECT is the type of
object to add the function to, a string from this list:
display
resource
drawable
window
pixmap
fontable
font
gc
colormap
cursor
NAME is the name of the method, a string. FUNCTION is a
normal function whose first argument is a 'self'.
"""
if object == 'display':
if hasattr(self, name):
raise AssertionError('attempting to replace display method: %s' % name)
self.display_extension_methods[name] = function
else:
class_list = (object, ) + _resource_hierarchy.get(object, ())
for class_name in class_list:
cls = _resource_baseclasses[class_name]
if hasattr(cls, name):
raise AssertionError('attempting to replace %s method: %s' % (class_name, name))
method = create_unbound_method(function, cls)
# Maybe should check extension overrides too
try:
self.class_extension_dicts[class_name][name] = method
except KeyError:
self.class_extension_dicts[class_name] = { name: method }
def extension_add_event(self, code, evt, name = None):
"""extension_add_event(code, evt, [name])
Add an extension event. CODE is the numeric code, and EVT is
the event class. EVT will be cloned, and the attribute _code
of the new event class will be set to CODE.
If NAME is omitted, it will be set to the name of EVT. This
name is used to insert an entry in the DictWrapper
extension_event.
"""
newevt = type(evt.__name__, evt.__bases__,
evt.__dict__.copy())
newevt._code = code
self.display.add_extension_event(code, newevt)
if name is None:
name = evt.__name__
setattr(self.extension_event, name, code)
def extension_add_subevent(self, code, subcode, evt, name = None):
"""extension_add_subevent(code, evt, [name])
Add an extension subevent. CODE is the numeric code, subcode
is the sub-ID of this event that shares the code ID with other
sub-events and EVT is the event class. EVT will be cloned, and
the attribute _code of the new event class will be set to CODE.
If NAME is omitted, it will be set to the name of EVT. This
name is used to insert an entry in the DictWrapper
extension_event.
"""
newevt = type(evt.__name__, evt.__bases__,
evt.__dict__.copy())
newevt._code = code
self.display.add_extension_event(code, newevt, subcode)
if name is None:
name = evt.__name__
# store subcodes as a tuple of (event code, subcode) in the
# extension dict maintained in the display object
setattr(self.extension_event, name, (code,subcode))
def add_extension_error(self, code, err):
"""add_extension_error(code, err)
Add an extension error. CODE is the numeric code, and ERR is
the error class.
"""
self.display.add_extension_error(code, err)
###
### keymap cache implementation
###
# The keycode->keysym map is stored in a list with 256 elements.
# Each element represents a keycode, and the tuple elements are
# the keysyms bound to the key.
# The keysym->keycode map is stored in a mapping, where the keys
# are keysyms. The values are a sorted list of tuples with two
# elements each: (index, keycode)
# keycode is the code for a key to which this keysym is bound, and
# index is the keysyms index in the map for that keycode.
def keycode_to_keysym(self, keycode, index):
"""Convert a keycode to a keysym, looking in entry index.
Normally index 0 is unshifted, 1 is shifted, 2 is alt grid, and 3
is shift+alt grid. If that key entry is not bound, X.NoSymbol is
returned."""
try:
return self._keymap_codes[keycode][index]
except IndexError:
return X.NoSymbol
def keysym_to_keycode(self, keysym):
"""Look up the primary keycode that is bound to keysym. If
several keycodes are found, the one with the lowest index and
lowest code is returned. If keysym is not bound to any key, 0 is
returned."""
try:
return self._keymap_syms[keysym][0][1]
except (KeyError, IndexError):
return 0
def keysym_to_keycodes(self, keysym):
"""Look up all the keycodes that is bound to keysym. A list of
tuples (keycode, index) is returned, sorted primarily on the
lowest index and secondarily on the lowest keycode."""
try:
# Copy the map list, reversing the arguments
return map(lambda x: (x[1], x[0]), self._keymap_syms[keysym])
except KeyError:
return []
def refresh_keyboard_mapping(self, evt):
"""This method should be called once when a MappingNotify event
is received, to update the keymap cache. evt should be the event
object."""
if isinstance(evt, event.MappingNotify):
if evt.request == X.MappingKeyboard:
self._update_keymap(evt.first_keycode, evt.count)
else:
raise TypeError('expected a MappingNotify event')
def _update_keymap(self, first_keycode, count):
"""Internal function, called to refresh the keymap cache.
"""
# Delete all sym->code maps for the changed codes
lastcode = first_keycode + count
for keysym, codes in self._keymap_syms.items():
i = 0
while i < len(codes):
code = codes[i][1]
if code >= first_keycode and code < lastcode:
del codes[i]
else:
i = i + 1
# Get the new keyboard mapping
keysyms = self.get_keyboard_mapping(first_keycode, count)
# Replace code->sym map with the new map
self._keymap_codes[first_keycode:lastcode] = keysyms
# Update sym->code map
code = first_keycode
for syms in keysyms:
index = 0
for sym in syms:
if sym != X.NoSymbol:
if sym in self._keymap_syms:
symcodes = self._keymap_syms[sym]
symcodes.append((index, code))
symcodes.sort()
else:
self._keymap_syms[sym] = [(index, code)]
index = index + 1
code = code + 1
###
### client-internal keysym to string translations
###
def lookup_string(self, keysym):
"""Return a string corresponding to KEYSYM, or None if no
reasonable translation is found.
"""
s = self.keysym_translations.get(keysym)
if s is not None:
return s
import Xlib.XK
return Xlib.XK.keysym_to_string(keysym)
def rebind_string(self, keysym, newstring):
"""Change the translation of KEYSYM to NEWSTRING.
If NEWSTRING is None, remove old translation if any.
"""
if newstring is None:
try:
del self.keysym_translations[keysym]
except KeyError:
pass
else:
self.keysym_translations[keysym] = newstring
###
### X requests
###
def intern_atom(self, name, only_if_exists = 0):
"""Intern the string name, returning its atom number. If
only_if_exists is true and the atom does not already exist, it
will not be created and X.NONE is returned."""
r = request.InternAtom(display = self.display,
name = name,
only_if_exists = only_if_exists)
return r.atom
def get_atom(self, atom, only_if_exists = 0):
"""Alias for intern_atom, using internal cache"""
return self.display.get_atom(atom, only_if_exists)
def get_atom_name(self, atom):
"""Look up the name of atom, returning it as a string. Will raise
BadAtom if atom does not exist."""
r = request.GetAtomName(display = self.display,
atom = atom)
return r.name
def get_selection_owner(self, selection):
"""Return the window that owns selection (an atom), or X.NONE if
there is no owner for the selection. Can raise BadAtom."""
r = request.GetSelectionOwner(display = self.display,
selection = selection)
return r.owner
def send_event(self, destination, event, event_mask = 0, propagate = 0,
onerror = None):
"""Send a synthetic event to the window destination which can be
a window object, or X.PointerWindow or X.InputFocus. event is the
event object to send, instantiated from one of the classes in
protocol.events. See XSendEvent(3X11) for details.
There is also a Window.send_event() method."""
request.SendEvent(display = self.display,
onerror = onerror,
propagate = propagate,
destination = destination,
event_mask = event_mask,
event = event)
def ungrab_pointer(self, time, onerror = None):
"""Release a grabbed pointer and any queued events. See
XUngrabPointer(3X11)."""
request.UngrabPointer(display = self.display,
onerror = onerror,
time = time)
def change_active_pointer_grab(self, event_mask, cursor, time, onerror = None):
"""Change the dynamic parameters of a pointer grab. See
XChangeActivePointerGrab(3X11)."""
request.ChangeActivePointerGrab(display = self.display,
onerror = onerror,
cursor = cursor,
time = time,
event_mask = event_mask)
def ungrab_keyboard(self, time, onerror = None):
"""Ungrab a grabbed keyboard and any queued events. See
XUngrabKeyboard(3X11)."""
request.UngrabKeyboard(display = self.display,
onerror = onerror,
time = time)
def allow_events(self, mode, time, onerror = None):
"""Release some queued events. mode should be one of
X.AsyncPointer, X.SyncPointer, X.AsyncKeyboard, X.SyncKeyboard,
X.ReplayPointer, X.ReplayKeyboard, X.AsyncBoth, or X.SyncBoth.
time should be a timestamp or X.CurrentTime."""
request.AllowEvents(display = self.display,
onerror = onerror,
mode = mode,
time = time)
def grab_server(self, onerror = None):
"""Disable processing of requests on all other client connections
until the server is ungrabbed. Server grabbing should be avoided
as much as possible."""
request.GrabServer(display = self.display,
onerror = onerror)
def ungrab_server(self, onerror = None):
"""Release the server if it was previously grabbed by this client."""
request.UngrabServer(display = self.display,
onerror = onerror)
def warp_pointer(self, x, y, src_window = X.NONE, src_x = 0, src_y = 0,
src_width = 0, src_height = 0, onerror = None):
"""Move the pointer relative its current position by the offsets
(x, y). However, if src_window is a window the pointer is only
moved if the specified rectangle in src_window contains it. If
src_width is 0 it will be replaced with the width of src_window -
src_x. src_height is treated in a similar way.
To move the pointer to absolute coordinates, use Window.warp_pointer()."""
request.WarpPointer(display = self.display,
onerror = onerror,
src_window = src_window,
dst_window = X.NONE,
src_x = src_x,
src_y = src_y,
src_width = src_width,
src_height = src_height,
dst_x = x,
dst_y = y)
def set_input_focus(self, focus, revert_to, time, onerror = None):
"""Set input focus to focus, which should be a window,
X.PointerRoot or X.NONE. revert_to specifies where the focus
reverts to if the focused window becomes not visible, and should
be X.RevertToParent, RevertToPointerRoot, or RevertToNone. See
XSetInputFocus(3X11) for details.
There is also a Window.set_input_focus()."""
request.SetInputFocus(display = self.display,
onerror = onerror,
revert_to = revert_to,
focus = focus,
time = time)
def get_input_focus(self):
"""Return an object with the following attributes:
focus
The window which currently holds the input
focus, X.NONE or X.PointerRoot.
revert_to
Where the focus will revert, one of X.RevertToParent,
RevertToPointerRoot, or RevertToNone. """
return request.GetInputFocus(display = self.display)
def query_keymap(self):
"""Return a bit vector for the logical state of the keyboard,
where each bit set to 1 indicates that the corresponding key is
currently pressed down. The vector is represented as a list of 32
integers. List item N contains the bits for keys 8N to 8N + 7
with the least significant bit in the byte representing key 8N."""
r = request.QueryKeymap(display = self.display)
return r.map
def open_font(self, name):
"""Open the font identifed by the pattern name and return its
font object. If name does not match any font, None is returned."""
fid = self.display.allocate_resource_id()
ec = error.CatchError(error.BadName)
request.OpenFont(display = self.display,
onerror = ec,
fid = fid,
name = name)
self.sync()
if ec.get_error():
self.display.free_resource_id(fid)
return None
else:
cls = self.display.get_resource_class('font', fontable.Font)
return cls(self.display, fid, owner = 1)
def list_fonts(self, pattern, max_names):
"""Return a list of font names matching pattern. No more than
max_names will be returned."""
r = request.ListFonts(display = self.display,
max_names = max_names,
pattern = pattern)
return r.fonts
def list_fonts_with_info(self, pattern, max_names):
"""Return a list of fonts matching pattern. No more than
max_names will be returned. Each list item represents one font
and has the following properties:
name
The name of the font.
min_bounds
max_bounds
min_char_or_byte2
max_char_or_byte2
default_char
draw_direction
min_byte1
max_byte1
all_chars_exist
font_ascent
font_descent
replies_hint
See the description of XFontStruct in XGetFontProperty(3X11)
for details on these values.
properties
A list of properties. Each entry has two attributes:
name
The atom identifying this property.
value
A 32-bit unsigned value.
"""
return request.ListFontsWithInfo(display = self.display,
max_names = max_names,
pattern = pattern)
def set_font_path(self, path, onerror = None):
"""Set the font path to path, which should be a list of strings.
If path is empty, the default font path of the server will be
restored."""
request.SetFontPath(display = self.display,
onerror = onerror,
path = path)
def get_font_path(self):
"""Return the current font path as a list of strings."""
r = request.GetFontPath(display = self.display)
return r.paths
def query_extension(self, name):
"""Ask the server if it supports the extension name. If it is
supported an object with the following attributes is returned:
major_opcode
The major opcode that the requests of this extension uses.
first_event
The base event code if the extension have additional events, or 0.
first_error
The base error code if the extension have additional errors, or 0.
If the extension is not supported, None is returned."""
r = request.QueryExtension(display = self.display,
name = name)
if r.present:
return r
else:
return None
def list_extensions(self):
"""Return a list of all the extensions provided by the server."""
r = request.ListExtensions(display = self.display)
return r.names
def change_keyboard_mapping(self, first_keycode, keysyms, onerror = None):
"""Modify the keyboard mapping, starting with first_keycode.
keysyms is a list of tuples of keysyms. keysyms[n][i] will be
assigned to keycode first_keycode+n at index i."""
request.ChangeKeyboardMapping(display = self.display,
onerror = onerror,
first_keycode = first_keycode,
keysyms = keysyms)
def get_keyboard_mapping(self, first_keycode, count):
"""Return the current keyboard mapping as a list of tuples,
starting at first_keycount and no more than count."""
r = request.GetKeyboardMapping(display = self.display,
first_keycode = first_keycode,
count = count)
return r.keysyms
def change_keyboard_control(self, onerror = None, **keys):
"""Change the parameters provided as keyword arguments:
key_click_percent
The volume of key clicks between 0 (off) and 100 (load).
-1 will restore default setting.
bell_percent
The base volume of the bell, coded as above.
bell_pitch
The pitch of the bell in Hz, -1 restores the default.
bell_duration
The duration of the bell in milliseconds, -1 restores
the default.
led
led_mode
led_mode should be X.LedModeOff or X.LedModeOn. If led is
provided, it should be a 32-bit mask listing the LEDs that
should change. If led is not provided, all LEDs are changed.
key
auto_repeat_mode
auto_repeat_mode should be one of X.AutoRepeatModeOff,
X.AutoRepeatModeOn, or X.AutoRepeatModeDefault. If key is
provided, that key will be modified, otherwise the global
state for the entire keyboard will be modified."""
request.ChangeKeyboardControl(display = self.display,
onerror = onerror,
attrs = keys)
def get_keyboard_control(self):
"""Return an object with the following attributes:
global_auto_repeat
X.AutoRepeatModeOn or X.AutoRepeatModeOff.
auto_repeats
A list of 32 integers. List item N contains the bits for keys
8N to 8N + 7 with the least significant bit in the byte
representing key 8N. If a bit is on, autorepeat is enabled
for the corresponding key.
led_mask
A 32-bit mask indicating which LEDs are on.
key_click_percent
The volume of key click, from 0 to 100.
bell_percent
bell_pitch
bell_duration
The volume, pitch and duration of the bell. """
return request.GetKeyboardControl(display = self.display)
def bell(self, percent = 0, onerror = None):
"""Ring the bell at the volume percent which is relative the base
volume. See XBell(3X11)."""
request.Bell(display = self.display,
onerror = onerror,
percent = percent)
def change_pointer_control(self, accel = None, threshold = None, onerror = None):
"""To change the pointer acceleration, set accel to a tuple (num,
denum). The pointer will then move num/denum times the normal
speed if it moves beyond the threshold number of pixels at once.
To change the threshold, set it to the number of pixels. -1
restores the default."""
if accel is None:
do_accel = 0
accel_num = 0
accel_denum = 0
else:
do_accel = 1
accel_num, accel_denum = accel
if threshold is None:
do_threshold = 0
else:
do_threshold = 1
request.ChangePointerControl(display = self.display,
onerror = onerror,
do_accel = do_accel,
do_thresh = do_threshold,
accel_num = accel_num,
accel_denum = accel_denum,
threshold = threshold)
def get_pointer_control(self):
"""Return an object with the following attributes:
accel_num
accel_denom
The acceleration as numerator/denumerator.
threshold
The number of pixels the pointer must move before the
acceleration kicks in."""
return request.GetPointerControl(display = self.display)
def set_screen_saver(self, timeout, interval, prefer_blank, allow_exposures, onerror = None):
"""See XSetScreenSaver(3X11)."""
request.SetScreenSaver(display = self.display,
onerror = onerror,
timeout = timeout,
interval = interval,
prefer_blank = prefer_blank,
allow_exposures = allow_exposures)
def get_screen_saver(self):
"""Return an object with the attributes timeout, interval,
prefer_blanking, allow_exposures. See XGetScreenSaver(3X11) for
details."""
return request.GetScreenSaver(display = self.display)
def change_hosts(self, mode, host_family, host, onerror = None):
"""mode is either X.HostInsert or X.HostDelete. host_family is
one of X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos,
X.FamilyServerInterpreted or X.FamilyInternetV6.
host is a list of bytes. For the Internet family, it should be the
four bytes of an IPv4 address."""
request.ChangeHosts(display = self.display,
onerror = onerror,
mode = mode,
host_family = host_family,
host = host)
def list_hosts(self):
"""Return an object with the following attributes:
mode
X.EnableAccess if the access control list is used, X.DisableAccess otherwise.
hosts
The hosts on the access list. Each entry has the following attributes:
family
X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos, X.FamilyServerInterpreted or X.FamilyInternetV6.
name
A list of byte values, the coding depends on family. For the Internet family, it is the 4 bytes of an IPv4 address.
"""
return request.ListHosts(display = self.display)
def set_access_control(self, mode, onerror = None):
"""Enable use of access control lists at connection setup if mode
is X.EnableAccess, disable if it is X.DisableAccess."""
request.SetAccessControl(display = self.display,
onerror = onerror,
mode = mode)
def set_close_down_mode(self, mode, onerror = None):
"""Control what will happen with the client's resources at
connection close. The default is X.DestroyAll, the other values
are X.RetainPermanent and X.RetainTemporary."""
request.SetCloseDownMode(display = self.display,
onerror = onerror,
mode = mode)
def force_screen_saver(self, mode, onerror = None):
"""If mode is X.ScreenSaverActive the screen saver is activated.
If it is X.ScreenSaverReset, the screen saver is deactivated as
if device input had been received."""
request.ForceScreenSaver(display = self.display,
onerror = onerror,
mode = mode)
def set_pointer_mapping(self, map):
"""Set the mapping of the pointer buttons. map is a list of
logical button numbers. map must be of the same length as the
list returned by Display.get_pointer_mapping().
map[n] sets the
logical number for the physical button n+1. Logical number 0
disables the button. Two physical buttons cannot be mapped to the
same logical number.
If one of the buttons to be altered are
logically in the down state, X.MappingBusy is returned and the
mapping is not changed. Otherwise the mapping is changed and
X.MappingSuccess is returned."""
r = request.SetPointerMapping(display = self.display,
map = map)
return r.status
def get_pointer_mapping(self):
"""Return a list of the pointer button mappings. Entry N in the
list sets the logical button number for the physical button N+1."""
r = request.GetPointerMapping(display = self.display)
return r.map
def set_modifier_mapping(self, keycodes):
"""Set the keycodes for the eight modifiers X.Shift, X.Lock,
X.Control, X.Mod1, X.Mod2, X.Mod3, X.Mod4 and X.Mod5. keycodes
should be a eight-element list where each entry is a list of the
keycodes that should be bound to that modifier.
If any changed
key is logically in the down state, X.MappingBusy is returned and
the mapping is not changed. If the mapping violates some server
restriction, X.MappingFailed is returned. Otherwise the mapping
is changed and X.MappingSuccess is returned."""
r = request.SetModifierMapping(display = self.display,
keycodes = keycodes)
return r.status
def get_modifier_mapping(self):
"""Return a list of eight lists, one for each modifier. The list
can be indexed using X.ShiftMapIndex, X.Mod1MapIndex, and so on.
The sublists list the keycodes bound to that modifier."""
r = request.GetModifierMapping(display = self.display)
return r.keycodes
def no_operation(self, onerror = None):
"""Do nothing but send a request to the server."""
request.NoOperation(display = self.display,
onerror = onerror)

160
Xlib/error.py

@ -0,0 +1,160 @@
# Xlib.error -- basic error classes
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
# Xlib modules
from . import X
# Xlib.protocol modules
from .protocol import rq
class DisplayError(Exception):
def __init__(self, display):
self.display = display
def __str__(self):
return 'Display error "%s"' % self.display
class DisplayNameError(DisplayError):
def __str__(self):
return 'Bad display name "%s"' % self.display
class DisplayConnectionError(DisplayError):
def __init__(self, display, msg):
self.display = display
self.msg = msg
def __str__(self):
return 'Can\'t connect to display "%s": %s' % (self.display, self.msg)
class ConnectionClosedError(Exception):
def __init__(self, whom):
self.whom = whom
def __str__(self):
return 'Display connection closed by %s' % self.whom
class XauthError(Exception): pass
class XNoAuthError(Exception): pass
class ResourceIDError(Exception): pass
class XError(rq.GetAttrData, Exception):
_fields = rq.Struct( rq.Card8('type'), # Always 0
rq.Card8('code'),
rq.Card16('sequence_number'),
rq.Card32('resource_id'),
rq.Card16('minor_opcode'),
rq.Card8('major_opcode'),
rq.Pad(21)
)
def __init__(self, display, data):
self._data, data = self._fields.parse_binary(data, display, rawdict = 1)
def __str__(self):
s = []
for f in ('code', 'resource_id', 'sequence_number',
'major_opcode', 'minor_opcode'):
s.append('{0} = {1}'.format(f, self._data[f]))
return '{0}: {1}'.format(self.__class__, ', '.join(s))
class XResourceError(XError):
_fields = rq.Struct( rq.Card8('type'), # Always 0
rq.Card8('code'),
rq.Card16('sequence_number'),
rq.Resource('resource_id'),
rq.Card16('minor_opcode'),
rq.Card8('major_opcode'),
rq.Pad(21)
)
class BadRequest(XError): pass
class BadValue(XError): pass
class BadWindow(XResourceError): pass
class BadPixmap(XResourceError): pass
class BadAtom(XError): pass
class BadCursor(XResourceError): pass
class BadFont(XResourceError): pass
class BadMatch(XError): pass
class BadDrawable(XResourceError): pass
class BadAccess(XError): pass
class BadAlloc(XError): pass
class BadColor(XResourceError): pass
class BadGC(XResourceError): pass
class BadIDChoice(XResourceError): pass
class BadName(XError): pass
class BadLength(XError): pass
class BadImplementation(XError): pass
xerror_class = {
X.BadRequest: BadRequest,
X.BadValue: BadValue,
X.BadWindow: BadWindow,
X.BadPixmap: BadPixmap,
X.BadAtom: BadAtom,
X.BadCursor: BadCursor,
X.BadFont: BadFont,
X.BadMatch: BadMatch,
X.BadDrawable: BadDrawable,
X.BadAccess: BadAccess,
X.BadAlloc: BadAlloc,
X.BadColor: BadColor,
X.BadGC: BadGC,
X.BadIDChoice: BadIDChoice,
X.BadName: BadName,
X.BadLength: BadLength,
X.BadImplementation: BadImplementation,
}
class CatchError(object):
def __init__(self, *errors):
self.error_types = errors
self.error = None
self.request = None
def __call__(self, error, request):
if self.error_types:
for etype in self.error_types:
if isinstance(error, etype):
self.error = error
self.request = request
return 1
return 0
else:
self.error = error
self.request = request
return 1
def get_error(self):
return self.error
def get_request(self):
return self.request
def reset(self):
self.error = None
self.request = None

46
Xlib/ext/__init__.py

@ -0,0 +1,46 @@
# Xlib.ext.__init__ -- X extension modules
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
# __extensions__ is a list of tuples: (extname, extmod)
# extname is the name of the extension according to the X
# protocol. extmod is the name of the module in this package.
__extensions__ = [
# We load this first so other extensions can register generic event data
# structures.
('Generic Event Extension', 'ge'),
('XTEST', 'xtest'),
('SHAPE', 'shape'),
('XINERAMA', 'xinerama'),
('RECORD', 'record'),
('Composite', 'composite'),
('RANDR', 'randr'),
('XFIXES', 'xfixes'),
('SECURITY', 'security'),
('XInputExtension', 'xinput'),
('NV-CONTROL', 'nvcontrol'),
('DAMAGE', 'damage'),
('DPMS', 'dpms'),
('X-Resource', 'res'),
('MIT-SCREEN-SAVER', 'screensaver'),
]
__all__ = map(lambda x: x[1], __extensions__)

BIN
Xlib/ext/__pycache__/__init__.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/composite.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/damage.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/dpms.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/ge.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/randr.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/record.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/res.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/screensaver.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/security.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/shape.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/xfixes.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/xinerama.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/xinput.cpython-38.pyc

Binary file not shown.

BIN
Xlib/ext/__pycache__/xtest.cpython-38.pyc

Binary file not shown.

272
Xlib/ext/composite.py

@ -0,0 +1,272 @@
# $Id: xtest.py,v 1.1 2000/08/21 10:03:45 petli Exp $
#
# Xlib.ext.composite -- Composite extension module
#
# Copyright (C) 2007 Peter Liljenberg <peter.liljenberg@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
"""Composite extension, allowing windows to be rendered to off-screen
storage.
For detailed description, see the protocol specification at
http://freedesktop.org/wiki/Software/CompositeExt
By itself this extension is not very useful, it is intended to be used
together with the DAMAGE and XFIXES extensions. Typically you would
also need RENDER or glX or some similar method of creating fancy
graphics.
"""
from Xlib import X
from Xlib.protocol import rq
from Xlib.xobject import drawable
extname = 'Composite'
RedirectAutomatic = 0
RedirectManual = 1
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card32('major_version'),
rq.Card32('minor_version')
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
rq.Pad(16),
)
def query_version(self):
return QueryVersion(
display = self.display,
opcode = self.display.get_extension_major(extname),
major_version=0,
minor_version=4
)
class RedirectWindow(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def redirect_window(self, update, onerror = None):
"""Redirect the hierarchy starting at this window to off-screen
storage.
"""
RedirectWindow(display = self.display,
onerror = onerror,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class RedirectSubwindows(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def redirect_subwindows(self, update, onerror = None):
"""Redirect the hierarchies starting at all current and future
children to this window to off-screen storage.
"""
RedirectSubwindows(display = self.display,
onerror = onerror,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class UnredirectWindow(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def unredirect_window(self, update, onerror = None):
"""Stop redirecting this window hierarchy.
"""
UnredirectWindow(display = self.display,
onerror = onerror,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class UnredirectSubindows(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
rq.Window('window'),
rq.Set('update', 1, (RedirectAutomatic, RedirectManual)),
rq.Pad(3),
)
def unredirect_subwindows(self, update, onerror = None):
"""Stop redirecting the hierarchies of children to this window.
"""
RedirectWindow(display = self.display,
onerror = onerror,
opcode = self.display.get_extension_major(extname),
window = self,
update = update,
)
class CreateRegionFromBorderClip(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(5),
rq.RequestLength(),
rq.Card32('region'), # FIXME: this should be a Region from XFIXES extension
rq.Window('window'),
)
def create_region_from_border_clip(self, onerror = None):
"""Create a region of the border clip of the window, i.e. the area
that is not clipped by the parent and any sibling windows.
"""
rid = self.display.allocate_resource_id()
CreateRegionFromBorderClip(
display = self.display,
onerror = onerror,
opcode = self.display.get_extension_major(extname),
region = rid,
window = self,
)
# FIXME: create Region object and return it
return rid
class NameWindowPixmap(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(6),
rq.RequestLength(),
rq.Window('window'),
rq.Pixmap('pixmap'),
)
def name_window_pixmap(self, onerror = None):
"""Create a new pixmap that refers to the off-screen storage of
the window, including its border.
This pixmap will remain allocated until freed whatever happens
with the window. However, the window will get a new off-screen
pixmap every time it is mapped or resized, so to keep track of the
contents you must listen for these events and get a new pixmap
after them.
"""
pid = self.display.allocate_resource_id()
NameWindowPixmap(display = self.display,
onerror = onerror,
opcode = self.display.get_extension_major(extname),
window = self,
pixmap = pid,
)
cls = self.display.get_resource_class('pixmap', drawable.Pixmap)
return cls(self.display, pid, owner = 1)
class GetOverlayWindow(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(7),
rq.RequestLength(),
rq.Window('window')
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Window('overlay_window'),
rq.Pad(20),
)
def get_overlay_window(self):
"""Return the overlay window of the root window.
"""
return GetOverlayWindow(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self)
def init(disp, info):
disp.extension_add_method('display',
'composite_query_version',
query_version)
disp.extension_add_method('window',
'composite_redirect_window',
redirect_window)
disp.extension_add_method('window',
'composite_redirect_subwindows',
redirect_subwindows)
disp.extension_add_method('window',
'composite_unredirect_window',
unredirect_window)
disp.extension_add_method('window',
'composite_unredirect_subwindows',
unredirect_subwindows)
disp.extension_add_method('window',
'composite_create_region_from_border_clip',
create_region_from_border_clip)
disp.extension_add_method('window',
'composite_name_window_pixmap',
name_window_pixmap)
disp.extension_add_method('window',
'composite_get_overlay_window',
get_overlay_window)

182
Xlib/ext/damage.py

@ -0,0 +1,182 @@
# Xlib.ext.damage -- DAMAGE extension module
#
# Copyright (C) 2018 Joseph Kogut <joseph.kogut@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
from Xlib import X
from Xlib.protocol import rq, structs
from Xlib.xobject import resource
from Xlib.error import XError
extname = 'DAMAGE'
# Event codes #
DamageNotifyCode = 0
# Error codes #
BadDamageCode = 0
class BadDamageError(XError):
pass
# DamageReportLevel options
DamageReportRawRectangles = 0
DamageReportDeltaRectangles = 1
DamageReportBoundingBox = 2
DamageReportNonEmpty = 3
DamageReportLevel = (
DamageReportRawRectangles,
DamageReportDeltaRectangles,
DamageReportBoundingBox,
DamageReportNonEmpty,
)
DAMAGE = rq.Card32
# Methods
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
)
_reply = rq.Struct(rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
rq.Pad(16),
)
def query_version(self):
return QueryVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class DamageCreate(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
DAMAGE('damage'),
rq.Drawable('drawable'),
rq.Set('level', 1, DamageReportLevel),
rq.Pad(3),
)
def damage_create(self, level):
did = self.display.allocate_resource_id()
DamageCreate(display=self.display,
opcode=self.display.get_extension_major(extname),
damage=did,
drawable=self.id,
level=level,
)
return did
class DamageDestroy(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
DAMAGE('damage')
)
def damage_destroy(self, damage):
DamageDestroy(display=self.display,
opcode=self.display.get_extension_major(extname),
damage=damage,
)
self.display.free_resource_id(damage)
class DamageSubtract(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
DAMAGE('damage'),
rq.Card32('repair'),
rq.Card32('parts')
)
def damage_subtract(self, damage, repair=X.NONE, parts=X.NONE):
DamageSubtract(display=self.display,
opcode=self.display.get_extension_major(extname),
damage=damage,
repair=repair,
parts=parts)
class DamageAdd(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
rq.Card32('repair'),
rq.Card32('parts'),
)
def damage_add(self, repair, parts):
DamageAdd(display=self.display,
opcode=self.display.get_extension_major(extname),
repair=repair,
parts=parts)
# Events #
class DamageNotify(rq.Event):
_code = None
_fields = rq.Struct(
rq.Card8('type'),
rq.Card8('level'),
rq.Card16('sequence_number'),
rq.Drawable('drawable'),
DAMAGE('damage'),
rq.Card32('timestamp'),
rq.Object('area', structs.Rectangle),
rq.Object('drawable_geometry', structs.Rectangle)
)
def init(disp, info):
disp.extension_add_method('display',
'damage_query_version',
query_version)
disp.extension_add_method('drawable',
'damage_create',
damage_create)
disp.extension_add_method('display',
'damage_destroy',
damage_destroy)
disp.extension_add_method('display',
'damage_subtract',
damage_subtract)
disp.extension_add_method('drawable',
'damage_add',
damage_add)
disp.extension_add_event(info.first_event + DamageNotifyCode, DamageNotify)
disp.add_extension_error(code=BadDamageCode, err=BadDamageError)

233
Xlib/ext/dpms.py

@ -0,0 +1,233 @@
# Xlib.ext.dpms -- X Display Power Management Signaling
#
# Copyright (C) 2020 Thiago Kenji Okada <thiagokokada@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
'''
This extension provides X Protocol control over the VESA Display
Power Management Signaling (DPMS) characteristics of video boards
under control of the X Window System.
Documentation: https://www.x.org/releases/X11R7.7/doc/xextproto/dpms.html
'''
from Xlib import X
from Xlib.protocol import rq
extname = 'DPMS'
# DPMS Extension Power Levels
# 0 DPMSModeOn In use
# 1 DPMSModeStandby Blanked, low power
# 2 DPMSModeSuspend Blanked, lower power
# 3 DPMSModeOff Shut off, awaiting activity
DPMSModeOn = 0
DPMSModeStandby = 1
DPMSModeSuspend = 2
DPMSModeOff = 3
DPMSPowerLevel = (
DPMSModeOn,
DPMSModeStandby,
DPMSModeSuspend,
DPMSModeOff,
)
class DPMSGetVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
rq.Pad(20),
)
def get_version(self):
return DPMSGetVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class DPMSCapable(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Bool('capable'),
rq.Pad(23),
)
def capable(self):
return DPMSCapable(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class DPMSGetTimeouts(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('standby_timeout'),
rq.Card16('suspend_timeout'),
rq.Card16('off_timeout'),
rq.Pad(18),
)
def get_timeouts(self):
return DPMSGetTimeouts(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class DPMSSetTimeouts(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Card16('standby_timeout'),
rq.Card16('suspend_timeout'),
rq.Card16('off_timeout'),
rq.Pad(2)
)
def set_timeouts(self, standby_timeout, suspend_timeout, off_timeout):
return DPMSSetTimeouts(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1,
standby_timeout=standby_timeout,
suspend_timeout=suspend_timeout,
off_timeout=off_timeout)
class DPMSEnable(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
)
def enable(self):
return DPMSEnable(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class DPMSDisable(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(5),
rq.RequestLength(),
)
def disable(self):
return DPMSDisable(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class DPMSForceLevel(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(6),
rq.RequestLength(),
rq.Resource('power_level', DPMSPowerLevel),
)
def force_level(self, power_level):
return DPMSForceLevel(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1,
power_level=power_level)
class DPMSInfo(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(7),
rq.RequestLength(),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('power_level'),
rq.Bool('state'),
rq.Pad(21),
)
def info(self):
return DPMSInfo(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
def init(disp, _info):
disp.extension_add_method('display', 'dpms_get_version', get_version)
disp.extension_add_method('display', 'dpms_capable', capable)
disp.extension_add_method('display', 'dpms_get_timeouts', get_timeouts)
disp.extension_add_method('display', 'dpms_set_timeouts', set_timeouts)
disp.extension_add_method('display', 'dpms_enable', enable)
disp.extension_add_method('display', 'dpms_disable', disable)
disp.extension_add_method('display', 'dpms_force_level', force_level)
disp.extension_add_method('display', 'dpms_info', info)

112
Xlib/ext/ge.py

@ -0,0 +1,112 @@
# Xlib.ext.ge -- Generic Event extension module
#
# Copyright (C) 2012 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
'''
ge - Generic Event Extension
'''
from Xlib.protocol import rq
extname = 'Generic Event Extension'
GenericEventCode = 35
class GEQueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
rq.Pad(16),
)
def query_version(self):
return GEQueryVersion(
display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=0,
)
class GenericEvent(rq.Event):
_code = GenericEventCode
_fields = rq.Struct(
rq.Card8('type'),
rq.Card8('extension'),
rq.Card16('sequence_number'),
rq.Card32('length'),
rq.Card16('evtype'),
# Some generic events make use of this space, but with
# others the data is simply discarded. In any case we
# don't need to explicitly pad this out as we are
# always given at least 32 bytes and we save
# everything after the first ten as the "data" field.
#rq.Pad(22),
)
def __init__(self, binarydata = None, display = None, **keys):
if binarydata:
data = binarydata[10:]
binarydata = binarydata[:10]
else:
data = ''
rq.Event.__init__(
self,
binarydata=binarydata,
display=display,
**keys
)
if display:
ge_event_data = getattr(display, 'ge_event_data', None)
if ge_event_data:
estruct = ge_event_data.get((self.extension, self.evtype), None)
if estruct:
data, _ = estruct.parse_binary(data, display)
self._data['data'] = data
def add_event_data(self, extension, evtype, estruct):
if not hasattr(self.display, 'ge_event_data'):
self.display.ge_event_data = {}
self.display.ge_event_data[(extension, evtype)] = estruct
def init(disp, info):
disp.extension_add_method('display', 'ge_query_version', query_version)
disp.extension_add_method('display', 'ge_add_event_data', add_event_data)
disp.extension_add_event(GenericEventCode, GenericEvent)

5393
Xlib/ext/nvcontrol.py

File diff suppressed because it is too large

1197
Xlib/ext/randr.py

File diff suppressed because it is too large

283
Xlib/ext/record.py

@ -0,0 +1,283 @@
# Xlib.ext.record -- RECORD extension module
#
# Copyright (C) 2006 Alex Badea <vamposdecampos@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
from Xlib import X
from Xlib.protocol import rq
extname = 'RECORD'
FromServerTime = 0x01
FromClientTime = 0x02
FromClientSequence = 0x04
CurrentClients = 1
FutureClients = 2
AllClients = 3
FromServer = 0
FromClient = 1
ClientStarted = 2
ClientDied = 3
StartOfData = 4
EndOfData = 5
Record_Range8 = rq.Struct(
rq.Card8('first'),
rq.Card8('last'))
Record_Range16 = rq.Struct(
rq.Card16('first'),
rq.Card16('last'))
Record_ExtRange = rq.Struct(
rq.Card8('major_range_first'),
rq.Card8('major_range_last'),
rq.Card16('minor_range_first'),
rq.Card16('minor_range_last'))
Record_Range = rq.Struct(
rq.Object('core_requests', Record_Range8),
rq.Object('core_replies', Record_Range8),
rq.Object('ext_requests', Record_ExtRange),
rq.Object('ext_replies', Record_ExtRange),
rq.Object('delivered_events', Record_Range8),
rq.Object('device_events', Record_Range8),
rq.Object('errors', Record_Range8),
rq.Bool('client_started'),
rq.Bool('client_died'))
Record_ClientInfo = rq.Struct(
rq.Card32('client_resource'),
rq.LengthOf('ranges', 4),
rq.List('ranges', Record_Range))
class RawField(rq.ValueField):
"""A field with raw data, stored as a string"""
structcode = None
def pack_value(self, val):
return val, len(val), None
def parse_binary_value(self, data, display, length, format):
return data, ''
class GetVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'))
_reply = rq.Struct(
rq.Pad(2),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
rq.Pad(20))
def get_version(self, major, minor):
return GetVersion(
display = self.display,
opcode = self.display.get_extension_major(extname),
major_version = major,
minor_version = minor)
class CreateContext(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.Card32('context'), # Record_RC
rq.Card8('element_header'), # Record_Element_Header
rq.Pad(3),
rq.LengthOf('clients', 4),
rq.LengthOf('ranges', 4),
rq.List('clients', rq.Card32Obj),
rq.List('ranges', Record_Range))
def create_context(self, datum_flags, clients, ranges):
context = self.display.allocate_resource_id()
CreateContext(
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context,
element_header = datum_flags,
clients = clients,
ranges = ranges)
return context
class RegisterClients(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Card32('context'), # Record_RC
rq.Card8('element_header'), # Record_Element_Header
rq.Pad(3),
rq.LengthOf('clients', 4),
rq.LengthOf('ranges', 4),
rq.List('clients', rq.Card32Obj),
rq.List('ranges', Record_Range))
def register_clients(self, context, element_header, clients, ranges):
RegisterClients(
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context,
element_header = element_header,
clients = clients,
ranges = ranges)
class UnregisterClients(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Card32('context'), # Record_RC
rq.LengthOf('clients', 4),
rq.List('clients', rq.Card32Obj))
def unregister_clients(self, context, clients):
UnregisterClients(
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context,
clients = clients)
class GetContext(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
rq.Card32('context')) # Record_RC
_reply = rq.Struct(
rq.Pad(2),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card8('element_header'), # Record_Element_Header
rq.Pad(3),
rq.LengthOf('client_info', 4),
rq.Pad(16),
rq.List('client_info', Record_ClientInfo))
def get_context(self, context):
return GetContext(
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context)
class EnableContext(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(5),
rq.RequestLength(),
rq.Card32('context')) # Record_RC
_reply = rq.Struct(
rq.Pad(1),
rq.Card8('category'),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card8('element_header'), # Record_Element_Header
rq.Bool('client_swapped'),
rq.Pad(2),
rq.Card32('id_base'), # Record_XIDBase
rq.Card32('server_time'),
rq.Card32('recorded_sequence_number'),
rq.Pad(8),
RawField('data'))
# This request receives multiple responses, so we need to keep
# ourselves in the 'sent_requests' list in order to receive them all.
# See the discussion on ListFonstsWithInfo in request.py
def __init__(self, callback, *args, **keys):
self._callback = callback
rq.ReplyRequest.__init__(self, *args, **keys)
def _parse_response(self, data):
r, d = self._reply.parse_binary(data, self._display)
self._callback(r)
if r.category == StartOfData:
# Hack ourselves a sequence number, used by the code in
# Xlib.protocol.display.Display.parse_request_response()
self.sequence_number = r.sequence_number
if r.category == EndOfData:
self._response_lock.acquire()
self._data = r
self._response_lock.release()
else:
self._display.sent_requests.insert(0, self)
def enable_context(self, context, callback):
EnableContext(
callback = callback,
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context)
class DisableContext(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(6),
rq.RequestLength(),
rq.Card32('context')) # Record_RC
def disable_context(self, context):
DisableContext(
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context)
class FreeContext(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(7),
rq.RequestLength(),
rq.Card32('context')) # Record_RC
def free_context(self, context):
FreeContext(
display = self.display,
opcode = self.display.get_extension_major(extname),
context = context)
self.display.free_resource_id(context)
def init(disp, info):
disp.extension_add_method('display', 'record_get_version', get_version)
disp.extension_add_method('display', 'record_create_context', create_context)
disp.extension_add_method('display', 'record_register_clients', register_clients)
disp.extension_add_method('display', 'record_unregister_clients', unregister_clients)
disp.extension_add_method('display', 'record_get_context', get_context)
disp.extension_add_method('display', 'record_enable_context', enable_context)
disp.extension_add_method('display', 'record_disable_context', disable_context)
disp.extension_add_method('display', 'record_free_context', free_context)

288
Xlib/ext/res.py

@ -0,0 +1,288 @@
# Xlib.ext.res -- X-Resource extension module
#
# Copyright (C) 2021 Aleksei Bavshin <alebastr89@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street,
# Fifth Floor,
# Boston, MA 02110-1301 USA
"""X-Resource extension allows a client to query the X server about its usage
of various resources.
For detailed description see any of the following documents.
Protocol specification:
https://www.x.org/releases/current/doc/resourceproto/resproto.txt
XCB Protocol specification:
https://cgit.freedesktop.org/xcb/proto/tree/src/res.xml
"""
from Xlib.protocol import rq
RES_MAJOR_VERSION = 1
RES_MINOR_VERSION = 2
extname = "X-Resource"
# v1.0
ResQueryVersion = 0
ResQueryClients = 1
ResQueryClientResources = 2
ResQueryClientPixmapBytes = 3
# v1.2
ResQueryClientIds = 4
ResQueryResourceBytes = 5
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8("opcode"),
rq.Opcode(ResQueryVersion),
rq.RequestLength(),
rq.Card8("client_major"),
rq.Card8("client_minor"),
rq.Pad(2))
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16("sequence_number"),
rq.ReplyLength(),
rq.Card16("server_major"),
rq.Card16("server_minor"),
rq.Pad(20))
def query_version(self, client_major=RES_MAJOR_VERSION,
client_minor=RES_MINOR_VERSION):
""" Query the protocol version supported by the X server.
The client sends the highest supported version to the server and the
server sends the highest version it supports, but no higher than the
requested version."""
return QueryVersion(
display=self.display,
opcode=self.display.get_extension_major(extname),
client_major=client_major,
client_minor=client_minor)
Client = rq.Struct(
rq.Card32("resource_base"),
rq.Card32("resource_mask"))
class QueryClients(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8("opcode"),
rq.Opcode(ResQueryClients),
rq.RequestLength())
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16("sequence_number"),
rq.ReplyLength(),
rq.LengthOf("clients", 4),
rq.Pad(20),
rq.List("clients", Client))
def query_clients(self):
"""Request the list of all currently connected clients."""
return QueryClients(
display=self.display,
opcode=self.display.get_extension_major(extname))
Type = rq.Struct(
rq.Card32("resource_type"),
rq.Card32("count"))
class QueryClientResources(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8("opcode"),
rq.Opcode(ResQueryClientResources),
rq.RequestLength(),
rq.Card32("client"))
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16("sequence_number"),
rq.ReplyLength(),
rq.LengthOf("types", 4),
rq.Pad(20),
rq.List("types", Type))
def query_client_resources(self, client):
"""Request the number of resources owned by a client.
The server will return the counts of each type of resource.
"""
return QueryClientResources(
display=self.display,
opcode=self.display.get_extension_major(extname),
client=client)
class QueryClientPixmapBytes(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8("opcode"),
rq.Opcode(ResQueryClientPixmapBytes),
rq.RequestLength(),
rq.Card32("client"))
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16("sequence_number"),
rq.ReplyLength(),
rq.Card32("bytes"),
rq.Card32("bytes_overflow"),
rq.Pad(16))
def query_client_pixmap_bytes(self, client):
"""Query the pixmap usage of some client.
The returned number is a sum of memory usage of each pixmap that can be
attributed to the given client.
"""
return QueryClientPixmapBytes(
display=self.display,
opcode=self.display.get_extension_major(extname),
client=client)
class SizeOf(rq.LengthOf):
"""A SizeOf stores the size in bytes of some other Field whose size
may vary, e.g. List
"""
def __init__(self, name, size, item_size):
rq.LengthOf.__init__(self, name, size)
self.item_size = item_size
def parse_value(self, length, display):
return length // self.item_size
ClientXIDMask = 1 << 0
LocalClientPIDMask = 1 << 1
ClientIdSpec = rq.Struct(
rq.Card32("client"),
rq.Card32("mask"))
ClientIdValue = rq.Struct(
rq.Object("spec", ClientIdSpec),
SizeOf("value", 4, 4),
rq.List("value", rq.Card32Obj))
class QueryClientIds(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8("opcode"),
rq.Opcode(ResQueryClientIds),
rq.RequestLength(),
rq.LengthOf("specs", 4),
rq.List("specs", ClientIdSpec))
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16("sequence_number"),
rq.ReplyLength(),
rq.LengthOf("ids", 4),
rq.Pad(20),
rq.List("ids", ClientIdValue))
def query_client_ids(self, specs):
"""Request to identify a given set of clients with some identification method.
The request sends a list of specifiers that select clients and
identification methods to server. The server then tries to identify the
chosen clients using the identification methods specified for each client.
The server returns IDs for those clients that were successfully identified.
"""
return QueryClientIds(
display=self.display,
opcode=self.display.get_extension_major(extname),
specs=specs)
ResourceIdSpec = rq.Struct(
rq.Card32("resource"),
rq.Card32("type"))
ResourceSizeSpec = rq.Struct(
# inline struct ResourceIdSpec to work around
# a parser bug with nested objects
rq.Card32("resource"),
rq.Card32("type"),
rq.Card32("bytes"),
rq.Card32("ref_count"),
rq.Card32("use_count"))
ResourceSizeValue = rq.Struct(
rq.Object("size", ResourceSizeSpec),
rq.LengthOf("cross_references", 4),
rq.List("cross_references", ResourceSizeSpec))
class QueryResourceBytes(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8("opcode"),
rq.Opcode(ResQueryResourceBytes),
rq.RequestLength(),
rq.Card32("client"),
rq.LengthOf("specs", 4),
rq.List("specs", ResourceIdSpec))
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16("sequence_number"),
rq.ReplyLength(),
rq.LengthOf("sizes", 4),
rq.Pad(20),
rq.List("sizes", ResourceSizeValue))
def query_resource_bytes(self, client, specs):
"""Query the sizes of resources from X server.
The request sends a list of specifiers that selects resources for size
calculation. The server tries to calculate the sizes of chosen resources
and returns an estimate for a resource only if the size could be determined
"""
return QueryResourceBytes(
display=self.display,
opcode=self.display.get_extension_major(extname),
client=client,
specs=specs)
def init(disp, info):
disp.extension_add_method("display", "res_query_version", query_version)
disp.extension_add_method("display", "res_query_clients", query_clients)
disp.extension_add_method("display", "res_query_client_resources",
query_client_resources)
disp.extension_add_method("display", "res_query_client_pixmap_bytes",
query_client_pixmap_bytes)
disp.extension_add_method("display", "res_query_client_ids",
query_client_ids)
disp.extension_add_method("display", "res_query_resource_bytes",
query_resource_bytes)

198
Xlib/ext/screensaver.py

@ -0,0 +1,198 @@
# Xlib.ext.screensaver -- X ScreenSaver extension module
#
# Copyright (C) 2022 Vladimir Panteleev <git@cy.md>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street,
# Fifth Floor,
# Boston, MA 02110-1301 USA
"""This extension allows registering the client as an X screensaver,
or query information about the current screensaver.
For detailed description see any of the following documents.
Protocol specification:
https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html
XCB Protocol specification:
https://cgit.freedesktop.org/xcb/proto/tree/src/screensaver.xml
"""
from Xlib import X
from Xlib.protocol import rq, structs
extname = 'MIT-SCREEN-SAVER'
# Event members
NotifyMask = 1
CycleMask = 2
# Notify state
StateOff = 0
StateOn = 1
StateCycle = 2
# Notify kind
KindBlanked = 0
KindInternal = 1
KindExternal = 2
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card8('major_version'),
rq.Card8('minor_version'),
rq.Pad(2),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
rq.Pad(20),
)
def query_version(self):
return QueryVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=0)
class QueryInfo(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.Drawable('drawable'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Card8('state'),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Window('saver_window'),
rq.Card32('til_or_since'),
rq.Card32('idle'),
rq.Card32('event_mask'), # rq.Set('event_mask', 4, (NotifyMask, CycleMask)),
rq.Card8('kind'),
rq.Pad(7),
)
def query_info(self):
return QueryInfo(display=self.display,
opcode=self.display.get_extension_major(extname),
drawable=self,
)
class SelectInput(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Drawable('drawable'),
rq.Card32('event_mask'), # rq.Set('event_mask', 4, (NotifyMask, CycleMask)),
)
def select_input(self, mask):
return SelectInput(display=self.display,
opcode=self.display.get_extension_major(extname),
drawable=self,
event_mask=mask,
)
class SetAttributes(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Drawable('drawable'),
rq.Int16('x'),
rq.Int16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('border_width'),
rq.Set('window_class', 1, (X.CopyFromParent, X.InputOutput, X.InputOnly)),
rq.Card8('depth'),
rq.Card32('visual'),
structs.WindowValues('attrs'),
)
def set_attributes(self, x, y, width, height, border_width,
window_class = X.CopyFromParent,
depth = X.CopyFromParent,
visual = X.CopyFromParent,
onerror = None,
**keys):
return SetAttributes(display=self.display,
onerror = onerror,
opcode=self.display.get_extension_major(extname),
drawable=self,
x = x,
y = y,
width = width,
height = height,
border_width = border_width,
window_class = window_class,
depth = depth,
visual = visual,
attrs = keys)
class UnsetAttributes(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
rq.Drawable('drawable'),
)
def unset_attributes(self, onerror = None):
return UnsetAttributes(display=self.display,
onerror = onerror,
opcode=self.display.get_extension_major(extname),
drawable=self)
class Notify(rq.Event):
_code = None
_fields = rq.Struct(
rq.Card8('type'),
rq.Set('state', 1, (StateOff, StateOn, StateCycle)),
rq.Card16('sequence_number'),
rq.Card32('timestamp'),
rq.Window('root'),
rq.Window('window'),
rq.Set('kind', 1, (KindBlanked, KindInternal, KindExternal)),
rq.Bool('forced'),
rq.Pad(14),
)
def init(disp, info):
disp.extension_add_method('display', 'screensaver_query_version', query_version)
disp.extension_add_method('drawable', 'screensaver_query_info', query_info)
disp.extension_add_method('drawable', 'screensaver_select_input', select_input)
disp.extension_add_method('drawable', 'screensaver_set_attributes', set_attributes)
disp.extension_add_method('drawable', 'screensaver_unset_attributes', unset_attributes)
disp.extension_add_event(info.first_event + 0, Notify)

139
Xlib/ext/security.py

@ -0,0 +1,139 @@
# Xlib.ext.security -- SECURITY extension module
#
# Copyright (C) 2010-2013 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
'''
A partial implementation of the SECURITY extension. Support for the
SecurityAuthorizationRevoked event is not implemented.
'''
from Xlib.protocol import rq
extname = 'SECURITY'
SecurityClientTrusted = 0
SecurityClientUntrusted = 1
SecurityAuthorizationRevokedMask = 1
AUTHID = rq.Card32
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card16('major_version'),
rq.Card16('minor_version')
)
_reply = rq.Struct(rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
rq.Pad(20)
)
def query_version(self):
return QueryVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=0)
class SecurityGenerateAuthorization(rq.ReplyRequest):
# The order of fields here does not match the specifications I've seen
# online, but it *does* match with the X.org implementation. I guess the
# spec is out-of-date.
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.LengthOf('auth_proto', 2),
rq.LengthOf('auth_data', 2),
rq.Card32('value_mask'),
rq.String8('auth_proto'),
rq.Binary('auth_data'),
rq.List('values', rq.Card32Obj)
)
_reply = rq.Struct(rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
AUTHID('authid'),
rq.LengthOf('auth_data_return', 2),
rq.Pad(18),
rq.Binary('auth_data_return')
)
def generate_authorization(self, auth_proto, auth_data=b'', timeout=None,
trust_level=None, group=None, event_mask=None):
value_mask = 0
values = []
if timeout is not None:
value_mask |= 1
values.append(timeout)
if trust_level is not None:
value_mask |= 2
values.append(trust_level)
if group is not None:
value_mask |= 4
values.append(group)
if event_mask is not None:
value_mask |= 8
values.append(event_mask)
return SecurityGenerateAuthorization(display=self.display,
opcode=self.display.get_extension_major(extname),
value_mask=value_mask,
auth_proto=auth_proto,
auth_data=auth_data,
values=values)
class SecurityRevokeAuthorization(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
AUTHID('authid')
)
def revoke_authorization(self, authid):
return SecurityRevokeAuthorization(display=self.display,
opcode=self.display.get_extension_major(extname),
authid=authid)
def init(disp, info):
disp.extension_add_method('display',
'security_query_version',
query_version)
disp.extension_add_method('display',
'security_generate_authorization',
generate_authorization)
disp.extension_add_method('display',
'security_revoke_authorization',
revoke_authorization)

297
Xlib/ext/shape.py

@ -0,0 +1,297 @@
# Automatically generated file; DO NOT EDIT.
# Generated from: /usr/share/xcb/shape.xml
from Xlib.protocol import rq, structs
extname = 'SHAPE'
OP = rq.Card8
class SO:
Set = 0
Union = 1
Intersect = 2
Subtract = 3
Invert = 4
class SK:
Bounding = 0
Clip = 1
Input = 2
class KIND(rq.Set):
def __init__(self, name):
super(KIND, self).__init__(name, 1,
values=(SK.Bounding,
SK.Clip,
SK.Input))
class NotifyEventData(rq.Event):
_code = None
_fields = rq.Struct(
rq.Card8('type'),
KIND('shape_kind'),
rq.Card16('sequence_number'),
rq.Window('affected_window'),
rq.Int16('extents_x'),
rq.Int16('extents_y'),
rq.Card16('extents_width'),
rq.Card16('extents_height'),
rq.Card32('server_time'),
rq.Card8('shaped'),
rq.Pad(11),
)
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
)
class Rectangles(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
OP('operation'),
KIND('destination_kind'),
rq.Card8('ordering'),
rq.Pad(1),
rq.Window('destination_window'),
rq.Int16('x_offset'),
rq.Int16('y_offset'),
rq.List('rectangles', structs.Rectangle, pad=0),
)
class Mask(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
OP('operation'),
KIND('destination_kind'),
rq.Pad(2),
rq.Window('destination_window'),
rq.Int16('x_offset'),
rq.Int16('y_offset'),
rq.Pixmap('source_bitmap'),
)
class Combine(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
OP('operation'),
KIND('destination_kind'),
KIND('source_kind'),
rq.Pad(1),
rq.Window('destination_window'),
rq.Int16('x_offset'),
rq.Int16('y_offset'),
rq.Window('source_window'),
)
class Offset(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
KIND('destination_kind'),
rq.Pad(3),
rq.Window('destination_window'),
rq.Int16('x_offset'),
rq.Int16('y_offset'),
)
class QueryExtents(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(5),
rq.RequestLength(),
rq.Window('destination_window'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card8('bounding_shaped'),
rq.Card8('clip_shaped'),
rq.Pad(2),
rq.Int16('bounding_shape_extents_x'),
rq.Int16('bounding_shape_extents_y'),
rq.Card16('bounding_shape_extents_width'),
rq.Card16('bounding_shape_extents_height'),
rq.Int16('clip_shape_extents_x'),
rq.Int16('clip_shape_extents_y'),
rq.Card16('clip_shape_extents_width'),
rq.Card16('clip_shape_extents_height'),
)
class SelectInput(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(6),
rq.RequestLength(),
rq.Window('destination_window'),
rq.Card8('enable'),
rq.Pad(3),
)
class InputSelected(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(7),
rq.RequestLength(),
rq.Window('destination_window'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Card8('enabled'),
rq.Card16('sequence_number'),
rq.ReplyLength(),
)
class GetRectangles(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(8),
rq.RequestLength(),
rq.Window('window'),
KIND('source_kind'),
rq.Pad(3),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Card8('ordering'),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.LengthOf('rectangles', 4),
rq.Pad(20),
rq.List('rectangles', structs.Rectangle, pad=0),
)
class Event:
# Sub events.
Notify = 0
def combine(self, operation, destination_kind, source_kind, x_offset, y_offset):
Combine(
display=self.display,
opcode=self.display.get_extension_major(extname),
source_window=self,
operation=operation,
destination_kind=destination_kind,
source_kind=source_kind,
x_offset=x_offset,
y_offset=y_offset,
)
def get_rectangles(self, source_kind):
return GetRectangles(
display=self.display,
opcode=self.display.get_extension_major(extname),
window=self,
source_kind=source_kind,
)
def input_selected(self, ):
return InputSelected(
display=self.display,
opcode=self.display.get_extension_major(extname),
destination_window=self,
)
def mask(self, operation, destination_kind, x_offset, y_offset, source_bitmap):
Mask(
display=self.display,
opcode=self.display.get_extension_major(extname),
destination_window=self,
operation=operation,
destination_kind=destination_kind,
x_offset=x_offset,
y_offset=y_offset,
source_bitmap=source_bitmap,
)
def offset(self, destination_kind, x_offset, y_offset):
Offset(
display=self.display,
opcode=self.display.get_extension_major(extname),
destination_window=self,
destination_kind=destination_kind,
x_offset=x_offset,
y_offset=y_offset,
)
def query_extents(self, ):
return QueryExtents(
display=self.display,
opcode=self.display.get_extension_major(extname),
destination_window=self,
)
def query_version(self, ):
return QueryVersion(
display=self.display,
opcode=self.display.get_extension_major(extname),
)
def rectangles(self, operation, destination_kind, ordering, x_offset, y_offset, rectangles):
Rectangles(
display=self.display,
opcode=self.display.get_extension_major(extname),
destination_window=self,
operation=operation,
destination_kind=destination_kind,
ordering=ordering,
x_offset=x_offset,
y_offset=y_offset,
rectangles=rectangles,
)
def select_input(self, enable):
SelectInput(
display=self.display,
opcode=self.display.get_extension_major(extname),
destination_window=self,
enable=enable,
)
def init(disp, info):
disp.extension_add_method('window', 'shape_combine', combine)
disp.extension_add_method('window', 'shape_get_rectangles', get_rectangles)
disp.extension_add_method('window', 'shape_input_selected', input_selected)
disp.extension_add_method('window', 'shape_mask', mask)
disp.extension_add_method('window', 'shape_offset', offset)
disp.extension_add_method('window', 'shape_query_extents', query_extents)
disp.extension_add_method('display', 'shape_query_version', query_version)
disp.extension_add_method('window', 'shape_rectangles', rectangles)
disp.extension_add_method('window', 'shape_select_input', select_input)
disp.extension_add_event(info.first_event + Event.Notify, NotifyEventData, 'ShapeNotify')

201
Xlib/ext/xfixes.py

@ -0,0 +1,201 @@
# Xlib.ext.xfixes -- XFIXES extension module
#
# Copyright (C) 2010-2011 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
'''
A partial implementation of the XFIXES extension. Only the HideCursor and
ShowCursor requests and SelectionNotify events are provided.
'''
from Xlib import X
from Xlib.protocol import rq, structs
extname = 'XFIXES'
XFixesSelectionNotify = 0
XFixesCursorNotify = 1
XFixesSetSelectionOwnerNotifyMask = (1 << 0)
XFixesSelectionWindowDestroyNotifyMask = (1 << 1)
XFixesSelectionClientCloseNotifyMask = (1 << 2)
XFixesDisplayCursorNotifyMask = (1 << 0)
XFixesSetSelectionOwnerNotify = 0
XFixesSelectionWindowDestroyNotify = 1
XFixesSelectionClientCloseNotify = 2
XFixesDisplayCursorNotify = 0
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card32('major_version'),
rq.Card32('minor_version')
)
_reply = rq.Struct(rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
rq.Pad(16)
)
def query_version(self):
return QueryVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=4,
minor_version=0)
class HideCursor(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(29),
rq.RequestLength(),
rq.Window('window')
)
def hide_cursor(self):
HideCursor(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self)
class ShowCursor(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(30),
rq.RequestLength(),
rq.Window('window')
)
def show_cursor(self):
ShowCursor(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self)
class SelectSelectionInput(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Window('window'),
rq.Card32('selection'),
rq.Card32('mask')
)
def select_selection_input(self, window, selection, mask):
return SelectSelectionInput(opcode=self.display.get_extension_major(extname),
display=self.display,
window=window,
selection=selection,
mask=mask)
class SelectionNotify(rq.Event):
_code = None
_fields = rq.Struct(rq.Card8('type'),
rq.Card8('sub_code'),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Window('owner'),
rq.Card32('selection'),
rq.Card32('timestamp'),
rq.Card32('selection_timestamp'),
rq.Pad(8))
class SetSelectionOwnerNotify(SelectionNotify):
pass
class SelectionWindowDestroyNotify(SelectionNotify):
pass
class SelectionClientCloseNotify(SelectionNotify):
pass
class SelectCursorInput(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Window('window'),
rq.Card32('mask')
)
def select_cursor_input(self, window, mask):
return SelectCursorInput(opcode=self.display.get_extension_major(extname),
display=self.display,
window=window,
cursor_serial=0,
mask=mask)
class GetCursorImage(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength()
)
_reply = rq.Struct(rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Int16('x'),
rq.Int16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('xhot'),
rq.Card16('yhot'),
rq.Card32('cursor_serial'),
rq.Pad(8),
rq.List('cursor_image', rq.Card32)
)
def get_cursor_image(self, window):
return GetCursorImage(opcode=self.display.get_extension_major(extname),
display=self.display,
)
class DisplayCursorNotify(rq.Event):
_code = None
_fields = rq.Struct(rq.Card8('type'),
rq.Card8('sub_code'),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card32('cursor_serial'),
rq.Card32('timestamp'))
def init(disp, info):
disp.extension_add_method('display', 'xfixes_select_selection_input', select_selection_input)
disp.extension_add_method('display', 'xfixes_query_version', query_version)
disp.extension_add_method('window', 'xfixes_hide_cursor', hide_cursor)
disp.extension_add_method('window', 'xfixes_show_cursor', show_cursor)
disp.extension_add_method('display', 'xfixes_select_cursor_input', select_cursor_input)
disp.extension_add_method('display', 'xfixes_get_cursor_image', get_cursor_image)
disp.extension_add_subevent(info.first_event + XFixesSelectionNotify, XFixesSetSelectionOwnerNotify, SetSelectionOwnerNotify)
disp.extension_add_subevent(info.first_event + XFixesSelectionNotify, XFixesSelectionWindowDestroyNotify, SelectionWindowDestroyNotify)
disp.extension_add_subevent(info.first_event + XFixesSelectionNotify, XFixesSelectionClientCloseNotify, SelectionClientCloseNotify)
disp.extension_add_subevent(info.first_event + XFixesCursorNotify, XFixesDisplayCursorNotify, DisplayCursorNotify)

223
Xlib/ext/xinerama.py

@ -0,0 +1,223 @@
# Xlib.ext.xinerama -- Xinerama extension module
#
# Copyright (C) 2006 Mike Meyer <mwm@mired.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
"""Xinerama - provide access to the Xinerama extension information.
There are at least there different - and mutually incomparable -
Xinerama extensions available. This uses the one bundled with XFree86
4.6 and/or Xorg 6.9 in the ati/radeon driver. It uses the include
files from that X distribution, so should work with it as well. I
provide code for the lone Sun 1.0 request that isn't part of 1.1, but
this is untested because I don't have a server that implements it.
The functions loosely follow the libXineram functions. Mostly, they
return an rq.Struct in lieu of passing in pointers that get data from
the rq.Struct crammed into them. The exception is isActive, which
returns the state information - because that's what libXinerama does."""
from Xlib import X
from Xlib.protocol import rq, structs
extname = 'XINERAMA'
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card8('major_version'),
rq.Card8('minor_version'),
rq.Pad(2),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
rq.Pad(20),
)
def query_version(self):
return QueryVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=1,
minor_version=1)
class GetState(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.Window('window'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Bool('state'),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Window('window'),
rq.Pad(20),
)
def get_state(self):
return GetState(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self.id,
)
class GetScreenCount(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Window('window'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Card8('screen_count'),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Window('window'),
rq.Pad(20),
)
def get_screen_count(self):
return GetScreenCount(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self.id,
)
class GetScreenSize(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Window('window'),
rq.Card32('screen'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Card32('length'),
rq.Card32('width'),
rq.Card32('height'),
rq.Window('window'),
rq.Card32('screen'),
rq.Pad(8),
)
def get_screen_size(self, screen_no):
"""Returns the size of the given screen number"""
return GetScreenSize(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self.id,
screen=screen_no,
)
# IsActive is only available from Xinerama 1.1 and later.
# It should be used in preference to GetState.
class IsActive(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('state'),
rq.Pad(20),
)
def is_active(self):
r = IsActive(display=self.display,
opcode=self.display.get_extension_major(extname),
)
return r.state
# QueryScreens is only available from Xinerama 1.1 and later
class QueryScreens(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(5),
rq.RequestLength(),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('number'),
rq.Pad(20),
rq.List('screens', structs.Rectangle),
)
def query_screens(self):
# Hmm. This one needs to read the screen data from the socket. Ooops...
return QueryScreens(display=self.display,
opcode=self.display.get_extension_major(extname),
)
# GetInfo is only available from some Xinerama 1.0, and *NOT* later! Untested
class GetInfo(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(4),
rq.RequestLength(),
rq.Card32('visual'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Window('window'),
# An array of subwindow slots goes here. Bah.
)
def get_info(self, visual):
r = GetInfo(display=self.display,
opcode=self.display.get_extension_major(extname),
visual=visual)
def init(disp, info):
disp.extension_add_method('display', 'xinerama_query_version', query_version)
disp.extension_add_method('window', 'xinerama_get_state', get_state)
disp.extension_add_method('window', 'xinerama_get_screen_count', get_screen_count)
disp.extension_add_method('window', 'xinerama_get_screen_size', get_screen_size)
disp.extension_add_method('display', 'xinerama_is_active', is_active)
disp.extension_add_method('display', 'xinerama_query_screens', query_screens)
disp.extension_add_method('display', 'xinerama_get_info', get_info)

777
Xlib/ext/xinput.py

@ -0,0 +1,777 @@
# Xlib.ext.xinput -- XInput extension module
#
# Copyright (C) 2012 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
'''
A very incomplete implementation of the XInput extension.
'''
import sys
import array
import struct
# Python 2/3 compatibility.
from six import integer_types
from Xlib.protocol import rq
from Xlib import X
extname = 'XInputExtension'
PropertyDeleted = 0
PropertyCreated = 1
PropertyModified = 2
NotifyNormal = 0
NotifyGrab = 1
NotifyUngrab = 2
NotifyWhileGrabbed = 3
NotifyPassiveGrab = 4
NotifyPassiveUngrab = 5
NotifyAncestor = 0
NotifyVirtual = 1
NotifyInferior = 2
NotifyNonlinear = 3
NotifyNonlinearVirtual = 4
NotifyPointer = 5
NotifyPointerRoot = 6
NotifyDetailNone = 7
GrabtypeButton = 0
GrabtypeKeycode = 1
GrabtypeEnter = 2
GrabtypeFocusIn = 3
GrabtypeTouchBegin = 4
AnyModifier = (1 << 31)
AnyButton = 0
AnyKeycode = 0
AsyncDevice = 0
SyncDevice = 1
ReplayDevice = 2
AsyncPairedDevice = 3
AsyncPair = 4
SyncPair = 5
SlaveSwitch = 1
DeviceChange = 2
MasterAdded = (1 << 0)
MasterRemoved = (1 << 1)
SlaveAdded = (1 << 2)
SlaveRemoved = (1 << 3)
SlaveAttached = (1 << 4)
SlaveDetached = (1 << 5)
DeviceEnabled = (1 << 6)
DeviceDisabled = (1 << 7)
AddMaster = 1
RemoveMaster = 2
AttachSlave = 3
DetachSlave = 4
AttachToMaster = 1
Floating = 2
ModeRelative = 0
ModeAbsolute = 1
MasterPointer = 1
MasterKeyboard = 2
SlavePointer = 3
SlaveKeyboard = 4
FloatingSlave = 5
KeyClass = 0
ButtonClass = 1
ValuatorClass = 2
ScrollClass = 3
TouchClass = 8
KeyRepeat = (1 << 16)
AllDevices = 0
AllMasterDevices = 1
DeviceChanged = 1
KeyPress = 2
KeyRelease = 3
ButtonPress = 4
ButtonRelease = 5
Motion = 6
Enter = 7
Leave = 8
FocusIn = 9
FocusOut = 10
HierarchyChanged = 11
PropertyEvent = 12
RawKeyPress = 13
RawKeyRelease = 14
RawButtonPress = 15
RawButtonRelease = 16
RawMotion = 17
DeviceChangedMask = (1 << DeviceChanged)
KeyPressMask = (1 << KeyPress)
KeyReleaseMask = (1 << KeyRelease)
ButtonPressMask = (1 << ButtonPress)
ButtonReleaseMask = (1 << ButtonRelease)
MotionMask = (1 << Motion)
EnterMask = (1 << Enter)
LeaveMask = (1 << Leave)
FocusInMask = (1 << FocusIn)
FocusOutMask = (1 << FocusOut)
HierarchyChangedMask = (1 << HierarchyChanged)
PropertyEventMask = (1 << PropertyEvent)
RawKeyPressMask = (1 << RawKeyPress)
RawKeyReleaseMask = (1 << RawKeyRelease)
RawButtonPressMask = (1 << RawButtonPress)
RawButtonReleaseMask = (1 << RawButtonRelease)
RawMotionMask = (1 << RawMotion)
GrabModeSync = 0
GrabModeAsync = 1
GrabModeTouch = 2
DEVICEID = rq.Card16
DEVICE = rq.Card16
DEVICEUSE = rq.Card8
PROPERTY_TYPE_FLOAT = 'FLOAT'
class FP1616(rq.Int32):
def check_value(self, value):
return int(value * 65536.0)
def parse_value(self, value, display):
return float(value) / float(1 << 16)
class FP3232(rq.ValueField):
structcode = 'lL'
structvalues = 2
def check_value(self, value):
return value
def parse_value(self, value, display):
integral, frac = value
ret = float(integral)
# optimised math.ldexp(float(frac), -32)
ret += float(frac) * (1.0 / (1 << 32))
return ret
class XIQueryVersion(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(47),
rq.RequestLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card16('major_version'),
rq.Card16('minor_version'),
rq.Pad(20),
)
def query_version(self):
return XIQueryVersion(
display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=2,
minor_version=0,
)
class Mask(rq.List):
def __init__(self, name):
rq.List.__init__(self, name, rq.Card32, pad=0)
def pack_value(self, val):
mask_seq = array.array(rq.struct_to_array_codes['L'])
if isinstance(val, integer_types):
# We need to build a "binary mask" that (as far as I can tell) is
# encoded in native byte order from end to end. The simple case is
# with a single unsigned 32-bit value, for which we construct an
# array with just one item. For values too big to fit inside 4
# bytes we build a longer array, being careful to maintain native
# byte order across the entire set of values.
if sys.byteorder == 'little':
def fun(val):
mask_seq.insert(0, val)
elif sys.byteorder == 'big':
fun = mask_seq.append
else:
raise AssertionError(sys.byteorder)
while val:
fun(val & 0xFFFFFFFF)
val = val >> 32
else:
mask_seq.extend(val)
return rq.encode_array(mask_seq), len(mask_seq), None
EventMask = rq.Struct(
DEVICE('deviceid'),
rq.LengthOf('mask', 2),
Mask('mask'),
)
class XISelectEvents(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(46),
rq.RequestLength(),
rq.Window('window'),
rq.LengthOf('masks', 2),
rq.Pad(2),
rq.List('masks', EventMask),
)
def select_events(self, event_masks):
'''
select_events(event_masks)
event_masks:
Sequence of (deviceid, mask) pairs, where deviceid is a numerical device
ID, or AllDevices or AllMasterDevices, and mask is either an unsigned
integer or sequence of 32 bits unsigned values
'''
return XISelectEvents(
display=self.display,
opcode=self.display.get_extension_major(extname),
window=self,
masks=event_masks,
)
AnyInfo = rq.Struct(
rq.Card16('type'),
rq.Card16('length'),
rq.Card16('sourceid'),
rq.Pad(2),
)
class ButtonMask(object):
def __init__(self, value, length):
self._value = value
self._length = length
def __len__(self):
return self._length
def __getitem__(self, key):
return self._value & (1 << key)
def __str__(self):
return repr(self)
def __repr__(self):
return '0b{value:0{width}b}'.format(value=self._value,
width=self._length)
class ButtonState(rq.ValueField):
structcode = None
def __init__(self, name):
rq.ValueField.__init__(self, name)
def parse_binary_value(self, data, display, length, fmt):
# Mask: bitfield of <length> button states.
mask_len = 4 * ((((length + 7) >> 3) + 3) >> 2)
mask_data = data[:mask_len]
mask_value = 0
for byte in reversed(struct.unpack('={0:d}B'.format(mask_len), mask_data)):
mask_value <<= 8
mask_value |= byte
data = data[mask_len:]
assert (mask_value & 1) == 0
return ButtonMask(mask_value >> 1, length), data
ButtonInfo = rq.Struct(
rq.Card16('type'),
rq.Card16('length'),
rq.Card16('sourceid'),
rq.LengthOf(('state', 'labels'), 2),
ButtonState('state'),
rq.List('labels', rq.Card32),
)
KeyInfo = rq.Struct(
rq.Card16('type'),
rq.Card16('length'),
rq.Card16('sourceid'),
rq.LengthOf('keycodes', 2),
rq.List('keycodes', rq.Card32),
)
ValuatorInfo = rq.Struct(
rq.Card16('type'),
rq.Card16('length'),
rq.Card16('sourceid'),
rq.Card16('number'),
rq.Card32('label'),
FP3232('min'),
FP3232('max'),
FP3232('value'),
rq.Card32('resolution'),
rq.Card8('mode'),
rq.Pad(3),
)
ScrollInfo = rq.Struct(
rq.Card16('type'),
rq.Card16('length'),
rq.Card16('sourceid'),
rq.Card16('number'),
rq.Card16('scroll_type'),
rq.Pad(2),
rq.Card32('flags'),
FP3232('increment'),
)
TouchInfo = rq.Struct(
rq.Card16('type'),
rq.Card16('length'),
rq.Card16('sourceid'),
rq.Card8('mode'),
rq.Card8('num_touches'),
)
INFO_CLASSES = {
KeyClass: KeyInfo,
ButtonClass: ButtonInfo,
ValuatorClass: ValuatorInfo,
ScrollClass: ScrollInfo,
TouchClass: TouchInfo,
}
class ClassInfoClass(object):
structcode = None
def parse_binary(self, data, display):
class_type, length = struct.unpack('=HH', data[:4])
class_struct = INFO_CLASSES.get(class_type, AnyInfo)
class_data, _ = class_struct.parse_binary(data, display)
data = data[length * 4:]
return class_data, data
ClassInfo = ClassInfoClass()
DeviceInfo = rq.Struct(
DEVICEID('deviceid'),
rq.Card16('use'),
rq.Card16('attachment'),
rq.LengthOf('classes', 2),
rq.LengthOf('name', 2),
rq.Bool('enabled'),
rq.Pad(1),
rq.String8('name', 4),
rq.List('classes', ClassInfo),
)
class XIQueryDevice(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(48),
rq.RequestLength(),
DEVICEID('deviceid'),
rq.Pad(2),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.LengthOf('devices', 2),
rq.Pad(22),
rq.List('devices', DeviceInfo),
)
def query_device(self, deviceid):
return XIQueryDevice(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
)
class XIListProperties(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(56),
rq.RequestLength(),
DEVICEID('deviceid'),
rq.Pad(2),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.LengthOf('atoms', 2),
rq.Pad(22),
rq.List('atoms', rq.Card32Obj),
)
def list_device_properties(self, deviceid):
return XIListProperties(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
)
class XIGetProperty(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(59),
rq.RequestLength(),
DEVICEID('deviceid'),
rq.Card8('delete'),
rq.Pad(1),
rq.Card32('property'),
rq.Card32('type'),
rq.Card32('offset'),
rq.Card32('length'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('type'),
rq.Card32('bytes_after'),
rq.LengthOf('value', 4),
rq.Format('value', 1),
rq.Pad(11),
rq.PropertyData('value')
)
def get_device_property(self, deviceid, property, type, offset, length, delete=False):
return XIGetProperty(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
property=property,
type=type,
offset=offset,
length=length,
delete=delete,
)
class XIChangeProperty(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(57),
rq.RequestLength(),
DEVICEID('deviceid'),
rq.Card8('mode'),
rq.Format('value', 1),
rq.Card32('property'),
rq.Card32('type'),
rq.LengthOf('value', 4),
rq.PropertyData('value'),
)
def change_device_property(self, deviceid, property, type, mode, value):
return XIChangeProperty(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
property=property,
type=type,
mode=mode,
value=value,
)
class XIDeleteProperty(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(58),
rq.RequestLength(),
DEVICEID('deviceid'),
rq.Pad(2),
rq.Card32('property'),
)
def delete_device_property(self, deviceid, property):
return XIDeleteProperty(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
property=property,
)
class XIGrabDevice(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(51),
rq.RequestLength(),
rq.Window('grab_window'),
rq.Card32('time'),
rq.Cursor('cursor', (X.NONE, )),
DEVICEID('deviceid'),
rq.Set('grab_mode', 1, (GrabModeSync, GrabModeAsync)),
rq.Set('paired_device_mode', 1, (GrabModeSync, GrabModeAsync)),
rq.Bool('owner_events'),
rq.Pad(1),
rq.LengthOf('mask', 2),
Mask('mask'),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card8('status'),
rq.Pad(23),
)
def grab_device(self, deviceid, time, grab_mode, paired_device_mode, owner_events, event_mask):
return XIGrabDevice(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
grab_window=self,
time=time,
cursor=X.NONE,
grab_mode=grab_mode,
paired_device_mode=paired_device_mode,
owner_events=owner_events,
mask=event_mask,
)
class XIUngrabDevice(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(52),
rq.RequestLength(),
rq.Card32('time'),
DEVICEID('deviceid'),
rq.Pad(2),
)
def ungrab_device(self, deviceid, time):
return XIUngrabDevice(
display=self.display,
opcode=self.display.get_extension_major(extname),
time=time,
deviceid=deviceid,
)
class XIPassiveGrabDevice(rq.ReplyRequest):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(54),
rq.RequestLength(),
rq.Card32('time'),
rq.Window('grab_window'),
rq.Cursor('cursor', (X.NONE, )),
rq.Card32('detail'),
DEVICEID('deviceid'),
rq.LengthOf('modifiers', 2),
rq.LengthOf('mask', 2),
rq.Set('grab_type', 1, (GrabtypeButton, GrabtypeKeycode, GrabtypeEnter,
GrabtypeFocusIn, GrabtypeTouchBegin)),
rq.Set('grab_mode', 1, (GrabModeSync, GrabModeAsync)),
rq.Set('paired_device_mode', 1, (GrabModeSync, GrabModeAsync)),
rq.Bool('owner_events'),
rq.Pad(2),
Mask('mask'),
rq.List('modifiers', rq.Card32),
)
_reply = rq.Struct(
rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.LengthOf('modifiers', 2),
rq.Pad(22),
rq.List('modifiers', rq.Card32),
)
def passive_grab_device(self, deviceid, time, detail,
grab_type, grab_mode, paired_device_mode,
owner_events, event_mask, modifiers):
return XIPassiveGrabDevice(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
grab_window=self,
time=time,
cursor=X.NONE,
detail=detail,
grab_type=grab_type,
grab_mode=grab_mode,
paired_device_mode=paired_device_mode,
owner_events=owner_events,
mask=event_mask,
modifiers=modifiers,
)
def grab_keycode(self, deviceid, time, keycode,
grab_mode, paired_device_mode,
owner_events, event_mask, modifiers):
return passive_grab_device(self, deviceid, time, keycode,
GrabtypeKeycode,
grab_mode, paired_device_mode,
owner_events, event_mask, modifiers)
class XIPassiveUngrabDevice(rq.Request):
_request = rq.Struct(
rq.Card8('opcode'),
rq.Opcode(55),
rq.RequestLength(),
rq.Window('grab_window'),
rq.Card32('detail'),
DEVICEID('deviceid'),
rq.LengthOf('modifiers', 2),
rq.Set('grab_type', 1, (GrabtypeButton, GrabtypeKeycode,
GrabtypeEnter, GrabtypeFocusIn,
GrabtypeTouchBegin)),
rq.Pad(3),
rq.List('modifiers', rq.Card32),
)
def passive_ungrab_device(self, deviceid, detail, grab_type, modifiers):
return XIPassiveUngrabDevice(
display=self.display,
opcode=self.display.get_extension_major(extname),
deviceid=deviceid,
grab_window=self,
detail=detail,
grab_type=grab_type,
modifiers=modifiers,
)
def ungrab_keycode(self, deviceid, keycode, modifiers):
return passive_ungrab_device(self, deviceid, keycode,
GrabtypeKeycode, modifiers)
HierarchyInfo = rq.Struct(
DEVICEID('deviceid'),
DEVICEID('attachment'),
DEVICEUSE('type'),
rq.Bool('enabled'),
rq.Pad(2),
rq.Card32('flags'),
)
HierarchyEventData = rq.Struct(
DEVICEID('deviceid'),
rq.Card32('time'),
rq.Card32('flags'),
rq.LengthOf('info', 2),
rq.Pad(10),
rq.List('info', HierarchyInfo),
)
ModifierInfo = rq.Struct(
rq.Card32('base_mods'),
rq.Card32('latched_mods'),
rq.Card32('locked_mods'),
rq.Card32('effective_mods'),
)
GroupInfo = rq.Struct(
rq.Card8('base_group'),
rq.Card8('latched_group'),
rq.Card8('locked_group'),
rq.Card8('effective_group'),
)
DeviceEventData = rq.Struct(
DEVICEID('deviceid'),
rq.Card32('time'),
rq.Card32('detail'),
rq.Window('root'),
rq.Window('event'),
rq.Window('child'),
FP1616('root_x'),
FP1616('root_y'),
FP1616('event_x'),
FP1616('event_y'),
rq.LengthOf('buttons', 2),
rq.Card16('valulators_len'),
DEVICEID('sourceid'),
rq.Pad(2),
rq.Card32('flags'),
rq.Object('mods', ModifierInfo),
rq.Object('groups', GroupInfo),
ButtonState('buttons'),
)
DeviceChangedEventData = rq.Struct(
DEVICEID('deviceid'),
rq.Card32('time'),
rq.LengthOf('classes', 2),
DEVICEID('sourceid'),
rq.Card8('reason'),
rq.Pad(11),
rq.List('classes', ClassInfo),
)
PropertyEventData = rq.Struct(
DEVICEID('deviceid'),
rq.Card32('time'),
rq.Card32('property'),
rq.Card8('what'),
rq.Pad(11),
)
def init(disp, info):
disp.extension_add_method('display', 'xinput_query_version', query_version)
disp.extension_add_method('window', 'xinput_select_events', select_events)
disp.extension_add_method('display', 'xinput_query_device', query_device)
disp.extension_add_method('window', 'xinput_grab_device', grab_device)
disp.extension_add_method('display', 'xinput_ungrab_device', ungrab_device)
disp.extension_add_method('window', 'xinput_grab_keycode', grab_keycode)
disp.extension_add_method('window', 'xinput_ungrab_keycode', ungrab_keycode)
disp.extension_add_method('display', 'xinput_get_device_property', get_device_property)
disp.extension_add_method('display', 'xinput_list_device_properties', list_device_properties)
disp.extension_add_method('display', 'xinput_change_device_property', change_device_property)
disp.extension_add_method('display', 'xinput_delete_device_property', delete_device_property)
if hasattr(disp,"ge_add_event_data"):
for device_event in (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion):
disp.ge_add_event_data(info.major_opcode, device_event, DeviceEventData)
disp.ge_add_event_data(info.major_opcode, DeviceChanged, DeviceEventData)
disp.ge_add_event_data(info.major_opcode, HierarchyChanged, HierarchyEventData)
disp.ge_add_event_data(info.major_opcode, PropertyEvent, PropertyEventData)

122
Xlib/ext/xtest.py

@ -0,0 +1,122 @@
# Xlib.ext.xtest -- XTEST extension module
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
from Xlib import X
from Xlib.protocol import rq
extname = 'XTEST'
CurrentCursor = 1
class GetVersion(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card8('major_version'),
rq.Pad(1),
rq.Card16('minor_version')
)
_reply = rq.Struct(rq.Pad(1),
rq.Card8('major_version'),
rq.Card16('sequence_number'),
rq.Pad(4),
rq.Card16('minor_version'),
rq.Pad(22)
)
def get_version(self, major, minor):
return GetVersion(display = self.display,
opcode = self.display.get_extension_major(extname),
major_version = major,
minor_version = minor)
class CompareCursor(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(1),
rq.RequestLength(),
rq.Window('window'),
rq.Cursor('cursor', (X.NONE, CurrentCursor)),
)
_reply = rq.Struct(rq.Pad(1),
rq.Card8('same'),
rq.Card16('sequence_number'),
rq.Pad(28),
)
def compare_cursor(self, cursor):
r = CompareCursor(display = self.display,
opcode = self.display.get_extension_major(extname),
window = self.id,
cursor = cursor)
return r.same
class FakeInput(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(2),
rq.RequestLength(),
rq.Set('event_type', 1, (X.KeyPress,
X.KeyRelease,
X.ButtonPress,
X.ButtonRelease,
X.MotionNotify)),
rq.Card8('detail'),
rq.Pad(2),
rq.Card32('time'),
rq.Window('root', (X.NONE, )),
rq.Pad(8),
rq.Int16('x'),
rq.Int16('y'),
rq.Pad(8)
)
def fake_input(self, event_type, detail = 0, time = X.CurrentTime,
root = X.NONE, x = 0, y = 0):
FakeInput(display = self.display,
opcode = self.display.get_extension_major(extname),
event_type = event_type,
detail = detail,
time = time,
root = root,
x = x,
y = y)
class GrabControl(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(3),
rq.RequestLength(),
rq.Bool('impervious'),
rq.Pad(3)
)
def grab_control(self, impervious):
GrabControl(display = self.display,
opcode = self.display.get_extension_major(extname),
impervious = impervious)
def init(disp, info):
disp.extension_add_method('display', 'xtest_get_version', get_version)
disp.extension_add_method('window', 'xtest_compare_cursor', compare_cursor)
disp.extension_add_method('display', 'xtest_fake_input', fake_input)
disp.extension_add_method('display', 'xtest_grab_control', grab_control)

42
Xlib/keysymdef/__init__.py

@ -0,0 +1,42 @@
# Xlib.keysymdef -- X keysym defs
#
# Copyright (C) 2001 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
__all__ = [
'apl',
'arabic',
'cyrillic',
'greek',
'hebrew',
'katakana',
'korean',
'latin1',
'latin2',
'latin3',
'latin4',
'miscellany',
'publishing',
'special',
'technical',
'thai',
'xf86',
'xk3270',
'xkb',
]

BIN
Xlib/keysymdef/__pycache__/__init__.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/apl.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/arabic.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/cyrillic.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/greek.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/hebrew.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/katakana.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/korean.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/latin1.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/latin2.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/latin3.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/latin4.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/miscellany.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/publishing.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/special.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/technical.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/thai.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/xf86.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/xk3270.cpython-38.pyc

Binary file not shown.

BIN
Xlib/keysymdef/__pycache__/xkb.cpython-38.pyc

Binary file not shown.

19
Xlib/keysymdef/apl.py

@ -0,0 +1,19 @@
XK_leftcaret = 0xba3
XK_rightcaret = 0xba6
XK_downcaret = 0xba8
XK_upcaret = 0xba9
XK_overbar = 0xbc0
XK_downtack = 0xbc2
XK_upshoe = 0xbc3
XK_downstile = 0xbc4
XK_underbar = 0xbc6
XK_jot = 0xbca
XK_quad = 0xbcc
XK_uptack = 0xbce
XK_circle = 0xbcf
XK_upstile = 0xbd3
XK_downshoe = 0xbd6
XK_rightshoe = 0xbd8
XK_leftshoe = 0xbda
XK_lefttack = 0xbdc
XK_righttack = 0xbfc

50
Xlib/keysymdef/arabic.py

@ -0,0 +1,50 @@
XK_Arabic_comma = 0x5ac
XK_Arabic_semicolon = 0x5bb
XK_Arabic_question_mark = 0x5bf
XK_Arabic_hamza = 0x5c1
XK_Arabic_maddaonalef = 0x5c2
XK_Arabic_hamzaonalef = 0x5c3
XK_Arabic_hamzaonwaw = 0x5c4
XK_Arabic_hamzaunderalef = 0x5c5
XK_Arabic_hamzaonyeh = 0x5c6
XK_Arabic_alef = 0x5c7
XK_Arabic_beh = 0x5c8
XK_Arabic_tehmarbuta = 0x5c9
XK_Arabic_teh = 0x5ca
XK_Arabic_theh = 0x5cb
XK_Arabic_jeem = 0x5cc
XK_Arabic_hah = 0x5cd
XK_Arabic_khah = 0x5ce
XK_Arabic_dal = 0x5cf
XK_Arabic_thal = 0x5d0
XK_Arabic_ra = 0x5d1
XK_Arabic_zain = 0x5d2
XK_Arabic_seen = 0x5d3
XK_Arabic_sheen = 0x5d4
XK_Arabic_sad = 0x5d5
XK_Arabic_dad = 0x5d6
XK_Arabic_tah = 0x5d7
XK_Arabic_zah = 0x5d8
XK_Arabic_ain = 0x5d9
XK_Arabic_ghain = 0x5da
XK_Arabic_tatweel = 0x5e0
XK_Arabic_feh = 0x5e1
XK_Arabic_qaf = 0x5e2
XK_Arabic_kaf = 0x5e3
XK_Arabic_lam = 0x5e4
XK_Arabic_meem = 0x5e5
XK_Arabic_noon = 0x5e6
XK_Arabic_ha = 0x5e7
XK_Arabic_heh = 0x5e7
XK_Arabic_waw = 0x5e8
XK_Arabic_alefmaksura = 0x5e9
XK_Arabic_yeh = 0x5ea
XK_Arabic_fathatan = 0x5eb
XK_Arabic_dammatan = 0x5ec
XK_Arabic_kasratan = 0x5ed
XK_Arabic_fatha = 0x5ee
XK_Arabic_damma = 0x5ef
XK_Arabic_kasra = 0x5f0
XK_Arabic_shadda = 0x5f1
XK_Arabic_sukun = 0x5f2
XK_Arabic_switch = 0xFF7E

107
Xlib/keysymdef/cyrillic.py

@ -0,0 +1,107 @@
XK_Serbian_dje = 0x6a1
XK_Macedonia_gje = 0x6a2
XK_Cyrillic_io = 0x6a3
XK_Ukrainian_ie = 0x6a4
XK_Ukranian_je = 0x6a4
XK_Macedonia_dse = 0x6a5
XK_Ukrainian_i = 0x6a6
XK_Ukranian_i = 0x6a6
XK_Ukrainian_yi = 0x6a7
XK_Ukranian_yi = 0x6a7
XK_Cyrillic_je = 0x6a8
XK_Serbian_je = 0x6a8
XK_Cyrillic_lje = 0x6a9
XK_Serbian_lje = 0x6a9
XK_Cyrillic_nje = 0x6aa
XK_Serbian_nje = 0x6aa
XK_Serbian_tshe = 0x6ab
XK_Macedonia_kje = 0x6ac
XK_Byelorussian_shortu = 0x6ae
XK_Cyrillic_dzhe = 0x6af
XK_Serbian_dze = 0x6af
XK_numerosign = 0x6b0
XK_Serbian_DJE = 0x6b1
XK_Macedonia_GJE = 0x6b2
XK_Cyrillic_IO = 0x6b3
XK_Ukrainian_IE = 0x6b4
XK_Ukranian_JE = 0x6b4
XK_Macedonia_DSE = 0x6b5
XK_Ukrainian_I = 0x6b6
XK_Ukranian_I = 0x6b6
XK_Ukrainian_YI = 0x6b7
XK_Ukranian_YI = 0x6b7
XK_Cyrillic_JE = 0x6b8
XK_Serbian_JE = 0x6b8
XK_Cyrillic_LJE = 0x6b9
XK_Serbian_LJE = 0x6b9
XK_Cyrillic_NJE = 0x6ba
XK_Serbian_NJE = 0x6ba
XK_Serbian_TSHE = 0x6bb
XK_Macedonia_KJE = 0x6bc
XK_Byelorussian_SHORTU = 0x6be
XK_Cyrillic_DZHE = 0x6bf
XK_Serbian_DZE = 0x6bf
XK_Cyrillic_yu = 0x6c0
XK_Cyrillic_a = 0x6c1
XK_Cyrillic_be = 0x6c2
XK_Cyrillic_tse = 0x6c3
XK_Cyrillic_de = 0x6c4
XK_Cyrillic_ie = 0x6c5
XK_Cyrillic_ef = 0x6c6
XK_Cyrillic_ghe = 0x6c7
XK_Cyrillic_ha = 0x6c8
XK_Cyrillic_i = 0x6c9
XK_Cyrillic_shorti = 0x6ca
XK_Cyrillic_ka = 0x6cb
XK_Cyrillic_el = 0x6cc
XK_Cyrillic_em = 0x6cd
XK_Cyrillic_en = 0x6ce
XK_Cyrillic_o = 0x6cf
XK_Cyrillic_pe = 0x6d0
XK_Cyrillic_ya = 0x6d1
XK_Cyrillic_er = 0x6d2
XK_Cyrillic_es = 0x6d3
XK_Cyrillic_te = 0x6d4
XK_Cyrillic_u = 0x6d5
XK_Cyrillic_zhe = 0x6d6
XK_Cyrillic_ve = 0x6d7
XK_Cyrillic_softsign = 0x6d8
XK_Cyrillic_yeru = 0x6d9
XK_Cyrillic_ze = 0x6da
XK_Cyrillic_sha = 0x6db
XK_Cyrillic_e = 0x6dc
XK_Cyrillic_shcha = 0x6dd
XK_Cyrillic_che = 0x6de
XK_Cyrillic_hardsign = 0x6df
XK_Cyrillic_YU = 0x6e0
XK_Cyrillic_A = 0x6e1
XK_Cyrillic_BE = 0x6e2
XK_Cyrillic_TSE = 0x6e3
XK_Cyrillic_DE = 0x6e4
XK_Cyrillic_IE = 0x6e5
XK_Cyrillic_EF = 0x6e6
XK_Cyrillic_GHE = 0x6e7
XK_Cyrillic_HA = 0x6e8
XK_Cyrillic_I = 0x6e9
XK_Cyrillic_SHORTI = 0x6ea
XK_Cyrillic_KA = 0x6eb
XK_Cyrillic_EL = 0x6ec
XK_Cyrillic_EM = 0x6ed
XK_Cyrillic_EN = 0x6ee
XK_Cyrillic_O = 0x6ef
XK_Cyrillic_PE = 0x6f0
XK_Cyrillic_YA = 0x6f1
XK_Cyrillic_ER = 0x6f2
XK_Cyrillic_ES = 0x6f3
XK_Cyrillic_TE = 0x6f4
XK_Cyrillic_U = 0x6f5
XK_Cyrillic_ZHE = 0x6f6
XK_Cyrillic_VE = 0x6f7
XK_Cyrillic_SOFTSIGN = 0x6f8
XK_Cyrillic_YERU = 0x6f9
XK_Cyrillic_ZE = 0x6fa
XK_Cyrillic_SHA = 0x6fb
XK_Cyrillic_E = 0x6fc
XK_Cyrillic_SHCHA = 0x6fd
XK_Cyrillic_CHE = 0x6fe
XK_Cyrillic_HARDSIGN = 0x6ff

74
Xlib/keysymdef/greek.py

@ -0,0 +1,74 @@
XK_Greek_ALPHAaccent = 0x7a1
XK_Greek_EPSILONaccent = 0x7a2
XK_Greek_ETAaccent = 0x7a3
XK_Greek_IOTAaccent = 0x7a4
XK_Greek_IOTAdiaeresis = 0x7a5
XK_Greek_OMICRONaccent = 0x7a7
XK_Greek_UPSILONaccent = 0x7a8
XK_Greek_UPSILONdieresis = 0x7a9
XK_Greek_OMEGAaccent = 0x7ab
XK_Greek_accentdieresis = 0x7ae
XK_Greek_horizbar = 0x7af
XK_Greek_alphaaccent = 0x7b1
XK_Greek_epsilonaccent = 0x7b2
XK_Greek_etaaccent = 0x7b3
XK_Greek_iotaaccent = 0x7b4
XK_Greek_iotadieresis = 0x7b5
XK_Greek_iotaaccentdieresis = 0x7b6
XK_Greek_omicronaccent = 0x7b7
XK_Greek_upsilonaccent = 0x7b8
XK_Greek_upsilondieresis = 0x7b9
XK_Greek_upsilonaccentdieresis = 0x7ba
XK_Greek_omegaaccent = 0x7bb
XK_Greek_ALPHA = 0x7c1
XK_Greek_BETA = 0x7c2
XK_Greek_GAMMA = 0x7c3
XK_Greek_DELTA = 0x7c4
XK_Greek_EPSILON = 0x7c5
XK_Greek_ZETA = 0x7c6
XK_Greek_ETA = 0x7c7
XK_Greek_THETA = 0x7c8
XK_Greek_IOTA = 0x7c9
XK_Greek_KAPPA = 0x7ca
XK_Greek_LAMDA = 0x7cb
XK_Greek_LAMBDA = 0x7cb
XK_Greek_MU = 0x7cc
XK_Greek_NU = 0x7cd
XK_Greek_XI = 0x7ce
XK_Greek_OMICRON = 0x7cf
XK_Greek_PI = 0x7d0
XK_Greek_RHO = 0x7d1
XK_Greek_SIGMA = 0x7d2
XK_Greek_TAU = 0x7d4
XK_Greek_UPSILON = 0x7d5
XK_Greek_PHI = 0x7d6
XK_Greek_CHI = 0x7d7
XK_Greek_PSI = 0x7d8
XK_Greek_OMEGA = 0x7d9
XK_Greek_alpha = 0x7e1
XK_Greek_beta = 0x7e2
XK_Greek_gamma = 0x7e3
XK_Greek_delta = 0x7e4
XK_Greek_epsilon = 0x7e5
XK_Greek_zeta = 0x7e6
XK_Greek_eta = 0x7e7
XK_Greek_theta = 0x7e8
XK_Greek_iota = 0x7e9
XK_Greek_kappa = 0x7ea
XK_Greek_lamda = 0x7eb
XK_Greek_lambda = 0x7eb
XK_Greek_mu = 0x7ec
XK_Greek_nu = 0x7ed
XK_Greek_xi = 0x7ee
XK_Greek_omicron = 0x7ef
XK_Greek_pi = 0x7f0
XK_Greek_rho = 0x7f1
XK_Greek_sigma = 0x7f2
XK_Greek_finalsmallsigma = 0x7f3
XK_Greek_tau = 0x7f4
XK_Greek_upsilon = 0x7f5
XK_Greek_phi = 0x7f6
XK_Greek_chi = 0x7f7
XK_Greek_psi = 0x7f8
XK_Greek_omega = 0x7f9
XK_Greek_switch = 0xFF7E

40
Xlib/keysymdef/hebrew.py

@ -0,0 +1,40 @@
XK_hebrew_doublelowline = 0xcdf
XK_hebrew_aleph = 0xce0
XK_hebrew_bet = 0xce1
XK_hebrew_beth = 0xce1
XK_hebrew_gimel = 0xce2
XK_hebrew_gimmel = 0xce2
XK_hebrew_dalet = 0xce3
XK_hebrew_daleth = 0xce3
XK_hebrew_he = 0xce4
XK_hebrew_waw = 0xce5
XK_hebrew_zain = 0xce6
XK_hebrew_zayin = 0xce6
XK_hebrew_chet = 0xce7
XK_hebrew_het = 0xce7
XK_hebrew_tet = 0xce8
XK_hebrew_teth = 0xce8
XK_hebrew_yod = 0xce9
XK_hebrew_finalkaph = 0xcea
XK_hebrew_kaph = 0xceb
XK_hebrew_lamed = 0xcec
XK_hebrew_finalmem = 0xced
XK_hebrew_mem = 0xcee
XK_hebrew_finalnun = 0xcef
XK_hebrew_nun = 0xcf0
XK_hebrew_samech = 0xcf1
XK_hebrew_samekh = 0xcf1
XK_hebrew_ayin = 0xcf2
XK_hebrew_finalpe = 0xcf3
XK_hebrew_pe = 0xcf4
XK_hebrew_finalzade = 0xcf5
XK_hebrew_finalzadi = 0xcf5
XK_hebrew_zade = 0xcf6
XK_hebrew_zadi = 0xcf6
XK_hebrew_qoph = 0xcf7
XK_hebrew_kuf = 0xcf7
XK_hebrew_resh = 0xcf8
XK_hebrew_shin = 0xcf9
XK_hebrew_taw = 0xcfa
XK_hebrew_taf = 0xcfa
XK_Hebrew_switch = 0xFF7E

70
Xlib/keysymdef/katakana.py

@ -0,0 +1,70 @@
XK_overline = 0x47e
XK_kana_fullstop = 0x4a1
XK_kana_openingbracket = 0x4a2
XK_kana_closingbracket = 0x4a3
XK_kana_comma = 0x4a4
XK_kana_conjunctive = 0x4a5
XK_kana_middledot = 0x4a5
XK_kana_WO = 0x4a6
XK_kana_a = 0x4a7
XK_kana_i = 0x4a8
XK_kana_u = 0x4a9
XK_kana_e = 0x4aa
XK_kana_o = 0x4ab
XK_kana_ya = 0x4ac
XK_kana_yu = 0x4ad
XK_kana_yo = 0x4ae
XK_kana_tsu = 0x4af
XK_kana_tu = 0x4af
XK_prolongedsound = 0x4b0
XK_kana_A = 0x4b1
XK_kana_I = 0x4b2
XK_kana_U = 0x4b3
XK_kana_E = 0x4b4
XK_kana_O = 0x4b5
XK_kana_KA = 0x4b6
XK_kana_KI = 0x4b7
XK_kana_KU = 0x4b8
XK_kana_KE = 0x4b9
XK_kana_KO = 0x4ba
XK_kana_SA = 0x4bb
XK_kana_SHI = 0x4bc
XK_kana_SU = 0x4bd
XK_kana_SE = 0x4be
XK_kana_SO = 0x4bf
XK_kana_TA = 0x4c0
XK_kana_CHI = 0x4c1
XK_kana_TI = 0x4c1
XK_kana_TSU = 0x4c2
XK_kana_TU = 0x4c2
XK_kana_TE = 0x4c3
XK_kana_TO = 0x4c4
XK_kana_NA = 0x4c5
XK_kana_NI = 0x4c6
XK_kana_NU = 0x4c7
XK_kana_NE = 0x4c8
XK_kana_NO = 0x4c9
XK_kana_HA = 0x4ca
XK_kana_HI = 0x4cb
XK_kana_FU = 0x4cc
XK_kana_HU = 0x4cc
XK_kana_HE = 0x4cd
XK_kana_HO = 0x4ce
XK_kana_MA = 0x4cf
XK_kana_MI = 0x4d0
XK_kana_MU = 0x4d1
XK_kana_ME = 0x4d2
XK_kana_MO = 0x4d3
XK_kana_YA = 0x4d4
XK_kana_YU = 0x4d5
XK_kana_YO = 0x4d6
XK_kana_RA = 0x4d7
XK_kana_RI = 0x4d8
XK_kana_RU = 0x4d9
XK_kana_RE = 0x4da
XK_kana_RO = 0x4db
XK_kana_WA = 0x4dc
XK_kana_N = 0x4dd
XK_voicedsound = 0x4de
XK_semivoicedsound = 0x4df
XK_kana_switch = 0xFF7E

107
Xlib/keysymdef/korean.py

@ -0,0 +1,107 @@
XK_Hangul = 0xff31
XK_Hangul_Start = 0xff32
XK_Hangul_End = 0xff33
XK_Hangul_Hanja = 0xff34
XK_Hangul_Jamo = 0xff35
XK_Hangul_Romaja = 0xff36
XK_Hangul_Codeinput = 0xff37
XK_Hangul_Jeonja = 0xff38
XK_Hangul_Banja = 0xff39
XK_Hangul_PreHanja = 0xff3a
XK_Hangul_PostHanja = 0xff3b
XK_Hangul_SingleCandidate = 0xff3c
XK_Hangul_MultipleCandidate = 0xff3d
XK_Hangul_PreviousCandidate = 0xff3e
XK_Hangul_Special = 0xff3f
XK_Hangul_switch = 0xFF7E
XK_Hangul_Kiyeog = 0xea1
XK_Hangul_SsangKiyeog = 0xea2
XK_Hangul_KiyeogSios = 0xea3
XK_Hangul_Nieun = 0xea4
XK_Hangul_NieunJieuj = 0xea5
XK_Hangul_NieunHieuh = 0xea6
XK_Hangul_Dikeud = 0xea7
XK_Hangul_SsangDikeud = 0xea8
XK_Hangul_Rieul = 0xea9
XK_Hangul_RieulKiyeog = 0xeaa
XK_Hangul_RieulMieum = 0xeab
XK_Hangul_RieulPieub = 0xeac
XK_Hangul_RieulSios = 0xead
XK_Hangul_RieulTieut = 0xeae
XK_Hangul_RieulPhieuf = 0xeaf
XK_Hangul_RieulHieuh = 0xeb0
XK_Hangul_Mieum = 0xeb1
XK_Hangul_Pieub = 0xeb2
XK_Hangul_SsangPieub = 0xeb3
XK_Hangul_PieubSios = 0xeb4
XK_Hangul_Sios = 0xeb5
XK_Hangul_SsangSios = 0xeb6
XK_Hangul_Ieung = 0xeb7
XK_Hangul_Jieuj = 0xeb8
XK_Hangul_SsangJieuj = 0xeb9
XK_Hangul_Cieuc = 0xeba
XK_Hangul_Khieuq = 0xebb
XK_Hangul_Tieut = 0xebc
XK_Hangul_Phieuf = 0xebd
XK_Hangul_Hieuh = 0xebe
XK_Hangul_A = 0xebf
XK_Hangul_AE = 0xec0
XK_Hangul_YA = 0xec1
XK_Hangul_YAE = 0xec2
XK_Hangul_EO = 0xec3
XK_Hangul_E = 0xec4
XK_Hangul_YEO = 0xec5
XK_Hangul_YE = 0xec6
XK_Hangul_O = 0xec7
XK_Hangul_WA = 0xec8
XK_Hangul_WAE = 0xec9
XK_Hangul_OE = 0xeca
XK_Hangul_YO = 0xecb
XK_Hangul_U = 0xecc
XK_Hangul_WEO = 0xecd
XK_Hangul_WE = 0xece
XK_Hangul_WI = 0xecf
XK_Hangul_YU = 0xed0
XK_Hangul_EU = 0xed1
XK_Hangul_YI = 0xed2
XK_Hangul_I = 0xed3
XK_Hangul_J_Kiyeog = 0xed4
XK_Hangul_J_SsangKiyeog = 0xed5
XK_Hangul_J_KiyeogSios = 0xed6
XK_Hangul_J_Nieun = 0xed7
XK_Hangul_J_NieunJieuj = 0xed8
XK_Hangul_J_NieunHieuh = 0xed9
XK_Hangul_J_Dikeud = 0xeda
XK_Hangul_J_Rieul = 0xedb
XK_Hangul_J_RieulKiyeog = 0xedc
XK_Hangul_J_RieulMieum = 0xedd
XK_Hangul_J_RieulPieub = 0xede
XK_Hangul_J_RieulSios = 0xedf
XK_Hangul_J_RieulTieut = 0xee0
XK_Hangul_J_RieulPhieuf = 0xee1
XK_Hangul_J_RieulHieuh = 0xee2
XK_Hangul_J_Mieum = 0xee3
XK_Hangul_J_Pieub = 0xee4
XK_Hangul_J_PieubSios = 0xee5
XK_Hangul_J_Sios = 0xee6
XK_Hangul_J_SsangSios = 0xee7
XK_Hangul_J_Ieung = 0xee8
XK_Hangul_J_Jieuj = 0xee9
XK_Hangul_J_Cieuc = 0xeea
XK_Hangul_J_Khieuq = 0xeeb
XK_Hangul_J_Tieut = 0xeec
XK_Hangul_J_Phieuf = 0xeed
XK_Hangul_J_Hieuh = 0xeee
XK_Hangul_RieulYeorinHieuh = 0xeef
XK_Hangul_SunkyeongeumMieum = 0xef0
XK_Hangul_SunkyeongeumPieub = 0xef1
XK_Hangul_PanSios = 0xef2
XK_Hangul_KkogjiDalrinIeung = 0xef3
XK_Hangul_SunkyeongeumPhieuf = 0xef4
XK_Hangul_YeorinHieuh = 0xef5
XK_Hangul_AraeA = 0xef6
XK_Hangul_AraeAE = 0xef7
XK_Hangul_J_PanSios = 0xef8
XK_Hangul_J_KkogjiDalrinIeung = 0xef9
XK_Hangul_J_YeorinHieuh = 0xefa
XK_Korean_Won = 0xeff

195
Xlib/keysymdef/latin1.py

@ -0,0 +1,195 @@
XK_space = 0x020
XK_exclam = 0x021
XK_quotedbl = 0x022
XK_numbersign = 0x023
XK_dollar = 0x024
XK_percent = 0x025
XK_ampersand = 0x026
XK_apostrophe = 0x027
XK_quoteright = 0x027
XK_parenleft = 0x028
XK_parenright = 0x029
XK_asterisk = 0x02a
XK_plus = 0x02b
XK_comma = 0x02c
XK_minus = 0x02d
XK_period = 0x02e
XK_slash = 0x02f
XK_0 = 0x030
XK_1 = 0x031
XK_2 = 0x032
XK_3 = 0x033
XK_4 = 0x034
XK_5 = 0x035
XK_6 = 0x036
XK_7 = 0x037
XK_8 = 0x038
XK_9 = 0x039
XK_colon = 0x03a
XK_semicolon = 0x03b
XK_less = 0x03c
XK_equal = 0x03d
XK_greater = 0x03e
XK_question = 0x03f
XK_at = 0x040
XK_A = 0x041
XK_B = 0x042
XK_C = 0x043
XK_D = 0x044
XK_E = 0x045
XK_F = 0x046
XK_G = 0x047
XK_H = 0x048
XK_I = 0x049
XK_J = 0x04a
XK_K = 0x04b
XK_L = 0x04c
XK_M = 0x04d
XK_N = 0x04e
XK_O = 0x04f
XK_P = 0x050
XK_Q = 0x051
XK_R = 0x052
XK_S = 0x053
XK_T = 0x054
XK_U = 0x055
XK_V = 0x056
XK_W = 0x057
XK_X = 0x058
XK_Y = 0x059
XK_Z = 0x05a
XK_bracketleft = 0x05b
XK_backslash = 0x05c
XK_bracketright = 0x05d
XK_asciicircum = 0x05e
XK_underscore = 0x05f
XK_grave = 0x060
XK_quoteleft = 0x060
XK_a = 0x061
XK_b = 0x062
XK_c = 0x063
XK_d = 0x064
XK_e = 0x065
XK_f = 0x066
XK_g = 0x067
XK_h = 0x068
XK_i = 0x069
XK_j = 0x06a
XK_k = 0x06b
XK_l = 0x06c
XK_m = 0x06d
XK_n = 0x06e
XK_o = 0x06f
XK_p = 0x070
XK_q = 0x071
XK_r = 0x072
XK_s = 0x073
XK_t = 0x074
XK_u = 0x075
XK_v = 0x076
XK_w = 0x077
XK_x = 0x078
XK_y = 0x079
XK_z = 0x07a
XK_braceleft = 0x07b
XK_bar = 0x07c
XK_braceright = 0x07d
XK_asciitilde = 0x07e
XK_nobreakspace = 0x0a0
XK_exclamdown = 0x0a1
XK_cent = 0x0a2
XK_sterling = 0x0a3
XK_currency = 0x0a4
XK_yen = 0x0a5
XK_brokenbar = 0x0a6
XK_section = 0x0a7
XK_diaeresis = 0x0a8
XK_copyright = 0x0a9
XK_ordfeminine = 0x0aa
XK_guillemotleft = 0x0ab
XK_notsign = 0x0ac
XK_hyphen = 0x0ad
XK_registered = 0x0ae
XK_macron = 0x0af
XK_degree = 0x0b0
XK_plusminus = 0x0b1
XK_twosuperior = 0x0b2
XK_threesuperior = 0x0b3
XK_acute = 0x0b4
XK_mu = 0x0b5
XK_paragraph = 0x0b6
XK_periodcentered = 0x0b7
XK_cedilla = 0x0b8
XK_onesuperior = 0x0b9
XK_masculine = 0x0ba
XK_guillemotright = 0x0bb
XK_onequarter = 0x0bc
XK_onehalf = 0x0bd
XK_threequarters = 0x0be
XK_questiondown = 0x0bf
XK_Agrave = 0x0c0
XK_Aacute = 0x0c1
XK_Acircumflex = 0x0c2
XK_Atilde = 0x0c3
XK_Adiaeresis = 0x0c4
XK_Aring = 0x0c5
XK_AE = 0x0c6
XK_Ccedilla = 0x0c7
XK_Egrave = 0x0c8
XK_Eacute = 0x0c9
XK_Ecircumflex = 0x0ca
XK_Ediaeresis = 0x0cb
XK_Igrave = 0x0cc
XK_Iacute = 0x0cd
XK_Icircumflex = 0x0ce
XK_Idiaeresis = 0x0cf
XK_ETH = 0x0d0
XK_Eth = 0x0d0
XK_Ntilde = 0x0d1
XK_Ograve = 0x0d2
XK_Oacute = 0x0d3
XK_Ocircumflex = 0x0d4
XK_Otilde = 0x0d5
XK_Odiaeresis = 0x0d6
XK_multiply = 0x0d7
XK_Ooblique = 0x0d8
XK_Ugrave = 0x0d9
XK_Uacute = 0x0da
XK_Ucircumflex = 0x0db
XK_Udiaeresis = 0x0dc
XK_Yacute = 0x0dd
XK_THORN = 0x0de
XK_Thorn = 0x0de
XK_ssharp = 0x0df
XK_agrave = 0x0e0
XK_aacute = 0x0e1
XK_acircumflex = 0x0e2
XK_atilde = 0x0e3
XK_adiaeresis = 0x0e4
XK_aring = 0x0e5
XK_ae = 0x0e6
XK_ccedilla = 0x0e7
XK_egrave = 0x0e8
XK_eacute = 0x0e9
XK_ecircumflex = 0x0ea
XK_ediaeresis = 0x0eb
XK_igrave = 0x0ec
XK_iacute = 0x0ed
XK_icircumflex = 0x0ee
XK_idiaeresis = 0x0ef
XK_eth = 0x0f0
XK_ntilde = 0x0f1
XK_ograve = 0x0f2
XK_oacute = 0x0f3
XK_ocircumflex = 0x0f4
XK_otilde = 0x0f5
XK_odiaeresis = 0x0f6
XK_division = 0x0f7
XK_oslash = 0x0f8
XK_ugrave = 0x0f9
XK_uacute = 0x0fa
XK_ucircumflex = 0x0fb
XK_udiaeresis = 0x0fc
XK_yacute = 0x0fd
XK_thorn = 0x0fe
XK_ydiaeresis = 0x0ff

57
Xlib/keysymdef/latin2.py

@ -0,0 +1,57 @@
XK_Aogonek = 0x1a1
XK_breve = 0x1a2
XK_Lstroke = 0x1a3
XK_Lcaron = 0x1a5
XK_Sacute = 0x1a6
XK_Scaron = 0x1a9
XK_Scedilla = 0x1aa
XK_Tcaron = 0x1ab
XK_Zacute = 0x1ac
XK_Zcaron = 0x1ae
XK_Zabovedot = 0x1af
XK_aogonek = 0x1b1
XK_ogonek = 0x1b2
XK_lstroke = 0x1b3
XK_lcaron = 0x1b5
XK_sacute = 0x1b6
XK_caron = 0x1b7
XK_scaron = 0x1b9
XK_scedilla = 0x1ba
XK_tcaron = 0x1bb
XK_zacute = 0x1bc
XK_doubleacute = 0x1bd
XK_zcaron = 0x1be
XK_zabovedot = 0x1bf
XK_Racute = 0x1c0
XK_Abreve = 0x1c3
XK_Lacute = 0x1c5
XK_Cacute = 0x1c6
XK_Ccaron = 0x1c8
XK_Eogonek = 0x1ca
XK_Ecaron = 0x1cc
XK_Dcaron = 0x1cf
XK_Dstroke = 0x1d0
XK_Nacute = 0x1d1
XK_Ncaron = 0x1d2
XK_Odoubleacute = 0x1d5
XK_Rcaron = 0x1d8
XK_Uring = 0x1d9
XK_Udoubleacute = 0x1db
XK_Tcedilla = 0x1de
XK_racute = 0x1e0
XK_abreve = 0x1e3
XK_lacute = 0x1e5
XK_cacute = 0x1e6
XK_ccaron = 0x1e8
XK_eogonek = 0x1ea
XK_ecaron = 0x1ec
XK_dcaron = 0x1ef
XK_dstroke = 0x1f0
XK_nacute = 0x1f1
XK_ncaron = 0x1f2
XK_odoubleacute = 0x1f5
XK_udoubleacute = 0x1fb
XK_rcaron = 0x1f8
XK_uring = 0x1f9
XK_tcedilla = 0x1fe
XK_abovedot = 0x1ff

22
Xlib/keysymdef/latin3.py

@ -0,0 +1,22 @@
XK_Hstroke = 0x2a1
XK_Hcircumflex = 0x2a6
XK_Iabovedot = 0x2a9
XK_Gbreve = 0x2ab
XK_Jcircumflex = 0x2ac
XK_hstroke = 0x2b1
XK_hcircumflex = 0x2b6
XK_idotless = 0x2b9
XK_gbreve = 0x2bb
XK_jcircumflex = 0x2bc
XK_Cabovedot = 0x2c5
XK_Ccircumflex = 0x2c6
XK_Gabovedot = 0x2d5
XK_Gcircumflex = 0x2d8
XK_Ubreve = 0x2dd
XK_Scircumflex = 0x2de
XK_cabovedot = 0x2e5
XK_ccircumflex = 0x2e6
XK_gabovedot = 0x2f5
XK_gcircumflex = 0x2f8
XK_ubreve = 0x2fd
XK_scircumflex = 0x2fe

36
Xlib/keysymdef/latin4.py

@ -0,0 +1,36 @@
XK_kra = 0x3a2
XK_kappa = 0x3a2
XK_Rcedilla = 0x3a3
XK_Itilde = 0x3a5
XK_Lcedilla = 0x3a6
XK_Emacron = 0x3aa
XK_Gcedilla = 0x3ab
XK_Tslash = 0x3ac
XK_rcedilla = 0x3b3
XK_itilde = 0x3b5
XK_lcedilla = 0x3b6
XK_emacron = 0x3ba
XK_gcedilla = 0x3bb
XK_tslash = 0x3bc
XK_ENG = 0x3bd
XK_eng = 0x3bf
XK_Amacron = 0x3c0
XK_Iogonek = 0x3c7
XK_Eabovedot = 0x3cc
XK_Imacron = 0x3cf
XK_Ncedilla = 0x3d1
XK_Omacron = 0x3d2
XK_Kcedilla = 0x3d3
XK_Uogonek = 0x3d9
XK_Utilde = 0x3dd
XK_Umacron = 0x3de
XK_amacron = 0x3e0
XK_iogonek = 0x3e7
XK_eabovedot = 0x3ec
XK_imacron = 0x3ef
XK_ncedilla = 0x3f1
XK_omacron = 0x3f2
XK_kcedilla = 0x3f3
XK_uogonek = 0x3f9
XK_utilde = 0x3fd
XK_umacron = 0x3fe

169
Xlib/keysymdef/miscellany.py

@ -0,0 +1,169 @@
XK_BackSpace = 0xFF08
XK_Tab = 0xFF09
XK_Linefeed = 0xFF0A
XK_Clear = 0xFF0B
XK_Return = 0xFF0D
XK_Pause = 0xFF13
XK_Scroll_Lock = 0xFF14
XK_Sys_Req = 0xFF15
XK_Escape = 0xFF1B
XK_Delete = 0xFFFF
XK_Multi_key = 0xFF20
XK_SingleCandidate = 0xFF3C
XK_MultipleCandidate = 0xFF3D
XK_PreviousCandidate = 0xFF3E
XK_Kanji = 0xFF21
XK_Muhenkan = 0xFF22
XK_Henkan_Mode = 0xFF23
XK_Henkan = 0xFF23
XK_Romaji = 0xFF24
XK_Hiragana = 0xFF25
XK_Katakana = 0xFF26
XK_Hiragana_Katakana = 0xFF27
XK_Zenkaku = 0xFF28
XK_Hankaku = 0xFF29
XK_Zenkaku_Hankaku = 0xFF2A
XK_Touroku = 0xFF2B
XK_Massyo = 0xFF2C
XK_Kana_Lock = 0xFF2D
XK_Kana_Shift = 0xFF2E
XK_Eisu_Shift = 0xFF2F
XK_Eisu_toggle = 0xFF30
XK_Zen_Koho = 0xFF3D
XK_Mae_Koho = 0xFF3E
XK_Home = 0xFF50
XK_Left = 0xFF51
XK_Up = 0xFF52
XK_Right = 0xFF53
XK_Down = 0xFF54
XK_Prior = 0xFF55
XK_Page_Up = 0xFF55
XK_Next = 0xFF56
XK_Page_Down = 0xFF56
XK_End = 0xFF57
XK_Begin = 0xFF58
XK_Select = 0xFF60
XK_Print = 0xFF61
XK_Execute = 0xFF62
XK_Insert = 0xFF63
XK_Undo = 0xFF65
XK_Redo = 0xFF66
XK_Menu = 0xFF67
XK_Find = 0xFF68
XK_Cancel = 0xFF69
XK_Help = 0xFF6A
XK_Break = 0xFF6B
XK_Mode_switch = 0xFF7E
XK_script_switch = 0xFF7E
XK_Num_Lock = 0xFF7F
XK_KP_Space = 0xFF80
XK_KP_Tab = 0xFF89
XK_KP_Enter = 0xFF8D
XK_KP_F1 = 0xFF91
XK_KP_F2 = 0xFF92
XK_KP_F3 = 0xFF93
XK_KP_F4 = 0xFF94
XK_KP_Home = 0xFF95
XK_KP_Left = 0xFF96
XK_KP_Up = 0xFF97
XK_KP_Right = 0xFF98
XK_KP_Down = 0xFF99
XK_KP_Prior = 0xFF9A
XK_KP_Page_Up = 0xFF9A
XK_KP_Next = 0xFF9B
XK_KP_Page_Down = 0xFF9B
XK_KP_End = 0xFF9C
XK_KP_Begin = 0xFF9D
XK_KP_Insert = 0xFF9E
XK_KP_Delete = 0xFF9F
XK_KP_Equal = 0xFFBD
XK_KP_Multiply = 0xFFAA
XK_KP_Add = 0xFFAB
XK_KP_Separator = 0xFFAC
XK_KP_Subtract = 0xFFAD
XK_KP_Decimal = 0xFFAE
XK_KP_Divide = 0xFFAF
XK_KP_0 = 0xFFB0
XK_KP_1 = 0xFFB1
XK_KP_2 = 0xFFB2
XK_KP_3 = 0xFFB3
XK_KP_4 = 0xFFB4
XK_KP_5 = 0xFFB5
XK_KP_6 = 0xFFB6
XK_KP_7 = 0xFFB7
XK_KP_8 = 0xFFB8
XK_KP_9 = 0xFFB9
XK_F1 = 0xFFBE
XK_F2 = 0xFFBF
XK_F3 = 0xFFC0
XK_F4 = 0xFFC1
XK_F5 = 0xFFC2
XK_F6 = 0xFFC3
XK_F7 = 0xFFC4
XK_F8 = 0xFFC5
XK_F9 = 0xFFC6
XK_F10 = 0xFFC7
XK_F11 = 0xFFC8
XK_L1 = 0xFFC8
XK_F12 = 0xFFC9
XK_L2 = 0xFFC9
XK_F13 = 0xFFCA
XK_L3 = 0xFFCA
XK_F14 = 0xFFCB
XK_L4 = 0xFFCB
XK_F15 = 0xFFCC
XK_L5 = 0xFFCC
XK_F16 = 0xFFCD
XK_L6 = 0xFFCD
XK_F17 = 0xFFCE
XK_L7 = 0xFFCE
XK_F18 = 0xFFCF
XK_L8 = 0xFFCF
XK_F19 = 0xFFD0
XK_L9 = 0xFFD0
XK_F20 = 0xFFD1
XK_L10 = 0xFFD1
XK_F21 = 0xFFD2
XK_R1 = 0xFFD2
XK_F22 = 0xFFD3
XK_R2 = 0xFFD3
XK_F23 = 0xFFD4
XK_R3 = 0xFFD4
XK_F24 = 0xFFD5
XK_R4 = 0xFFD5
XK_F25 = 0xFFD6
XK_R5 = 0xFFD6
XK_F26 = 0xFFD7
XK_R6 = 0xFFD7
XK_F27 = 0xFFD8
XK_R7 = 0xFFD8
XK_F28 = 0xFFD9
XK_R8 = 0xFFD9
XK_F29 = 0xFFDA
XK_R9 = 0xFFDA
XK_F30 = 0xFFDB
XK_R10 = 0xFFDB
XK_F31 = 0xFFDC
XK_R11 = 0xFFDC
XK_F32 = 0xFFDD
XK_R12 = 0xFFDD
XK_F33 = 0xFFDE
XK_R13 = 0xFFDE
XK_F34 = 0xFFDF
XK_R14 = 0xFFDF
XK_F35 = 0xFFE0
XK_R15 = 0xFFE0
XK_Shift_L = 0xFFE1
XK_Shift_R = 0xFFE2
XK_Control_L = 0xFFE3
XK_Control_R = 0xFFE4
XK_Caps_Lock = 0xFFE5
XK_Shift_Lock = 0xFFE6
XK_Meta_L = 0xFFE7
XK_Meta_R = 0xFFE8
XK_Alt_L = 0xFFE9
XK_Alt_R = 0xFFEA
XK_Super_L = 0xFFEB
XK_Super_R = 0xFFEC
XK_Hyper_L = 0xFFED
XK_Hyper_R = 0xFFEE

83
Xlib/keysymdef/publishing.py

@ -0,0 +1,83 @@
XK_emspace = 0xaa1
XK_enspace = 0xaa2
XK_em3space = 0xaa3
XK_em4space = 0xaa4
XK_digitspace = 0xaa5
XK_punctspace = 0xaa6
XK_thinspace = 0xaa7
XK_hairspace = 0xaa8
XK_emdash = 0xaa9
XK_endash = 0xaaa
XK_signifblank = 0xaac
XK_ellipsis = 0xaae
XK_doubbaselinedot = 0xaaf
XK_onethird = 0xab0
XK_twothirds = 0xab1
XK_onefifth = 0xab2
XK_twofifths = 0xab3
XK_threefifths = 0xab4
XK_fourfifths = 0xab5
XK_onesixth = 0xab6
XK_fivesixths = 0xab7
XK_careof = 0xab8
XK_figdash = 0xabb
XK_leftanglebracket = 0xabc
XK_decimalpoint = 0xabd
XK_rightanglebracket = 0xabe
XK_marker = 0xabf
XK_oneeighth = 0xac3
XK_threeeighths = 0xac4
XK_fiveeighths = 0xac5
XK_seveneighths = 0xac6
XK_trademark = 0xac9
XK_signaturemark = 0xaca
XK_trademarkincircle = 0xacb
XK_leftopentriangle = 0xacc
XK_rightopentriangle = 0xacd
XK_emopencircle = 0xace
XK_emopenrectangle = 0xacf
XK_leftsinglequotemark = 0xad0
XK_rightsinglequotemark = 0xad1
XK_leftdoublequotemark = 0xad2
XK_rightdoublequotemark = 0xad3
XK_prescription = 0xad4
XK_minutes = 0xad6
XK_seconds = 0xad7
XK_latincross = 0xad9
XK_hexagram = 0xada
XK_filledrectbullet = 0xadb
XK_filledlefttribullet = 0xadc
XK_filledrighttribullet = 0xadd
XK_emfilledcircle = 0xade
XK_emfilledrect = 0xadf
XK_enopencircbullet = 0xae0
XK_enopensquarebullet = 0xae1
XK_openrectbullet = 0xae2
XK_opentribulletup = 0xae3
XK_opentribulletdown = 0xae4
XK_openstar = 0xae5
XK_enfilledcircbullet = 0xae6
XK_enfilledsqbullet = 0xae7
XK_filledtribulletup = 0xae8
XK_filledtribulletdown = 0xae9
XK_leftpointer = 0xaea
XK_rightpointer = 0xaeb
XK_club = 0xaec
XK_diamond = 0xaed
XK_heart = 0xaee
XK_maltesecross = 0xaf0
XK_dagger = 0xaf1
XK_doubledagger = 0xaf2
XK_checkmark = 0xaf3
XK_ballotcross = 0xaf4
XK_musicalsharp = 0xaf5
XK_musicalflat = 0xaf6
XK_malesymbol = 0xaf7
XK_femalesymbol = 0xaf8
XK_telephone = 0xaf9
XK_telephonerecorder = 0xafa
XK_phonographcopyright = 0xafb
XK_caret = 0xafc
XK_singlelowquotemark = 0xafd
XK_doublelowquotemark = 0xafe
XK_cursor = 0xaff

24
Xlib/keysymdef/special.py

@ -0,0 +1,24 @@
XK_blank = 0x9df
XK_soliddiamond = 0x9e0
XK_checkerboard = 0x9e1
XK_ht = 0x9e2
XK_ff = 0x9e3
XK_cr = 0x9e4
XK_lf = 0x9e5
XK_nl = 0x9e8
XK_vt = 0x9e9
XK_lowrightcorner = 0x9ea
XK_uprightcorner = 0x9eb
XK_upleftcorner = 0x9ec
XK_lowleftcorner = 0x9ed
XK_crossinglines = 0x9ee
XK_horizlinescan1 = 0x9ef
XK_horizlinescan3 = 0x9f0
XK_horizlinescan5 = 0x9f1
XK_horizlinescan7 = 0x9f2
XK_horizlinescan9 = 0x9f3
XK_leftt = 0x9f4
XK_rightt = 0x9f5
XK_bott = 0x9f6
XK_topt = 0x9f7
XK_vertbar = 0x9f8

49
Xlib/keysymdef/technical.py

@ -0,0 +1,49 @@
XK_leftradical = 0x8a1
XK_topleftradical = 0x8a2
XK_horizconnector = 0x8a3
XK_topintegral = 0x8a4
XK_botintegral = 0x8a5
XK_vertconnector = 0x8a6
XK_topleftsqbracket = 0x8a7
XK_botleftsqbracket = 0x8a8
XK_toprightsqbracket = 0x8a9
XK_botrightsqbracket = 0x8aa
XK_topleftparens = 0x8ab
XK_botleftparens = 0x8ac
XK_toprightparens = 0x8ad
XK_botrightparens = 0x8ae
XK_leftmiddlecurlybrace = 0x8af
XK_rightmiddlecurlybrace = 0x8b0
XK_topleftsummation = 0x8b1
XK_botleftsummation = 0x8b2
XK_topvertsummationconnector = 0x8b3
XK_botvertsummationconnector = 0x8b4
XK_toprightsummation = 0x8b5
XK_botrightsummation = 0x8b6
XK_rightmiddlesummation = 0x8b7
XK_lessthanequal = 0x8bc
XK_notequal = 0x8bd
XK_greaterthanequal = 0x8be
XK_integral = 0x8bf
XK_therefore = 0x8c0
XK_variation = 0x8c1
XK_infinity = 0x8c2
XK_nabla = 0x8c5
XK_approximate = 0x8c8
XK_similarequal = 0x8c9
XK_ifonlyif = 0x8cd
XK_implies = 0x8ce
XK_identical = 0x8cf
XK_radical = 0x8d6
XK_includedin = 0x8da
XK_includes = 0x8db
XK_intersection = 0x8dc
XK_union = 0x8dd
XK_logicaland = 0x8de
XK_logicalor = 0x8df
XK_partialderivative = 0x8ef
XK_function = 0x8f6
XK_leftarrow = 0x8fb
XK_uparrow = 0x8fc
XK_rightarrow = 0x8fd
XK_downarrow = 0x8fe

84
Xlib/keysymdef/thai.py

@ -0,0 +1,84 @@
XK_Thai_kokai = 0xda1
XK_Thai_khokhai = 0xda2
XK_Thai_khokhuat = 0xda3
XK_Thai_khokhwai = 0xda4
XK_Thai_khokhon = 0xda5
XK_Thai_khorakhang = 0xda6
XK_Thai_ngongu = 0xda7
XK_Thai_chochan = 0xda8
XK_Thai_choching = 0xda9
XK_Thai_chochang = 0xdaa
XK_Thai_soso = 0xdab
XK_Thai_chochoe = 0xdac
XK_Thai_yoying = 0xdad
XK_Thai_dochada = 0xdae
XK_Thai_topatak = 0xdaf
XK_Thai_thothan = 0xdb0
XK_Thai_thonangmontho = 0xdb1
XK_Thai_thophuthao = 0xdb2
XK_Thai_nonen = 0xdb3
XK_Thai_dodek = 0xdb4
XK_Thai_totao = 0xdb5
XK_Thai_thothung = 0xdb6
XK_Thai_thothahan = 0xdb7
XK_Thai_thothong = 0xdb8
XK_Thai_nonu = 0xdb9
XK_Thai_bobaimai = 0xdba
XK_Thai_popla = 0xdbb
XK_Thai_phophung = 0xdbc
XK_Thai_fofa = 0xdbd
XK_Thai_phophan = 0xdbe
XK_Thai_fofan = 0xdbf
XK_Thai_phosamphao = 0xdc0
XK_Thai_moma = 0xdc1
XK_Thai_yoyak = 0xdc2
XK_Thai_rorua = 0xdc3
XK_Thai_ru = 0xdc4
XK_Thai_loling = 0xdc5
XK_Thai_lu = 0xdc6
XK_Thai_wowaen = 0xdc7
XK_Thai_sosala = 0xdc8
XK_Thai_sorusi = 0xdc9
XK_Thai_sosua = 0xdca
XK_Thai_hohip = 0xdcb
XK_Thai_lochula = 0xdcc
XK_Thai_oang = 0xdcd
XK_Thai_honokhuk = 0xdce
XK_Thai_paiyannoi = 0xdcf
XK_Thai_saraa = 0xdd0
XK_Thai_maihanakat = 0xdd1
XK_Thai_saraaa = 0xdd2
XK_Thai_saraam = 0xdd3
XK_Thai_sarai = 0xdd4
XK_Thai_saraii = 0xdd5
XK_Thai_saraue = 0xdd6
XK_Thai_sarauee = 0xdd7
XK_Thai_sarau = 0xdd8
XK_Thai_sarauu = 0xdd9
XK_Thai_phinthu = 0xdda
XK_Thai_maihanakat_maitho = 0xdde
XK_Thai_baht = 0xddf
XK_Thai_sarae = 0xde0
XK_Thai_saraae = 0xde1
XK_Thai_sarao = 0xde2
XK_Thai_saraaimaimuan = 0xde3
XK_Thai_saraaimaimalai = 0xde4
XK_Thai_lakkhangyao = 0xde5
XK_Thai_maiyamok = 0xde6
XK_Thai_maitaikhu = 0xde7
XK_Thai_maiek = 0xde8
XK_Thai_maitho = 0xde9
XK_Thai_maitri = 0xdea
XK_Thai_maichattawa = 0xdeb
XK_Thai_thanthakhat = 0xdec
XK_Thai_nikhahit = 0xded
XK_Thai_leksun = 0xdf0
XK_Thai_leknung = 0xdf1
XK_Thai_leksong = 0xdf2
XK_Thai_leksam = 0xdf3
XK_Thai_leksi = 0xdf4
XK_Thai_lekha = 0xdf5
XK_Thai_lekhok = 0xdf6
XK_Thai_lekchet = 0xdf7
XK_Thai_lekpaet = 0xdf8
XK_Thai_lekkao = 0xdf9

202
Xlib/keysymdef/xf86.py

@ -0,0 +1,202 @@
XK_XF86_ModeLock = 0x1008FF01
XK_XF86_MonBrightnessUp = 0x1008FF02
XK_XF86_MonBrightnessDown = 0x1008FF03
XK_XF86_KbdLightOnOff = 0x1008FF04
XK_XF86_KbdBrightnessUp = 0x1008FF05
XK_XF86_KbdBrightnessDown = 0x1008FF06
XK_XF86_MonBrightnessCycle = 0x1008FF07
XK_XF86_Standby = 0x1008FF10
XK_XF86_AudioLowerVolume = 0x1008FF11
XK_XF86_AudioMute = 0x1008FF12
XK_XF86_AudioRaiseVolume = 0x1008FF13
XK_XF86_AudioPlay = 0x1008FF14
XK_XF86_AudioStop = 0x1008FF15
XK_XF86_AudioPrev = 0x1008FF16
XK_XF86_AudioNext = 0x1008FF17
XK_XF86_HomePage = 0x1008FF18
XK_XF86_Mail = 0x1008FF19
XK_XF86_Start = 0x1008FF1A
XK_XF86_Search = 0x1008FF1B
XK_XF86_AudioRecord = 0x1008FF1C
XK_XF86_Calculator = 0x1008FF1D
XK_XF86_Memo = 0x1008FF1E
XK_XF86_ToDoList = 0x1008FF1F
XK_XF86_Calendar = 0x1008FF20
XK_XF86_PowerDown = 0x1008FF21
XK_XF86_ContrastAdjust = 0x1008FF22
XK_XF86_RockerUp = 0x1008FF23
XK_XF86_RockerDown = 0x1008FF24
XK_XF86_RockerEnter = 0x1008FF25
XK_XF86_Back = 0x1008FF26
XK_XF86_Forward = 0x1008FF27
XK_XF86_Stop = 0x1008FF28
XK_XF86_Refresh = 0x1008FF29
XK_XF86_PowerOff = 0x1008FF2A
XK_XF86_WakeUp = 0x1008FF2B
XK_XF86_Eject = 0x1008FF2C
XK_XF86_ScreenSaver = 0x1008FF2D
XK_XF86_WWW = 0x1008FF2E
XK_XF86_Sleep = 0x1008FF2F
XK_XF86_Favorites = 0x1008FF30
XK_XF86_AudioPause = 0x1008FF31
XK_XF86_AudioMedia = 0x1008FF32
XK_XF86_MyComputer = 0x1008FF33
XK_XF86_VendorHome = 0x1008FF34
XK_XF86_LightBulb = 0x1008FF35
XK_XF86_Shop = 0x1008FF36
XK_XF86_History = 0x1008FF37
XK_XF86_OpenURL = 0x1008FF38
XK_XF86_AddFavorite = 0x1008FF39
XK_XF86_HotLinks = 0x1008FF3A
XK_XF86_BrightnessAdjust = 0x1008FF3B
XK_XF86_Finance = 0x1008FF3C
XK_XF86_Community = 0x1008FF3D
XK_XF86_AudioRewind = 0x1008FF3E
XK_XF86_XF86BackForward = 0x1008FF3F
XK_XF86_Launch0 = 0x1008FF40
XK_XF86_Launch1 = 0x1008FF41
XK_XF86_Launch2 = 0x1008FF42
XK_XF86_Launch3 = 0x1008FF43
XK_XF86_Launch4 = 0x1008FF44
XK_XF86_Launch5 = 0x1008FF45
XK_XF86_Launch6 = 0x1008FF46
XK_XF86_Launch7 = 0x1008FF47
XK_XF86_Launch8 = 0x1008FF48
XK_XF86_Launch9 = 0x1008FF49
XK_XF86_LaunchA = 0x1008FF4A
XK_XF86_LaunchB = 0x1008FF4B
XK_XF86_LaunchC = 0x1008FF4C
XK_XF86_LaunchD = 0x1008FF4D
XK_XF86_LaunchE = 0x1008FF4E
XK_XF86_LaunchF = 0x1008FF4F
XK_XF86_ApplicationLeft = 0x1008FF50
XK_XF86_ApplicationRight = 0x1008FF51
XK_XF86_Book = 0x1008FF52
XK_XF86_CD = 0x1008FF53
XK_XF86_Calculater = 0x1008FF54
XK_XF86_Clear = 0x1008FF55
XK_XF86_Close = 0x1008FF56
XK_XF86_Copy = 0x1008FF57
XK_XF86_Cut = 0x1008FF58
XK_XF86_Display = 0x1008FF59
XK_XF86_DOS = 0x1008FF5A
XK_XF86_Documents = 0x1008FF5B
XK_XF86_Excel = 0x1008FF5C
XK_XF86_Explorer = 0x1008FF5D
XK_XF86_Game = 0x1008FF5E
XK_XF86_Go = 0x1008FF5F
XK_XF86_iTouch = 0x1008FF60
XK_XF86_LogOff = 0x1008FF61
XK_XF86_Market = 0x1008FF62
XK_XF86_Meeting = 0x1008FF63
XK_XF86_MenuKB = 0x1008FF65
XK_XF86_MenuPB = 0x1008FF66
XK_XF86_MySites = 0x1008FF67
XK_XF86_New = 0x1008FF68
XK_XF86_News = 0x1008FF69
XK_XF86_OfficeHome = 0x1008FF6A
XK_XF86_Open = 0x1008FF6B
XK_XF86_Option = 0x1008FF6C
XK_XF86_Paste = 0x1008FF6D
XK_XF86_Phone = 0x1008FF6E
XK_XF86_Q = 0x1008FF70
XK_XF86_Reply = 0x1008FF72
XK_XF86_Reload = 0x1008FF73
XK_XF86_RotateWindows = 0x1008FF74
XK_XF86_RotationPB = 0x1008FF75
XK_XF86_RotationKB = 0x1008FF76
XK_XF86_Save = 0x1008FF77
XK_XF86_ScrollUp = 0x1008FF78
XK_XF86_ScrollDown = 0x1008FF79
XK_XF86_ScrollClick = 0x1008FF7A
XK_XF86_Send = 0x1008FF7B
XK_XF86_Spell = 0x1008FF7C
XK_XF86_SplitScreen = 0x1008FF7D
XK_XF86_Support = 0x1008FF7E
XK_XF86_TaskPane = 0x1008FF7F
XK_XF86_Terminal = 0x1008FF80
XK_XF86_Tools = 0x1008FF81
XK_XF86_Travel = 0x1008FF82
XK_XF86_UserPB = 0x1008FF84
XK_XF86_User1KB = 0x1008FF85
XK_XF86_User2KB = 0x1008FF86
XK_XF86_Video = 0x1008FF87
XK_XF86_WheelButton = 0x1008FF88
XK_XF86_Word = 0x1008FF89
XK_XF86_Xfer = 0x1008FF8A
XK_XF86_ZoomIn = 0x1008FF8B
XK_XF86_ZoomOut = 0x1008FF8C
XK_XF86_Away = 0x1008FF8D
XK_XF86_Messenger = 0x1008FF8E
XK_XF86_WebCam = 0x1008FF8F
XK_XF86_MailForward = 0x1008FF90
XK_XF86_Pictures = 0x1008FF91
XK_XF86_Music = 0x1008FF92
XK_XF86_Battery = 0x1008FF93
XK_XF86_Bluetooth = 0x1008FF94
XK_XF86_WLAN = 0x1008FF95
XK_XF86_UWB = 0x1008FF96
XK_XF86_AudioForward = 0x1008FF97
XK_XF86_AudioRepeat = 0x1008FF98
XK_XF86_AudioRandomPlay = 0x1008FF99
XK_XF86_Subtitle = 0x1008FF9A
XK_XF86_AudioCycleTrack = 0x1008FF9B
XK_XF86_CycleAngle = 0x1008FF9C
XK_XF86_FrameBack = 0x1008FF9D
XK_XF86_FrameForward = 0x1008FF9E
XK_XF86_Time = 0x1008FF9F
XK_XF86_Select = 0x1008FFA0
XK_XF86_View = 0x1008FFA1
XK_XF86_TopMenu = 0x1008FFA2
XK_XF86_Red = 0x1008FFA3
XK_XF86_Green = 0x1008FFA4
XK_XF86_Yellow = 0x1008FFA5
XK_XF86_Blue = 0x1008FFA6
XK_XF86_Suspend = 0x1008FFA7
XK_XF86_Hibernate = 0x1008FFA8
XK_XF86_TouchpadToggle = 0x1008FFA9
XK_XF86_TouchpadOn = 0x1008FFB0
XK_XF86_TouchpadOff = 0x1008FFB1
XK_XF86_AudioMicMute = 0x1008FFB2
XK_XF86_Keyboard = 0x1008FFB3
XK_XF86_WWAN = 0x1008FFB4
XK_XF86_RFKill = 0x1008FFB5
XK_XF86_AudioPreset = 0x1008FFB6
XK_XF86_RotationLockToggle = 0x1008FFB7
XK_XF86_FullScreen = 0x1008FFB8
XK_XF86_Switch_VT_1 = 0x1008FE01
XK_XF86_Switch_VT_2 = 0x1008FE02
XK_XF86_Switch_VT_3 = 0x1008FE03
XK_XF86_Switch_VT_4 = 0x1008FE04
XK_XF86_Switch_VT_5 = 0x1008FE05
XK_XF86_Switch_VT_6 = 0x1008FE06
XK_XF86_Switch_VT_7 = 0x1008FE07
XK_XF86_Switch_VT_8 = 0x1008FE08
XK_XF86_Switch_VT_9 = 0x1008FE09
XK_XF86_Switch_VT_10 = 0x1008FE0A
XK_XF86_Switch_VT_11 = 0x1008FE0B
XK_XF86_Switch_VT_12 = 0x1008FE0C
XK_XF86_Ungrab = 0x1008FE20
XK_XF86_ClearGrab = 0x1008FE21
XK_XF86_Next_VMode = 0x1008FE22
XK_XF86_Prev_VMode = 0x1008FE23
XK_XF86_LogWindowTree = 0x1008FE24
XK_XF86_LogGrabInfo = 0x1008FE25

30
Xlib/keysymdef/xk3270.py

@ -0,0 +1,30 @@
XK_3270_Duplicate = 0xFD01
XK_3270_FieldMark = 0xFD02
XK_3270_Right2 = 0xFD03
XK_3270_Left2 = 0xFD04
XK_3270_BackTab = 0xFD05
XK_3270_EraseEOF = 0xFD06
XK_3270_EraseInput = 0xFD07
XK_3270_Reset = 0xFD08
XK_3270_Quit = 0xFD09
XK_3270_PA1 = 0xFD0A
XK_3270_PA2 = 0xFD0B
XK_3270_PA3 = 0xFD0C
XK_3270_Test = 0xFD0D
XK_3270_Attn = 0xFD0E
XK_3270_CursorBlink = 0xFD0F
XK_3270_AltCursor = 0xFD10
XK_3270_KeyClick = 0xFD11
XK_3270_Jump = 0xFD12
XK_3270_Ident = 0xFD13
XK_3270_Rule = 0xFD14
XK_3270_Copy = 0xFD15
XK_3270_Play = 0xFD16
XK_3270_Setup = 0xFD17
XK_3270_Record = 0xFD18
XK_3270_ChangeScreen = 0xFD19
XK_3270_DeleteWord = 0xFD1A
XK_3270_ExSelect = 0xFD1B
XK_3270_CursorSelect = 0xFD1C
XK_3270_PrintScreen = 0xFD1D
XK_3270_Enter = 0xFD1E

100
Xlib/keysymdef/xkb.py

@ -0,0 +1,100 @@
XK_ISO_Lock = 0xFE01
XK_ISO_Level2_Latch = 0xFE02
XK_ISO_Level3_Shift = 0xFE03
XK_ISO_Level3_Latch = 0xFE04
XK_ISO_Level3_Lock = 0xFE05
XK_ISO_Group_Shift = 0xFF7E
XK_ISO_Group_Latch = 0xFE06
XK_ISO_Group_Lock = 0xFE07
XK_ISO_Next_Group = 0xFE08
XK_ISO_Next_Group_Lock = 0xFE09
XK_ISO_Prev_Group = 0xFE0A
XK_ISO_Prev_Group_Lock = 0xFE0B
XK_ISO_First_Group = 0xFE0C
XK_ISO_First_Group_Lock = 0xFE0D
XK_ISO_Last_Group = 0xFE0E
XK_ISO_Last_Group_Lock = 0xFE0F
XK_ISO_Left_Tab = 0xFE20
XK_ISO_Move_Line_Up = 0xFE21
XK_ISO_Move_Line_Down = 0xFE22
XK_ISO_Partial_Line_Up = 0xFE23
XK_ISO_Partial_Line_Down = 0xFE24
XK_ISO_Partial_Space_Left = 0xFE25
XK_ISO_Partial_Space_Right = 0xFE26
XK_ISO_Set_Margin_Left = 0xFE27
XK_ISO_Set_Margin_Right = 0xFE28
XK_ISO_Release_Margin_Left = 0xFE29
XK_ISO_Release_Margin_Right = 0xFE2A
XK_ISO_Release_Both_Margins = 0xFE2B
XK_ISO_Fast_Cursor_Left = 0xFE2C
XK_ISO_Fast_Cursor_Right = 0xFE2D
XK_ISO_Fast_Cursor_Up = 0xFE2E
XK_ISO_Fast_Cursor_Down = 0xFE2F
XK_ISO_Continuous_Underline = 0xFE30
XK_ISO_Discontinuous_Underline = 0xFE31
XK_ISO_Emphasize = 0xFE32
XK_ISO_Center_Object = 0xFE33
XK_ISO_Enter = 0xFE34
XK_dead_grave = 0xFE50
XK_dead_acute = 0xFE51
XK_dead_circumflex = 0xFE52
XK_dead_tilde = 0xFE53
XK_dead_macron = 0xFE54
XK_dead_breve = 0xFE55
XK_dead_abovedot = 0xFE56
XK_dead_diaeresis = 0xFE57
XK_dead_abovering = 0xFE58
XK_dead_doubleacute = 0xFE59
XK_dead_caron = 0xFE5A
XK_dead_cedilla = 0xFE5B
XK_dead_ogonek = 0xFE5C
XK_dead_iota = 0xFE5D
XK_dead_voiced_sound = 0xFE5E
XK_dead_semivoiced_sound = 0xFE5F
XK_dead_belowdot = 0xFE60
XK_First_Virtual_Screen = 0xFED0
XK_Prev_Virtual_Screen = 0xFED1
XK_Next_Virtual_Screen = 0xFED2
XK_Last_Virtual_Screen = 0xFED4
XK_Terminate_Server = 0xFED5
XK_AccessX_Enable = 0xFE70
XK_AccessX_Feedback_Enable = 0xFE71
XK_RepeatKeys_Enable = 0xFE72
XK_SlowKeys_Enable = 0xFE73
XK_BounceKeys_Enable = 0xFE74
XK_StickyKeys_Enable = 0xFE75
XK_MouseKeys_Enable = 0xFE76
XK_MouseKeys_Accel_Enable = 0xFE77
XK_Overlay1_Enable = 0xFE78
XK_Overlay2_Enable = 0xFE79
XK_AudibleBell_Enable = 0xFE7A
XK_Pointer_Left = 0xFEE0
XK_Pointer_Right = 0xFEE1
XK_Pointer_Up = 0xFEE2
XK_Pointer_Down = 0xFEE3
XK_Pointer_UpLeft = 0xFEE4
XK_Pointer_UpRight = 0xFEE5
XK_Pointer_DownLeft = 0xFEE6
XK_Pointer_DownRight = 0xFEE7
XK_Pointer_Button_Dflt = 0xFEE8
XK_Pointer_Button1 = 0xFEE9
XK_Pointer_Button2 = 0xFEEA
XK_Pointer_Button3 = 0xFEEB
XK_Pointer_Button4 = 0xFEEC
XK_Pointer_Button5 = 0xFEED
XK_Pointer_DblClick_Dflt = 0xFEEE
XK_Pointer_DblClick1 = 0xFEEF
XK_Pointer_DblClick2 = 0xFEF0
XK_Pointer_DblClick3 = 0xFEF1
XK_Pointer_DblClick4 = 0xFEF2
XK_Pointer_DblClick5 = 0xFEF3
XK_Pointer_Drag_Dflt = 0xFEF4
XK_Pointer_Drag1 = 0xFEF5
XK_Pointer_Drag2 = 0xFEF6
XK_Pointer_Drag3 = 0xFEF7
XK_Pointer_Drag4 = 0xFEF8
XK_Pointer_Drag5 = 0xFEFD
XK_Pointer_EnableKeys = 0xFEF9
XK_Pointer_Accelerate = 0xFEFA
XK_Pointer_DfltBtnNext = 0xFEFB
XK_Pointer_DfltBtnPrev = 0xFEFC

124
Xlib/protocol/ChangeLog

@ -0,0 +1,124 @@
2006-07-22 Mike Grant <mgg@nobodymuch.org>
* Xlib/protocol/display.py: (mggrant) Fix for 1219457 - flushing
was blocking and waiting for a read operation. Added missing
"import socket" per bug report #681511. Fix for bug:1098695 &
1098738. The "recv" variable was being used for more than one
thing - renamed one.
Changelog hasn't been maintained since 2002, but some of the more
significant comments from cvs logs follow:
* Xlib/protocol/request.py: (petli) Fix bugs in definition and
method of GrabButton/Pointer
2002-02-22 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* event.py(CirculateNotify, CirculateRequest): These are
identical, so subclass the common Circulate.
2002-02-13 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* rq.py (ValueList.parse_binary_value): Use = both for calcsize
and unpacking. Caused problems on Alpha.
2002-02-11 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* request.py (GetWindowAttributes): Rename class to win_class.
(AllocColorPlanes): Fix Pad(4) to Pad(8) in reply.
* rq.py (ReplyLength): Add a reply length field, for completeness
and easier unit test generation.
2002-02-10 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* rq.py (DictWrapper.__cmp__): Let DictWrapper compare with plain
dictionaries.
(Event.__init__): Set send_event to 0 when creating new events
objects, and allow events to be compared.
(Struct.parse_binary): Allow LengthFields to have a parse_value method.
(OddLength.parse_value): Decode field.
(String16.parse_binary_value): Handle OddLength fields.
(TextElements8.parse_binary_value): Bugfix: return values instead
of v.
(String8.parse_binary_value): Parse String8 with no LengthOf
field.
2002-02-09 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* rq.py (TextElements16): Bugfix: inherit TextElements8 instead of
TextElements16. Found while preparing unit tests, whee.
2002-01-14 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* display.py (Display.parse_event_response): Fix bug reported by
Ilpo Nyyssönen, whereby ReplyRequests which generates events
(e.g. get_property with delete = 1) will get dropped when the
event is received.
2001-12-14 Peter Liljenberg <peter.liljenberg@esdgkonsult.com>
* display.py (Display.parse_event_response):
* rq.py (Event.__init__): Fixed bug in event type decoding: bit
0-6 is the event type, and bit 7 is set if the event was sent by
SendEvent.
2001-01-16 <petli@cendio.se>
* event.py: Changed some class names so that they correspond
exactly to the event type constants.
Tue Jan 9 10:03:25 2001 Peter Liljenberg <petli@cendio.se>
* display.py (Display.send_request): Fixed a call to append() with
multiple arguments, something that modern Pythons don't allow.
2001-01-04 <petli@cendio.se>
* rq.py: The fix for 64-bit platforms didn't work, and close
scrutiny of structmodule.c shows why: it turns out that '='
translates into '<' or '>', the one the platform would use. This
means B is one byte, H is two and L is four, and no extra
alignment, always. '@', which is the default, selects native
number of bytes, which on Alpha means that 'L' is eight bytes.
Now the code goes to pains to ensure that '=' encoding is always
used, so _now_ it should work on all platforms. Ahem.
2000-12-29 <petli@cendio.se>
* rq.py: Optimizations:
+ replace calls to Field.get_name() with access to attribute
name.
(Struct.build_from_args):
Fri Dec 29 17:05:02 2000 Peter Liljenberg <petli@cendio.se>
* rq.py: Alpha forces us to probe how many bytes each struct code
in 'bhil' represents, instead of being able to assume that b is 1,
h is 2 and l is 4.
2000-12-21 <petli@cendio.se>
* request.py (SetClipRectangles): Fixed typo (attribute was
"rectangels").
2000-12-20 <petli@cendio.se>
* rq.py (DictWrapper.__setitem__),
(DictWrapper.__delitem__),
(DictWrapper.__setattr__),
(DictWrapper.__delattr__):
Add a few methods to the DictWrapper, to make sure that even if
attributes are changed, all attributes can be found in the _data
mapping.
(ValueField.__init__):
(Object.__init__):
(ValueField.pack_value):
(Set.__init__):
Added a default parameter, so that structure elements with a
default value can be omitted when calling build_from_args.

28
Xlib/protocol/__init__.py

@ -0,0 +1,28 @@
# Xlib.protocol.__init__ -- glue for Xlib.protocol package
#
# Copyright (C) 2000 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
__all__ = [
'display',
'event',
'request',
'rq',
'structs',
]

BIN
Xlib/protocol/__pycache__/__init__.cpython-38.pyc

Binary file not shown.

BIN
Xlib/protocol/__pycache__/display.cpython-38.pyc

Binary file not shown.

BIN
Xlib/protocol/__pycache__/event.cpython-38.pyc

Binary file not shown.

BIN
Xlib/protocol/__pycache__/request.cpython-38.pyc

Binary file not shown.

BIN
Xlib/protocol/__pycache__/rq.cpython-38.pyc

Binary file not shown.

BIN
Xlib/protocol/__pycache__/structs.cpython-38.pyc

Binary file not shown.

1075
Xlib/protocol/display.py

File diff suppressed because it is too large

434
Xlib/protocol/event.py

@ -0,0 +1,434 @@
# Xlib.protocol.event -- definitions of core events
#
# Copyright (C) 2000-2002 Peter Liljenberg <petli@ctrl-c.liu.se>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307 USA
# Xlib modules
from .. import X
# Xlib.protocol modules
from . import rq
class AnyEvent(rq.Event):
_code = None
_fields = rq.Struct( rq.Card8('type'),
rq.Card8('detail'),
rq.Card16('sequence_number'),
rq.FixedBinary('data', 28),
)
class KeyButtonPointer(rq.Event):
_code = None
_fields = rq.Struct( rq.Card8('type'),
rq.Card8('detail'),
rq.Card16('sequence_number'),
rq.Card32('time'),
rq.Window('root'),
rq.Window('window'),
rq.Window('child', (X.NONE, )),
rq.Int16('root_x'),
rq.Int16('root_y'),
rq.Int16('event_x'),
rq.Int16('event_y'),
rq.Card16('state'),
rq.Card8('same_screen'),
rq.Pad(1),
)
class KeyPress(KeyButtonPointer):
_code = X.KeyPress
class KeyRelease(KeyButtonPointer):
_code = X.KeyRelease
class ButtonPress(KeyButtonPointer):
_code = X.ButtonPress
class ButtonRelease(KeyButtonPointer):
_code = X.ButtonRelease
class MotionNotify(KeyButtonPointer):
_code = X.MotionNotify
class EnterLeave(rq.Event):
_code = None
_fields = rq.Struct( rq.Card8('type'),
rq.Card8('detail'),
rq.Card16('sequence_number'),
rq.Card32('time'),
rq.Window('root'),
rq.Window('window'),
rq.Window('child', (X.NONE, )),
rq.Int16('root_x'),
rq.Int16('root_y'),
rq.Int16('event_x'),
rq.Int16('event_y'),
rq.Card16('state'),
rq.Card8('mode'),
rq.Card8('flags'),
)
class EnterNotify(EnterLeave):
_code = X.EnterNotify
class LeaveNotify(EnterLeave):
_code = X.LeaveNotify
class Focus(rq.Event):
_code = None
_fields = rq.Struct( rq.Card8('type'),
rq.Card8('detail'),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card8('mode'),
rq.Pad(23),
)
class FocusIn(Focus):
_code = X.FocusIn
class FocusOut(Focus):
_code = X.FocusOut
class Expose(rq.Event):
_code = X.Expose
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card16('x'),
rq.Card16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('count'),
rq.Pad(14),
)
class GraphicsExpose(rq.Event):
_code = X.GraphicsExpose
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Drawable('drawable'),
rq.Card16('x'),
rq.Card16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('minor_event'),
rq.Card16('count'),
rq.Card8('major_event'),
rq.Pad(11),
)
class NoExpose(rq.Event):
_code = X.NoExpose
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Drawable('window'),
rq.Card16('minor_event'),
rq.Card8('major_event'),
rq.Pad(21),
)
class VisibilityNotify(rq.Event):
_code = X.VisibilityNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card8('state'),
rq.Pad(23),
)
class CreateNotify(rq.Event):
_code = X.CreateNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('parent'),
rq.Window('window'),
rq.Int16('x'),
rq.Int16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('border_width'),
rq.Card8('override'),
rq.Pad(9),
)
class DestroyNotify(rq.Event):
_code = X.DestroyNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Pad(20),
)
class UnmapNotify(rq.Event):
_code = X.UnmapNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Card8('from_configure'),
rq.Pad(19),
)
class MapNotify(rq.Event):
_code = X.MapNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Card8('override'),
rq.Pad(19),
)
class MapRequest(rq.Event):
_code = X.MapRequest
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('parent'),
rq.Window('window'),
rq.Pad(20),
)
class ReparentNotify(rq.Event):
_code = X.ReparentNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Window('parent'),
rq.Int16('x'),
rq.Int16('y'),
rq.Card8('override'),
rq.Pad(11),
)
class ConfigureNotify(rq.Event):
_code = X.ConfigureNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Window('above_sibling', (X.NONE, )),
rq.Int16('x'),
rq.Int16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('border_width'),
rq.Card8('override'),
rq.Pad(5),
)
class ConfigureRequest(rq.Event):
_code = X.ConfigureRequest
_fields = rq.Struct( rq.Card8('type'),
rq.Card8('stack_mode'),
rq.Card16('sequence_number'),
rq.Window('parent'),
rq.Window('window'),
rq.Window('sibling', (X.NONE, )),
rq.Int16('x'),
rq.Int16('y'),
rq.Card16('width'),
rq.Card16('height'),
rq.Card16('border_width'),
rq.Card16('value_mask'),
rq.Pad(4),
)
class GravityNotify(rq.Event):
_code = X.GravityNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Int16('x'),
rq.Int16('y'),
rq.Pad(16),
)
class ResizeRequest(rq.Event):
_code = X.ResizeRequest
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card16('width'),
rq.Card16('height'),
rq.Pad(20),
)
class Circulate(rq.Event):
_code = None
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('event'),
rq.Window('window'),
rq.Pad(4),
rq.Card8('place'),
rq.Pad(15),
)
class CirculateNotify(Circulate):
_code = X.CirculateNotify
class CirculateRequest(Circulate):
_code = X.CirculateRequest
class PropertyNotify(rq.Event):
_code = X.PropertyNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card32('atom'),
rq.Card32('time'),
rq.Card8('state'),
rq.Pad(15),
)
class SelectionClear(rq.Event):
_code = X.SelectionClear
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Card32('time'),
rq.Window('window'),
rq.Card32('atom'),
rq.Pad(16),
)
class SelectionRequest(rq.Event):
_code = X.SelectionRequest
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Card32('time'),
rq.Window('owner'),
rq.Window('requestor'),
rq.Card32('selection'),
rq.Card32('target'),
rq.Card32('property'),
rq.Pad(4),
)
class SelectionNotify(rq.Event):
_code = X.SelectionNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Card32('time'),
rq.Window('requestor'),
rq.Card32('selection'),
rq.Card32('target'),
rq.Card32('property'),
rq.Pad(8),
)
class ColormapNotify(rq.Event):
_code = X.ColormapNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Colormap('colormap', (X.NONE, )),
rq.Card8('new'),
rq.Card8('state'),
rq.Pad(18),
)
class MappingNotify(rq.Event):
_code = X.MappingNotify
_fields = rq.Struct( rq.Card8('type'),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.Card8('request'),
rq.Card8('first_keycode'),
rq.Card8('count'),
rq.Pad(25),
)
class ClientMessage(rq.Event):
_code = X.ClientMessage
_fields = rq.Struct( rq.Card8('type'),
rq.Format('data', 1),
rq.Card16('sequence_number'),
rq.Window('window'),
rq.Card32('client_type'),
rq.FixedPropertyData('data', 20),
)
class KeymapNotify(rq.Event):
_code = X.KeymapNotify
_fields = rq.Struct( rq.Card8('type'),
rq.FixedList('data', 31, rq.Card8Obj, pad = 0)
)
event_class = {
X.KeyPress: KeyPress,
X.KeyRelease: KeyRelease,
X.ButtonPress: ButtonPress,
X.ButtonRelease: ButtonRelease,
X.MotionNotify: MotionNotify,
X.EnterNotify: EnterNotify,
X.LeaveNotify: LeaveNotify,
X.FocusIn: FocusIn,
X.FocusOut: FocusOut,
X.KeymapNotify: KeymapNotify,
X.Expose: Expose,
X.GraphicsExpose: GraphicsExpose,
X.NoExpose: NoExpose,
X.VisibilityNotify: VisibilityNotify,
X.CreateNotify: CreateNotify,
X.DestroyNotify: DestroyNotify,
X.UnmapNotify: UnmapNotify,
X.MapNotify: MapNotify,
X.MapRequest: MapRequest,
X.ReparentNotify: ReparentNotify,
X.ConfigureNotify: ConfigureNotify,
X.ConfigureRequest: ConfigureRequest,
X.GravityNotify: GravityNotify,
X.ResizeRequest: ResizeRequest,
X.CirculateNotify: CirculateNotify,
X.CirculateRequest: CirculateRequest,
X.PropertyNotify: PropertyNotify,
X.SelectionClear: SelectionClear,
X.SelectionRequest: SelectionRequest,
X.SelectionNotify: SelectionNotify,
X.ColormapNotify: ColormapNotify,
X.ClientMessage: ClientMessage,
X.MappingNotify: MappingNotify,
}

1900
Xlib/protocol/request.py

File diff suppressed because it is too large

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save