2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* Xutil.h 1.1 - Fujitsu source for CDEnext 95/11/06 20:32:12 */
24 /* $XConsortium: _falutil.h /main/1 1996/04/08 15:20:39 cde-fuj $ */
26 /***********************************************************
28 Copyright (c) 1987 X Consortium
30 Permission is hereby granted, free of charge, to any person obtaining a copy
31 of this software and associated documentation files (the "Software"), to deal
32 in the Software without restriction, including without limitation the rights
33 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34 copies of the Software, and to permit persons to whom the Software is
35 furnished to do so, subject to the following conditions:
37 The above copyright notice and this permission notice shall be included in
38 all copies or substantial portions of the Software.
40 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
44 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
47 Except as contained in this notice, the name of the X Consortium shall not be
48 used in advertising or otherwise to promote the sale, use or other dealings
49 in this Software without prior written authorization from the X Consortium.
52 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
56 Permission to use, copy, modify, and distribute this software and its
57 documentation for any purpose and without fee is hereby granted,
58 provided that the above copyright notice appear in all copies and that
59 both that copyright notice and this permission notice appear in
60 supporting documentation, and that the name of Digital not be
61 used in advertising or publicity pertaining to distribution of the
62 software without specific, written prior permission.
64 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
65 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
66 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
67 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
68 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
69 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
72 ******************************************************************/
77 /* You must include "syncx.h" before including this file */
80 * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
81 * value (x, y, width, height) was found in the parsed string.
83 #define NoValue 0x0000
86 #define WidthValue 0x0004
87 #define HeightValue 0x0008
88 #define AllValues 0x000F
89 #define XNegative 0x0010
90 #define YNegative 0x0020
93 * new version containing base_width, base_height, and win_gravity fields;
94 * used with WM_NORMAL_HINTS.
97 long flags; /* marks which fields in this structure are defined */
98 int x, y; /* obsolete for new window mgrs, but clients */
99 int width, height; /* should set so old wm's don't mess up */
100 int min_width, min_height;
101 int max_width, max_height;
102 int width_inc, height_inc;
104 int x; /* numerator */
105 int y; /* denominator */
106 } min_aspect, max_aspect;
107 int base_width, base_height; /* added by ICCCM version 1 */
108 int win_gravity; /* added by ICCCM version 1 */
112 * The next block of definitions are for window manager properties that
113 * clients and applications use for communication.
116 /* flags argument in size hints */
117 #define USPosition (1L << 0) /* user specified x, y */
118 #define USSize (1L << 1) /* user specified width, height */
120 #define PPosition (1L << 2) /* program specified position */
121 #define PSize (1L << 3) /* program specified size */
122 #define PMinSize (1L << 4) /* program specified minimum size */
123 #define PMaxSize (1L << 5) /* program specified maximum size */
124 #define PResizeInc (1L << 6) /* program specified resize increments */
125 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
126 #define PBaseSize (1L << 8) /* program specified base for incrementing */
127 #define PWinGravity (1L << 9) /* program specified window gravity */
130 #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
135 long flags; /* marks which fields in this structure are defined */
136 Bool input; /* does this application rely on the window manager to
137 get keyboard input? */
138 int initial_state; /* see below */
139 Pixmap icon_pixmap; /* pixmap to be used as icon */
140 Window icon_window; /* window to be used as icon */
141 int icon_x, icon_y; /* initial position of icon */
142 Pixmap icon_mask; /* icon mask bitmap */
143 XID window_group; /* id of related window group */
144 /* this structure may be extended in the future */
147 /* definition for flags of XWMHints */
149 #define InputHint (1L << 0)
150 #define StateHint (1L << 1)
151 #define IconPixmapHint (1L << 2)
152 #define IconWindowHint (1L << 3)
153 #define IconPositionHint (1L << 4)
154 #define IconMaskHint (1L << 5)
155 #define WindowGroupHint (1L << 6)
156 #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
157 IconPositionHint|IconMaskHint|WindowGroupHint)
158 #define XUrgencyHint (1L << 8)
160 /* definitions for initial window state */
161 #define WithdrawnState 0 /* for windows that are not mapped */
162 #define NormalState 1 /* most applications want to start this way */
163 #define IconicState 3 /* application wants to start as an icon */
166 * Obsolete states no longer defined by ICCCM
168 #define DontCareState 0 /* don't know or care */
169 #define ZoomState 2 /* application wants to start zoomed */
170 #define InactiveState 4 /* application believes it is seldom used; */
171 /* some wm's may put it on inactive menu */
175 * new structure for manipulating TEXT properties; used with WM_NAME,
176 * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
179 unsigned char *value; /* same as Property routines */
180 Atom encoding; /* prop type */
181 int format; /* prop data format: 8, 16, or 32 */
182 unsigned long nitems; /* number of data items in value */
186 #define XLocaleNotSupported -2
187 #define XConverterNotFound -3
190 XStringStyle, /* STRING */
191 XCompoundTextStyle, /* COMPOUND_TEXT */
192 XTextStyle, /* text in owner's encoding (current locale)*/
193 XStdICCTextStyle /* STRING, else COMPOUND_TEXT */
197 int min_width, min_height;
198 int max_width, max_height;
199 int width_inc, height_inc;
208 * These macros are used to give some sugar to the image routines so that
209 * naive people are more comfortable with them.
211 #define XDestroyImage(ximage) \
212 ((*((ximage)->f.destroy_image))((ximage)))
213 #define XGetPixel(ximage, x, y) \
214 ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
215 #define XPutPixel(ximage, x, y, pixel) \
216 ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
217 #define XSubImage(ximage, x, y, width, height) \
218 ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
219 #define XAddPixel(ximage, value) \
220 ((*((ximage)->f.add_pixel))((ximage), (value)))
223 * Compose sequence status structure, used in calling XLookupString.
225 typedef struct _XComposeStatus {
226 XPointer compose_ptr; /* state table pointer */
227 int chars_matched; /* match state */
231 * Keysym macros, used on Keysyms to test for classes of symbols
233 #define IsKeypadKey(keysym) \
234 (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
236 #define IsPrivateKeypadKey(keysym) \
237 (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
239 #define IsCursorKey(keysym) \
240 (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
242 #define IsPFKey(keysym) \
243 (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
245 #define IsFunctionKey(keysym) \
246 (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
248 #define IsMiscFunctionKey(keysym) \
249 (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
251 #define IsModifierKey(keysym) \
252 ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
253 || ((KeySym)(keysym) == XK_Mode_switch) \
254 || ((KeySym)(keysym) == XK_Num_Lock))
256 * opaque reference to Region data type
258 typedef struct _XRegion *Region;
260 /* Return values from XRectInRegion() */
262 #define RectangleOut 0
263 #define RectangleIn 1
264 #define RectanglePart 2
268 * Information used by the visual utility routines to find desired visual
269 * type from the many visuals a display may support.
277 #if defined(__cplusplus) || defined(c_plusplus)
278 int c_class; /* C++ */
282 unsigned long red_mask;
283 unsigned long green_mask;
284 unsigned long blue_mask;
289 #define VisualNoMask 0x0
290 #define VisualIDMask 0x1
291 #define VisualScreenMask 0x2
292 #define VisualDepthMask 0x4
293 #define VisualClassMask 0x8
294 #define VisualRedMaskMask 0x10
295 #define VisualGreenMaskMask 0x20
296 #define VisualBlueMaskMask 0x40
297 #define VisualColormapSizeMask 0x80
298 #define VisualBitsPerRGBMask 0x100
299 #define VisualAllMask 0x1FF
302 * This defines a window manager property that clients may use to
303 * share standard color maps of type RGB_COLOR_MAP:
307 unsigned long red_max;
308 unsigned long red_mult;
309 unsigned long green_max;
310 unsigned long green_mult;
311 unsigned long blue_max;
312 unsigned long blue_mult;
313 unsigned long base_pixel;
314 VisualID visualid; /* added by ICCCM version 1 */
315 XID killid; /* added by ICCCM version 1 */
318 #define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
322 * return codes for XReadBitmapFile and XWriteBitmapFile
324 #define BitmapSuccess 0
325 #define BitmapOpenFailed 1
326 #define BitmapFileInvalid 2
327 #define BitmapNoMemory 3
329 /****************************************************************
333 ****************************************************************/
336 /* Associative lookup table return codes */
338 #define XCSUCCESS 0 /* No error. */
339 #define XCNOMEM 1 /* Out of memory */
340 #define XCNOENT 2 /* No entry in table */
342 typedef int XContext;
344 #define XUniqueContext() ((XContext) falrmUniqueQuark())
345 #define XStringToContext(string) ((XContext) falrmStringToQuark(string))
349 /* The following declarations are alphabetized. */
351 extern XClassHint *XAllocClassHint (
352 #if NeedFunctionPrototypes
357 extern XIconSize *XAllocIconSize (
358 #if NeedFunctionPrototypes
363 extern XSizeHints *XAllocSizeHints (
364 #if NeedFunctionPrototypes
369 extern XStandardColormap *XAllocStandardColormap (
370 #if NeedFunctionPrototypes
375 extern XWMHints *XAllocWMHints (
376 #if NeedFunctionPrototypes
382 #if NeedFunctionPrototypes
384 XRectangle* /* rect_return */
388 extern Region XCreateRegion(
389 #if NeedFunctionPrototypes
394 extern char *falDefaultString(
395 #if NeedFunctionPrototypes
400 extern int XDeleteContext(
401 #if NeedFunctionPrototypes
402 Display* /* display */,
404 XContext /* context */
408 extern XDestroyRegion(
409 #if NeedFunctionPrototypes
415 #if NeedFunctionPrototypes
421 #if NeedFunctionPrototypes
427 extern int XFindContext(
428 #if NeedFunctionPrototypes
429 Display* /* display */,
431 XContext /* context */,
432 XPointer* /* data_return */
436 extern Status XGetClassHint(
437 #if NeedFunctionPrototypes
438 Display* /* display */,
440 XClassHint* /* class_hints_return */
444 extern Status XGetIconSizes(
445 #if NeedFunctionPrototypes
446 Display* /* display */,
448 XIconSize** /* size_list_return */,
449 int* /* count_return */
453 extern Status XGetNormalHints(
454 #if NeedFunctionPrototypes
455 Display* /* display */,
457 XSizeHints* /* hints_return */
461 extern Status XGetRGBColormaps(
462 #if NeedFunctionPrototypes
463 Display* /* display */,
465 XStandardColormap** /* stdcmap_return */,
466 int* /* count_return */,
471 extern Status XGetSizeHints(
472 #if NeedFunctionPrototypes
473 Display* /* display */,
475 XSizeHints* /* hints_return */,
480 extern Status XGetStandardColormap(
481 #if NeedFunctionPrototypes
482 Display* /* display */,
484 XStandardColormap* /* colormap_return */,
489 extern Status XGetTextProperty(
490 #if NeedFunctionPrototypes
491 Display* /* display */,
493 XTextProperty* /* text_prop_return */,
498 extern XVisualInfo *XGetVisualInfo(
499 #if NeedFunctionPrototypes
500 Display* /* display */,
501 long /* vinfo_mask */,
502 XVisualInfo* /* vinfo_template */,
503 int* /* nitems_return */
507 extern Status XGetWMClientMachine(
508 #if NeedFunctionPrototypes
509 Display* /* display */,
511 XTextProperty* /* text_prop_return */
515 extern XWMHints *XGetWMHints(
516 #if NeedFunctionPrototypes
517 Display* /* display */,
522 extern Status XGetWMIconName(
523 #if NeedFunctionPrototypes
524 Display* /* display */,
526 XTextProperty* /* text_prop_return */
530 extern Status XGetWMName(
531 #if NeedFunctionPrototypes
532 Display* /* display */,
534 XTextProperty* /* text_prop_return */
538 extern Status XGetWMNormalHints(
539 #if NeedFunctionPrototypes
540 Display* /* display */,
542 XSizeHints* /* hints_return */,
543 long* /* supplied_return */
547 extern Status XGetWMSizeHints(
548 #if NeedFunctionPrototypes
549 Display* /* display */,
551 XSizeHints* /* hints_return */,
552 long* /* supplied_return */,
557 extern Status XGetZoomHints(
558 #if NeedFunctionPrototypes
559 Display* /* display */,
561 XSizeHints* /* zhints_return */
565 extern XIntersectRegion(
566 #if NeedFunctionPrototypes
569 Region /* dr_return */
573 extern void XConvertCase(
574 #if NeedFunctionPrototypes
581 extern int XLookupString(
582 #if NeedFunctionPrototypes
583 XKeyEvent* /* event_struct */,
584 char* /* buffer_return */,
585 int /* bytes_buffer */,
586 KeySym* /* keysym_return */,
587 XComposeStatus* /* status_in_out */
591 extern Status XMatchVisualInfo(
592 #if NeedFunctionPrototypes
593 Display* /* display */,
597 XVisualInfo* /* vinfo_return */
601 extern XOffsetRegion(
602 #if NeedFunctionPrototypes
609 extern Bool XPointInRegion(
610 #if NeedFunctionPrototypes
617 extern Region XPolygonRegion(
618 #if NeedFunctionPrototypes
619 XPoint* /* points */,
625 extern int XRectInRegion(
626 #if NeedFunctionPrototypes
630 unsigned int /* width */,
631 unsigned int /* height */
635 extern int XSaveContext(
636 #if NeedFunctionPrototypes
637 Display* /* display */,
639 XContext /* context */,
640 _Xconst char* /* data */
644 extern XSetClassHint(
645 #if NeedFunctionPrototypes
646 Display* /* display */,
648 XClassHint* /* class_hints */
652 extern XSetIconSizes(
653 #if NeedFunctionPrototypes
654 Display* /* display */,
656 XIconSize* /* size_list */,
661 extern XSetNormalHints(
662 #if NeedFunctionPrototypes
663 Display* /* display */,
665 XSizeHints* /* hints */
669 extern void XSetRGBColormaps(
670 #if NeedFunctionPrototypes
671 Display* /* display */,
673 XStandardColormap* /* stdcmaps */,
679 extern XSetSizeHints(
680 #if NeedFunctionPrototypes
681 Display* /* display */,
683 XSizeHints* /* hints */,
688 extern XSetStandardProperties(
689 #if NeedFunctionPrototypes
690 Display* /* display */,
692 _Xconst char* /* window_name */,
693 _Xconst char* /* icon_name */,
694 Pixmap /* icon_pixmap */,
697 XSizeHints* /* hints */
701 extern void XSetTextProperty(
702 #if NeedFunctionPrototypes
703 Display* /* display */,
705 XTextProperty* /* text_prop */,
710 extern void XSetWMClientMachine(
711 #if NeedFunctionPrototypes
712 Display* /* display */,
714 XTextProperty* /* text_prop */
719 #if NeedFunctionPrototypes
720 Display* /* display */,
722 XWMHints* /* wm_hints */
726 extern void XSetWMIconName(
727 #if NeedFunctionPrototypes
728 Display* /* display */,
730 XTextProperty* /* text_prop */
734 extern void XSetWMName(
735 #if NeedFunctionPrototypes
736 Display* /* display */,
738 XTextProperty* /* text_prop */
742 extern void XSetWMNormalHints(
743 #if NeedFunctionPrototypes
744 Display* /* display */,
746 XSizeHints* /* hints */
750 extern void XSetWMProperties(
751 #if NeedFunctionPrototypes
752 Display* /* display */,
754 XTextProperty* /* window_name */,
755 XTextProperty* /* icon_name */,
758 XSizeHints* /* normal_hints */,
759 XWMHints* /* wm_hints */,
760 XClassHint* /* class_hints */
764 extern void XmbSetWMProperties(
765 #if NeedFunctionPrototypes
766 Display* /* display */,
768 _Xconst char* /* window_name */,
769 _Xconst char* /* icon_name */,
772 XSizeHints* /* normal_hints */,
773 XWMHints* /* wm_hints */,
774 XClassHint* /* class_hints */
778 extern void XSetWMSizeHints(
779 #if NeedFunctionPrototypes
780 Display* /* display */,
782 XSizeHints* /* hints */,
788 #if NeedFunctionPrototypes
789 Display* /* display */,
795 extern void XSetStandardColormap(
796 #if NeedFunctionPrototypes
797 Display* /* display */,
799 XStandardColormap* /* colormap */,
804 extern XSetZoomHints(
805 #if NeedFunctionPrototypes
806 Display* /* display */,
808 XSizeHints* /* zhints */
812 extern XShrinkRegion(
813 #if NeedFunctionPrototypes
820 extern Status XStringListToTextProperty(
821 #if NeedFunctionPrototypes
824 XTextProperty* /* text_prop_return */
828 extern XSubtractRegion(
829 #if NeedFunctionPrototypes
832 Region /* dr_return */
836 extern int falmbTextListToTextProperty(
837 #if NeedFunctionPrototypes
838 Display* /* display */,
841 XICCEncodingStyle /* style */,
842 XTextProperty* /* text_prop_return */
846 extern int falwcTextListToTextProperty(
847 #if NeedFunctionPrototypes
848 Display* /* display */,
849 wchar_t** /* list */,
851 XICCEncodingStyle /* style */,
852 XTextProperty* /* text_prop_return */
856 extern void falwcFreeStringList(
857 #if NeedFunctionPrototypes
862 extern Status XTextPropertyToStringList(
863 #if NeedFunctionPrototypes
864 XTextProperty* /* text_prop */,
865 char*** /* list_return */,
866 int* /* count_return */
870 extern int falmbTextPropertyToTextList(
871 #if NeedFunctionPrototypes
872 Display* /* display */,
873 XTextProperty* /* text_prop */,
874 char*** /* list_return */,
875 int* /* count_return */
879 extern int falwcTextPropertyToTextList(
880 #if NeedFunctionPrototypes
881 Display* /* display */,
882 XTextProperty* /* text_prop */,
883 wchar_t*** /* list_return */,
884 int* /* count_return */
888 extern XUnionRectWithRegion(
889 #if NeedFunctionPrototypes
890 XRectangle* /* rectangle */,
891 Region /* src_region */,
892 Region /* dest_region_return */
897 #if NeedFunctionPrototypes
900 Region /* dr_return */
904 extern int XWMGeometry(
905 #if NeedFunctionPrototypes
906 Display* /* display */,
907 int /* screen_number */,
908 _Xconst char* /* user_geometry */,
909 _Xconst char* /* default_geometry */,
910 unsigned int /* border_width */,
911 XSizeHints* /* hints */,
914 int* /* width_return */,
915 int* /* height_return */,
916 int* /* gravity_return */
921 #if NeedFunctionPrototypes
924 Region /* dr_return */
930 #endif /* _XUTIL_H_ */