Macros.c revision 61b2299d
11ab64890Smrg/* $Xorg: Macros.c,v 1.4 2001/02/09 02:03:34 xorgcvs Exp $ */
21ab64890Smrg/*
31ab64890Smrg
41ab64890SmrgCopyright 1987, 1998  The Open Group
51ab64890Smrg
61ab64890SmrgPermission to use, copy, modify, distribute, and sell this software and its
71ab64890Smrgdocumentation for any purpose is hereby granted without fee, provided that
81ab64890Smrgthe above copyright notice appear in all copies and that both that
91ab64890Smrgcopyright notice and this permission notice appear in supporting
101ab64890Smrgdocumentation.
111ab64890Smrg
121ab64890SmrgThe above copyright notice and this permission notice shall be included in
131ab64890Smrgall copies or substantial portions of the Software.
141ab64890Smrg
151ab64890SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161ab64890SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171ab64890SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
181ab64890SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
191ab64890SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
201ab64890SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
211ab64890Smrg
221ab64890SmrgExcept as contained in this notice, the name of The Open Group shall not be
231ab64890Smrgused in advertising or otherwise to promote the sale, use or other dealings
241ab64890Smrgin this Software without prior written authorization from The Open Group.
251ab64890Smrg
261ab64890Smrg*/
271ab64890Smrg/* $XFree86: xc/lib/X11/Macros.c,v 1.4 2001/12/14 19:54:02 dawes Exp $ */
281ab64890Smrg
291ab64890Smrg#ifdef HAVE_CONFIG_H
301ab64890Smrg#include <config.h>
311ab64890Smrg#endif
321ab64890Smrg#include "Xlibint.h"
331ab64890Smrg#define XUTIL_DEFINE_FUNCTIONS
341ab64890Smrg#include "Xutil.h"
351ab64890Smrg
361ab64890Smrg/*
371ab64890Smrg * This file makes full definitions of routines for each macro.
381ab64890Smrg * We do not expect C programs to use these, but other languages may
391ab64890Smrg * need them.
401ab64890Smrg */
411ab64890Smrg
421ab64890Smrgint XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); }
431ab64890Smrg
441ab64890SmrgWindow XRootWindow (Display *dpy, int scr)
451ab64890Smrg{
461ab64890Smrg    return (RootWindow(dpy,scr));
471ab64890Smrg}
481ab64890Smrg
491ab64890Smrgint XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); }
501ab64890Smrg
511ab64890SmrgWindow XDefaultRootWindow (Display *dpy)
521ab64890Smrg{
531ab64890Smrg    return (RootWindow(dpy,DefaultScreen(dpy)));
541ab64890Smrg}
551ab64890Smrg
561ab64890SmrgVisual *XDefaultVisual(Display *dpy, int scr)
571ab64890Smrg{
581ab64890Smrg    return (DefaultVisual(dpy, scr));
591ab64890Smrg}
601ab64890Smrg
611ab64890SmrgGC XDefaultGC(Display *dpy, int scr)
621ab64890Smrg{
6361b2299dSmrg    return (DefaultGC(dpy,scr));
641ab64890Smrg}
651ab64890Smrg
6661b2299dSmrgunsigned long XBlackPixel(Display *dpy, int scr)
671ab64890Smrg{
681ab64890Smrg    return (BlackPixel(dpy, scr));
691ab64890Smrg}
701ab64890Smrg
7161b2299dSmrgunsigned long XWhitePixel(Display *dpy, int scr)
721ab64890Smrg{
731ab64890Smrg    return (WhitePixel(dpy,scr));
741ab64890Smrg}
751ab64890Smrg
761ab64890Smrgunsigned long XAllPlanes(void) { return AllPlanes; }
771ab64890Smrg
781ab64890Smrgint XQLength(Display *dpy) { return (QLength(dpy)); }
791ab64890Smrg
801ab64890Smrgint XDisplayWidth(Display *dpy, int scr)
811ab64890Smrg{
821ab64890Smrg    return (DisplayWidth(dpy,scr));
831ab64890Smrg}
841ab64890Smrg
851ab64890Smrgint XDisplayHeight(Display *dpy, int scr)
861ab64890Smrg{
8761b2299dSmrg    return (DisplayHeight(dpy, scr));
881ab64890Smrg}
891ab64890Smrg
901ab64890Smrgint XDisplayWidthMM(Display *dpy, int scr)
911ab64890Smrg{
921ab64890Smrg    return (DisplayWidthMM(dpy, scr));
931ab64890Smrg}
941ab64890Smrg
951ab64890Smrgint XDisplayHeightMM(Display *dpy, int scr)
961ab64890Smrg{
971ab64890Smrg    return (DisplayHeightMM(dpy, scr));
981ab64890Smrg}
991ab64890Smrg
1001ab64890Smrgint XDisplayPlanes(Display *dpy, int scr)
10161b2299dSmrg{
1021ab64890Smrg    return (DisplayPlanes(dpy, scr));
1031ab64890Smrg}
1041ab64890Smrg
1051ab64890Smrgint XDisplayCells(Display *dpy, int scr)
1061ab64890Smrg{
1071ab64890Smrg    return (DisplayCells (dpy, scr));
1081ab64890Smrg}
1091ab64890Smrg
1101ab64890Smrgint XScreenCount(Display *dpy) { return (ScreenCount(dpy)); }
1111ab64890Smrg
1121ab64890Smrgchar *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); }
1131ab64890Smrg
1141ab64890Smrgint XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); }
1151ab64890Smrg
1161ab64890Smrgint XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));}
1171ab64890Smrg
1181ab64890Smrgint XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); }
1191ab64890Smrg
1201ab64890Smrgchar *XDisplayString(Display *dpy) { return (DisplayString(dpy)); }
1211ab64890Smrg
1221ab64890Smrgint XDefaultDepth(Display *dpy, int scr)
12361b2299dSmrg{
1241ab64890Smrg    return(DefaultDepth(dpy, scr));
1251ab64890Smrg}
1261ab64890Smrg
1271ab64890SmrgColormap XDefaultColormap(Display *dpy, int scr)
12861b2299dSmrg{
1291ab64890Smrg    return (DefaultColormap(dpy, scr));
1301ab64890Smrg}
1311ab64890Smrg
1321ab64890Smrgint XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); }
1331ab64890Smrg
1341ab64890Smrgint XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); }
1351ab64890Smrg
1361ab64890Smrgint XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); }
1371ab64890Smrg
1381ab64890Smrgint XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); }
1391ab64890Smrg
1401ab64890Smrgunsigned long XNextRequest(Display *dpy)
1411ab64890Smrg{
1421ab64890Smrg#ifdef WORD64
1431ab64890Smrg    WORD64ALIGN
1441ab64890Smrg    return dpy->request + 1;
1451ab64890Smrg#else
1461ab64890Smrg    return (NextRequest(dpy));
1471ab64890Smrg#endif
1481ab64890Smrg}
1491ab64890Smrg
1501ab64890Smrgunsigned long XLastKnownRequestProcessed(Display *dpy)
1511ab64890Smrg{
1521ab64890Smrg    return (LastKnownRequestProcessed(dpy));
1531ab64890Smrg}
1541ab64890Smrg
1551ab64890Smrg/* screen oriented macros (toolkit) */
1561ab64890SmrgScreen *XScreenOfDisplay(Display *dpy, int scr)
1571ab64890Smrg{
1581ab64890Smrg    return (ScreenOfDisplay(dpy, scr));
1591ab64890Smrg}
1601ab64890Smrg
1611ab64890SmrgScreen *XDefaultScreenOfDisplay(Display *dpy)
16261b2299dSmrg{
1631ab64890Smrg    return (DefaultScreenOfDisplay(dpy));
1641ab64890Smrg}
1651ab64890Smrg
1661ab64890SmrgDisplay *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); }
1671ab64890Smrg
1681ab64890SmrgWindow XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); }
1691ab64890Smrg
17061b2299dSmrgunsigned long XBlackPixelOfScreen(Screen *s)
1711ab64890Smrg{
1721ab64890Smrg    return (BlackPixelOfScreen(s));
1731ab64890Smrg}
1741ab64890Smrg
17561b2299dSmrgunsigned long XWhitePixelOfScreen(Screen *s)
1761ab64890Smrg{
1771ab64890Smrg    return (WhitePixelOfScreen(s));
1781ab64890Smrg}
1791ab64890Smrg
18061b2299dSmrgColormap XDefaultColormapOfScreen(Screen *s)
1811ab64890Smrg{
1821ab64890Smrg    return (DefaultColormapOfScreen(s));
1831ab64890Smrg}
1841ab64890Smrg
18561b2299dSmrgint XDefaultDepthOfScreen(Screen *s)
18661b2299dSmrg{
1871ab64890Smrg    return (DefaultDepthOfScreen(s));
1881ab64890Smrg}
1891ab64890Smrg
19061b2299dSmrgGC XDefaultGCOfScreen(Screen *s)
19161b2299dSmrg{
1921ab64890Smrg    return (DefaultGCOfScreen(s));
1931ab64890Smrg}
1941ab64890Smrg
19561b2299dSmrgVisual *XDefaultVisualOfScreen(Screen *s)
1961ab64890Smrg{
1971ab64890Smrg    return (DefaultVisualOfScreen(s));
1981ab64890Smrg}
1991ab64890Smrg
2001ab64890Smrgint XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); }
2011ab64890Smrg
2021ab64890Smrgint XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); }
2031ab64890Smrg
2041ab64890Smrgint XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); }
2051ab64890Smrg
2061ab64890Smrgint XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); }
2071ab64890Smrg
2081ab64890Smrgint XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); }
2091ab64890Smrg
2101ab64890Smrgint XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); }
2111ab64890Smrg
2121ab64890Smrgint XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); }
2131ab64890Smrg
2141ab64890Smrgint XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); }
2151ab64890Smrg
2161ab64890SmrgBool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); }
2171ab64890Smrg
2181ab64890Smrgint XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); }
2191ab64890Smrg
2201ab64890Smrglong XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); }
2211ab64890Smrg
2221ab64890Smrgint XScreenNumberOfScreen (register Screen *scr)
2231ab64890Smrg{
2241ab64890Smrg    register Display *dpy = scr->display;
2251ab64890Smrg    register Screen *dpyscr = dpy->screens;
2261ab64890Smrg    register int i;
2271ab64890Smrg
2281ab64890Smrg    for (i = 0; i < dpy->nscreens; i++, dpyscr++) {
2291ab64890Smrg	if (scr == dpyscr) return i;
2301ab64890Smrg    }
2311ab64890Smrg    return -1;
2321ab64890Smrg}
2331ab64890Smrg
2341ab64890Smrg/*
2351ab64890Smrg * These macros are used to give some sugar to the image routines so that
2361ab64890Smrg * naive people are more comfortable with them.
2371ab64890Smrg */
2381ab64890Smrg#undef XDestroyImage
2391ab64890Smrgint
2401ab64890SmrgXDestroyImage(
2411ab64890Smrg	XImage *ximage)
2421ab64890Smrg{
2431ab64890Smrg	return((*((ximage)->f.destroy_image))((ximage)));
2441ab64890Smrg}
2451ab64890Smrg#undef XGetPixel
2461ab64890Smrgunsigned long XGetPixel(
2471ab64890Smrg	XImage *ximage,
2481ab64890Smrg	int x, int y)
2491ab64890Smrg{
2501ab64890Smrg	return ((*((ximage)->f.get_pixel))((ximage), (x), (y)));
2511ab64890Smrg}
2521ab64890Smrg#undef XPutPixel
2531ab64890Smrgint XPutPixel(
2541ab64890Smrg	XImage *ximage,
2551ab64890Smrg	int x, int y,
2561ab64890Smrg	unsigned long pixel)
2571ab64890Smrg{
2581ab64890Smrg	return((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)));
2591ab64890Smrg}
2601ab64890Smrg#undef XSubImage
2611ab64890SmrgXImage *XSubImage(
2621ab64890Smrg	XImage *ximage,
2631ab64890Smrg	int x, int y,
2641ab64890Smrg	unsigned int width, unsigned int height)
2651ab64890Smrg{
2661ab64890Smrg	return((*((ximage)->f.sub_image))((ximage), (x),
2671ab64890Smrg		(y), (width), (height)));
2681ab64890Smrg}
2691ab64890Smrg#undef XAddPixel
2701ab64890Smrgint XAddPixel(
2711ab64890Smrg	XImage *ximage,
2721ab64890Smrg	long value)
2731ab64890Smrg{
2741ab64890Smrg	return((*((ximage)->f.add_pixel))((ximage), (value)));
2751ab64890Smrg}
2761ab64890Smrg
2771ab64890Smrg
2781ab64890Smrgint
2791ab64890SmrgXNoOp (register Display *dpy)
2801ab64890Smrg{
2811ab64890Smrg    register xReq *req;
2821ab64890Smrg
2831ab64890Smrg    LockDisplay(dpy);
2841ab64890Smrg    GetEmptyReq(NoOperation, req);
2851ab64890Smrg
2861ab64890Smrg    UnlockDisplay(dpy);
2871ab64890Smrg    SyncHandle();
2881ab64890Smrg    return 1;
2891ab64890Smrg}
290