Skip to content

Commit

Permalink
Merge pull request #3511 from IllusionMan1212/x11-xkb
Browse files Browse the repository at this point in the history
vendor/x11: some XKB extension procedures and constants
  • Loading branch information
Kelimion authored Jul 8, 2024
2 parents a3af94e + 0c27d95 commit 9575d85
Show file tree
Hide file tree
Showing 3 changed files with 891 additions and 1 deletion.
74 changes: 74 additions & 0 deletions vendor/x11/xlib/xlib_const.odin
Original file line number Diff line number Diff line change
@@ -1,6 +1,80 @@
//+build linux, freebsd, openbsd
package xlib

/* ---- X11/extensions/XKB.h ---------------------------------------------------------*/

XkbMinLegalKeyCode :: 8
XkbMaxLegalKeyCode :: 255
XkbMaxKeyCount :: XkbMaxLegalKeyCode - XkbMinLegalKeyCode + 1
XkbPerKeyBitArraySize :: (XkbMaxLegalKeyCode + 1) / 8
XkbKeyNameLength :: 4
XkbNumVirtualMods :: 16
XkbNumIndicators :: 32
XkbNumKbdGroups :: 4
XkbAnyActionDataSize :: 7
XkbUseCoreKbd :: 0x0100
XkbActionMessageLength :: 6

XkbInfoMask :: bit_set[XkbInfoMaskBits; int]
XkbInfoMaskBits :: enum u32 {
KeyTypes = 0,
KeySyms = 1,
ModifierMap = 2,
ExplicitComponents = 3,
KeyActions = 4,
KeyBehaviors = 5,
VirtualMods = 6,
VirtualModMap = 7,
}

XkbAllClientInfoMask :: XkbInfoMask {
.KeyTypes,
.KeySyms,
.ModifierMap,
}

XkbAllServerInfoMask :: XkbInfoMask {
.ExplicitComponents,
.KeyActions,
.KeyBehaviors,
.VirtualMods,
.VirtualModMap,
}

XkbEventMask :: bit_set[XkbEventType; int]
XkbEventType :: enum i32 {
NewKeyboardNotify = 0,
MapNotify = 1,
StateNotify = 2,
ControlsNotify = 3,
IndicatorStateNotify = 4,
IndicatorMapNotify = 5,
NamesNotify = 6,
CompatMapNotify = 7,
BellNotify = 8,
ActionMessage = 9,
AccessXNotify = 10,
ExtensionDeviceNotify = 11,
}

XkbAllEventsMask :: XkbEventMask {
.NewKeyboardNotify,
.MapNotify,
.StateNotify,
.ControlsNotify,
.IndicatorStateNotify,
.IndicatorMapNotify,
.NamesNotify,
.CompatMapNotify,
.BellNotify,
.ActionMessage,
.AccessXNotify,
.ExtensionDeviceNotify,
}


/* ---- X11/Xlib.h ---------------------------------------------------------*/

// Special values for many types. Most of these constants
// aren't attached to a specific type.

Expand Down
57 changes: 56 additions & 1 deletion vendor/x11/xlib/xlib_procs.odin
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ foreign xlib {
DoesBackingStore :: proc(screen: ^Screen) -> BackingStore ---
DoesSaveUnders :: proc(screen: ^Screen) -> b32 ---
DisplayOfScreen :: proc(screen: ^Screen) -> ^Display ---
ScreenNumberOfScreens :: proc(screen: ^Screen) -> i32 ---
ScreenNumberOfScreen :: proc(screen: ^Screen) -> i32 ---
EventMaskOfScreen :: proc(screen: ^Screen) -> EventMask ---
WidthOfScreen :: proc(screen: ^Screen) -> i32 ---
HeightOfScreen :: proc(screen: ^Screen) -> i32 ---
Expand Down Expand Up @@ -1637,6 +1637,13 @@ foreign xlib {
wm_hints: ^XWMHints,
class_hints: ^XClassHint,
) ---
OpenIM :: proc(
display: ^Display,
rdb: XrmHashBucket,
res_name: cstring,
res_class: cstring,
) -> XIM ---
SetLocaleModifiers :: proc(modifiers: cstring) -> cstring ---
}

@(default_calling_convention="c")
Expand Down Expand Up @@ -1938,4 +1945,52 @@ foreign xlib {
XrmInitialize :: proc() ---
XrmGetStringDatabase :: proc(data: cstring) -> XrmDatabase ---
XrmGetResource :: proc(db: XrmDatabase, name: cstring, class: cstring, type_return: ^cstring, val_return: ^XrmValue) -> b32 ---

/* ---- X11/XKBlib.h ---------------------------------------------------------*/

XkbQueryExtension :: proc(
display: ^Display,
opcode_return: ^i32,
event_base_return: ^i32,
error_base_return: ^i32,
major_return: ^i32,
minor_return: ^i32,
) -> b32 ---
XkbUseExtension :: proc(
display: ^Display,
major_return: ^i32,
minor_return: ^i32,
) -> b32 ---
XkbGetMap :: proc(
display: ^Display,
which: XkbInfoMask,
device_spec: i32,
) -> XkbDescPtr ---
XkbGetUpdatedMap :: proc(
display: ^Display,
which: XkbInfoMask,
desc: XkbDescPtr,
) -> b32 ---
XkbSelectEvents :: proc(
display: ^Display,
deviceID: u32,
bits_to_change: XkbEventMask,
values: XkbEventMask,
) -> b32 ---
XkbSetDetectableAutoRepeat :: proc(
display: ^Display,
detectable: b32,
supported: ^b32,
) -> b32 ---
XkbGetState :: proc (
display: ^Display,
device_spec: u32,
return_state: XkbStatePtr,
) -> Status ---
XkbGetKeySyms :: proc(
display: ^Display,
first: u32,
num: u32,
xkb: XkbDescPtr,
) -> Status ---
}
Loading

0 comments on commit 9575d85

Please sign in to comment.