File indexing completed on 2025-01-18 10:14:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049 #ifndef _X11_XUTIL_H_
0050 #define _X11_XUTIL_H_
0051
0052
0053 #include <X11/Xlib.h>
0054 #include <X11/keysym.h>
0055
0056
0057
0058
0059 #ifdef __clang__
0060 #pragma clang diagnostic push
0061 #pragma clang diagnostic ignored "-Wpadded"
0062 #endif
0063
0064
0065
0066
0067
0068 #define NoValue 0x0000
0069 #define XValue 0x0001
0070 #define YValue 0x0002
0071 #define WidthValue 0x0004
0072 #define HeightValue 0x0008
0073 #define AllValues 0x000F
0074 #define XNegative 0x0010
0075 #define YNegative 0x0020
0076
0077
0078
0079
0080
0081 typedef struct {
0082 long flags;
0083 int x, y;
0084 int width, height;
0085 int min_width, min_height;
0086 int max_width, max_height;
0087 int width_inc, height_inc;
0088 struct {
0089 int x;
0090 int y;
0091 } min_aspect, max_aspect;
0092 int base_width, base_height;
0093 int win_gravity;
0094 } XSizeHints;
0095
0096
0097
0098
0099
0100
0101
0102 #define USPosition (1L << 0)
0103 #define USSize (1L << 1)
0104
0105 #define PPosition (1L << 2)
0106 #define PSize (1L << 3)
0107 #define PMinSize (1L << 4)
0108 #define PMaxSize (1L << 5)
0109 #define PResizeInc (1L << 6)
0110 #define PAspect (1L << 7)
0111 #define PBaseSize (1L << 8)
0112 #define PWinGravity (1L << 9)
0113
0114
0115 #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
0116
0117
0118
0119 typedef struct {
0120 long flags;
0121 Bool input;
0122
0123 int initial_state;
0124 Pixmap icon_pixmap;
0125 Window icon_window;
0126 int icon_x, icon_y;
0127 Pixmap icon_mask;
0128 XID window_group;
0129
0130 } XWMHints;
0131
0132
0133
0134 #define InputHint (1L << 0)
0135 #define StateHint (1L << 1)
0136 #define IconPixmapHint (1L << 2)
0137 #define IconWindowHint (1L << 3)
0138 #define IconPositionHint (1L << 4)
0139 #define IconMaskHint (1L << 5)
0140 #define WindowGroupHint (1L << 6)
0141 #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
0142 IconPositionHint|IconMaskHint|WindowGroupHint)
0143 #define XUrgencyHint (1L << 8)
0144
0145
0146 #define WithdrawnState 0
0147 #define NormalState 1
0148 #define IconicState 3
0149
0150
0151
0152
0153 #define DontCareState 0
0154 #define ZoomState 2
0155 #define InactiveState 4
0156
0157
0158
0159
0160
0161
0162
0163 typedef struct {
0164 unsigned char *value;
0165 Atom encoding;
0166 int format;
0167 unsigned long nitems;
0168 } XTextProperty;
0169
0170 #define XNoMemory -1
0171 #define XLocaleNotSupported -2
0172 #define XConverterNotFound -3
0173
0174 typedef enum {
0175 XStringStyle,
0176 XCompoundTextStyle,
0177 XTextStyle,
0178 XStdICCTextStyle,
0179
0180 XUTF8StringStyle
0181 } XICCEncodingStyle;
0182
0183 typedef struct {
0184 int min_width, min_height;
0185 int max_width, max_height;
0186 int width_inc, height_inc;
0187 } XIconSize;
0188
0189 typedef struct {
0190 char *res_name;
0191 char *res_class;
0192 } XClassHint;
0193
0194 #ifdef XUTIL_DEFINE_FUNCTIONS
0195 extern int XDestroyImage(
0196 XImage *ximage);
0197 extern unsigned long XGetPixel(
0198 XImage *ximage,
0199 int x, int y);
0200 extern int XPutPixel(
0201 XImage *ximage,
0202 int x, int y,
0203 unsigned long pixel);
0204 extern XImage *XSubImage(
0205 XImage *ximage,
0206 int x, int y,
0207 unsigned int width, unsigned int height);
0208 extern int XAddPixel(
0209 XImage *ximage,
0210 long value);
0211 #else
0212
0213
0214
0215
0216 #define XDestroyImage(ximage) \
0217 ((*((ximage)->f.destroy_image))((ximage)))
0218 #define XGetPixel(ximage, x, y) \
0219 ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
0220 #define XPutPixel(ximage, x, y, pixel) \
0221 ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
0222 #define XSubImage(ximage, x, y, width, height) \
0223 ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
0224 #define XAddPixel(ximage, value) \
0225 ((*((ximage)->f.add_pixel))((ximage), (value)))
0226 #endif
0227
0228
0229
0230
0231 typedef struct _XComposeStatus {
0232 XPointer compose_ptr;
0233 int chars_matched;
0234 } XComposeStatus;
0235
0236
0237
0238
0239 #define IsKeypadKey(keysym) \
0240 (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
0241
0242 #define IsPrivateKeypadKey(keysym) \
0243 (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
0244
0245 #define IsCursorKey(keysym) \
0246 (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
0247
0248 #define IsPFKey(keysym) \
0249 (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
0250
0251 #define IsFunctionKey(keysym) \
0252 (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
0253
0254 #define IsMiscFunctionKey(keysym) \
0255 (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
0256
0257 #ifdef XK_XKB_KEYS
0258 #define IsModifierKey(keysym) \
0259 ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
0260 || (((KeySym)(keysym) >= XK_ISO_Lock) && \
0261 ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
0262 || ((KeySym)(keysym) == XK_Mode_switch) \
0263 || ((KeySym)(keysym) == XK_Num_Lock))
0264 #else
0265 #define IsModifierKey(keysym) \
0266 ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
0267 || ((KeySym)(keysym) == XK_Mode_switch) \
0268 || ((KeySym)(keysym) == XK_Num_Lock))
0269 #endif
0270
0271
0272
0273 typedef struct _XRegion *Region;
0274
0275
0276
0277 #define RectangleOut 0
0278 #define RectangleIn 1
0279 #define RectanglePart 2
0280
0281
0282
0283
0284
0285
0286
0287 typedef struct {
0288 Visual *visual;
0289 VisualID visualid;
0290 int screen;
0291 int depth;
0292 #if defined(__cplusplus) || defined(c_plusplus)
0293 int c_class;
0294 #else
0295 int class;
0296 #endif
0297 unsigned long red_mask;
0298 unsigned long green_mask;
0299 unsigned long blue_mask;
0300 int colormap_size;
0301 int bits_per_rgb;
0302 } XVisualInfo;
0303
0304 #define VisualNoMask 0x0
0305 #define VisualIDMask 0x1
0306 #define VisualScreenMask 0x2
0307 #define VisualDepthMask 0x4
0308 #define VisualClassMask 0x8
0309 #define VisualRedMaskMask 0x10
0310 #define VisualGreenMaskMask 0x20
0311 #define VisualBlueMaskMask 0x40
0312 #define VisualColormapSizeMask 0x80
0313 #define VisualBitsPerRGBMask 0x100
0314 #define VisualAllMask 0x1FF
0315
0316
0317
0318
0319
0320 typedef struct {
0321 Colormap colormap;
0322 unsigned long red_max;
0323 unsigned long red_mult;
0324 unsigned long green_max;
0325 unsigned long green_mult;
0326 unsigned long blue_max;
0327 unsigned long blue_mult;
0328 unsigned long base_pixel;
0329 VisualID visualid;
0330 XID killid;
0331 } XStandardColormap;
0332
0333 #define ReleaseByFreeingColormap ((XID) 1L)
0334
0335
0336
0337
0338
0339 #define BitmapSuccess 0
0340 #define BitmapOpenFailed 1
0341 #define BitmapFileInvalid 2
0342 #define BitmapNoMemory 3
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353 #define XCSUCCESS 0
0354 #define XCNOMEM 1
0355 #define XCNOENT 2
0356
0357 typedef int XContext;
0358
0359 #define XUniqueContext() ((XContext) XrmUniqueQuark())
0360 #define XStringToContext(string) ((XContext) XrmStringToQuark(string))
0361
0362 _XFUNCPROTOBEGIN
0363
0364
0365
0366 extern XClassHint *XAllocClassHint (
0367 void
0368 );
0369
0370 extern XIconSize *XAllocIconSize (
0371 void
0372 );
0373
0374 extern XSizeHints *XAllocSizeHints (
0375 void
0376 );
0377
0378 extern XStandardColormap *XAllocStandardColormap (
0379 void
0380 );
0381
0382 extern XWMHints *XAllocWMHints (
0383 void
0384 );
0385
0386 extern int XClipBox(
0387 Region ,
0388 XRectangle*
0389 );
0390
0391 extern Region XCreateRegion(
0392 void
0393 );
0394
0395 extern const char *XDefaultString (void);
0396
0397 extern int XDeleteContext(
0398 Display* ,
0399 XID ,
0400 XContext
0401 );
0402
0403 extern int XDestroyRegion(
0404 Region
0405 );
0406
0407 extern Bool XEmptyRegion(
0408 Region
0409 );
0410
0411 extern Bool XEqualRegion(
0412 Region ,
0413 Region
0414 );
0415
0416 extern int XFindContext(
0417 Display* ,
0418 XID ,
0419 XContext ,
0420 XPointer*
0421 );
0422
0423 extern Status XGetClassHint(
0424 Display* ,
0425 Window ,
0426 XClassHint*
0427 );
0428
0429 extern Status XGetIconSizes(
0430 Display* ,
0431 Window ,
0432 XIconSize** ,
0433 int*
0434 );
0435
0436 extern Status XGetNormalHints(
0437 Display* ,
0438 Window ,
0439 XSizeHints*
0440 );
0441
0442 extern Status XGetRGBColormaps(
0443 Display* ,
0444 Window ,
0445 XStandardColormap** ,
0446 int* ,
0447 Atom
0448 );
0449
0450 extern Status XGetSizeHints(
0451 Display* ,
0452 Window ,
0453 XSizeHints* ,
0454 Atom
0455 );
0456
0457 extern Status XGetStandardColormap(
0458 Display* ,
0459 Window ,
0460 XStandardColormap* ,
0461 Atom
0462 );
0463
0464 extern Status XGetTextProperty(
0465 Display* ,
0466 Window ,
0467 XTextProperty* ,
0468 Atom
0469 );
0470
0471 extern XVisualInfo *XGetVisualInfo(
0472 Display* ,
0473 long ,
0474 XVisualInfo* ,
0475 int*
0476 );
0477
0478 extern Status XGetWMClientMachine(
0479 Display* ,
0480 Window ,
0481 XTextProperty*
0482 );
0483
0484 extern XWMHints *XGetWMHints(
0485 Display* ,
0486 Window
0487 );
0488
0489 extern Status XGetWMIconName(
0490 Display* ,
0491 Window ,
0492 XTextProperty*
0493 );
0494
0495 extern Status XGetWMName(
0496 Display* ,
0497 Window ,
0498 XTextProperty*
0499 );
0500
0501 extern Status XGetWMNormalHints(
0502 Display* ,
0503 Window ,
0504 XSizeHints* ,
0505 long*
0506 );
0507
0508 extern Status XGetWMSizeHints(
0509 Display* ,
0510 Window ,
0511 XSizeHints* ,
0512 long* ,
0513 Atom
0514 );
0515
0516 extern Status XGetZoomHints(
0517 Display* ,
0518 Window ,
0519 XSizeHints*
0520 );
0521
0522 extern int XIntersectRegion(
0523 Region ,
0524 Region ,
0525 Region
0526 );
0527
0528 extern void XConvertCase(
0529 KeySym ,
0530 KeySym* ,
0531 KeySym*
0532 );
0533
0534 extern int XLookupString(
0535 XKeyEvent* ,
0536 char* ,
0537 int ,
0538 KeySym* ,
0539 XComposeStatus*
0540 );
0541
0542 extern Status XMatchVisualInfo(
0543 Display* ,
0544 int ,
0545 int ,
0546 int ,
0547 XVisualInfo*
0548 );
0549
0550 extern int XOffsetRegion(
0551 Region ,
0552 int ,
0553 int
0554 );
0555
0556 extern Bool XPointInRegion(
0557 Region ,
0558 int ,
0559 int
0560 );
0561
0562 extern Region XPolygonRegion(
0563 XPoint* ,
0564 int ,
0565 int
0566 );
0567
0568 extern int XRectInRegion(
0569 Region ,
0570 int ,
0571 int ,
0572 unsigned int ,
0573 unsigned int
0574 );
0575
0576 extern int XSaveContext(
0577 Display* ,
0578 XID ,
0579 XContext ,
0580 _Xconst char*
0581 );
0582
0583 extern int XSetClassHint(
0584 Display* ,
0585 Window ,
0586 XClassHint*
0587 );
0588
0589 extern int XSetIconSizes(
0590 Display* ,
0591 Window ,
0592 XIconSize* ,
0593 int
0594 );
0595
0596 extern int XSetNormalHints(
0597 Display* ,
0598 Window ,
0599 XSizeHints*
0600 );
0601
0602 extern void XSetRGBColormaps(
0603 Display* ,
0604 Window ,
0605 XStandardColormap* ,
0606 int ,
0607 Atom
0608 );
0609
0610 extern int XSetSizeHints(
0611 Display* ,
0612 Window ,
0613 XSizeHints* ,
0614 Atom
0615 );
0616
0617 extern int XSetStandardProperties(
0618 Display* ,
0619 Window ,
0620 _Xconst char* ,
0621 _Xconst char* ,
0622 Pixmap ,
0623 char** ,
0624 int ,
0625 XSizeHints*
0626 );
0627
0628 extern void XSetTextProperty(
0629 Display* ,
0630 Window ,
0631 XTextProperty* ,
0632 Atom
0633 );
0634
0635 extern void XSetWMClientMachine(
0636 Display* ,
0637 Window ,
0638 XTextProperty*
0639 );
0640
0641 extern int XSetWMHints(
0642 Display* ,
0643 Window ,
0644 XWMHints*
0645 );
0646
0647 extern void XSetWMIconName(
0648 Display* ,
0649 Window ,
0650 XTextProperty*
0651 );
0652
0653 extern void XSetWMName(
0654 Display* ,
0655 Window ,
0656 XTextProperty*
0657 );
0658
0659 extern void XSetWMNormalHints(
0660 Display* ,
0661 Window ,
0662 XSizeHints*
0663 );
0664
0665 extern void XSetWMProperties(
0666 Display* ,
0667 Window ,
0668 XTextProperty* ,
0669 XTextProperty* ,
0670 char** ,
0671 int ,
0672 XSizeHints* ,
0673 XWMHints* ,
0674 XClassHint*
0675 );
0676
0677 extern void XmbSetWMProperties(
0678 Display* ,
0679 Window ,
0680 _Xconst char* ,
0681 _Xconst char* ,
0682 char** ,
0683 int ,
0684 XSizeHints* ,
0685 XWMHints* ,
0686 XClassHint*
0687 );
0688
0689 extern void Xutf8SetWMProperties(
0690 Display* ,
0691 Window ,
0692 _Xconst char* ,
0693 _Xconst char* ,
0694 char** ,
0695 int ,
0696 XSizeHints* ,
0697 XWMHints* ,
0698 XClassHint*
0699 );
0700
0701 extern void XSetWMSizeHints(
0702 Display* ,
0703 Window ,
0704 XSizeHints* ,
0705 Atom
0706 );
0707
0708 extern int XSetRegion(
0709 Display* ,
0710 GC ,
0711 Region
0712 );
0713
0714 extern void XSetStandardColormap(
0715 Display* ,
0716 Window ,
0717 XStandardColormap* ,
0718 Atom
0719 );
0720
0721 extern int XSetZoomHints(
0722 Display* ,
0723 Window ,
0724 XSizeHints*
0725 );
0726
0727 extern int XShrinkRegion(
0728 Region ,
0729 int ,
0730 int
0731 );
0732
0733 extern Status XStringListToTextProperty(
0734 char** ,
0735 int ,
0736 XTextProperty*
0737 );
0738
0739 extern int XSubtractRegion(
0740 Region ,
0741 Region ,
0742 Region
0743 );
0744
0745 extern int XmbTextListToTextProperty(
0746 Display* display,
0747 char** list,
0748 int count,
0749 XICCEncodingStyle style,
0750 XTextProperty* text_prop_return
0751 );
0752
0753 extern int XwcTextListToTextProperty(
0754 Display* display,
0755 wchar_t** list,
0756 int count,
0757 XICCEncodingStyle style,
0758 XTextProperty* text_prop_return
0759 );
0760
0761 extern int Xutf8TextListToTextProperty(
0762 Display* display,
0763 char** list,
0764 int count,
0765 XICCEncodingStyle style,
0766 XTextProperty* text_prop_return
0767 );
0768
0769 extern void XwcFreeStringList(
0770 wchar_t** list
0771 );
0772
0773 extern Status XTextPropertyToStringList(
0774 XTextProperty* ,
0775 char*** ,
0776 int*
0777 );
0778
0779 extern int XmbTextPropertyToTextList(
0780 Display* display,
0781 const XTextProperty* text_prop,
0782 char*** list_return,
0783 int* count_return
0784 );
0785
0786 extern int XwcTextPropertyToTextList(
0787 Display* display,
0788 const XTextProperty* text_prop,
0789 wchar_t*** list_return,
0790 int* count_return
0791 );
0792
0793 extern int Xutf8TextPropertyToTextList(
0794 Display* display,
0795 const XTextProperty* text_prop,
0796 char*** list_return,
0797 int* count_return
0798 );
0799
0800 extern int XUnionRectWithRegion(
0801 XRectangle* ,
0802 Region ,
0803 Region
0804 );
0805
0806 extern int XUnionRegion(
0807 Region ,
0808 Region ,
0809 Region
0810 );
0811
0812 extern int XWMGeometry(
0813 Display* ,
0814 int ,
0815 _Xconst char* ,
0816 _Xconst char* ,
0817 unsigned int ,
0818 XSizeHints* ,
0819 int* ,
0820 int* ,
0821 int* ,
0822 int* ,
0823 int*
0824 );
0825
0826 extern int XXorRegion(
0827 Region ,
0828 Region ,
0829 Region
0830 );
0831
0832 #ifdef __clang__
0833 #pragma clang diagnostic pop
0834 #endif
0835
0836 _XFUNCPROTOEND
0837
0838 #endif