Define constants in X.h

This commit is contained in:
Takashi Kokubun 2016-11-30 02:34:12 +09:00
parent 560e51efb5
commit a8de68d52a
2 changed files with 384 additions and 3 deletions

View File

@ -18,8 +18,8 @@ module Xkremap
display = @display
# C-b -> Left
result[to_keycode(X11::XK_b)][1<<2] = Proc.new do
XlibWrapper.input_key(display, 0xff51, 0)
result[to_keycode(X11::XK_b)][X11::ControlMask] = Proc.new do
XlibWrapper.input_key(display, X11::XK_Left, X11::NoModifier)
end
end

View File

@ -1,4 +1,5 @@
#include <X11/keysym.h>
#include <X11/X.h>
#include "mruby.h"
void
@ -7,7 +8,10 @@ mrb_xkremap_x11_constants_init(mrb_state *mrb, struct RClass *mXkremap)
struct RClass *mX11 = mrb_define_module_under(mrb, mXkremap, "X11");
# define define_x11_const(name) mrb_define_const(mrb, mX11, #name, mrb_fixnum_value(name))
// cat /usr/include/X11/keysymdef.h| ruby -e 'puts STDIN.read.split("\n").select {|l| l.match(/\A(#define XK_|#ifdef|#endif)/) }.map{|l| l.match(/\A#define XK_/) ? %Q[ define_x11_const(#{l.split(" ")[1]});] : l }.join("\n")'
// original constant.
mrb_define_const(mrb, mX11, "NoModifier", mrb_fixnum_value(0));
// cat /usr/include/X11/keysymdef.h | ruby -e 'puts STDIN.read.split("\n").select {|l| l.match(/\A(#define XK_|#ifdef|#endif)/) }.map{|l| l.match(/\A#define XK_/) ? %Q[ define_x11_const(#{l.split(" ")[1]});] : l }.join("\n")'
define_x11_const(XK_VoidSymbol);
#ifdef XK_MISCELLANY
define_x11_const(XK_BackSpace);
@ -2163,4 +2167,381 @@ mrb_xkremap_x11_constants_init(mrb_state *mrb, struct RClass *mXkremap)
define_x11_const(XK_Sinh_luu2);
define_x11_const(XK_Sinh_kunddaliya);
#endif /* XK_SINHALA */
// cat /usr/include/X11/X.h | ruby -e 'puts STDIN.read.split("\n").select {|l| l.start_with?("#")}[2..-2].map{|l| l.start_with?("#define") ? %Q[ define_x11_const(#{l.split(" ")[1]});] : l}'
define_x11_const(X_PROTOCOL);
define_x11_const(X_PROTOCOL_REVISION);
#ifndef _XSERVER64
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
# endif
#else
# include <X11/Xmd.h>
# ifndef _XTYPEDEF_XID
# define _XTYPEDEF_XID
# endif
# ifndef _XTYPEDEF_MASK
# define _XTYPEDEF_MASK
# endif
# ifndef _XTYPEDEF_ATOM
# define _XTYPEDEF_ATOM
# endif
#endif
#ifndef _XTYPEDEF_FONT
# define _XTYPEDEF_FONT
#endif
#ifndef None
define_x11_const(None);
#endif
define_x11_const(ParentRelative);
define_x11_const(CopyFromParent);
define_x11_const(PointerWindow);
define_x11_const(InputFocus);
define_x11_const(PointerRoot);
define_x11_const(AnyPropertyType);
define_x11_const(AnyKey);
define_x11_const(AnyButton);
define_x11_const(AllTemporary);
define_x11_const(CurrentTime);
define_x11_const(NoSymbol);
define_x11_const(NoEventMask);
define_x11_const(KeyPressMask);
define_x11_const(KeyReleaseMask);
define_x11_const(ButtonPressMask);
define_x11_const(ButtonReleaseMask);
define_x11_const(EnterWindowMask);
define_x11_const(LeaveWindowMask);
define_x11_const(PointerMotionMask);
define_x11_const(PointerMotionHintMask);
define_x11_const(Button1MotionMask);
define_x11_const(Button2MotionMask);
define_x11_const(Button3MotionMask);
define_x11_const(Button4MotionMask);
define_x11_const(Button5MotionMask);
define_x11_const(ButtonMotionMask);
define_x11_const(KeymapStateMask);
define_x11_const(ExposureMask);
define_x11_const(VisibilityChangeMask);
define_x11_const(StructureNotifyMask);
define_x11_const(ResizeRedirectMask);
define_x11_const(SubstructureNotifyMask);
define_x11_const(SubstructureRedirectMask);
define_x11_const(FocusChangeMask);
define_x11_const(PropertyChangeMask);
define_x11_const(ColormapChangeMask);
define_x11_const(OwnerGrabButtonMask);
define_x11_const(KeyPress);
define_x11_const(KeyRelease);
define_x11_const(ButtonPress);
define_x11_const(ButtonRelease);
define_x11_const(MotionNotify);
define_x11_const(EnterNotify);
define_x11_const(LeaveNotify);
define_x11_const(FocusIn);
define_x11_const(FocusOut);
define_x11_const(KeymapNotify);
define_x11_const(Expose);
define_x11_const(GraphicsExpose);
define_x11_const(NoExpose);
define_x11_const(VisibilityNotify);
define_x11_const(CreateNotify);
define_x11_const(DestroyNotify);
define_x11_const(UnmapNotify);
define_x11_const(MapNotify);
define_x11_const(MapRequest);
define_x11_const(ReparentNotify);
define_x11_const(ConfigureNotify);
define_x11_const(ConfigureRequest);
define_x11_const(GravityNotify);
define_x11_const(ResizeRequest);
define_x11_const(CirculateNotify);
define_x11_const(CirculateRequest);
define_x11_const(PropertyNotify);
define_x11_const(SelectionClear);
define_x11_const(SelectionRequest);
define_x11_const(SelectionNotify);
define_x11_const(ColormapNotify);
define_x11_const(ClientMessage);
define_x11_const(MappingNotify);
define_x11_const(GenericEvent);
define_x11_const(LASTEvent);
define_x11_const(ShiftMask);
define_x11_const(LockMask);
define_x11_const(ControlMask);
define_x11_const(Mod1Mask);
define_x11_const(Mod2Mask);
define_x11_const(Mod3Mask);
define_x11_const(Mod4Mask);
define_x11_const(Mod5Mask);
define_x11_const(ShiftMapIndex);
define_x11_const(LockMapIndex);
define_x11_const(ControlMapIndex);
define_x11_const(Mod1MapIndex);
define_x11_const(Mod2MapIndex);
define_x11_const(Mod3MapIndex);
define_x11_const(Mod4MapIndex);
define_x11_const(Mod5MapIndex);
define_x11_const(Button1Mask);
define_x11_const(Button2Mask);
define_x11_const(Button3Mask);
define_x11_const(Button4Mask);
define_x11_const(Button5Mask);
define_x11_const(AnyModifier);
define_x11_const(Button1);
define_x11_const(Button2);
define_x11_const(Button3);
define_x11_const(Button4);
define_x11_const(Button5);
define_x11_const(NotifyNormal);
define_x11_const(NotifyGrab);
define_x11_const(NotifyUngrab);
define_x11_const(NotifyWhileGrabbed);
define_x11_const(NotifyHint);
define_x11_const(NotifyAncestor);
define_x11_const(NotifyVirtual);
define_x11_const(NotifyInferior);
define_x11_const(NotifyNonlinear);
define_x11_const(NotifyNonlinearVirtual);
define_x11_const(NotifyPointer);
define_x11_const(NotifyPointerRoot);
define_x11_const(NotifyDetailNone);
define_x11_const(VisibilityUnobscured);
define_x11_const(VisibilityPartiallyObscured);
define_x11_const(VisibilityFullyObscured);
define_x11_const(PlaceOnTop);
define_x11_const(PlaceOnBottom);
define_x11_const(FamilyInternet);
define_x11_const(FamilyDECnet);
define_x11_const(FamilyChaos);
define_x11_const(FamilyInternet6);
define_x11_const(FamilyServerInterpreted);
define_x11_const(PropertyNewValue);
define_x11_const(PropertyDelete);
define_x11_const(ColormapUninstalled);
define_x11_const(ColormapInstalled);
define_x11_const(GrabModeSync);
define_x11_const(GrabModeAsync);
define_x11_const(GrabSuccess);
define_x11_const(AlreadyGrabbed);
define_x11_const(GrabInvalidTime);
define_x11_const(GrabNotViewable);
define_x11_const(GrabFrozen);
define_x11_const(AsyncPointer);
define_x11_const(SyncPointer);
define_x11_const(ReplayPointer);
define_x11_const(AsyncKeyboard);
define_x11_const(SyncKeyboard);
define_x11_const(ReplayKeyboard);
define_x11_const(AsyncBoth);
define_x11_const(SyncBoth);
define_x11_const(RevertToNone);
define_x11_const(RevertToPointerRoot);
define_x11_const(RevertToParent);
define_x11_const(Success);
define_x11_const(BadRequest);
define_x11_const(BadValue);
define_x11_const(BadWindow);
define_x11_const(BadPixmap);
define_x11_const(BadAtom);
define_x11_const(BadCursor);
define_x11_const(BadFont);
define_x11_const(BadMatch);
define_x11_const(BadDrawable);
define_x11_const(BadAccess);
define_x11_const(BadAlloc);
define_x11_const(BadColor);
define_x11_const(BadGC);
define_x11_const(BadIDChoice);
define_x11_const(BadName);
define_x11_const(BadLength);
define_x11_const(BadImplementation);
define_x11_const(FirstExtensionError);
define_x11_const(LastExtensionError);
define_x11_const(InputOutput);
define_x11_const(InputOnly);
define_x11_const(CWBackPixmap);
define_x11_const(CWBackPixel);
define_x11_const(CWBorderPixmap);
define_x11_const(CWBorderPixel);
define_x11_const(CWBitGravity);
define_x11_const(CWWinGravity);
define_x11_const(CWBackingStore);
define_x11_const(CWBackingPlanes);
define_x11_const(CWBackingPixel);
define_x11_const(CWOverrideRedirect);
define_x11_const(CWSaveUnder);
define_x11_const(CWEventMask);
define_x11_const(CWDontPropagate);
define_x11_const(CWColormap);
define_x11_const(CWCursor);
define_x11_const(CWX);
define_x11_const(CWY);
define_x11_const(CWWidth);
define_x11_const(CWHeight);
define_x11_const(CWBorderWidth);
define_x11_const(CWSibling);
define_x11_const(CWStackMode);
define_x11_const(ForgetGravity);
define_x11_const(NorthWestGravity);
define_x11_const(NorthGravity);
define_x11_const(NorthEastGravity);
define_x11_const(WestGravity);
define_x11_const(CenterGravity);
define_x11_const(EastGravity);
define_x11_const(SouthWestGravity);
define_x11_const(SouthGravity);
define_x11_const(SouthEastGravity);
define_x11_const(StaticGravity);
define_x11_const(UnmapGravity);
define_x11_const(NotUseful);
define_x11_const(WhenMapped);
define_x11_const(Always);
define_x11_const(IsUnmapped);
define_x11_const(IsUnviewable);
define_x11_const(IsViewable);
define_x11_const(SetModeInsert);
define_x11_const(SetModeDelete);
define_x11_const(DestroyAll);
define_x11_const(RetainPermanent);
define_x11_const(RetainTemporary);
define_x11_const(Above);
define_x11_const(Below);
define_x11_const(TopIf);
define_x11_const(BottomIf);
define_x11_const(Opposite);
define_x11_const(RaiseLowest);
define_x11_const(LowerHighest);
define_x11_const(PropModeReplace);
define_x11_const(PropModePrepend);
define_x11_const(PropModeAppend);
define_x11_const(GXclear);
define_x11_const(GXand);
define_x11_const(GXandReverse);
define_x11_const(GXcopy);
define_x11_const(GXandInverted);
define_x11_const(GXnoop);
define_x11_const(GXxor);
define_x11_const(GXor);
define_x11_const(GXnor);
define_x11_const(GXequiv);
define_x11_const(GXinvert);
define_x11_const(GXorReverse);
define_x11_const(GXcopyInverted);
define_x11_const(GXorInverted);
define_x11_const(GXnand);
define_x11_const(GXset);
define_x11_const(LineSolid);
define_x11_const(LineOnOffDash);
define_x11_const(LineDoubleDash);
define_x11_const(CapNotLast);
define_x11_const(CapButt);
define_x11_const(CapRound);
define_x11_const(CapProjecting);
define_x11_const(JoinMiter);
define_x11_const(JoinRound);
define_x11_const(JoinBevel);
define_x11_const(FillSolid);
define_x11_const(FillTiled);
define_x11_const(FillStippled);
define_x11_const(FillOpaqueStippled);
define_x11_const(EvenOddRule);
define_x11_const(WindingRule);
define_x11_const(ClipByChildren);
define_x11_const(IncludeInferiors);
define_x11_const(Unsorted);
define_x11_const(YSorted);
define_x11_const(YXSorted);
define_x11_const(YXBanded);
define_x11_const(CoordModeOrigin);
define_x11_const(CoordModePrevious);
define_x11_const(Complex);
define_x11_const(Nonconvex);
define_x11_const(Convex);
define_x11_const(ArcChord);
define_x11_const(ArcPieSlice);
define_x11_const(GCFunction);
define_x11_const(GCPlaneMask);
define_x11_const(GCForeground);
define_x11_const(GCBackground);
define_x11_const(GCLineWidth);
define_x11_const(GCLineStyle);
define_x11_const(GCCapStyle);
define_x11_const(GCJoinStyle);
define_x11_const(GCFillStyle);
define_x11_const(GCFillRule);
define_x11_const(GCTile);
define_x11_const(GCStipple);
define_x11_const(GCTileStipXOrigin);
define_x11_const(GCTileStipYOrigin);
define_x11_const(GCFont);
define_x11_const(GCSubwindowMode);
define_x11_const(GCGraphicsExposures);
define_x11_const(GCClipXOrigin);
define_x11_const(GCClipYOrigin);
define_x11_const(GCClipMask);
define_x11_const(GCDashOffset);
define_x11_const(GCDashList);
define_x11_const(GCArcMode);
define_x11_const(GCLastBit);
define_x11_const(FontLeftToRight);
define_x11_const(FontRightToLeft);
define_x11_const(FontChange);
define_x11_const(XYBitmap);
define_x11_const(XYPixmap);
define_x11_const(ZPixmap);
define_x11_const(AllocNone);
define_x11_const(AllocAll);
define_x11_const(DoRed);
define_x11_const(DoGreen);
define_x11_const(DoBlue);
define_x11_const(CursorShape);
define_x11_const(TileShape);
define_x11_const(StippleShape);
define_x11_const(AutoRepeatModeOff);
define_x11_const(AutoRepeatModeOn);
define_x11_const(AutoRepeatModeDefault);
define_x11_const(LedModeOff);
define_x11_const(LedModeOn);
define_x11_const(KBKeyClickPercent);
define_x11_const(KBBellPercent);
define_x11_const(KBBellPitch);
define_x11_const(KBBellDuration);
define_x11_const(KBLed);
define_x11_const(KBLedMode);
define_x11_const(KBKey);
define_x11_const(KBAutoRepeatMode);
define_x11_const(MappingSuccess);
define_x11_const(MappingBusy);
define_x11_const(MappingFailed);
define_x11_const(MappingModifier);
define_x11_const(MappingKeyboard);
define_x11_const(MappingPointer);
define_x11_const(DontPreferBlanking);
define_x11_const(PreferBlanking);
define_x11_const(DefaultBlanking);
define_x11_const(DisableScreenSaver);
define_x11_const(DisableScreenInterval);
define_x11_const(DontAllowExposures);
define_x11_const(AllowExposures);
define_x11_const(DefaultExposures);
define_x11_const(ScreenSaverReset);
define_x11_const(ScreenSaverActive);
define_x11_const(HostInsert);
define_x11_const(HostDelete);
define_x11_const(EnableAccess);
define_x11_const(DisableAccess);
define_x11_const(StaticGray);
define_x11_const(GrayScale);
define_x11_const(StaticColor);
define_x11_const(PseudoColor);
define_x11_const(TrueColor);
define_x11_const(DirectColor);
define_x11_const(LSBFirst);
define_x11_const(MSBFirst);
}