Add bindings to allow for grabbing key presses
This commit is contained in:
parent
0857596ac3
commit
71cd1a6f6a
|
@ -1,3 +1,4 @@
|
|||
with Interfaces.C.Strings;
|
||||
|
||||
package Xlib.Keys is
|
||||
pragma Linker_Options ("-lX11");
|
||||
|
@ -10,4 +11,11 @@ package Xlib.Keys is
|
|||
Mod3Mask : constant := (2**5);
|
||||
Mod4Mask : constant := (2**6);
|
||||
Mod5Mask : constant := (2**7);
|
||||
|
||||
function Symbol_To_Code (Display : Display_Type;
|
||||
Key_Symbol : Key_Symbol_Type) return Key_Code_Type;
|
||||
pragma Import (C, Symbol_To_Code, "XKeysymToKeycode");
|
||||
|
||||
function String_To_Symbol (Str : Interfaces.C.Strings.Chars_Ptr) return Key_Symbol_Type;
|
||||
pragma Import (C, String_To_Symbol, "XStringToKeysym");
|
||||
end Xlib.Keys;
|
||||
|
|
18
src/xlib.ads
18
src/xlib.ads
|
@ -33,6 +33,9 @@ package Xlib is
|
|||
subtype Colormap_Type is Xid_Type;
|
||||
subtype Cursor_Type is Xid_Type;
|
||||
subtype VisualId_Type is Xid_Type;
|
||||
subtype Key_Symbol_Type is Xid_Type;
|
||||
|
||||
subtype Key_Code_Type is Unsigned_Char;
|
||||
|
||||
CurrentTime : constant Time_Type := 0;
|
||||
|
||||
|
@ -42,6 +45,16 @@ package Xlib is
|
|||
function Default_Root_Window (D : Display_Type) return Window_Type;
|
||||
pragma Import (C, Default_Root_Window, "XDefaultRootWindow");
|
||||
|
||||
|
||||
function Grab_Key (Display : Display_Type;
|
||||
Key_Code : Key_Code_Type;
|
||||
Modifiers : Unsigned;
|
||||
Window : Window_Type;
|
||||
Owner_Events : Int;
|
||||
Pointer_Mode : Int;
|
||||
Keyboard_Mode : Int) return Return_Code_Type;
|
||||
pragma Import (C, Grab_Key, "XGrabKey");
|
||||
|
||||
function Grab_Button (Display : Display_Type;
|
||||
Button : Unsigned;
|
||||
Modifiers : Unsigned;
|
||||
|
@ -77,6 +90,11 @@ package Xlib is
|
|||
Height : Unsigned) return Return_Code_Type;
|
||||
pragma Import (C, Move_Resize_Window, "XMoveResizeWindow");
|
||||
|
||||
|
||||
function Raise_Window (Display : Display_Type;
|
||||
Window : Window_Type) return Return_Code_Type;
|
||||
pragma Import (C, Raise_Window, "XRaiseWindow");
|
||||
|
||||
type XPointer is new Interfaces.C.Strings.Chars_Ptr;
|
||||
type u_XExtData is record
|
||||
number : aliased Int;
|
||||
|
|
Loading…
Reference in New Issue