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