diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2016-07-29 00:44:38 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-08-24 23:05:45 +0200 |
commit | acfe0013c9d1ef1344c7813d4dae51ba6f2da622 (patch) | |
tree | ba17af85081b346a6b0e753fd9ac1e590a4ca494 /nx-X11/lib | |
parent | 35145c251305a562c4273d712fab5b4b387913ab (diff) | |
download | nx-libs-acfe0013c9d1ef1344c7813d4dae51ba6f2da622.tar.gz nx-libs-acfe0013c9d1ef1344c7813d4dae51ba6f2da622.tar.bz2 nx-libs-acfe0013c9d1ef1344c7813d4dae51ba6f2da622.zip |
update src files *[ch] to libX11 1.3.4
Diffstat (limited to 'nx-X11/lib')
242 files changed, 2681 insertions, 2582 deletions
diff --git a/nx-X11/lib/X11/AllCells.c b/nx-X11/lib/X11/AllCells.c index 902324837..0c188aab4 100644 --- a/nx-X11/lib/X11/AllCells.c +++ b/nx-X11/lib/X11/AllCells.c @@ -24,19 +24,21 @@ in this Software without prior written authorization from The Open Group. */ +#define NEED_REPLIES + #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "Xlibint.h" -Status XAllocColorCells(dpy, cmap, contig, masks, nplanes, pixels, ncolors) -register Display *dpy; -Colormap cmap; -Bool contig; -unsigned int ncolors; /* CARD16 */ -unsigned int nplanes; /* CARD16 */ -unsigned long *masks; /* LISTofCARD32 */ /* RETURN */ -unsigned long *pixels; /* LISTofCARD32 */ /* RETURN */ +Status XAllocColorCells( + register Display *dpy, + Colormap cmap, + Bool contig, + unsigned long *masks, /* LISTofCARD32 */ /* RETURN */ + unsigned int nplanes, /* CARD16 */ + unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ + unsigned int ncolors) /* CARD16 */ { Status status; diff --git a/nx-X11/lib/X11/AllPlanes.c b/nx-X11/lib/X11/AllPlanes.c index 6e405f59d..b2e245387 100644 --- a/nx-X11/lib/X11/AllPlanes.c +++ b/nx-X11/lib/X11/AllPlanes.c @@ -29,15 +29,18 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XAllocColorPlanes(dpy, cmap, contig, pixels, ncolors, nreds, ngreens, - nblues, rmask, gmask, bmask) -register Display *dpy; -Colormap cmap; -Bool contig; -unsigned long *pixels; /* LISTofCARD32 */ /* RETURN */ -int ncolors; -int nreds, ngreens, nblues; -unsigned long *rmask, *gmask, *bmask; /* CARD32 */ /* RETURN */ +Status XAllocColorPlanes( + register Display *dpy, + Colormap cmap, + Bool contig, + unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ + int ncolors, + int nreds, + int ngreens, + int nblues, + unsigned long *rmask, + unsigned long *gmask, + unsigned long *bmask) /* CARD32 */ /* RETURN */ { xAllocColorPlanesReply rep; Status status; @@ -68,4 +71,4 @@ unsigned long *rmask, *gmask, *bmask; /* CARD32 */ /* RETURN */ UnlockDisplay(dpy); SyncHandle(); return(status); -} +} diff --git a/nx-X11/lib/X11/AllowEv.c b/nx-X11/lib/X11/AllowEv.c index d1edddd01..4a17e7b2d 100644 --- a/nx-X11/lib/X11/AllowEv.c +++ b/nx-X11/lib/X11/AllowEv.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XAllowEvents(dpy, mode, time) - register Display *dpy; - int mode; - Time time; +XAllowEvents( + register Display *dpy, + int mode, + Time time) { register xAllowEventsReq *req; diff --git a/nx-X11/lib/X11/AutoRep.c b/nx-X11/lib/X11/AutoRep.c index 857515413..66b4097a8 100644 --- a/nx-X11/lib/X11/AutoRep.c +++ b/nx-X11/lib/X11/AutoRep.c @@ -30,8 +30,7 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XAutoRepeatOn (dpy) -register Display *dpy; +XAutoRepeatOn (register Display *dpy) { XKeyboardControl values; values.auto_repeat_mode = AutoRepeatModeOn; @@ -40,8 +39,7 @@ register Display *dpy; } int -XAutoRepeatOff (dpy) -register Display *dpy; +XAutoRepeatOff (register Display *dpy) { XKeyboardControl values; values.auto_repeat_mode = AutoRepeatModeOff; diff --git a/nx-X11/lib/X11/Backgnd.c b/nx-X11/lib/X11/Backgnd.c index ee084286b..bf7d75f8f 100644 --- a/nx-X11/lib/X11/Backgnd.c +++ b/nx-X11/lib/X11/Backgnd.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetWindowBackground(dpy, w, pixel) - register Display *dpy; - Window w; - unsigned long pixel; +XSetWindowBackground( + register Display *dpy, + Window w, + unsigned long pixel) { register xChangeWindowAttributesReq *req; diff --git a/nx-X11/lib/X11/BdrWidth.c b/nx-X11/lib/X11/BdrWidth.c index 66b650458..5da8ce772 100644 --- a/nx-X11/lib/X11/BdrWidth.c +++ b/nx-X11/lib/X11/BdrWidth.c @@ -33,10 +33,10 @@ from The Open Group. #include "Xlibint.h" int -XSetWindowBorderWidth(dpy, w, width) -Display *dpy; -Window w; -unsigned int width; +XSetWindowBorderWidth( + Display *dpy, + Window w, + unsigned int width) { unsigned long lwidth = width; /* must be CARD32 */ diff --git a/nx-X11/lib/X11/Bell.c b/nx-X11/lib/X11/Bell.c index b791f5739..7da8772cf 100644 --- a/nx-X11/lib/X11/Bell.c +++ b/nx-X11/lib/X11/Bell.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XBell(dpy, percent) - register Display *dpy; - int percent; +XBell( + register Display *dpy, + int percent) { register xBellReq *req; diff --git a/nx-X11/lib/X11/Border.c b/nx-X11/lib/X11/Border.c index d41f78546..133043a5b 100644 --- a/nx-X11/lib/X11/Border.c +++ b/nx-X11/lib/X11/Border.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetWindowBorder(dpy, w, pixel) - register Display *dpy; - Window w; - unsigned long pixel; +XSetWindowBorder( + register Display *dpy, + Window w, + unsigned long pixel) { register xChangeWindowAttributesReq *req; diff --git a/nx-X11/lib/X11/ChAccCon.c b/nx-X11/lib/X11/ChAccCon.c index f68714892..f8d099668 100644 --- a/nx-X11/lib/X11/ChAccCon.c +++ b/nx-X11/lib/X11/ChAccCon.c @@ -30,25 +30,21 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XEnableAccessControl(dpy) - register Display *dpy; - +XEnableAccessControl(register Display *dpy) { return XSetAccessControl(dpy, EnableAccess); } int -XDisableAccessControl(dpy) - register Display *dpy; - +XDisableAccessControl(register Display *dpy) { return XSetAccessControl(dpy, DisableAccess); } int -XSetAccessControl(dpy, mode) - register Display *dpy; - int mode; +XSetAccessControl( + register Display *dpy, + int mode) { register xSetAccessControlReq *req; diff --git a/nx-X11/lib/X11/ChActPGb.c b/nx-X11/lib/X11/ChActPGb.c index 82d404310..bebef2b01 100644 --- a/nx-X11/lib/X11/ChActPGb.c +++ b/nx-X11/lib/X11/ChActPGb.c @@ -30,11 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XChangeActivePointerGrab(dpy, event_mask, curs, time) -register Display *dpy; -unsigned int event_mask; /* CARD16 */ -Cursor curs; -Time time; +XChangeActivePointerGrab( + register Display *dpy, + unsigned int event_mask, /* CARD16 */ + Cursor curs, + Time time) { register xChangeActivePointerGrabReq *req; diff --git a/nx-X11/lib/X11/ChClMode.c b/nx-X11/lib/X11/ChClMode.c index 29726e337..5250a80bc 100644 --- a/nx-X11/lib/X11/ChClMode.c +++ b/nx-X11/lib/X11/ChClMode.c @@ -30,10 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetCloseDownMode(dpy, mode) - register Display *dpy; - int mode; - +XSetCloseDownMode( + register Display *dpy, + int mode) { register xSetCloseDownModeReq *req; diff --git a/nx-X11/lib/X11/ChCmap.c b/nx-X11/lib/X11/ChCmap.c index 25e869c8c..d9372cdf3 100644 --- a/nx-X11/lib/X11/ChCmap.c +++ b/nx-X11/lib/X11/ChCmap.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetWindowColormap(dpy, w, colormap) - register Display *dpy; - Window w; - Colormap colormap; +XSetWindowColormap( + register Display *dpy, + Window w, + Colormap colormap) { register xChangeWindowAttributesReq *req; diff --git a/nx-X11/lib/X11/ChGC.c b/nx-X11/lib/X11/ChGC.c index 74ba7233f..8f677dc3a 100644 --- a/nx-X11/lib/X11/ChGC.c +++ b/nx-X11/lib/X11/ChGC.c @@ -31,11 +31,11 @@ in this Software without prior written authorization from The Open Group. #include "Cr.h" int -XChangeGC (dpy, gc, valuemask, values) - register Display *dpy; - GC gc; - unsigned long valuemask; - XGCValues *values; +XChangeGC ( + register Display *dpy, + GC gc, + unsigned long valuemask, + XGCValues *values) { LockDisplay(dpy); diff --git a/nx-X11/lib/X11/ChKeyCon.c b/nx-X11/lib/X11/ChKeyCon.c index cc38b05dc..bcf522340 100644 --- a/nx-X11/lib/X11/ChKeyCon.c +++ b/nx-X11/lib/X11/ChKeyCon.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XChangeKeyboardControl(dpy, mask, value_list) - register Display *dpy; - unsigned long mask; - XKeyboardControl *value_list; +XChangeKeyboardControl( + register Display *dpy, + unsigned long mask, + XKeyboardControl *value_list) { unsigned long values[8]; register unsigned long *value = values; @@ -46,7 +46,7 @@ XChangeKeyboardControl(dpy, mask, value_list) if (mask & KBKeyClickPercent) *value++ = value_list->key_click_percent; - + if (mask & KBBellPercent) *value++ = value_list->bell_percent; diff --git a/nx-X11/lib/X11/ChPntCon.c b/nx-X11/lib/X11/ChPntCon.c index 1dba32504..c177c0045 100644 --- a/nx-X11/lib/X11/ChPntCon.c +++ b/nx-X11/lib/X11/ChPntCon.c @@ -30,11 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XChangePointerControl(dpy, do_acc, do_thresh, acc_numerator, - acc_denominator, threshold) - register Display *dpy; - Bool do_acc, do_thresh; - int acc_numerator, acc_denominator, threshold; +XChangePointerControl( + register Display *dpy, + Bool do_acc, + Bool do_thresh, + int acc_numerator, + int acc_denominator, + int threshold) { register xChangePointerControlReq *req; diff --git a/nx-X11/lib/X11/ChSaveSet.c b/nx-X11/lib/X11/ChSaveSet.c index 6fd341b48..068b042d2 100644 --- a/nx-X11/lib/X11/ChSaveSet.c +++ b/nx-X11/lib/X11/ChSaveSet.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XChangeSaveSet(dpy, win, mode) -register Display *dpy; -Window win; -int mode; +XChangeSaveSet( + register Display *dpy, + Window win, + int mode) { register xChangeSaveSetReq *req; @@ -47,17 +47,17 @@ int mode; } int -XAddToSaveSet(dpy, win) - register Display *dpy; - Window win; +XAddToSaveSet( + register Display *dpy, + Window win) { return XChangeSaveSet(dpy,win,SetModeInsert); } int -XRemoveFromSaveSet (dpy, win) - register Display *dpy; - Window win; +XRemoveFromSaveSet ( + register Display *dpy, + Window win) { return XChangeSaveSet(dpy,win,SetModeDelete); } diff --git a/nx-X11/lib/X11/ChWAttrs.c b/nx-X11/lib/X11/ChWAttrs.c index b766e648c..25cbcbd05 100644 --- a/nx-X11/lib/X11/ChWAttrs.c +++ b/nx-X11/lib/X11/ChWAttrs.c @@ -36,11 +36,11 @@ in this Software without prior written authorization from The Open Group. CWDontPropagate|CWColormap|CWCursor) int -XChangeWindowAttributes (dpy, w, valuemask, attributes) - register Display *dpy; - Window w; - unsigned long valuemask; - XSetWindowAttributes *attributes; +XChangeWindowAttributes ( + register Display *dpy, + Window w, + unsigned long valuemask, + XSetWindowAttributes *attributes) { register xChangeWindowAttributesReq *req; diff --git a/nx-X11/lib/X11/ChWindow.c b/nx-X11/lib/X11/ChWindow.c index 2c395678d..89a81e12a 100644 --- a/nx-X11/lib/X11/ChWindow.c +++ b/nx-X11/lib/X11/ChWindow.c @@ -30,10 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XResizeWindow(dpy, w, width, height) -register Display *dpy; -Window w; -unsigned int width, height; +XResizeWindow( + register Display *dpy, + Window w, + unsigned int width, + unsigned int height) { register xConfigureWindowReq *req; diff --git a/nx-X11/lib/X11/ChkMaskEv.c b/nx-X11/lib/X11/ChkMaskEv.c index d1d48cc4f..78928e079 100644 --- a/nx-X11/lib/X11/ChkMaskEv.c +++ b/nx-X11/lib/X11/ChkMaskEv.c @@ -35,28 +35,32 @@ extern long const _Xevent_to_mask[]; #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) -/* +/* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ -Bool XCheckMaskEvent (dpy, mask, event) - register Display *dpy; - long mask; /* Selected event mask. */ - register XEvent *event; /* XEvent to be filled in. */ +Bool XCheckMaskEvent ( + register Display *dpy, + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { - if ((qelt->event.type < LASTEvent) && + if ((qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || diff --git a/nx-X11/lib/X11/ChkTypEv.c b/nx-X11/lib/X11/ChkTypEv.c index 558099c1b..8ca1c8048 100644 --- a/nx-X11/lib/X11/ChkTypEv.c +++ b/nx-X11/lib/X11/ChkTypEv.c @@ -29,22 +29,26 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -/* +/* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ -Bool XCheckTypedEvent (dpy, type, event) - register Display *dpy; - int type; /* Selected event type. */ - register XEvent *event; /* XEvent to be filled in. */ +Bool XCheckTypedEvent ( + register Display *dpy, + int type, /* Selected event type. */ + register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; diff --git a/nx-X11/lib/X11/ChkTypWEv.c b/nx-X11/lib/X11/ChkTypWEv.c index cbf8355fe..92b3f5d94 100644 --- a/nx-X11/lib/X11/ChkTypWEv.c +++ b/nx-X11/lib/X11/ChkTypWEv.c @@ -29,23 +29,27 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -/* +/* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ -Bool XCheckTypedWindowEvent (dpy, w, type, event) - register Display *dpy; - Window w; /* Selected window. */ - int type; /* Selected event type. */ - register XEvent *event; /* XEvent to be filled in. */ +Bool XCheckTypedWindowEvent ( + register Display *dpy, + Window w, /* Selected window. */ + int type, /* Selected event type. */ + register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; diff --git a/nx-X11/lib/X11/ChkWinEv.c b/nx-X11/lib/X11/ChkWinEv.c index 381c30cdc..9fb7db06a 100644 --- a/nx-X11/lib/X11/ChkWinEv.c +++ b/nx-X11/lib/X11/ChkWinEv.c @@ -34,30 +34,34 @@ extern long const _Xevent_to_mask[]; #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) -/* +/* * Check existing events in queue to find if any match. If so, return. * If not, flush buffer and see if any more events are readable. If one * matches, return. If all else fails, tell the user no events found. */ -Bool XCheckWindowEvent (dpy, w, mask, event) - register Display *dpy; - Window w; /* Selected window. */ - long mask; /* Selected event mask. */ - register XEvent *event; /* XEvent to be filled in. */ +Bool XCheckWindowEvent ( + register Display *dpy, + Window w, /* Selected window. */ + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; int n; /* time through count */ LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + prev = NULL; for (n = 3; --n >= 0;) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { if ((qelt->event.xany.window == w) && - (qelt->event.type < LASTEvent) && + (qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || diff --git a/nx-X11/lib/X11/CirWin.c b/nx-X11/lib/X11/CirWin.c index d6702f671..e37a42ade 100644 --- a/nx-X11/lib/X11/CirWin.c +++ b/nx-X11/lib/X11/CirWin.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XCirculateSubwindows(dpy, w, direction) - register Display *dpy; - Window w; - int direction; +XCirculateSubwindows( + register Display *dpy, + Window w, + int direction) { register xCirculateWindowReq *req; diff --git a/nx-X11/lib/X11/CirWinDn.c b/nx-X11/lib/X11/CirWinDn.c index 31b9e68c0..f2b54852b 100644 --- a/nx-X11/lib/X11/CirWinDn.c +++ b/nx-X11/lib/X11/CirWinDn.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XCirculateSubwindowsDown(dpy,w) - register Display *dpy; - Window w; +XCirculateSubwindowsDown( + register Display *dpy, + Window w) { register xCirculateWindowReq *req; diff --git a/nx-X11/lib/X11/CirWinUp.c b/nx-X11/lib/X11/CirWinUp.c index 00ad09403..be9f094cd 100644 --- a/nx-X11/lib/X11/CirWinUp.c +++ b/nx-X11/lib/X11/CirWinUp.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XCirculateSubwindowsUp(dpy, w) - register Display *dpy; - Window w; +XCirculateSubwindowsUp( + register Display *dpy, + Window w) { register xCirculateWindowReq *req; diff --git a/nx-X11/lib/X11/ClDisplay.c b/nx-X11/lib/X11/ClDisplay.c index 48625d673..898fc9144 100644 --- a/nx-X11/lib/X11/ClDisplay.c +++ b/nx-X11/lib/X11/ClDisplay.c @@ -30,12 +30,16 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include <config.h> #endif +#if USE_XCB +#include "Xxcbint.h" +#else /* !USE_XCB */ #include <nx-X11/Xtrans/Xtrans.h> +#endif /* USE_XCB */ #include "Xlib.h" #include "Xlibint.h" #include "Xintconn.h" -/* +/* * XCloseDisplay - XSync the connection to the X Server, close the connection, * and free all associated storage. Extension close procs should only free * memory and must be careful about the types of requests they generate. @@ -68,7 +72,11 @@ XCloseDisplay ( if (dpy->request != dpy->last_request_read) XSync(dpy, 1); } +#if USE_XCB + xcb_disconnect(dpy->xcb->connection); +#else /* !USE_XCB */ _XDisconnectDisplay(dpy->trans_conn); +#endif /* USE_XCB */ _XFreeDisplayStructure (dpy); return 0; } diff --git a/nx-X11/lib/X11/Clear.c b/nx-X11/lib/X11/Clear.c index 170765c0f..63dc64045 100644 --- a/nx-X11/lib/X11/Clear.c +++ b/nx-X11/lib/X11/Clear.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XClearWindow(dpy, w) - register Display *dpy; - Window w; +XClearWindow( + register Display *dpy, + Window w) { register xClearAreaReq *req; diff --git a/nx-X11/lib/X11/ClearArea.c b/nx-X11/lib/X11/ClearArea.c index 354c992c8..41fd17c80 100644 --- a/nx-X11/lib/X11/ClearArea.c +++ b/nx-X11/lib/X11/ClearArea.c @@ -30,12 +30,14 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XClearArea (dpy, w, x, y, width, height, exposures) - register Display *dpy; - Window w; - int x, y; - unsigned int width, height; - Bool exposures; +XClearArea ( + register Display *dpy, + Window w, + int x, + int y, + unsigned int width, + unsigned int height, + Bool exposures) { register xClearAreaReq *req; diff --git a/nx-X11/lib/X11/Cmap.h b/nx-X11/lib/X11/Cmap.h index b4312be78..062b5383b 100644 --- a/nx-X11/lib/X11/Cmap.h +++ b/nx-X11/lib/X11/Cmap.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifndef _CMAP_H_ #define _CMAP_H_ diff --git a/nx-X11/lib/X11/ConfWind.c b/nx-X11/lib/X11/ConfWind.c index 2a7363041..eefce4dd5 100644 --- a/nx-X11/lib/X11/ConfWind.c +++ b/nx-X11/lib/X11/ConfWind.c @@ -30,11 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XMoveResizeWindow(dpy, w, x, y, width, height) -register Display *dpy; -Window w; -int x, y; -unsigned int width, height; +XMoveResizeWindow( + register Display *dpy, + Window w, + int x, + int y, + unsigned int width, + unsigned int height) { register xConfigureWindowReq *req; diff --git a/nx-X11/lib/X11/Context.c b/nx-X11/lib/X11/Context.c index 9c9de653f..79ae7d66c 100644 --- a/nx-X11/lib/X11/Context.c +++ b/nx-X11/lib/X11/Context.c @@ -4,13 +4,13 @@ Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -154,7 +154,7 @@ static void _XFreeContextDB(Display *display) /* Save the given value of data to correspond with the keys XID and context. Returns nonzero error code if an error has occured, 0 otherwise. Possible errors are Out-of-memory. -*/ +*/ int XSaveContext( Display *display, @@ -228,16 +228,12 @@ int XSaveContext( -/* Given an XID and context, returns the associated data. Note that data +/* Given an XID and context, returns the associated data. Note that data here is a pointer since it is a return value. Returns nonzero error code if an error has occured, 0 otherwise. Possible errors are Entry-not-found. */ -int XFindContext(display, rid, context, data) - Display *display; - register XID rid; - register XContext context; - XPointer *data; /* RETURN */ +int XFindContext(Display *display, XID rid, XContext context, XPointer *data) { register DB db; register TableEntry entry; @@ -272,10 +268,7 @@ int XFindContext(display, rid, context, data) with the same arguments. */ -int XDeleteContext(display, rid, context) - Display *display; - register XID rid; - register XContext context; +int XDeleteContext(Display *display, XID rid, XContext context) { register DB db; register TableEntry entry, *prev; diff --git a/nx-X11/lib/X11/ConvSel.c b/nx-X11/lib/X11/ConvSel.c index 3a3ca3865..fb6e8e338 100644 --- a/nx-X11/lib/X11/ConvSel.c +++ b/nx-X11/lib/X11/ConvSel.c @@ -30,12 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XConvertSelection(dpy, selection, target, property, requestor, time) -register Display *dpy; -Atom selection, target; -Atom property; -Window requestor; -Time time; +XConvertSelection( + register Display *dpy, + Atom selection, + Atom target, + Atom property, + Window requestor, + Time time) { register xConvertSelectionReq *req; diff --git a/nx-X11/lib/X11/CopyArea.c b/nx-X11/lib/X11/CopyArea.c index ec4ee1fed..582582120 100644 --- a/nx-X11/lib/X11/CopyArea.c +++ b/nx-X11/lib/X11/CopyArea.c @@ -30,15 +30,17 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XCopyArea(dpy, src_drawable, dst_drawable, gc, - src_x, src_y, width, height, - dst_x, dst_y) - register Display *dpy; - Drawable src_drawable, dst_drawable; - GC gc; - int src_x, src_y; - unsigned int width, height; - int dst_x, dst_y; +XCopyArea( + register Display *dpy, + Drawable src_drawable, + Drawable dst_drawable, + GC gc, + int src_x, + int src_y, + unsigned int width, + unsigned int height, + int dst_x, + int dst_y) { register xCopyAreaReq *req; diff --git a/nx-X11/lib/X11/CopyCmap.c b/nx-X11/lib/X11/CopyCmap.c index b33c57f5a..5444550cd 100644 --- a/nx-X11/lib/X11/CopyCmap.c +++ b/nx-X11/lib/X11/CopyCmap.c @@ -40,9 +40,9 @@ extern XcmsCmapRec * _XcmsCopyCmapRecAndFree(Display *dpy, Colormap copy_cmap); #endif -Colormap XCopyColormapAndFree(dpy, src_cmap) -register Display *dpy; -Colormap src_cmap; +Colormap XCopyColormapAndFree( + register Display *dpy, + Colormap src_cmap) { Colormap mid; register xCopyColormapAndFreeReq *req; @@ -59,6 +59,6 @@ Colormap src_cmap; #if XCMS _XcmsCopyCmapRecAndFree(dpy, src_cmap, mid); #endif - + return(mid); } diff --git a/nx-X11/lib/X11/CopyGC.c b/nx-X11/lib/X11/CopyGC.c index ab6683261..9c71249cf 100644 --- a/nx-X11/lib/X11/CopyGC.c +++ b/nx-X11/lib/X11/CopyGC.c @@ -30,10 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XCopyGC (dpy, srcGC, mask, destGC) - register Display *dpy; - unsigned long mask; /* which ones to set initially */ - GC srcGC, destGC; +XCopyGC ( + register Display *dpy, + GC srcGC, + unsigned long mask, /* which ones to set initially */ + GC destGC) { register XGCValues *destgv = &destGC->values, *srcgv = &srcGC->values; @@ -43,7 +44,7 @@ XCopyGC (dpy, srcGC, mask, destGC) LockDisplay(dpy); mask &= (1L << (GCLastBit + 1)) - 1; - /* if some of the source values to be copied are "dirty", flush them + /* if some of the source values to be copied are "dirty", flush them out before sending the CopyGC request. */ if (srcGC->dirty & mask) _XFlushGCCache(dpy, srcGC); @@ -58,7 +59,7 @@ XCopyGC (dpy, srcGC, mask, destGC) if (mask & GCFunction) destgv->function = srcgv->function; - + if (mask & GCPlaneMask) destgv->plane_mask = srcgv->plane_mask; @@ -76,14 +77,14 @@ XCopyGC (dpy, srcGC, mask, destGC) if (mask & GCCapStyle) destgv->cap_style = srcgv->cap_style; - + if (mask & GCJoinStyle) destgv->join_style = srcgv->join_style; if (mask & GCFillStyle) destgv->fill_style = srcgv->fill_style; - if (mask & GCFillRule) + if (mask & GCFillRule) destgv->fill_rule = srcgv->fill_rule; if (mask & GCArcMode) @@ -101,19 +102,19 @@ XCopyGC (dpy, srcGC, mask, destGC) if (mask & GCTileStipYOrigin) destgv->ts_y_origin = srcgv->ts_y_origin; - if (mask & GCFont) + if (mask & GCFont) destgv->font = srcgv->font; - if (mask & GCSubwindowMode) + if (mask & GCSubwindowMode) destgv->subwindow_mode = srcgv->subwindow_mode; - if (mask & GCGraphicsExposures) + if (mask & GCGraphicsExposures) destgv->graphics_exposures = srcgv->graphics_exposures; - if (mask & GCClipXOrigin) + if (mask & GCClipXOrigin) destgv->clip_x_origin = srcgv->clip_x_origin; - if (mask & GCClipYOrigin) + if (mask & GCClipYOrigin) destgv->clip_y_origin = srcgv->clip_y_origin; if (mask & GCClipMask) { @@ -121,7 +122,7 @@ XCopyGC (dpy, srcGC, mask, destGC) destgv->clip_mask = srcgv->clip_mask; } - if (mask & GCDashOffset) + if (mask & GCDashOffset) destgv->dash_offset = srcgv->dash_offset; if (mask & GCDashList) { diff --git a/nx-X11/lib/X11/CopyPlane.c b/nx-X11/lib/X11/CopyPlane.c index 12b4ef2ac..818687687 100644 --- a/nx-X11/lib/X11/CopyPlane.c +++ b/nx-X11/lib/X11/CopyPlane.c @@ -30,18 +30,20 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XCopyPlane(dpy, src_drawable, dst_drawable, gc, - src_x, src_y, width, height, - dst_x, dst_y, bit_plane) - register Display *dpy; - Drawable src_drawable, dst_drawable; - GC gc; - int src_x, src_y; - unsigned int width, height; - int dst_x, dst_y; - unsigned long bit_plane; +XCopyPlane( + register Display *dpy, + Drawable src_drawable, + Drawable dst_drawable, + GC gc, + int src_x, + int src_y, + unsigned int width, + unsigned int height, + int dst_x, + int dst_y, + unsigned long bit_plane) -{ +{ register xCopyPlaneReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/Cr.h b/nx-X11/lib/X11/Cr.h index 101817175..800c9ab1c 100644 --- a/nx-X11/lib/X11/Cr.h +++ b/nx-X11/lib/X11/Cr.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifndef _CR_H_ #define _CR_H_ diff --git a/nx-X11/lib/X11/CrBFData.c b/nx-X11/lib/X11/CrBFData.c index c9f2149e5..449095690 100644 --- a/nx-X11/lib/X11/CrBFData.c +++ b/nx-X11/lib/X11/CrBFData.c @@ -23,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -31,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlib.h" /* - * XCreateBitmapFromData: Routine to make a pixmap of depth 1 from user + * XCreateBitmapFromData: Routine to make a pixmap of depth 1 from user * supplied data. * D is any drawable on the same screen that the pixmap will be used in. - * Data is a pointer to the bit data, and + * Data is a pointer to the bit data, and * width & height give the size in bits of the pixmap. * * The following format is assumed for data: @@ -46,7 +45,7 @@ in this Software without prior written authorization from The Open Group. * bitmap_unit=8 * xoffset=0 * no extra bytes per line - */ + */ Pixmap XCreateBitmapFromData( Display *display, Drawable d, diff --git a/nx-X11/lib/X11/CrCmap.c b/nx-X11/lib/X11/CrCmap.c index 30e1a89c9..9904c7dda 100644 --- a/nx-X11/lib/X11/CrCmap.c +++ b/nx-X11/lib/X11/CrCmap.c @@ -31,11 +31,11 @@ in this Software without prior written authorization from The Open Group. #include "Xcmsint.h" -Colormap XCreateColormap(dpy, w, visual, alloc) -register Display *dpy; -Window w; -Visual *visual; -int alloc; +Colormap XCreateColormap( + register Display *dpy, + Window w, + Visual *visual, + int alloc) { register xCreateColormapReq *req; Colormap mid; @@ -51,7 +51,9 @@ int alloc; UnlockDisplay(dpy); SyncHandle(); +#ifdef XCMS _XcmsAddCmapRec(dpy, mid, w, visual); +#endif return(mid); } diff --git a/nx-X11/lib/X11/CrCursor.c b/nx-X11/lib/X11/CrCursor.c index 18dfea654..c8c174e5f 100644 --- a/nx-X11/lib/X11/CrCursor.c +++ b/nx-X11/lib/X11/CrCursor.c @@ -23,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -40,19 +39,22 @@ _XTryShapeBitmapCursor (Display *dpy, unsigned int x, unsigned int y); #endif - -Cursor XCreatePixmapCursor(dpy, source, mask, foreground, background, x, y) - register Display *dpy; - Pixmap source, mask; - XColor *foreground, *background; - unsigned int x, y; -{ +Cursor XCreatePixmapCursor( + register Display *dpy, + Pixmap source, + Pixmap mask, + XColor *foreground, + XColor *background, + unsigned int x, + unsigned int y) + +{ register xCreateCursorReq *req; Cursor cid; #ifdef USE_DYNAMIC_XCURSOR - cid = _XTryShapeBitmapCursor (dpy, source, mask, + cid = _XTryShapeBitmapCursor (dpy, source, mask, foreground, background, x, y); if (cid) return cid; diff --git a/nx-X11/lib/X11/CrGC.c b/nx-X11/lib/X11/CrGC.c index 3c6fde33e..11de94c1f 100644 --- a/nx-X11/lib/X11/CrGC.c +++ b/nx-X11/lib/X11/CrGC.c @@ -61,11 +61,11 @@ static void _XGenerateGCList( GC gc, xReq *req); -GC XCreateGC (dpy, d, valuemask, values) - register Display *dpy; - Drawable d; /* Window or Pixmap for which depth matches */ - unsigned long valuemask; /* which ones to set initially */ - XGCValues *values; /* the values themselves */ +GC XCreateGC ( + register Display *dpy, + Drawable d, /* Window or Pixmap for which depth matches */ + unsigned long valuemask, /* which ones to set initially */ + XGCValues *values) /* the values themselves */ { register GC gc; register xCreateGCReq *req; @@ -148,10 +148,10 @@ _XGenerateGCList ( req->length += (nvalues = value - values); - /* + /* * note: Data is a macro that uses its arguments multiple * times, so "nvalues" is changed in a separate assignment - * statement + * statement */ nvalues <<= 2; @@ -161,11 +161,11 @@ _XGenerateGCList ( int -_XUpdateGCCache (gc, mask, attr) - register unsigned long mask; - register XGCValues *attr; - register GC gc; - { +_XUpdateGCCache ( + register GC gc, + register unsigned long mask, + register XGCValues *attr) +{ register XGCValues *gv = &gc->values; if (mask & GCFunction) @@ -173,7 +173,7 @@ _XUpdateGCCache (gc, mask, attr) gv->function = attr->function; gc->dirty |= GCFunction; } - + if (mask & GCPlaneMask) if (gv->plane_mask != attr->plane_mask) { gv->plane_mask = attr->plane_mask; @@ -209,7 +209,7 @@ _XUpdateGCCache (gc, mask, attr) gv->cap_style = attr->cap_style; gc->dirty |= GCCapStyle; } - + if (mask & GCJoinStyle) if (gv->join_style != attr->join_style) { gv->join_style = attr->join_style; @@ -308,13 +308,13 @@ _XUpdateGCCache (gc, mask, attr) gc->dashes = 0; } return 0; - } +} /* can only call when display is already locked. */ -void _XFlushGCCache(dpy, gc) - Display *dpy; - GC gc; +void _XFlushGCCache( + Display *dpy, + GC gc) { register xChangeGCReq *req; register _XExtension *ext; @@ -331,13 +331,15 @@ void _XFlushGCCache(dpy, gc) } } -void XFlushGC(dpy, gc) - Display *dpy; - GC gc; +void +XFlushGC( + Display *dpy, + GC gc) { FlushGC(dpy, gc); } -GContext XGContextFromGC(gc) - GC gc; - { return (gc->gid); } +GContext XGContextFromGC(GC gc) +{ + return (gc->gid); +} diff --git a/nx-X11/lib/X11/CrGlCur.c b/nx-X11/lib/X11/CrGlCur.c index 88a8c30d3..460660f81 100644 --- a/nx-X11/lib/X11/CrGlCur.c +++ b/nx-X11/lib/X11/CrGlCur.c @@ -44,14 +44,18 @@ in this Software without prior written authorization from The Open Group. #endif #include "Cr.h" +#ifdef __CYGWIN__ +#define LIBXCURSOR "cygXcursor-1.dll" +#endif + #if defined(hpux) -typedef shl_dt XModuleType; +typedef shl_t XModuleType; #else typedef void *XModuleType; #endif #ifndef LIBXCURSOR -#define LIBXCURSOR "libXcursor.so" +#define LIBXCURSOR "libXcursor.so.1" #endif static char libraryName[] = LIBXCURSOR; @@ -76,18 +80,18 @@ open_library (void) break; *dot = '\0'; } - return 0; + return NULL; } static void * -fetch_symbol (XModuleType module, char *under_symbol) +fetch_symbol (XModuleType module, const char *under_symbol) { void *result = NULL; - char *symbol = under_symbol + 1; + const char *symbol = under_symbol + 1; #if defined(hpux) int getsyms_cnt, i; struct shl_symbol *symbols; - + getsyms_cnt = shl_getsymbols(module, TYPE_PROCEDURE, EXPORT_SYMBOLS, malloc, &symbols); @@ -218,20 +222,20 @@ _XTryShapeBitmapCursor (Display *dpy, } #endif -Cursor XCreateGlyphCursor(dpy, source_font, mask_font, - source_char, mask_char, - foreground, background) - register Display *dpy; - Font source_font, mask_font; - unsigned int source_char, mask_char; - XColor _Xconst *foreground, *background; - -{ +Cursor XCreateGlyphCursor( + register Display *dpy, + Font source_font, + Font mask_font, + unsigned int source_char, + unsigned int mask_char, + XColor _Xconst *foreground, + XColor _Xconst *background) +{ Cursor cid; register xCreateGlyphCursorReq *req; #ifdef USE_DYNAMIC_XCURSOR - cid = _XTryShapeCursor (dpy, source_font, mask_font, + cid = _XTryShapeCursor (dpy, source_font, mask_font, source_char, mask_char, foreground, background); if (cid) return cid; diff --git a/nx-X11/lib/X11/CrPFBData.c b/nx-X11/lib/X11/CrPFBData.c index 872dc204e..57cd15303 100644 --- a/nx-X11/lib/X11/CrPFBData.c +++ b/nx-X11/lib/X11/CrPFBData.c @@ -33,7 +33,7 @@ in this Software without prior written authorization from The Open Group. /* * XCreatePixmapFromBitmapData: Routine to make a pixmap from user supplied bitmap data. * D is any drawable on the same screen that the pixmap will be used in. - * Data is a pointer to the bit data, and + * Data is a pointer to the bit data, and * width & height give the size in bits of the pixmap. * Fg and Bg are the pixel values to use for the two colors. * Depth is the depth of the pixmap to create. @@ -47,14 +47,16 @@ in this Software without prior written authorization from The Open Group. * bitmap_unit=8 * xoffset=0 * no extra bytes per line - */ -Pixmap XCreatePixmapFromBitmapData(display,d,data,width,height,fg,bg,depth) - Display *display; - Drawable d; - char *data; - unsigned int width, height; - unsigned long fg, bg; - unsigned int depth; + */ +Pixmap XCreatePixmapFromBitmapData( + Display *display, + Drawable d, + char *data, + unsigned int width, + unsigned int height, + unsigned long fg, + unsigned long bg, + unsigned int depth) { XImage ximage; GC gc; diff --git a/nx-X11/lib/X11/CrPixmap.c b/nx-X11/lib/X11/CrPixmap.c index 648a3de3d..cdf312076 100644 --- a/nx-X11/lib/X11/CrPixmap.c +++ b/nx-X11/lib/X11/CrPixmap.c @@ -23,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -38,10 +37,12 @@ _XNoticeCreateBitmap (Display *dpy, unsigned int height); #endif -Pixmap XCreatePixmap (dpy, d, width, height, depth) - register Display *dpy; - Drawable d; - unsigned int width, height, depth; +Pixmap XCreatePixmap ( + register Display *dpy, + Drawable d, + unsigned int width, + unsigned int height, + unsigned int depth) { Pixmap pid; register xCreatePixmapReq *req; diff --git a/nx-X11/lib/X11/CrWindow.c b/nx-X11/lib/X11/CrWindow.c index a5bc59df9..7b5460186 100644 --- a/nx-X11/lib/X11/CrWindow.c +++ b/nx-X11/lib/X11/CrWindow.c @@ -29,14 +29,16 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Window XCreateSimpleWindow(dpy, parent, x, y, width, height, - borderWidth, border, background) - register Display *dpy; - Window parent; - int x, y; - unsigned int width, height, borderWidth; - unsigned long border; - unsigned long background; +Window XCreateSimpleWindow( + register Display *dpy, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int borderWidth, + unsigned long border, + unsigned long background) { Window wid; register xCreateWindowReq *req; diff --git a/nx-X11/lib/X11/Cursor.c b/nx-X11/lib/X11/Cursor.c index 5700f707a..80b91c36d 100644 --- a/nx-X11/lib/X11/Cursor.c +++ b/nx-X11/lib/X11/Cursor.c @@ -31,11 +31,11 @@ in this Software without prior written authorization from The Open Group. static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */ static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */ -Cursor XCreateFontCursor(dpy, which) - Display *dpy; - unsigned int which; +Cursor XCreateFontCursor( + Display *dpy, + unsigned int which) { - /* + /* * the cursor font contains the shape glyph followed by the mask * glyph; so character position 0 contains a shape, 1 the mask for 0, * 2 a shape, etc. <X11/cursorfont.h> contains hash define names @@ -47,7 +47,7 @@ Cursor XCreateFontCursor(dpy, which) if (dpy->cursor_font == None) return None; } - return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, + return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, which, which + 1, &foreground, &background); } diff --git a/nx-X11/lib/X11/DefCursor.c b/nx-X11/lib/X11/DefCursor.c index ebfd4620d..e3cee0649 100644 --- a/nx-X11/lib/X11/DefCursor.c +++ b/nx-X11/lib/X11/DefCursor.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDefineCursor (dpy, w, cursor) - register Display *dpy; - Window w; - Cursor cursor; +XDefineCursor ( + register Display *dpy, + Window w, + Cursor cursor) { register xChangeWindowAttributesReq *req; diff --git a/nx-X11/lib/X11/DelProp.c b/nx-X11/lib/X11/DelProp.c index d598cc551..da486b8ef 100644 --- a/nx-X11/lib/X11/DelProp.c +++ b/nx-X11/lib/X11/DelProp.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDeleteProperty(dpy, window, property) -register Display *dpy; -Window window; -Atom property; +XDeleteProperty( + register Display *dpy, + Window window, + Atom property) { register xDeletePropertyReq *req; diff --git a/nx-X11/lib/X11/Depths.c b/nx-X11/lib/X11/Depths.c index 14aebceb6..f49655cb2 100644 --- a/nx-X11/lib/X11/Depths.c +++ b/nx-X11/lib/X11/Depths.c @@ -33,10 +33,10 @@ in this Software without prior written authorization from The Open Group. /* * XListDepths - return info from connection setup */ -int *XListDepths (dpy, scrnum, countp) - Display *dpy; - int scrnum; - int *countp; +int *XListDepths ( + Display *dpy, + int scrnum, + int *countp) { Screen *scr; int count; @@ -51,7 +51,7 @@ int *XListDepths (dpy, scrnum, countp) depths = (int *) Xmalloc (count * sizeof(int)); if (!depths) return NULL; - for (i = 0, dp = scr->depths; i < count; i++, dp++) + for (i = 0, dp = scr->depths; i < count; i++, dp++) depths[i] = dp->depth; } else { /* a screen must have a depth */ diff --git a/nx-X11/lib/X11/DestSubs.c b/nx-X11/lib/X11/DestSubs.c index b250d5791..7c6c428be 100644 --- a/nx-X11/lib/X11/DestSubs.c +++ b/nx-X11/lib/X11/DestSubs.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDestroySubwindows(dpy, win) -register Display *dpy; -Window win; +XDestroySubwindows( + register Display *dpy, + Window win) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/DestWind.c b/nx-X11/lib/X11/DestWind.c index 099027219..c1aec893a 100644 --- a/nx-X11/lib/X11/DestWind.c +++ b/nx-X11/lib/X11/DestWind.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDestroyWindow (dpy, w) - register Display *dpy; - Window w; +XDestroyWindow ( + register Display *dpy, + Window w) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/DisName.c b/nx-X11/lib/X11/DisName.c index fbadb679d..8a0528834 100644 --- a/nx-X11/lib/X11/DisName.c +++ b/nx-X11/lib/X11/DisName.c @@ -29,14 +29,14 @@ from The Open Group. /* $XFree86$ */ /* XDisplayName.c */ -/* +/* * Returns the name of the display XOpenDisplay would use. This is better * than just printing the "display" variable in a program because that * could be NULL and/or there could be an environment variable set. * This makes it easier for programmers to provide meaningful error - * messages. + * messages. + * * - * * For example, this is used in XOpenDisplay() as * strncpy( displaybuf, XDisplayName( display ), sizeof(displaybuf) ); * if ( *displaybuf == '\0' ) return( NULL ); diff --git a/nx-X11/lib/X11/DrArc.c b/nx-X11/lib/X11/DrArc.c index d68d70f95..61102e9b2 100644 --- a/nx-X11/lib/X11/DrArc.c +++ b/nx-X11/lib/X11/DrArc.c @@ -29,20 +29,23 @@ in this Software without prior written authorization from The Open Group. We don't do this because X_PolyArc applies the GC's join-style if the last point in one arc coincides with the first point in another. The client wouldn't expect this and would have no easy way to defeat it. */ - + #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "Xlibint.h" int -XDrawArc(dpy, d, gc, x, y, width, height, angle1, angle2) - register Display *dpy; - Drawable d; - GC gc; - int x, y; /* INT16 */ - unsigned int width, height; /* CARD16 */ - int angle1, angle2; /* INT16 */ +XDrawArc( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height, /* CARD16 */ + int angle1, + int angle2) /* INT16 */ { register xPolyArcReq *req; register xArc *arc; diff --git a/nx-X11/lib/X11/DrArcs.c b/nx-X11/lib/X11/DrArcs.c index 283f6f952..14405aa3d 100644 --- a/nx-X11/lib/X11/DrArcs.c +++ b/nx-X11/lib/X11/DrArcs.c @@ -32,12 +32,12 @@ in this Software without prior written authorization from The Open Group. #define arc_scale (SIZEOF(xArc) / 4) int -XDrawArcs(dpy, d, gc, arcs, n_arcs) -register Display *dpy; -Drawable d; -GC gc; -XArc *arcs; -int n_arcs; +XDrawArcs( + register Display *dpy, + Drawable d, + GC gc, + XArc *arcs, + int n_arcs) { register xPolyArcReq *req; register long len; diff --git a/nx-X11/lib/X11/DrLine.c b/nx-X11/lib/X11/DrLine.c index ddee9777a..dc82d5a15 100644 --- a/nx-X11/lib/X11/DrLine.c +++ b/nx-X11/lib/X11/DrLine.c @@ -35,11 +35,14 @@ in this Software without prior written authorization from The Open Group. #define zsize (SIZEOF(xPolySegmentReq) + ZLNSPERBATCH * SIZEOF(xSegment)) int -XDrawLine (dpy, d, gc, x1, y1, x2, y2) - register Display *dpy; - Drawable d; - GC gc; - int x1, y1, x2, y2; +XDrawLine ( + register Display *dpy, + Drawable d, + GC gc, + int x1, + int y1, + int x2, + int y2) { register xSegment *segment; diff --git a/nx-X11/lib/X11/DrLines.c b/nx-X11/lib/X11/DrLines.c index f1ddb884c..68071b6b4 100644 --- a/nx-X11/lib/X11/DrLines.c +++ b/nx-X11/lib/X11/DrLines.c @@ -30,13 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDrawLines (dpy, d, gc, points, npoints, mode) - register Display *dpy; - Drawable d; - GC gc; - XPoint *points; - int npoints; - int mode; +XDrawLines ( + register Display *dpy, + Drawable d, + GC gc, + XPoint *points, + int npoints, + int mode) { register xPolyLineReq *req; register long length; diff --git a/nx-X11/lib/X11/DrPoint.c b/nx-X11/lib/X11/DrPoint.c index f5341be0d..f0332e853 100644 --- a/nx-X11/lib/X11/DrPoint.c +++ b/nx-X11/lib/X11/DrPoint.c @@ -34,11 +34,12 @@ in this Software without prior written authorization from The Open Group. #define size (SIZEOF(xPolyPointReq) + PTSPERBATCH * SIZEOF(xPoint)) int -XDrawPoint(dpy, d, gc, x, y) - register Display *dpy; - Drawable d; - GC gc; - int x, y; /* INT16 */ +XDrawPoint( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y) /* INT16 */ { xPoint *point; diff --git a/nx-X11/lib/X11/DrPoints.c b/nx-X11/lib/X11/DrPoints.c index 4f318eb41..287fa057d 100644 --- a/nx-X11/lib/X11/DrPoints.c +++ b/nx-X11/lib/X11/DrPoints.c @@ -30,13 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDrawPoints(dpy, d, gc, points, n_points, mode) - register Display *dpy; - Drawable d; - GC gc; - XPoint *points; - int n_points; - int mode; /* CoordMode */ +XDrawPoints( + register Display *dpy, + Drawable d, + GC gc, + XPoint *points, + int n_points, + int mode) /* CoordMode */ { register xPolyPointReq *req; register long nbytes; diff --git a/nx-X11/lib/X11/DrRect.c b/nx-X11/lib/X11/DrRect.c index 9dadf063b..d9141eef9 100644 --- a/nx-X11/lib/X11/DrRect.c +++ b/nx-X11/lib/X11/DrRect.c @@ -35,12 +35,14 @@ in this Software without prior written authorization from The Open Group. #define zsize (SIZEOF(xPolyRectangleReq) + ZRCTSPERBATCH * SIZEOF(xRectangle)) int -XDrawRectangle(dpy, d, gc, x, y, width, height) - register Display *dpy; - Drawable d; - GC gc; - int x, y; /* INT16 */ - unsigned int width, height; /* CARD16 */ +XDrawRectangle( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height) /* CARD16 */ { xRectangle *rect; diff --git a/nx-X11/lib/X11/DrRects.c b/nx-X11/lib/X11/DrRects.c index 1773cb2f3..7827bf18d 100644 --- a/nx-X11/lib/X11/DrRects.c +++ b/nx-X11/lib/X11/DrRects.c @@ -30,12 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDrawRectangles(dpy, d, gc, rects, n_rects) -register Display *dpy; -Drawable d; -GC gc; -XRectangle *rects; -int n_rects; +XDrawRectangles( + register Display *dpy, + Drawable d, + GC gc, + XRectangle *rects, + int n_rects) { register xPolyRectangleReq *req; long len; diff --git a/nx-X11/lib/X11/DrSegs.c b/nx-X11/lib/X11/DrSegs.c index 9cd144e06..93eab4d08 100644 --- a/nx-X11/lib/X11/DrSegs.c +++ b/nx-X11/lib/X11/DrSegs.c @@ -30,12 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDrawSegments (dpy, d, gc, segments, nsegments) - register Display *dpy; - Drawable d; - GC gc; - XSegment *segments; - int nsegments; +XDrawSegments ( + register Display *dpy, + Drawable d, + GC gc, + XSegment *segments, + int nsegments) { register xPolySegmentReq *req; long len; diff --git a/nx-X11/lib/X11/ErrDes.c b/nx-X11/lib/X11/ErrDes.c index fae9deba2..ac13b480b 100644 --- a/nx-X11/lib/X11/ErrDes.c +++ b/nx-X11/lib/X11/ErrDes.c @@ -1,6 +1,4 @@ /* - * $Xorg: ErrDes.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ - * $XdotOrg: xc/lib/X11/ErrDes.c,v 1.8 2005/08/26 05:16:46 daniels Exp $ */ /*********************************************************** @@ -32,13 +30,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -70,34 +68,40 @@ SOFTWARE. * descriptions of errors in Section 4 of Protocol doc (pp. 350-351); more * verbose descriptions are given in the error database */ -static const char * const _XErrorList[] = { - /* No error */ "no error", - /* BadRequest */ "BadRequest", - /* BadValue */ "BadValue", - /* BadWindow */ "BadWindow", - /* BadPixmap */ "BadPixmap", - /* BadAtom */ "BadAtom", - /* BadCursor */ "BadCursor", - /* BadFont */ "BadFont", - /* BadMatch */ "BadMatch", - /* BadDrawable */ "BadDrawable", - /* BadAccess */ "BadAccess", - /* BadAlloc */ "BadAlloc", - /* BadColor */ "BadColor", - /* BadGC */ "BadGC", - /* BadIDChoice */ "BadIDChoice", - /* BadName */ "BadName", - /* BadLength */ "BadLength", - /* BadImplementation */ "BadImplementation", +static const char _XErrorList[] = + /* No error */ "no error\0" + /* BadRequest */ "BadRequest\0" + /* BadValue */ "BadValue\0" + /* BadWindow */ "BadWindow\0" + /* BadPixmap */ "BadPixmap\0" + /* BadAtom */ "BadAtom\0" + /* BadCursor */ "BadCursor\0" + /* BadFont */ "BadFont\0" + /* BadMatch */ "BadMatch\0" + /* BadDrawable */ "BadDrawable\0" + /* BadAccess */ "BadAccess\0" + /* BadAlloc */ "BadAlloc\0" + /* BadColor */ "BadColor\0" + /* BadGC */ "BadGC\0" + /* BadIDChoice */ "BadIDChoice\0" + /* BadName */ "BadName\0" + /* BadLength */ "BadLength\0" + /* BadImplementation */ "BadImplementation" +; + +/* offsets into _XErrorList */ +static const unsigned char _XErrorOffsets[] = { + 0, 9, 20, 29, 39, 49, 57, 67, 75, 84, 96, + 106, 115, 124, 130, 142, 150, 160 }; int -XGetErrorText(dpy, code, buffer, nbytes) - register int code; - register Display *dpy; - char *buffer; - int nbytes; +XGetErrorText( + register Display *dpy, + register int code, + char *buffer, + int nbytes) { char buf[150]; register _XExtension *ext; @@ -106,7 +110,8 @@ XGetErrorText(dpy, code, buffer, nbytes) if (nbytes == 0) return 0; if (code <= BadImplementation && code > 0) { sprintf(buf, "%d", code); - (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, _XErrorList[code], + (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, + _XErrorList + _XErrorOffsets[code], buffer, nbytes); } else buffer[0] = '\0'; @@ -115,10 +120,10 @@ XGetErrorText(dpy, code, buffer, nbytes) if (ext->error_string) (*ext->error_string)(dpy, code, &ext->codes, buffer, nbytes); if (ext->codes.first_error && - ext->codes.first_error < code && + ext->codes.first_error <= code && (!bext || ext->codes.first_error > bext->codes.first_error)) bext = ext; - } + } if (!buffer[0] && bext) { sprintf(buf, "%s.%d", bext->name, code - bext->codes.first_error); (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); @@ -186,7 +191,7 @@ XGetErrorDatabaseText( tptr = Xmalloc (tlen); if (tptr) { sprintf(tptr, "%s.%s", name, type); - XrmGetResource(db, tptr, "ErrorType.ErrorNumber", + XrmGetResource(db, tptr, "ErrorType.ErrorNumber", &type_str, &result); if (tptr != temp) Xfree (tptr); diff --git a/nx-X11/lib/X11/EvToWire.c b/nx-X11/lib/X11/EvToWire.c index f8a2565dd..4aca053ab 100644 --- a/nx-X11/lib/X11/EvToWire.c +++ b/nx-X11/lib/X11/EvToWire.c @@ -38,13 +38,15 @@ from The Open Group. #include "Xlibint.h" /* - * reformat a wire event into an XEvent structure of the right type. + * Reformat an XEvent structure to a wire event of the right type. + * Return True on success. If the type is unrecognized, return what + * _XUnknownNativeEvent returns (i.e., False). */ Status _XEventToWire( -register Display *dpy, /* pointer to display structure */ -register XEvent *re, /* pointer to where event should be reformatted */ -register xEvent *event) /* wire protocol event */ + register Display *dpy, + register XEvent *re, /* in: from */ + register xEvent *event) /* out: to */ { switch (event->u.u.type = re->type) { case KeyPress: @@ -351,12 +353,12 @@ register xEvent *event) /* wire protocol event */ case ClientMessage: { register int i; - register XClientMessageEvent *ev + register XClientMessageEvent *ev = (XClientMessageEvent *) re; event->u.clientMessage.window = ev->window; event->u.u.detail = ev->format; switch (ev->format) { - case 8: + case 8: event->u.clientMessage.u.b.type = ev->message_type; for (i = 0; i < 20; i++) event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; @@ -396,7 +398,7 @@ register xEvent *event) /* wire protocol event */ event->u.mappingNotify.count = ev->count; } break; - + default: return(_XUnknownNativeEvent(dpy, re, event)); } diff --git a/nx-X11/lib/X11/FSSaver.c b/nx-X11/lib/X11/FSSaver.c index bb4b6a32e..3df8ae681 100644 --- a/nx-X11/lib/X11/FSSaver.c +++ b/nx-X11/lib/X11/FSSaver.c @@ -30,28 +30,23 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XActivateScreenSaver(dpy) - register Display *dpy; - +XActivateScreenSaver(register Display *dpy) { XForceScreenSaver (dpy, ScreenSaverActive); return 1; } int -XResetScreenSaver(dpy) - register Display *dpy; - +XResetScreenSaver(register Display *dpy) { XForceScreenSaver (dpy, ScreenSaverReset); return 1; } int -XForceScreenSaver(dpy, mode) - register Display *dpy; - int mode; - +XForceScreenSaver( + register Display *dpy, + int mode) { register xForceScreenSaverReq *req; diff --git a/nx-X11/lib/X11/FSWrap.c b/nx-X11/lib/X11/FSWrap.c index 50fab8ed3..35bf33d2a 100644 --- a/nx-X11/lib/X11/FSWrap.c +++ b/nx-X11/lib/X11/FSWrap.c @@ -17,15 +17,15 @@ * OPEN SOFTWARE FOUNDATION DISCLAIMS ALL WARRANTIES WITH REGARD TO * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL OPEN SOFTWARE FOUNDATIONN BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF + * + * M. Collins OSF * * Katsuhisa Yano TOSHIBA Corp. - */ + */ /* @@ -179,13 +179,13 @@ XCreateFontSet ( om = XOpenOM(dpy, NULL, NULL, NULL); if (om == NULL) return (XFontSet) NULL; - + if ((oc = XCreateOC(om, XNBaseFontName, base_font_name_list, NULL))) { list = &oc->core.missing_list; oc->core.om_automatic = True; } else list = &om->core.required_charset; - + *missing_charset_list = copy_string_list(list->charset_list, list->charset_count); *missing_charset_count = list->charset_count; @@ -198,7 +198,7 @@ XCreateFontSet ( if (!*def_string) *def_string = ""; } - + if (oc == NULL) XCloseOM(om); @@ -206,10 +206,10 @@ XCreateFontSet ( } int -XFontsOfFontSet(font_set, font_struct_list, font_name_list) - XFontSet font_set; - XFontStruct ***font_struct_list; - char ***font_name_list; +XFontsOfFontSet( + XFontSet font_set, + XFontStruct ***font_struct_list, + char ***font_name_list) { *font_name_list = font_set->core.font_info.font_name_list; *font_struct_list = font_set->core.font_info.font_struct_list; @@ -217,50 +217,47 @@ XFontsOfFontSet(font_set, font_struct_list, font_name_list) } char * -XBaseFontNameListOfFontSet(font_set) - XFontSet font_set; +XBaseFontNameListOfFontSet(XFontSet font_set) { return font_set->core.base_name_list; } char * -XLocaleOfFontSet(font_set) - XFontSet font_set; +XLocaleOfFontSet(XFontSet font_set) { return font_set->core.om->core.lcd->core->name; } -extern Bool XContextDependentDrawing(font_set) - XFontSet font_set; +Bool +XContextDependentDrawing(XFontSet font_set) { return font_set->core.om->core.context_dependent; } Bool -XDirectionalDependentDrawing(font_set) - XFontSet font_set; +XDirectionalDependentDrawing(XFontSet font_set) { return font_set->core.om->core.directional_dependent; } Bool -XContextualDrawing(font_set) - XFontSet font_set; +XContextualDrawing(XFontSet font_set) { return font_set->core.om->core.contextual_drawing; } XFontSetExtents * -XExtentsOfFontSet(font_set) - XFontSet font_set; +XExtentsOfFontSet(XFontSet font_set) { + if (!font_set) + return NULL; return &font_set->core.font_set_extents; } void -XFreeFontSet(dpy, font_set) - Display *dpy; - XFontSet font_set; +XFreeFontSet( + Display *dpy, + XFontSet font_set) { XCloseOM(font_set->core.om); } diff --git a/nx-X11/lib/X11/FetchName.c b/nx-X11/lib/X11/FetchName.c index fc8f64eb8..7503482fa 100644 --- a/nx-X11/lib/X11/FetchName.c +++ b/nx-X11/lib/X11/FetchName.c @@ -33,17 +33,17 @@ in this Software without prior written authorization from The Open Group. #include <stdio.h> -Status XFetchName (dpy, w, name) - register Display *dpy; - Window w; - char **name; +Status XFetchName ( + register Display *dpy, + Window w, + char **name) { Atom actual_type; int actual_format; unsigned long nitems; unsigned long leftover; unsigned char *data = NULL; - if (XGetWindowProperty(dpy, w, XA_WM_NAME, 0L, (long)BUFSIZ, False, XA_STRING, + if (XGetWindowProperty(dpy, w, XA_WM_NAME, 0L, (long)BUFSIZ, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { *name = NULL; @@ -63,10 +63,10 @@ Status XFetchName (dpy, w, name) return(0); } -Status XGetIconName (dpy, w, icon_name) - register Display *dpy; - Window w; - char **icon_name; +Status XGetIconName ( + register Display *dpy, + Window w, + char **icon_name) { Atom actual_type; int actual_format; @@ -74,7 +74,7 @@ Status XGetIconName (dpy, w, icon_name) unsigned long leftover; unsigned char *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_ICON_NAME, 0L, (long)BUFSIZ, False, - XA_STRING, + XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { *icon_name = NULL; diff --git a/nx-X11/lib/X11/FillArc.c b/nx-X11/lib/X11/FillArc.c index 6364ff3ae..c67f977b7 100644 --- a/nx-X11/lib/X11/FillArc.c +++ b/nx-X11/lib/X11/FillArc.c @@ -34,13 +34,16 @@ in this Software without prior written authorization from The Open Group. #define size (SIZEOF(xPolyFillArcReq) + FARCSPERBATCH * SIZEOF(xArc)) int -XFillArc(dpy, d, gc, x, y, width, height, angle1, angle2) - register Display *dpy; - Drawable d; - GC gc; - int x, y; /* INT16 */ - unsigned int width, height; /* CARD16 */ - int angle1, angle2; /* INT16 */ +XFillArc( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height, /* CARD16 */ + int angle1, + int angle2) /* INT16 */ { xArc *arc; diff --git a/nx-X11/lib/X11/FillArcs.c b/nx-X11/lib/X11/FillArcs.c index 44b0f3b97..62cfabf8f 100644 --- a/nx-X11/lib/X11/FillArcs.c +++ b/nx-X11/lib/X11/FillArcs.c @@ -32,12 +32,12 @@ in this Software without prior written authorization from The Open Group. #define arc_scale (SIZEOF(xArc) / 4) int -XFillArcs(dpy, d, gc, arcs, n_arcs) -register Display *dpy; -Drawable d; -GC gc; -XArc *arcs; -int n_arcs; +XFillArcs( + register Display *dpy, + Drawable d, + GC gc, + XArc *arcs, + int n_arcs) { register xPolyFillArcReq *req; long len; diff --git a/nx-X11/lib/X11/FillPoly.c b/nx-X11/lib/X11/FillPoly.c index 8bb6b6f1b..ea162a41e 100644 --- a/nx-X11/lib/X11/FillPoly.c +++ b/nx-X11/lib/X11/FillPoly.c @@ -30,14 +30,14 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XFillPolygon(dpy, d, gc, points, n_points, shape, mode) -register Display *dpy; -Drawable d; -GC gc; -XPoint *points; -int n_points; -int shape; -int mode; +XFillPolygon( + register Display *dpy, + Drawable d, + GC gc, + XPoint *points, + int n_points, + int shape, + int mode) { register xFillPolyReq *req; register long nbytes; @@ -56,7 +56,7 @@ int mode; /* shift (mult. by 4) before passing to the (possible) macro */ nbytes = n_points << 2; - + Data16 (dpy, (short *) points, nbytes); UnlockDisplay(dpy); SyncHandle(); diff --git a/nx-X11/lib/X11/FillRct.c b/nx-X11/lib/X11/FillRct.c index 293baf93a..3ca9afe9e 100644 --- a/nx-X11/lib/X11/FillRct.c +++ b/nx-X11/lib/X11/FillRct.c @@ -34,12 +34,14 @@ in this Software without prior written authorization from The Open Group. #define size (SIZEOF(xPolyFillRectangleReq) + FRCTSPERBATCH * SIZEOF(xRectangle)) int -XFillRectangle(dpy, d, gc, x, y, width, height) - register Display *dpy; - Drawable d; - GC gc; - int x, y; /* INT16 */ - unsigned int width, height; /* CARD16 */ +XFillRectangle( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height) /* CARD16 */ { xRectangle *rect; @@ -47,7 +49,7 @@ XFillRectangle(dpy, d, gc, x, y, width, height) FlushGC(dpy, gc); { - register xPolyFillRectangleReq *req + register xPolyFillRectangleReq *req = (xPolyFillRectangleReq *) dpy->last_req; /* if same as previous request, with same drawable, batch requests */ diff --git a/nx-X11/lib/X11/FillRcts.c b/nx-X11/lib/X11/FillRcts.c index 949bcd7bf..7d9569124 100644 --- a/nx-X11/lib/X11/FillRcts.c +++ b/nx-X11/lib/X11/FillRcts.c @@ -30,12 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XFillRectangles(dpy, d, gc, rectangles, n_rects) -register Display *dpy; -Drawable d; -GC gc; -XRectangle *rectangles; -int n_rects; +XFillRectangles( + register Display *dpy, + Drawable d, + GC gc, + XRectangle *rectangles, + int n_rects) { register xPolyFillRectangleReq *req; long len; @@ -63,4 +63,3 @@ int n_rects; SyncHandle(); return 1; } - diff --git a/nx-X11/lib/X11/FilterEv.c b/nx-X11/lib/X11/FilterEv.c index 37a4d79af..0a48e5486 100644 --- a/nx-X11/lib/X11/FilterEv.c +++ b/nx-X11/lib/X11/FilterEv.c @@ -18,12 +18,12 @@ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * PERFORMANCE OF THIS SOFTWARE. * * Author: Seiji Kuwari OMRON Corporation * kuwa@omron.co.jp * kuwa%omron.co.jp@uunet.uu.net - */ + */ /* @@ -69,9 +69,9 @@ extern long const _Xevent_to_mask[]; * Look up if there is a specified filter for the event. */ Bool -XFilterEvent(ev, window) - XEvent *ev; - Window window; +XFilterEvent( + XEvent *ev, + Window window) { #if XLOCALE XFilterEventList p; @@ -93,9 +93,9 @@ XFilterEvent(ev, window) if (win == p->window) { if ((mask & p->event_mask) || (ev->type >= p->start_type && ev->type <= p->end_type)) { + UnlockDisplay(ev->xany.display); ret = (*(p->filter))(ev->xany.display, p->window, ev, p->client_data); - UnlockDisplay(ev->xany.display); return(ret); } } diff --git a/nx-X11/lib/X11/Flush.c b/nx-X11/lib/X11/Flush.c index 0328bf8f6..46168999b 100644 --- a/nx-X11/lib/X11/Flush.c +++ b/nx-X11/lib/X11/Flush.c @@ -33,9 +33,8 @@ in this Software without prior written authorization from The Open Group. /* NOTE: NOT necessary when calling any of the Xlib routines. */ int -XFlush (dpy) - register Display *dpy; - { +XFlush (register Display *dpy) +{ LockDisplay(dpy); _XFlush (dpy); UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/Font.c b/nx-X11/lib/X11/Font.c index 92ba71a5d..f60a8a874 100644 --- a/nx-X11/lib/X11/Font.c +++ b/nx-X11/lib/X11/Font.c @@ -123,9 +123,9 @@ XFontStruct *XLoadQueryFont( return font_result; } -XFontStruct *XQueryFont (dpy, fid) - register Display *dpy; - Font fid; +XFontStruct *XQueryFont ( + register Display *dpy, + Font fid) { XFontStruct *font_result; #ifdef USE_XF86BIGFONT @@ -147,10 +147,10 @@ XFontStruct *XQueryFont (dpy, fid) } int -XFreeFont(dpy, fs) - register Display *dpy; - XFontStruct *fs; -{ +XFreeFont( + register Display *dpy, + XFontStruct *fs) +{ register xResourceReq *req; register _XExtension *ext; @@ -177,10 +177,10 @@ XFreeFont(dpy, fs) static XFontStruct * -_XQueryFont (dpy, fid, seq) - register Display *dpy; - Font fid; - unsigned long seq; +_XQueryFont ( + register Display *dpy, + Font fid, + unsigned long seq) { register XFontStruct *fs; register long nbytes; @@ -227,13 +227,13 @@ _XQueryFont (dpy, fid, seq) fs->all_chars_exist = reply.allCharsExist; fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); - + /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; fs->n_properties = reply.nFontProps; - /* + /* * if no properties defined for the font, then it is bad * font, but shouldn't try to read nothing. */ @@ -384,11 +384,11 @@ _XF86BigfontFreeNop ( } static XFontStruct * -_XF86BigfontQueryFont (dpy, extcodes, fid, seq) - register Display *dpy; - XF86BigfontCodes *extcodes; - Font fid; - unsigned long seq; +_XF86BigfontQueryFont ( + register Display *dpy, + XF86BigfontCodes *extcodes, + Font fid, + unsigned long seq) { register XFontStruct *fs; register long nbytes; @@ -470,7 +470,7 @@ _XF86BigfontQueryFont (dpy, extcodes, fid, seq) fs->max_bounds = * (XCharStruct *) &reply.maxBounds; fs->n_properties = reply.nFontProps; - /* + /* * if no properties defined for the font, then it is bad * font, but shouldn't try to read nothing. */ @@ -554,7 +554,7 @@ _XF86BigfontQueryFont (dpy, extcodes, fid, seq) signature. Then we set the CAP_VerifiedLocal bit to indicate the verification was successful. */ - if ((addr = shmat(reply.shmid, 0, SHM_RDONLY)) == (char *)-1) { + if ((addr = shmat(reply.shmid, NULL, SHM_RDONLY)) == (char *)-1) { if (extcodes->serverCapabilities & CAP_VerifiedLocal) fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n"); Xfree((char *) pData); @@ -606,8 +606,7 @@ _XF86BigfontQueryFont (dpy, extcodes, fid, seq) } void -_XF86BigfontFreeFontMetrics (fs) - XFontStruct *fs; +_XF86BigfontFreeFontMetrics (XFontStruct *fs) { #ifdef HAS_SHM XExtData *pData; @@ -633,7 +632,7 @@ int _XF86LoadQueryLocaleFont( Font *fidp) { int l; - char *charset, *p; + const char *charset, *p; char buf[256]; XFontStruct *fs; XLCd lcd; @@ -643,7 +642,7 @@ int _XF86LoadQueryLocaleFont( l = strlen(name); if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-') return 0; - charset = 0; + charset = NULL; /* next three lines stolen from _XkbGetCharset() */ lcd = _XlcCurrentLC(); if ((lcd = _XlcCurrentLC()) != 0) diff --git a/nx-X11/lib/X11/FontInfo.c b/nx-X11/lib/X11/FontInfo.c index c46d34ec1..368beebe4 100644 --- a/nx-X11/lib/X11/FontInfo.c +++ b/nx-X11/lib/X11/FontInfo.c @@ -44,7 +44,7 @@ _Xconst char *pattern, /* null-terminated */ int maxNames, int *actualCount, /* RETURN */ XFontStruct **info) /* RETURN */ -{ +{ register long nbytes; register int i; register XFontStruct *fs; @@ -65,7 +65,7 @@ XFontStruct **info) /* RETURN */ for (i = 0; ; i++) { if (!_XReply (dpy, (xReply *) &reply, - ((SIZEOF(xListFontsWithInfoReply) - + ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) >> 2), xFalse)) { for (j=(i-1); (j >= 0); j--) { Xfree(flist[j]); @@ -83,7 +83,7 @@ XFontStruct **info) /* RETURN */ size = i + reply.nReplies + 1; if (finfo) { - XFontStruct * tmp_finfo = (XFontStruct *) + XFontStruct * tmp_finfo = (XFontStruct *) Xrealloc ((char *) finfo, (unsigned) (sizeof(XFontStruct) * size)); char ** tmp_flist = (char **) @@ -131,7 +131,7 @@ XFontStruct **info) /* RETURN */ fs->all_chars_exist = reply.allCharsExist; fs->ascent = cvtINT16toInt (reply.fontAscent); fs->descent = cvtINT16toInt (reply.fontDescent); - + /* XXX the next two statements won't work if short isn't 16 bits */ fs->min_bounds = * (XCharStruct *) &reply.minBounds; fs->max_bounds = * (XCharStruct *) &reply.maxBounds; @@ -201,10 +201,10 @@ XFontStruct **info) /* RETURN */ } int -XFreeFontInfo (names, info, actualCount) -char **names; -XFontStruct *info; -int actualCount; +XFreeFontInfo ( + char **names, + XFontStruct *info, + int actualCount) { register int i; if (names) { diff --git a/nx-X11/lib/X11/FontNames.c b/nx-X11/lib/X11/FontNames.c index f0b72a75e..3018cf2cf 100644 --- a/nx-X11/lib/X11/FontNames.c +++ b/nx-X11/lib/X11/FontNames.c @@ -36,7 +36,7 @@ register Display *dpy, _Xconst char *pattern, /* null-terminated */ int maxNames, int *actualCount) /* RETURN */ -{ +{ register long nbytes; register unsigned i; register int length; @@ -98,9 +98,8 @@ int *actualCount) /* RETURN */ } int -XFreeFontNames(list) -char **list; -{ +XFreeFontNames(char **list) +{ if (list) { if (!*(list[0]-1)) { /* from ListFontsWithInfo */ register char **names; diff --git a/nx-X11/lib/X11/FreeCmap.c b/nx-X11/lib/X11/FreeCmap.c index d43358548..e2b76fa6f 100644 --- a/nx-X11/lib/X11/FreeCmap.c +++ b/nx-X11/lib/X11/FreeCmap.c @@ -44,6 +44,9 @@ XFreeColormap( UnlockDisplay(dpy); SyncHandle(); +#ifdef XCMS _XcmsDeleteCmapRec(dpy, cmap); +#endif + return 1; } diff --git a/nx-X11/lib/X11/FreeCols.c b/nx-X11/lib/X11/FreeCols.c index ad2abcfa1..a8b7f8867 100644 --- a/nx-X11/lib/X11/FreeCols.c +++ b/nx-X11/lib/X11/FreeCols.c @@ -30,12 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XFreeColors(dpy, cmap, pixels, npixels, planes) -register Display *dpy; -Colormap cmap; -unsigned long *pixels; /* LISTofCARD32 */ -int npixels; -unsigned long planes; /* CARD32 */ +XFreeColors( + register Display *dpy, + Colormap cmap, + unsigned long *pixels, /* LISTofCARD32 */ + int npixels, + unsigned long planes) /* CARD32 */ { register xFreeColorsReq *req; register long nbytes; diff --git a/nx-X11/lib/X11/FreeCurs.c b/nx-X11/lib/X11/FreeCurs.c index 8f77de074..89fb577cc 100644 --- a/nx-X11/lib/X11/FreeCurs.c +++ b/nx-X11/lib/X11/FreeCurs.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XFreeCursor(dpy, cursor) - register Display *dpy; - Cursor cursor; +XFreeCursor( + register Display *dpy, + Cursor cursor) { register xResourceReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/FreeEData.c b/nx-X11/lib/X11/FreeEData.c index 847f71eb9..3a7abca74 100644 --- a/nx-X11/lib/X11/FreeEData.c +++ b/nx-X11/lib/X11/FreeEData.c @@ -30,12 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -_XFreeExtData (extension) - XExtData *extension; +_XFreeExtData (XExtData *extension) { XExtData *temp; while (extension) { - if (extension->free_private) + if (extension->free_private) (*extension->free_private)(extension); else Xfree ((char *)extension->private_data); temp = extension->next; diff --git a/nx-X11/lib/X11/FreeGC.c b/nx-X11/lib/X11/FreeGC.c index ed0a3d00d..cc9765551 100644 --- a/nx-X11/lib/X11/FreeGC.c +++ b/nx-X11/lib/X11/FreeGC.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XFreeGC (dpy, gc) - register Display *dpy; - GC gc; +XFreeGC ( + register Display *dpy, + GC gc) { register xResourceReq *req; register _XExtension *ext; @@ -47,4 +47,3 @@ XFreeGC (dpy, gc) Xfree ((char *) gc); return 1; } - diff --git a/nx-X11/lib/X11/FreePix.c b/nx-X11/lib/X11/FreePix.c index 01bbbb660..21367978e 100644 --- a/nx-X11/lib/X11/FreePix.c +++ b/nx-X11/lib/X11/FreePix.c @@ -30,12 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XFreePixmap(dpy, pixmap) - register Display *dpy; - Pixmap pixmap; - -{ - register xResourceReq *req; +XFreePixmap( + register Display *dpy, + Pixmap pixmap) +{ + register xResourceReq *req; LockDisplay(dpy); GetResReq(FreePixmap, pixmap, req); UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/GCMisc.c b/nx-X11/lib/X11/GCMisc.c index 912308c40..751e27dca 100644 --- a/nx-X11/lib/X11/GCMisc.c +++ b/nx-X11/lib/X11/GCMisc.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetArcMode (dpy, gc, arc_mode) -register Display *dpy; -register GC gc; -int arc_mode; +XSetArcMode ( + register Display *dpy, + register GC gc, + int arc_mode) { LockDisplay(dpy); if (gc->values.arc_mode != arc_mode) { @@ -46,10 +46,10 @@ int arc_mode; } int -XSetFillRule (dpy, gc, fill_rule) -register Display *dpy; -register GC gc; -int fill_rule; +XSetFillRule ( + register Display *dpy, + register GC gc, + int fill_rule) { LockDisplay(dpy); if (gc->values.fill_rule != fill_rule) { @@ -62,10 +62,10 @@ int fill_rule; } int -XSetFillStyle (dpy, gc, fill_style) -register Display *dpy; -register GC gc; -int fill_style; +XSetFillStyle ( + register Display *dpy, + register GC gc, + int fill_style) { LockDisplay(dpy); if (gc->values.fill_style != fill_style) { @@ -78,10 +78,10 @@ int fill_style; } int -XSetGraphicsExposures (dpy, gc, graphics_exposures) -register Display *dpy; -register GC gc; -Bool graphics_exposures; +XSetGraphicsExposures ( + register Display *dpy, + register GC gc, + Bool graphics_exposures) { LockDisplay(dpy); if (gc->values.graphics_exposures != graphics_exposures) { @@ -94,10 +94,10 @@ Bool graphics_exposures; } int -XSetSubwindowMode (dpy, gc, subwindow_mode) -register Display *dpy; -register GC gc; -int subwindow_mode; +XSetSubwindowMode ( + register Display *dpy, + register GC gc, + int subwindow_mode) { LockDisplay(dpy); if (gc->values.subwindow_mode != subwindow_mode) { diff --git a/nx-X11/lib/X11/Geom.c b/nx-X11/lib/X11/Geom.c index 6b86be27e..1da74f1c3 100644 --- a/nx-X11/lib/X11/Geom.c +++ b/nx-X11/lib/X11/Geom.c @@ -26,7 +26,6 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -66,11 +65,11 @@ XGeometry ( dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight); /* set default values */ - *x = (dmask & XNegative) ? - DisplayWidth(dpy, screen) + dx - dwidth * fwidth - + *x = (dmask & XNegative) ? + DisplayWidth(dpy, screen) + dx - dwidth * fwidth - 2 * bwidth - xadd : dx; - *y = (dmask & YNegative) ? - DisplayHeight(dpy, screen) + dy - dheight * fheight - + *y = (dmask & YNegative) ? + DisplayHeight(dpy, screen) + dy - dheight * fheight - 2 * bwidth - yadd : dy; *width = dwidth; *height = dheight; @@ -80,11 +79,11 @@ XGeometry ( if (pmask & XValue) *x = (pmask & XNegative) ? - DisplayWidth(dpy, screen) + px - *width * fwidth - + DisplayWidth(dpy, screen) + px - *width * fwidth - 2 * bwidth - xadd : px; if (pmask & YValue) *y = (pmask & YNegative) ? - DisplayHeight(dpy, screen) + py - *height * fheight - + DisplayHeight(dpy, screen) + py - *height * fheight - 2 * bwidth - yadd : py; return (pmask); } diff --git a/nx-X11/lib/X11/GetAtomNm.c b/nx-X11/lib/X11/GetAtomNm.c index 4efe3ddc8..9823c690c 100644 --- a/nx-X11/lib/X11/GetAtomNm.c +++ b/nx-X11/lib/X11/GetAtomNm.c @@ -49,16 +49,16 @@ char *_XGetAtomName( if ((name = (char *)Xmalloc(idx))) strcpy(name, EntryName(e)); return name; - } + } } } GetResReq(GetAtomName, atom, req); return (char *)NULL; } -char *XGetAtomName(dpy, atom) - register Display *dpy; - Atom atom; +char *XGetAtomName( + register Display *dpy, + Atom atom) { xGetAtomNameReply rep; char *name; @@ -67,7 +67,7 @@ char *XGetAtomName(dpy, atom) if ((name = _XGetAtomName(dpy, atom))) { UnlockDisplay(dpy); return name; - } + } if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { UnlockDisplay(dpy); SyncHandle(); @@ -139,11 +139,11 @@ Bool _XGetAtomNameHandler( } Status -XGetAtomNames (dpy, atoms, count, names_return) - Display *dpy; - Atom *atoms; - int count; - char **names_return; +XGetAtomNames ( + Display *dpy, + Atom *atoms, + int count, + char **names_return) { _XAsyncHandler async; _XGetAtomNameState async_state; diff --git a/nx-X11/lib/X11/GetColor.c b/nx-X11/lib/X11/GetColor.c index 6725278e7..cd0eb9f63 100644 --- a/nx-X11/lib/X11/GetColor.c +++ b/nx-X11/lib/X11/GetColor.c @@ -48,6 +48,7 @@ XColor *exact_def) /* RETURN */ XcmsColor cmsColor_exact; Status ret; +#ifdef XCMS /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ @@ -73,6 +74,7 @@ XColor *exact_def) /* RETURN */ break; } } +#endif /* * Xcms and i18n approach failed. diff --git a/nx-X11/lib/X11/GetDflt.c b/nx-X11/lib/X11/GetDflt.c index 7907a2c8f..0c00b3c94 100644 --- a/nx-X11/lib/X11/GetDflt.c +++ b/nx-X11/lib/X11/GetDflt.c @@ -28,13 +28,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -96,16 +96,16 @@ GetHomeDir( int len) { #ifdef WIN32 - register char *ptr1; - register char *ptr2; + register char *ptr1 = NULL; + register char *ptr2 = NULL; int len1 = 0, len2 = 0; - if (ptr1 = getenv("HOME")) { /* old, deprecated */ + if ((ptr1 = getenv("HOME"))) { /* old, deprecated */ len1 = strlen (ptr1); } else if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) { len1 = strlen (ptr1); len2 = strlen (ptr2); - } else if (ptr2 = getenv("USERNAME")) { + } else if ((ptr2 = getenv("USERNAME"))) { len1 = strlen (ptr1 = "/users/"); len2 = strlen (ptr2); } @@ -162,7 +162,7 @@ InitDefaults( */ if (dpy->xdefaults == NULL) { - char *slashDotXdefaults = "/.Xdefaults"; + const char *slashDotXdefaults = "/.Xdefaults"; (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaults) - 1); (void) strcat (fname, slashDotXdefaults); @@ -172,7 +172,7 @@ InitDefaults( } if (!(xenv = getenv ("XENVIRONMENT"))) { - char *slashDotXdefaultsDash = "/.Xdefaults-"; + const char *slashDotXdefaultsDash = "/.Xdefaults-"; int len; (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaultsDash) - 1); diff --git a/nx-X11/lib/X11/GetFPath.c b/nx-X11/lib/X11/GetFPath.c index 72ab74ed7..7d497c92e 100644 --- a/nx-X11/lib/X11/GetFPath.c +++ b/nx-X11/lib/X11/GetFPath.c @@ -29,9 +29,9 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -char **XGetFontPath(dpy, npaths) -register Display *dpy; -int *npaths; /* RETURN */ +char **XGetFontPath( + register Display *dpy, + int *npaths) /* RETURN */ { xGetFontPathReply rep; register long nbytes; @@ -81,8 +81,7 @@ int *npaths; /* RETURN */ } int -XFreeFontPath (list) -char **list; +XFreeFontPath (char **list) { if (list != NULL) { Xfree (list[0]-1); diff --git a/nx-X11/lib/X11/GetFProp.c b/nx-X11/lib/X11/GetFProp.c index 10b1b5c2e..78e69c941 100644 --- a/nx-X11/lib/X11/GetFProp.c +++ b/nx-X11/lib/X11/GetFProp.c @@ -29,11 +29,11 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Bool XGetFontProperty (fs, name, valuePtr) - XFontStruct *fs; - register Atom name; - unsigned long *valuePtr; - { +Bool XGetFontProperty ( + XFontStruct *fs, + register Atom name, + unsigned long *valuePtr) +{ /* XXX this is a simple linear search for now. If the protocol is changed to sort the property list, this should become a binary search. */ @@ -49,7 +49,4 @@ Bool XGetFontProperty (fs, name, valuePtr) return (0); } - - - diff --git a/nx-X11/lib/X11/GetGCVals.c b/nx-X11/lib/X11/GetGCVals.c index 5e7ed2334..4861739a6 100644 --- a/nx-X11/lib/X11/GetGCVals.c +++ b/nx-X11/lib/X11/GetGCVals.c @@ -43,11 +43,11 @@ in this Software without prior written authorization from The Open Group. GCArcMode) /*ARGSUSED*/ -Status XGetGCValues (dpy, gc, valuemask, values) - Display *dpy; - GC gc; - unsigned long valuemask; - XGCValues *values; +Status XGetGCValues ( + Display *dpy, + GC gc, + unsigned long valuemask, + XGCValues *values) { if (valuemask == ValidGCValuesBits) { char dashes = values->dashes; diff --git a/nx-X11/lib/X11/GetGeom.c b/nx-X11/lib/X11/GetGeom.c index 953deafe8..1e1249d81 100644 --- a/nx-X11/lib/X11/GetGeom.c +++ b/nx-X11/lib/X11/GetGeom.c @@ -29,12 +29,16 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XGetGeometry (dpy, d, root, x, y, width, height, borderWidth, depth) - register Display *dpy; - Drawable d; - Window *root; /* RETURN */ - int *x, *y; /* RETURN */ - unsigned int *width, *height, *borderWidth, *depth; /* RETURN */ +Status XGetGeometry ( + register Display *dpy, + Drawable d, + Window *root, /* RETURN */ + int *x, + int *y, /* RETURN */ + unsigned int *width, + unsigned int *height, + unsigned int *borderWidth, + unsigned int *depth) /* RETURN */ { xGetGeometryReply rep; register xResourceReq *req; diff --git a/nx-X11/lib/X11/GetHColor.c b/nx-X11/lib/X11/GetHColor.c index d824d021b..081a2248d 100644 --- a/nx-X11/lib/X11/GetHColor.c +++ b/nx-X11/lib/X11/GetHColor.c @@ -29,10 +29,10 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XAllocColor(dpy, cmap, def) -register Display *dpy; -Colormap cmap; -XColor *def; +Status XAllocColor( + register Display *dpy, + Colormap cmap, + XColor *def) { Status status; xAllocColorReply rep; diff --git a/nx-X11/lib/X11/GetHints.c b/nx-X11/lib/X11/GetHints.c index 6469d506d..1b522c8ef 100644 --- a/nx-X11/lib/X11/GetHints.c +++ b/nx-X11/lib/X11/GetHints.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -56,11 +56,11 @@ SOFTWARE. #include <nx-X11/Xatom.h> #include <stdio.h> -Status XGetSizeHints (dpy, w, hints, property) - Display *dpy; - Window w; - XSizeHints *hints; - Atom property; +Status XGetSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + Atom property) { xPropSizeHints *prop = NULL; Atom actual_type; @@ -97,15 +97,15 @@ Status XGetSizeHints (dpy, w, hints, property) return(1); } -/* +/* * must return a pointer to the hint, in malloc'd memory, or routine is not * extensible; any use of the caller's memory would cause things to be stepped * on. */ -XWMHints *XGetWMHints (dpy, w) - Display *dpy; - Window w; +XWMHints *XGetWMHints ( + Display *dpy, + Window w) { xPropWMHints *prop = NULL; register XWMHints *hints; @@ -113,7 +113,7 @@ XWMHints *XGetWMHints (dpy, w) int actual_format; unsigned long leftover; unsigned long nitems; - if (XGetWindowProperty(dpy, w, XA_WM_HINTS, + if (XGetWindowProperty(dpy, w, XA_WM_HINTS, 0L, (long)NumPropWMHintsElements, False, XA_WM_HINTS, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **)&prop) @@ -147,34 +147,34 @@ XWMHints *XGetWMHints (dpy, w) } Status -XGetZoomHints (dpy, w, zhints) - Display *dpy; - Window w; - XSizeHints *zhints; +XGetZoomHints ( + Display *dpy, + Window w, + XSizeHints *zhints) { return (XGetSizeHints(dpy, w, zhints, XA_WM_ZOOM_HINTS)); } Status -XGetNormalHints (dpy, w, hints) - Display *dpy; - Window w; - XSizeHints *hints; +XGetNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints) { return (XGetSizeHints(dpy, w, hints, XA_WM_NORMAL_HINTS)); } - + /* - * XGetIconSizes reads the property + * XGetIconSizes reads the property * ICONSIZE_ATOM type: ICONSIZE_ATOM format: 32 */ -Status XGetIconSizes (dpy, w, size_list, count) - Display *dpy; - Window w; /* typically, root */ - XIconSize **size_list; /* RETURN */ - int *count; /* RETURN number of items on the list */ +Status XGetIconSizes ( + Display *dpy, + Window w, /* typically, root */ + XIconSize **size_list, /* RETURN */ + int *count) /* RETURN number of items on the list */ { xPropIconSize *prop = NULL; register xPropIconSize *pp; @@ -203,7 +203,7 @@ Status XGetIconSizes (dpy, w, size_list, count) /* static copies not allowed in library, due to reentrancy constraint*/ nitems /= NumPropIconSizeElements; - if (! (hp = hints = (XIconSize *) + if (! (hp = hints = (XIconSize *) Xcalloc ((unsigned) nitems, (unsigned) sizeof(XIconSize)))) { if (prop) Xfree ((char *) prop); return 0; @@ -227,11 +227,11 @@ Status XGetIconSizes (dpy, w, size_list, count) } -Status XGetCommand (dpy, w, argvp, argcp) - Display *dpy; - Window w; - char ***argvp; - int *argcp; +Status XGetCommand ( + Display *dpy, + Window w, + char ***argvp, + int *argcp) { XTextProperty tp; int argc; @@ -267,10 +267,10 @@ Status XGetCommand (dpy, w, argvp, argcp) Status -XGetTransientForHint(dpy, w, propWindow) - Display *dpy; - Window w; - Window *propWindow; +XGetTransientForHint( + Display *dpy, + Window w, + Window *propWindow) { Atom actual_type; int actual_format; @@ -278,7 +278,7 @@ XGetTransientForHint(dpy, w, propWindow) unsigned long leftover; Window *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_TRANSIENT_FOR, 0L, 1L, False, - XA_WINDOW, + XA_WINDOW, &actual_type, &actual_format, &nitems, &leftover, (unsigned char **) &data) != Success) { @@ -297,10 +297,10 @@ XGetTransientForHint(dpy, w, propWindow) } Status -XGetClassHint(dpy, w, classhint) - Display *dpy; - Window w; - XClassHint *classhint; /* RETURN */ +XGetClassHint( + Display *dpy, + Window w, + XClassHint *classhint) /* RETURN */ { int len_name, len_class; @@ -310,11 +310,11 @@ XGetClassHint(dpy, w, classhint) unsigned long leftover; unsigned char *data = NULL; if (XGetWindowProperty(dpy, w, XA_WM_CLASS, 0L, (long)BUFSIZ, False, - XA_STRING, + XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) return (0); - + if ( (actual_type == XA_STRING) && (actual_format == 8) ) { len_name = strlen((char *) data); if (! (classhint->res_name = Xmalloc((unsigned) (len_name+1)))) { diff --git a/nx-X11/lib/X11/GetIFocus.c b/nx-X11/lib/X11/GetIFocus.c index e5f83160c..5d43ead4f 100644 --- a/nx-X11/lib/X11/GetIFocus.c +++ b/nx-X11/lib/X11/GetIFocus.c @@ -30,11 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGetInputFocus(dpy, focus, revert_to) - register Display *dpy; - Window *focus; - int *revert_to; -{ +XGetInputFocus( + register Display *dpy, + Window *focus, + int *revert_to) +{ xGetInputFocusReply rep; register xReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/GetImage.c b/nx-X11/lib/X11/GetImage.c index 44ca7b05f..ddd434a81 100644 --- a/nx-X11/lib/X11/GetImage.c +++ b/nx-X11/lib/X11/GetImage.c @@ -43,13 +43,15 @@ static unsigned int Ones( /* HACKMEM 169 */ return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); } -XImage *XGetImage (dpy, d, x, y, width, height, plane_mask, format) - register Display *dpy; - Drawable d; - int x, y; - unsigned int width, height; - unsigned long plane_mask; - int format; /* either XYPixmap or ZPixmap */ +XImage *XGetImage ( + register Display *dpy, + Drawable d, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned long plane_mask, + int format) /* either XYPixmap or ZPixmap */ { xGetImageReply rep; register xGetImageReq *req; @@ -68,14 +70,14 @@ XImage *XGetImage (dpy, d, x, y, width, height, plane_mask, format) req->height = height; req->planeMask = plane_mask; req->format = format; - + if (_XReply (dpy, (xReply *) &rep, 0, xFalse) == 0 || rep.length == 0) { UnlockDisplay(dpy); SyncHandle(); return (XImage *)NULL; } - + nbytes = (long)rep.length << 2; data = (char *) Xmalloc((unsigned) nbytes); if (! data) { @@ -102,23 +104,25 @@ XImage *XGetImage (dpy, d, x, y, width, height, plane_mask, format) return (image); } -XImage *XGetSubImage(dpy, d, x, y, width, height, plane_mask, format, - dest_image, dest_x, dest_y) - register Display *dpy; - Drawable d; - int x, y; - unsigned int width, height; - unsigned long plane_mask; - int format; /* either XYPixmap or ZPixmap */ - XImage *dest_image; - int dest_x, dest_y; +XImage *XGetSubImage( + register Display *dpy, + Drawable d, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned long plane_mask, + int format, /* either XYPixmap or ZPixmap */ + XImage *dest_image, + int dest_x, + int dest_y) { XImage *temp_image; - temp_image = XGetImage(dpy, d, x, y, width, height, + temp_image = XGetImage(dpy, d, x, y, width, height, plane_mask, format); if (!temp_image) return (XImage *)NULL; _XSetImage(temp_image, dest_image, dest_x, dest_y); XDestroyImage(temp_image); return (dest_image); -} +} diff --git a/nx-X11/lib/X11/GetKCnt.c b/nx-X11/lib/X11/GetKCnt.c index 3a1cee6f9..17f487fbe 100644 --- a/nx-X11/lib/X11/GetKCnt.c +++ b/nx-X11/lib/X11/GetKCnt.c @@ -30,15 +30,15 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGetKeyboardControl (dpy, state) - register Display *dpy; - register XKeyboardState *state; - { +XGetKeyboardControl ( + register Display *dpy, + register XKeyboardState *state) +{ xGetKeyboardControlReply rep; register xReq *req; LockDisplay(dpy); GetEmptyReq (GetKeyboardControl, req); - (void) _XReply (dpy, (xReply *) &rep, + (void) _XReply (dpy, (xReply *) &rep, (SIZEOF(xGetKeyboardControlReply) - SIZEOF(xReply)) >> 2, xTrue); state->key_click_percent = rep.keyClickPercent; diff --git a/nx-X11/lib/X11/GetMoEv.c b/nx-X11/lib/X11/GetMoEv.c index 8a9c25449..3db176feb 100644 --- a/nx-X11/lib/X11/GetMoEv.c +++ b/nx-X11/lib/X11/GetMoEv.c @@ -29,12 +29,13 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -XTimeCoord *XGetMotionEvents(dpy, w, start, stop, nEvents) - register Display *dpy; - Time start, stop; - Window w; - int *nEvents; /* RETURN */ -{ +XTimeCoord *XGetMotionEvents( + register Display *dpy, + Window w, + Time start, + Time stop, + int *nEvents) /* RETURN */ +{ xGetMotionEventsReply rep; register xGetMotionEventsReq *req; XTimeCoord *tc = NULL; @@ -50,10 +51,10 @@ XTimeCoord *XGetMotionEvents(dpy, w, start, stop, nEvents) SyncHandle(); return (NULL); } - + if (rep.nEvents) { if (! (tc = (XTimeCoord *) - Xmalloc( (unsigned) + Xmalloc( (unsigned) (nbytes = (long) rep.nEvents * sizeof(XTimeCoord))))) { _XEatData (dpy, (unsigned long) nbytes); UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/GetNrmHint.c b/nx-X11/lib/X11/GetNrmHint.c index 527c7cf3c..939d353b9 100644 --- a/nx-X11/lib/X11/GetNrmHint.c +++ b/nx-X11/lib/X11/GetNrmHint.c @@ -4,20 +4,20 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF -USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +software without specific, written prior permission. + +DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL DIGITAL OR WYSE BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ @@ -60,12 +60,12 @@ from The Open Group. #include <nx-X11/Xutil.h> #include <stdio.h> -Status XGetWMSizeHints (dpy, w, hints, supplied, property) - Display *dpy; - Window w; - XSizeHints *hints; - long *supplied; - Atom property; +Status XGetWMSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + long *supplied, + Atom property) { xPropSizeHints *prop = NULL; Atom actual_type; @@ -73,10 +73,10 @@ Status XGetWMSizeHints (dpy, w, hints, supplied, property) unsigned long leftover; unsigned long nitems; - if (XGetWindowProperty (dpy, w, property, 0L, + if (XGetWindowProperty (dpy, w, property, 0L, (long)NumPropSizeElements, False, XA_WM_SIZE_HINTS, &actual_type, - &actual_format, &nitems, &leftover, + &actual_format, &nitems, &leftover, (unsigned char **)&prop) != Success) return False; @@ -117,11 +117,11 @@ Status XGetWMSizeHints (dpy, w, hints, supplied, property) } -Status XGetWMNormalHints (dpy, w, hints, supplied) - Display *dpy; - Window w; - XSizeHints *hints; - long *supplied; +Status XGetWMNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints, + long *supplied) { return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS)); } diff --git a/nx-X11/lib/X11/GetPCnt.c b/nx-X11/lib/X11/GetPCnt.c index c30515112..2c35d210c 100644 --- a/nx-X11/lib/X11/GetPCnt.c +++ b/nx-X11/lib/X11/GetPCnt.c @@ -30,12 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGetPointerControl(dpy, accel_numer, accel_denom, threshold) - register Display *dpy; +XGetPointerControl( + register Display *dpy, /* the following are return only vars */ - int *accel_numer, *accel_denom; - int *threshold; -{ + int *accel_numer, + int *accel_denom, + int *threshold) +{ xGetPointerControlReply rep; xReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/GetPntMap.c b/nx-X11/lib/X11/GetPntMap.c index b8bd8cd66..0fcdb6696 100644 --- a/nx-X11/lib/X11/GetPntMap.c +++ b/nx-X11/lib/X11/GetPntMap.c @@ -35,10 +35,10 @@ in this Software without prior written authorization from The Open Group. #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) -int XGetPointerMapping (dpy, map, nmaps) - register Display *dpy; - unsigned char *map; /* RETURN */ - int nmaps; +int XGetPointerMapping ( + register Display *dpy, + unsigned char *map, /* RETURN */ + int nmaps) { unsigned char mapping[256]; /* known fixed size */ @@ -64,11 +64,11 @@ int XGetPointerMapping (dpy, map, nmaps) _XRead (dpy, (char *)mapping, nbytes); /* don't return more data than the user asked for. */ if (rep.nElts) { - memcpy ((char *) map, (char *) mapping, + memcpy ((char *) map, (char *) mapping, MIN((int)rep.nElts, nmaps) ); } - if (remainder) + if (remainder) _XEatData(dpy, (unsigned long)remainder); UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/GetProp.c b/nx-X11/lib/X11/GetProp.c index 80dd57c8e..a80c19c50 100644 --- a/nx-X11/lib/X11/GetProp.c +++ b/nx-X11/lib/X11/GetProp.c @@ -30,19 +30,19 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGetWindowProperty(dpy, w, property, offset, length, delete, - req_type, actual_type, actual_format, nitems, bytesafter, prop) - register Display *dpy; - Window w; - Atom property; - Bool delete; - Atom req_type; - Atom *actual_type; /* RETURN */ - int *actual_format; /* RETURN 8, 16, or 32 */ - long offset, length; - unsigned long *nitems; /* RETURN # of 8-, 16-, or 32-bit entities */ - unsigned long *bytesafter; /* RETURN */ - unsigned char **prop; /* RETURN */ +XGetWindowProperty( + register Display *dpy, + Window w, + Atom property, + long offset, + long length, + Bool delete, + Atom req_type, + Atom *actual_type, /* RETURN */ + int *actual_format, /* RETURN 8, 16, or 32 */ + unsigned long *nitems, /* RETURN # of 8-, 16-, or 32-bit entities */ + unsigned long *bytesafter, /* RETURN */ + unsigned char **prop) /* RETURN */ { xGetPropertyReply reply; register xGetPropertyReq *req; @@ -57,22 +57,22 @@ XGetWindowProperty(dpy, w, property, offset, length, delete, req->longOffset = offset; req->longLength = length; error.sequenceNumber = dpy->request; - + if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return (1); /* not Success */ - } + } *prop = (unsigned char *) NULL; if (reply.propertyType != None) { long nbytes, netbytes; switch (reply.format) { - /* + /* * One extra byte is malloced than is needed to contain the property - * data, but this last byte is null terminated and convenient for - * returning string properties, so the client doesn't then have to - * recopy the string to make it null terminated. + * data, but this last byte is null terminated and convenient for + * returning string properties, so the client doesn't then have to + * recopy the string to make it null terminated. */ case 8: nbytes = netbytes = reply.nItems; @@ -101,7 +101,7 @@ XGetWindowProperty(dpy, w, property, offset, length, delete, /* * This part of the code should never be reached. If it is, * the server sent back a property with an invalid format. - * This is a BadImplementation error. + * This is a BadImplementation error. */ { /* sequence number stored above */ diff --git a/nx-X11/lib/X11/GetRGBCMap.c b/nx-X11/lib/X11/GetRGBCMap.c index 7d1fb89e8..b58468bab 100644 --- a/nx-X11/lib/X11/GetRGBCMap.c +++ b/nx-X11/lib/X11/GetRGBCMap.c @@ -35,12 +35,12 @@ from The Open Group. #include "Xatomtype.h" #include <nx-X11/Xatom.h> -Status XGetRGBColormaps (dpy, w, stdcmap, count, property) - Display *dpy; - Window w; - XStandardColormap **stdcmap; /* RETURN */ - int *count; /* RETURN */ - Atom property; /* XA_RGB_BEST_MAP, etc. */ +Status XGetRGBColormaps ( + Display *dpy, + Window w, + XStandardColormap **stdcmap, /* RETURN */ + int *count, /* RETURN */ + Atom property) /* XA_RGB_BEST_MAP, etc. */ { register int i; /* iterator variable */ xPropStandardColormap *data = NULL; /* data read in from prop */ @@ -68,7 +68,7 @@ Status XGetRGBColormaps (dpy, w, stdcmap, count, property) } /* - * See how many properties were found; if pre-ICCCM then assume + * See how many properties were found; if pre-ICCCM then assume * default visual and a kill id of 1. */ if (nitems < NumPropStandardColormapElements) { @@ -85,7 +85,7 @@ Status XGetRGBColormaps (dpy, w, stdcmap, count, property) } } else { /* - * make sure we have an integral number of colormaps + * make sure we have an integral number of colormaps */ ncmaps = (nitems / NumPropStandardColormapElements); if ((((unsigned long) ncmaps) * NumPropStandardColormapElements) != @@ -95,7 +95,7 @@ Status XGetRGBColormaps (dpy, w, stdcmap, count, property) } } - + /* * allocate array */ diff --git a/nx-X11/lib/X11/GetSOwner.c b/nx-X11/lib/X11/GetSOwner.c index 00a4e2d1d..2258f8ce1 100644 --- a/nx-X11/lib/X11/GetSOwner.c +++ b/nx-X11/lib/X11/GetSOwner.c @@ -29,9 +29,9 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Window XGetSelectionOwner(dpy, selection) -register Display *dpy; -Atom selection; +Window XGetSelectionOwner( + register Display *dpy, + Atom selection) { xGetSelectionOwnerReply rep; register xResourceReq *req; diff --git a/nx-X11/lib/X11/GetSSaver.c b/nx-X11/lib/X11/GetSSaver.c index bdae436df..1aba3bb74 100644 --- a/nx-X11/lib/X11/GetSSaver.c +++ b/nx-X11/lib/X11/GetSSaver.c @@ -30,13 +30,15 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGetScreenSaver(dpy, timeout, interval, prefer_blanking, allow_exp) - register Display *dpy; +XGetScreenSaver( + register Display *dpy, /* the following are return only vars */ - int *timeout, *interval; - int *prefer_blanking, *allow_exp; /*boolean */ - -{ + int *timeout, + int *interval, + int *prefer_blanking, + int *allow_exp) /*boolean */ + +{ xGetScreenSaverReply rep; register xReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/GetStCmap.c b/nx-X11/lib/X11/GetStCmap.c index 2a5d9dd92..1ca6a0c70 100644 --- a/nx-X11/lib/X11/GetStCmap.c +++ b/nx-X11/lib/X11/GetStCmap.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -56,16 +56,16 @@ SOFTWARE. /* * WARNING - * + * * This is a pre-ICCCM routine. It must not reference any of the new fields * in the XStandardColormap structure. */ -Status XGetStandardColormap (dpy, w, cmap, property) - Display *dpy; - Window w; - XStandardColormap *cmap; - Atom property; /* XA_RGB_BEST_MAP, etc. */ +Status XGetStandardColormap ( + Display *dpy, + Window w, + XStandardColormap *cmap, + Atom property) /* XA_RGB_BEST_MAP, etc. */ { Status stat; /* return value */ XStandardColormap *stdcmaps; /* will get malloced value */ @@ -98,7 +98,7 @@ Status XGetStandardColormap (dpy, w, cmap, property) } else { use = stdcmaps; } - + /* * assign only those fields which were in the pre-ICCCM version */ diff --git a/nx-X11/lib/X11/GetTxtProp.c b/nx-X11/lib/X11/GetTxtProp.c index 1694107b8..2694b8184 100644 --- a/nx-X11/lib/X11/GetTxtProp.c +++ b/nx-X11/lib/X11/GetTxtProp.c @@ -3,13 +3,13 @@ Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Wyse not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -57,11 +57,11 @@ from The Open Group. #include <nx-X11/Xos.h> #include <stdio.h> -Status XGetTextProperty (display, window, tp, property) - Display *display; - Window window; - XTextProperty *tp; - Atom property; +Status XGetTextProperty ( + Display *display, + Window window, + XTextProperty *tp, + Atom property) { Atom actual_type; int actual_format = 0; @@ -87,26 +87,26 @@ Status XGetTextProperty (display, window, tp, property) return False; } -Status XGetWMName (dpy, w, tp) - Display *dpy; - Window w; - XTextProperty *tp; +Status XGetWMName ( + Display *dpy, + Window w, + XTextProperty *tp) { return (XGetTextProperty (dpy, w, tp, XA_WM_NAME)); } -Status XGetWMIconName (dpy, w, tp) - Display *dpy; - Window w; - XTextProperty *tp; +Status XGetWMIconName ( + Display *dpy, + Window w, + XTextProperty *tp) { return (XGetTextProperty (dpy, w, tp, XA_WM_ICON_NAME)); } -Status XGetWMClientMachine (dpy, w, tp) - Display *dpy; - Window w; - XTextProperty *tp; +Status XGetWMClientMachine ( + Display *dpy, + Window w, + XTextProperty *tp) { return (XGetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE)); } diff --git a/nx-X11/lib/X11/GetWMCMapW.c b/nx-X11/lib/X11/GetWMCMapW.c index 5a7d8acd8..04f98a8a8 100644 --- a/nx-X11/lib/X11/GetWMCMapW.c +++ b/nx-X11/lib/X11/GetWMCMapW.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -53,11 +53,11 @@ SOFTWARE. #include <nx-X11/Xatom.h> #include <stdio.h> -Status XGetWMColormapWindows (dpy, w, colormapWindows, countReturn) - Display *dpy; - Window w; - Window **colormapWindows; - int *countReturn; +Status XGetWMColormapWindows ( + Display *dpy, + Window w, + Window **colormapWindows, + int *countReturn) { Atom *data = NULL; Atom actual_type; diff --git a/nx-X11/lib/X11/GetWMProto.c b/nx-X11/lib/X11/GetWMProto.c index d0fe0b4f4..1303382fe 100644 --- a/nx-X11/lib/X11/GetWMProto.c +++ b/nx-X11/lib/X11/GetWMProto.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -53,11 +53,11 @@ SOFTWARE. #include <nx-X11/Xatom.h> #include <stdio.h> -Status XGetWMProtocols (dpy, w, protocols, countReturn) - Display *dpy; - Window w; - Atom **protocols; - int *countReturn; +Status XGetWMProtocols ( + Display *dpy, + Window w, + Atom **protocols, + int *countReturn) { Atom *data = NULL; Atom actual_type; diff --git a/nx-X11/lib/X11/GrButton.c b/nx-X11/lib/X11/GrButton.c index 6ad7e8ac6..621f49a5c 100644 --- a/nx-X11/lib/X11/GrButton.c +++ b/nx-X11/lib/X11/GrButton.c @@ -30,17 +30,17 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGrabButton(dpy, button, modifiers, grab_window, owner_events, event_mask, - pointer_mode, keyboard_mode, confine_to, curs) -register Display *dpy; -unsigned int modifiers; /* CARD16 */ -unsigned int button; /* CARD8 */ -Window grab_window; -Bool owner_events; -unsigned int event_mask; /* CARD16 */ -int pointer_mode, keyboard_mode; -Window confine_to; -Cursor curs; +XGrabButton( + register Display *dpy, + unsigned int button, /* CARD8 */ + unsigned int modifiers, /* CARD16 */ + Window grab_window, + Bool owner_events, + unsigned int event_mask, /* CARD16 */ + int pointer_mode, + int keyboard_mode, + Window confine_to, + Cursor curs) { register xGrabButtonReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/GrKey.c b/nx-X11/lib/X11/GrKey.c index 51c30c977..d2da5952f 100644 --- a/nx-X11/lib/X11/GrKey.c +++ b/nx-X11/lib/X11/GrKey.c @@ -30,14 +30,14 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGrabKey(dpy, key, modifiers, grab_window, owner_events, - pointer_mode, keyboard_mode) - register Display *dpy; - int key; - unsigned int modifiers; - Window grab_window; - Bool owner_events; - int pointer_mode, keyboard_mode; +XGrabKey( + register Display *dpy, + int key, + unsigned int modifiers, + Window grab_window, + Bool owner_events, + int pointer_mode, + int keyboard_mode) { register xGrabKeyReq *req; diff --git a/nx-X11/lib/X11/GrKeybd.c b/nx-X11/lib/X11/GrKeybd.c index 8b9802c58..07dc84115 100644 --- a/nx-X11/lib/X11/GrKeybd.c +++ b/nx-X11/lib/X11/GrKeybd.c @@ -28,12 +28,13 @@ in this Software without prior written authorization from The Open Group. #include <config.h> #endif #include "Xlibint.h" -int XGrabKeyboard (dpy, window, ownerEvents, pointerMode, keyboardMode, time) - register Display *dpy; - Window window; - Bool ownerEvents; - int pointerMode, keyboardMode; - Time time; +int XGrabKeyboard ( + register Display *dpy, + Window window, + Bool ownerEvents, + int pointerMode, + int keyboardMode, + Time time) { xGrabKeyboardReply rep; register xGrabKeyboardReq *req; @@ -47,7 +48,7 @@ int XGrabKeyboard (dpy, window, ownerEvents, pointerMode, keyboardMode, time) req->time = time; /* if we ever return, suppress the error */ - if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) + if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) rep.status = GrabSuccess; status = rep.status; UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/GrPointer.c b/nx-X11/lib/X11/GrPointer.c index 39435da0c..a0d98277c 100644 --- a/nx-X11/lib/X11/GrPointer.c +++ b/nx-X11/lib/X11/GrPointer.c @@ -29,16 +29,16 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -int XGrabPointer(dpy, grab_window, owner_events, event_mask, pointer_mode, - keyboard_mode, confine_to, curs, time) -register Display *dpy; -Window grab_window; -Bool owner_events; -unsigned int event_mask; /* CARD16 */ -int pointer_mode, keyboard_mode; -Window confine_to; -Cursor curs; -Time time; +int XGrabPointer( + register Display *dpy, + Window grab_window, + Bool owner_events, + unsigned int event_mask, /* CARD16 */ + int pointer_mode, + int keyboard_mode, + Window confine_to, + Cursor curs, + Time time) { xGrabPointerReply rep; register xGrabPointerReq *req; @@ -53,7 +53,7 @@ Time time; req->confineTo = confine_to; req->cursor = curs; req->time = time; - + /* if we ever return, suppress the error */ if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) rep.status = GrabSuccess; diff --git a/nx-X11/lib/X11/GrServer.c b/nx-X11/lib/X11/GrServer.c index 7dc177890..11d21e491 100644 --- a/nx-X11/lib/X11/GrServer.c +++ b/nx-X11/lib/X11/GrServer.c @@ -30,8 +30,7 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XGrabServer (dpy) -register Display *dpy; +XGrabServer (register Display *dpy) { register xReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/Host.c b/nx-X11/lib/X11/Host.c index b2ce07338..5df52505a 100644 --- a/nx-X11/lib/X11/Host.c +++ b/nx-X11/lib/X11/Host.c @@ -1,7 +1,6 @@ /* Copyright 1986, 1998 The Open Group -Copyright 2004 Sun Microsystems, Inc. All rights reserved. @@ -34,6 +33,30 @@ X Window System is a trademark of The Open Group. */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + /* this might be rightly regarded an os dependent file */ #ifdef HAVE_CONFIG_H @@ -48,14 +71,14 @@ changehost (Display *dpy, XHostAddress *host, BYTE mode) int length; XServerInterpretedAddress *siAddr; int addrlen; - + siAddr = host->family == FamilyServerInterpreted ? (XServerInterpretedAddress *)host->address : NULL; addrlen = siAddr ? siAddr->typelength + siAddr->valuelength + 1 : host->length; - - length = (addrlen + 3) & ~0x3; /* round up */ - + + length = (addrlen + 3) & ~0x3; /* round up */ + LockDisplay(dpy); GetReqExtra (ChangeHosts, length, req); if (!req) { @@ -84,7 +107,7 @@ XAddHost ( XHostAddress *host) { return changehost(dpy, host, HostInsert); -} + } int XRemoveHost ( diff --git a/nx-X11/lib/X11/Iconify.c b/nx-X11/lib/X11/Iconify.c index fbaef6af5..9e24c6b86 100644 --- a/nx-X11/lib/X11/Iconify.c +++ b/nx-X11/lib/X11/Iconify.c @@ -4,13 +4,13 @@ Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Wyse not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -62,10 +62,10 @@ from The Open Group. * This function instructs the window manager to change this window from * NormalState to IconicState. */ -Status XIconifyWindow (dpy, w, screen) - Display *dpy; - Window w; - int screen; +Status XIconifyWindow ( + Display *dpy, + Window w, + int screen) { XClientMessageEvent ev; Window root = RootWindow (dpy, screen); diff --git a/nx-X11/lib/X11/ImText.c b/nx-X11/lib/X11/ImText.c index 87cf22353..c12f26854 100644 --- a/nx-X11/lib/X11/ImText.c +++ b/nx-X11/lib/X11/ImText.c @@ -38,7 +38,7 @@ XDrawImageString( int y, _Xconst char *string, int length) -{ +{ register xImageText8Req *req; char *CharacterOffset = (char *)string; int FirstTimeThrough = True; @@ -47,7 +47,7 @@ XDrawImageString( LockDisplay(dpy); FlushGC(dpy, gc); - while (length > 0) + while (length > 0) { int Unit; diff --git a/nx-X11/lib/X11/ImText16.c b/nx-X11/lib/X11/ImText16.c index 60bd79f0e..b0b60710c 100644 --- a/nx-X11/lib/X11/ImText16.c +++ b/nx-X11/lib/X11/ImText16.c @@ -38,7 +38,7 @@ XDrawImageString16( int y, _Xconst XChar2b *string, int length) -{ +{ register xImageText16Req *req; XChar2b *CharacterOffset = (XChar2b *)string; int FirstTimeThrough = True; @@ -47,7 +47,7 @@ XDrawImageString16( LockDisplay(dpy); FlushGC(dpy, gc); - while (length > 0) + while (length > 0) { int Unit, Datalength; diff --git a/nx-X11/lib/X11/ImUtil.c b/nx-X11/lib/X11/ImUtil.c index dabe3d5b6..00b6f7db8 100644 --- a/nx-X11/lib/X11/ImUtil.c +++ b/nx-X11/lib/X11/ImUtil.c @@ -49,8 +49,8 @@ static int _XAddPixel(XImage *, long); static unsigned char const _lomask[0x09] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; static unsigned char const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00 }; -/* These two convenience routines return the scanline_pad and bits_per_pixel - associated with a specific depth of ZPixmap format image for a +/* These two convenience routines return the scanline_pad and bits_per_pixel + associated with a specific depth of ZPixmap format image for a display. */ int @@ -60,14 +60,14 @@ _XGetScanlinePad( { register ScreenFormat *fmt = dpy->pixmap_format; register int i; - + for (i = dpy->nformats + 1; --i; ++fmt) if (fmt->depth == depth) return(fmt->scanline_pad); - + return(dpy->bitmap_pad); } - + int _XGetBitsPerPixel( Display *dpy, @@ -75,7 +75,7 @@ _XGetBitsPerPixel( { register ScreenFormat *fmt = dpy->pixmap_format; register int i; - + for (i = dpy->nformats + 1; --i; ++fmt) if (fmt->depth == depth) return(fmt->bits_per_pixel); @@ -87,7 +87,7 @@ _XGetBitsPerPixel( return 16; return 32; } - + /* * This module provides rudimentary manipulation routines for image data @@ -111,7 +111,7 @@ _XGetBitsPerPixel( * * The logic contained in these routines makes several assumptions about * the image data structures, and at least for current implementations - * these assumptions are believed to be true. They are: + * these assumptions are believed to be true. They are: * * For all formats, bits_per_pixel is less than or equal to 32. * For XY formats, bitmap_unit is always less than or equal to bitmap_pad. @@ -211,31 +211,31 @@ static void _putbits( break; } numbits = numbits - dstoffset; - } + } } /* * Macros - * + * * The ROUNDUP macro rounds up a quantity to the specified boundary, * then truncates to bytes. * - * The XYNORMALIZE macro determines whether XY format data requires + * The XYNORMALIZE macro determines whether XY format data requires * normalization and calls a routine to do so if needed. The logic in - * this module is designed for LSBFirst byte and bit order, so + * this module is designed for LSBFirst byte and bit order, so * normalization is done as required to present the data in this order. * - * The ZNORMALIZE macro performs byte and nibble order normalization if + * The ZNORMALIZE macro performs byte and nibble order normalization if * required for Z format data. * * The XYINDEX macro computes the index to the starting byte (char) boundary * for a bitmap_unit containing a pixel with coordinates x and y for image * data in XY format. - * - * The ZINDEX macro computes the index to the starting byte (char) boundary + * + * The ZINDEX macro computes the index to the starting byte (char) boundary * for a pixel with coordinates x and y for image data in ZPixmap format. - * + * */ #if defined(Lynx) && defined(ROUNDUP) @@ -299,26 +299,25 @@ void _XInitImageFuncPtrs ( /* * CreateImage - * - * Allocates the memory necessary for an XImage data structure. - * Initializes the structure with "default" values and returns XImage. - * + * + * Allocates the memory necessary for an XImage data structure. + * Initializes the structure with "default" values and returns XImage. + * */ -XImage *XCreateImage (dpy, visual, depth, format, offset, data, width, height, - xpad, image_bytes_per_line) - register Display *dpy; - register Visual *visual; - unsigned int depth; - int format; - int offset; /*How many pixels from the start of the data does the +XImage *XCreateImage ( + register Display *dpy, + register Visual *visual, + unsigned int depth, + int format, + int offset, /*How many pixels from the start of the data does the picture to be transmitted start?*/ - char *data; - unsigned int width; - unsigned int height; - int xpad; - int image_bytes_per_line; + char *data, + unsigned int width, + unsigned int height, + int xpad, + int image_bytes_per_line) /*How many bytes between a pixel on one line and the pixel with the same X coordinate on the next line? 0 means XCreateImage can calculate it.*/ @@ -350,7 +349,7 @@ XImage *XCreateImage (dpy, visual, depth, format, offset, data, width, height, else { image->red_mask = image->green_mask = image->blue_mask = 0; } - if (format == ZPixmap) + if (format == ZPixmap) { bits_per_pixel = _XGetBitsPerPixel(dpy, (int) depth); } @@ -364,7 +363,7 @@ XImage *XCreateImage (dpy, visual, depth, format, offset, data, width, height, */ { if (format == ZPixmap) - min_bytes_per_line = + min_bytes_per_line = ROUNDUP((bits_per_pixel * width), image->bitmap_pad); else min_bytes_per_line = @@ -373,7 +372,7 @@ XImage *XCreateImage (dpy, visual, depth, format, offset, data, width, height, if (image_bytes_per_line == 0) { image->bytes_per_line = min_bytes_per_line; } else if (image_bytes_per_line < min_bytes_per_line) { - return 0; + return NULL; } else { image->bytes_per_line = image_bytes_per_line; } @@ -385,8 +384,7 @@ XImage *XCreateImage (dpy, visual, depth, format, offset, data, width, height, return image; } -Status XInitImage (image) - XImage *image; +Status XInitImage (XImage *image) { int min_bytes_per_line; @@ -407,7 +405,7 @@ Status XInitImage (image) * compute per line accelerator. */ if (image->format == ZPixmap) - min_bytes_per_line = + min_bytes_per_line = ROUNDUP((image->bits_per_pixel * image->width), image->bitmap_pad); else @@ -427,15 +425,13 @@ Status XInitImage (image) /* * _DestroyImage - * - * Deallocates the memory associated with the ximage data structure. + * + * Deallocates the memory associated with the ximage data structure. * this version handles the case of the image data being malloc'd * entirely by the library. */ -static int _XDestroyImage (ximage) - XImage *ximage; - +static int _XDestroyImage (XImage *ximage) { if (ximage->data != NULL) Xfree((char *)ximage->data); if (ximage->obdata != NULL) Xfree((char *)ximage->obdata); @@ -446,8 +442,8 @@ static int _XDestroyImage (ximage) /* * GetPixel - * - * Returns the specified pixel. The X and Y coordinates are relative to + * + * Returns the specified pixel. The X and Y coordinates are relative to * the origin (upper left [0,0]) of the image. The pixel value is returned * in normalized format, i.e. the LSB of the long is the LSB of the pixel. * The algorithm used is: @@ -470,10 +466,10 @@ static unsigned long const low_bits_table[] = { 0xffffffff }; -static unsigned long _XGetPixel (ximage, x, y) - register XImage *ximage; - int x; - int y; +static unsigned long _XGetPixel ( + register XImage *ximage, + int x, + int y) { unsigned long pixel, px; @@ -482,7 +478,7 @@ static unsigned long _XGetPixel (ximage, x, y) register int i, j; int bits, nbytes; long plane; - + if ((ximage->bits_per_pixel | ximage->depth) == 1) { src = &ximage->data[XYINDEX(x, y, ximage)]; dst = (char *)&pixel; @@ -511,7 +507,7 @@ static unsigned long _XGetPixel (ximage, x, y) dst = (char *)&px; px = 0; for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; ) - *dst++ = *src++; + *dst++ = *src++; ZNORMALIZE(&px, ximage); pixel = 0; for (i=sizeof(unsigned long); --i >= 0; ) @@ -533,10 +529,10 @@ static unsigned long _XGetPixel (ximage, x, y) static CARD32 const byteorderpixel = MSBFirst << 24; -static unsigned long _XGetPixel32 (ximage, x, y) - register XImage *ximage; - int x; - int y; +static unsigned long _XGetPixel32 ( + register XImage *ximage, + int x, + int y) { register unsigned char *addr; unsigned long pixel; @@ -566,10 +562,10 @@ static unsigned long _XGetPixel32 (ximage, x, y) } } -static unsigned long _XGetPixel16 (ximage, x, y) - register XImage *ximage; - int x; - int y; +static unsigned long _XGetPixel16 ( + register XImage *ximage, + int x, + int y) { register unsigned char *addr; unsigned long pixel; @@ -590,10 +586,10 @@ static unsigned long _XGetPixel16 (ximage, x, y) } } -static unsigned long _XGetPixel8 (ximage, x, y) - register XImage *ximage; - int x; - int y; +static unsigned long _XGetPixel8 ( + register XImage *ximage, + int x, + int y) { unsigned char pixel; @@ -609,10 +605,10 @@ static unsigned long _XGetPixel8 (ximage, x, y) } } -static unsigned long _XGetPixel1 (ximage, x, y) - register XImage *ximage; - int x; - int y; +static unsigned long _XGetPixel1 ( + register XImage *ximage, + int x, + int y) { unsigned char bit; int xoff, yoff; @@ -632,11 +628,11 @@ static unsigned long _XGetPixel1 (ximage, x, y) return XGetPixel(ximage, x, y); } } - + /* * PutPixel - * - * Overwrites the specified pixel. The X and Y coordinates are relative to + * + * Overwrites the specified pixel. The X and Y coordinates are relative to * the origin (upper left [0,0]) of the image. The input pixel value must be * in normalized format, i.e. the LSB of the long is the LSB of the pixel. * The algorithm used is: @@ -649,11 +645,11 @@ static unsigned long _XGetPixel1 (ximage, x, y) * */ -static int _XPutPixel (ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +static int _XPutPixel ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned long px, npixel; @@ -709,8 +705,8 @@ static int _XPutPixel (ximage, x, y, pixel) nbytes = (ximage->bits_per_pixel + 7) >> 3; for (i = nbytes; --i >= 0; ) *dst++ = *src++; ZNORMALIZE(&px, ximage); - _putbits ((char *)&pixel, - (x * ximage->bits_per_pixel) & 7, + _putbits ((char *)&pixel, + (x * ximage->bits_per_pixel) & 7, ximage->bits_per_pixel, (char *)&px); ZNORMALIZE(&px, ximage); src = (char *)&px; @@ -722,11 +718,11 @@ static int _XPutPixel (ximage, x, y, pixel) return 1; } -static int _XPutPixel32 (ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +static int _XPutPixel32 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -754,11 +750,11 @@ static int _XPutPixel32 (ximage, x, y, pixel) } } -static int _XPutPixel16 (ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +static int _XPutPixel16 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char *addr; @@ -779,11 +775,11 @@ static int _XPutPixel16 (ximage, x, y, pixel) } } -static int _XPutPixel8 (ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +static int _XPutPixel8 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { ximage->data[y * ximage->bytes_per_line + x] = pixel; @@ -794,11 +790,11 @@ static int _XPutPixel8 (ximage, x, y, pixel) } } -static int _XPutPixel1 (ximage, x, y, pixel) - register XImage *ximage; - int x; - int y; - unsigned long pixel; +static int _XPutPixel1 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) { unsigned char bit; int xoff, yoff; @@ -825,20 +821,20 @@ static int _XPutPixel1 (ximage, x, y, pixel) /* * SubImage - * + * * Creates a new image that is a subsection of an existing one. - * Allocates the memory necessary for the new XImage data structure. + * Allocates the memory necessary for the new XImage data structure. * Pointer to new image is returned. The algorithm used is repetitive * calls to get and put pixel. * */ -static XImage *_XSubImage (ximage, x, y, width, height) - XImage *ximage; - register int x; /* starting x coordinate in existing image */ - register int y; /* starting y coordinate in existing image */ - unsigned int width; /* width in pixels of new subimage */ - unsigned int height;/* height in pixels of new subimage */ +static XImage *_XSubImage ( + XImage *ximage, + register int x, /* starting x coordinate in existing image */ + register int y, /* starting y coordinate in existing image */ + unsigned int width, /* width in pixels of new subimage */ + unsigned int height)/* height in pixels of new subimage */ { register XImage *subimage; @@ -862,8 +858,8 @@ static XImage *_XSubImage (ximage, x, y, width, height) /* * compute per line accelerator. */ - if (subimage->format == ZPixmap) - subimage->bytes_per_line = + if (subimage->format == ZPixmap) + subimage->bytes_per_line = ROUNDUP(subimage->bits_per_pixel * width, subimage->bitmap_pad); else @@ -900,7 +896,7 @@ static XImage *_XSubImage (ximage, x, y, width, height) /* * SetImage - * + * * Overwrites a section of one image with all of the data from another. * If the two images are not of the same format (i.e. XYPixmap and ZPixmap), * the image data is converted to the destination format. The following @@ -915,7 +911,7 @@ static XImage *_XSubImage (ximage, x, y, width, height) * 3. If the width of the source image is too large to fit between * the specified x starting point and the end of the scanline, * then pixels are truncated on the right. - * + * * The images need not have the same bitmap_bit_order, byte_order, * bitmap_unit, bits_per_pixel, bitmap_pad, or xoffset. * @@ -959,15 +955,15 @@ int _XSetImage( /* * AddPixel - * + * * Adds a constant value to every pixel in a pixmap. * */ static int -_XAddPixel (ximage, value) - register XImage *ximage; - register long value; +_XAddPixel ( + register XImage *ximage, + register long value) { register int x; register int y; diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile index d5f8026d5..8a4ed3542 100644 --- a/nx-X11/lib/X11/Imakefile +++ b/nx-X11/lib/X11/Imakefile @@ -90,6 +90,12 @@ NX_XCOMPEXTCONFIGTARGET = $(NX_XCOMPEXTLIBDIR)/config.status SUBDIRS = xlibi18n #endif +/* + FIXME: This is switchable upstream via configure option, we leave it + on for now as this is the upstream default. +*/ +XCMS_DEFINES = -DXCMS + #include <Threads.tmpl> #ifndef MotifBC @@ -187,7 +193,7 @@ XCURSOR_DEFINES = -DUSE_DYNAMIC_XCURSOR -DLIBXCURSOR=\"libXcursor.so.$(SOXCURSOR POSTLOCALELIBDEFINES = -DPOSTLOCALELIBDIR=\"$(POSTLOCALELIBDIR)\" #endif DEFINES = $(MALLOC_DEFINES) $(LIB_DEFINES) $(MISC_DEFINES)\ - $(POSTLOCALELIBDEFINES) $(NX_INCLUDES) $(NX_DEFINES) + $(POSTLOCALELIBDEFINES) $(NX_INCLUDES) $(NX_DEFINES) ${XCMS_DEFINES} OPEN_DEFINES = -I$(EXTINCSRC) $(K5INCL) $(K5DEFS) DEPEND_DEFINES = $(OPEN_DEFINES) $(TRANS_INCLUDES) $(CONN_DEFINES) $(THREADS_DEFINES) DependDefines AUTHOBJS = AuDispose.o AuGetBest.o AuFileName.o AuRead.o diff --git a/nx-X11/lib/X11/InitExt.c b/nx-X11/lib/X11/InitExt.c index 51971970a..21c392c0e 100644 --- a/nx-X11/lib/X11/InitExt.c +++ b/nx-X11/lib/X11/InitExt.c @@ -44,7 +44,7 @@ XExtCodes *XInitExtension ( { XExtCodes codes; /* temp. place for extension information. */ register _XExtension *ext;/* need a place to build it all */ - if (!XQueryExtension(dpy, name, + if (!XQueryExtension(dpy, name, &codes.major_opcode, &codes.first_event, &codes.first_error)) return (NULL); @@ -59,7 +59,7 @@ XExtCodes *XInitExtension ( ext->codes = codes; (void) strcpy(ext->name, name); - /* chain it onto the display list */ + /* chain it onto the display list */ ext->next = dpy->ext_procs; dpy->ext_procs = ext; UnlockDisplay (dpy); @@ -67,8 +67,7 @@ XExtCodes *XInitExtension ( return (&ext->codes); /* tell him which extension */ } -XExtCodes *XAddExtension (dpy) - Display *dpy; +XExtCodes *XAddExtension (Display *dpy) { register _XExtension *ext; @@ -97,25 +96,24 @@ static _XExtension *XLookupExtension ( return (NULL); } -XExtData **XEHeadOfExtensionList(object) - XEDataObject object; +XExtData **XEHeadOfExtensionList(XEDataObject object) { return *(XExtData ***)&object; } int -XAddToExtensionList(structure, ext_data) - XExtData **structure; - XExtData *ext_data; +XAddToExtensionList( + XExtData **structure, + XExtData *ext_data) { ext_data->next = *structure; *structure = ext_data; return 1; } -XExtData *XFindOnExtensionList(structure, number) - XExtData **structure; - int number; +XExtData *XFindOnExtensionList( + XExtData **structure, + int number) { XExtData *ext; @@ -128,10 +126,10 @@ XExtData *XFindOnExtensionList(structure, number) /* * Routines to hang procs on the extension structure. */ -CreateGCType XESetCreateGC(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - CreateGCType proc; /* routine to call when GC created */ +CreateGCType XESetCreateGC( + Display *dpy, /* display */ + int extension, /* extension number */ + CreateGCType proc) /* routine to call when GC created */ { register _XExtension *e; /* for lookup of extension */ register CreateGCType oldproc; @@ -143,10 +141,10 @@ CreateGCType XESetCreateGC(dpy, extension, proc) return (CreateGCType)oldproc; } -CopyGCType XESetCopyGC(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - CopyGCType proc; /* routine to call when GC copied */ +CopyGCType XESetCopyGC( + Display *dpy, /* display */ + int extension, /* extension number */ + CopyGCType proc) /* routine to call when GC copied */ { register _XExtension *e; /* for lookup of extension */ register CopyGCType oldproc; @@ -158,10 +156,10 @@ CopyGCType XESetCopyGC(dpy, extension, proc) return (CopyGCType)oldproc; } -FlushGCType XESetFlushGC(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - FlushGCType proc; /* routine to call when GC copied */ +FlushGCType XESetFlushGC( + Display *dpy, /* display */ + int extension, /* extension number */ + FlushGCType proc) /* routine to call when GC copied */ { register _XExtension *e; /* for lookup of extension */ register FlushGCType oldproc; @@ -173,10 +171,10 @@ FlushGCType XESetFlushGC(dpy, extension, proc) return (FlushGCType)oldproc; } -FreeGCType XESetFreeGC(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - FreeGCType proc; /* routine to call when GC freed */ +FreeGCType XESetFreeGC( + Display *dpy, /* display */ + int extension, /* extension number */ + FreeGCType proc) /* routine to call when GC freed */ { register _XExtension *e; /* for lookup of extension */ register FreeGCType oldproc; @@ -188,10 +186,10 @@ FreeGCType XESetFreeGC(dpy, extension, proc) return (FreeGCType)oldproc; } -CreateFontType XESetCreateFont(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - CreateFontType proc; /* routine to call when font created */ +CreateFontType XESetCreateFont( + Display *dpy, /* display */ + int extension, /* extension number */ + CreateFontType proc) /* routine to call when font created */ { register _XExtension *e; /* for lookup of extension */ register CreateFontType oldproc; @@ -203,10 +201,10 @@ CreateFontType XESetCreateFont(dpy, extension, proc) return (CreateFontType)oldproc; } -FreeFontType XESetFreeFont(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - FreeFontType proc; /* routine to call when font freed */ +FreeFontType XESetFreeFont( + Display *dpy, /* display */ + int extension, /* extension number */ + FreeFontType proc) /* routine to call when font freed */ { register _XExtension *e; /* for lookup of extension */ register FreeFontType oldproc; @@ -218,10 +216,10 @@ FreeFontType XESetFreeFont(dpy, extension, proc) return (FreeFontType)oldproc; } -CloseDisplayType XESetCloseDisplay(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - CloseDisplayType proc; /* routine to call when display closed */ +CloseDisplayType XESetCloseDisplay( + Display *dpy, /* display */ + int extension, /* extension number */ + CloseDisplayType proc) /* routine to call when display closed */ { register _XExtension *e; /* for lookup of extension */ register CloseDisplayType oldproc; @@ -239,10 +237,10 @@ typedef Bool (*WireToEventType) ( xEvent* /* event */ ); -WireToEventType XESetWireToEvent(dpy, event_number, proc) - Display *dpy; /* display */ - WireToEventType proc; /* routine to call when converting event */ - int event_number; /* event routine to replace */ +WireToEventType XESetWireToEvent( + Display *dpy, /* display */ + int event_number, /* event routine to replace */ + WireToEventType proc) /* routine to call when converting event */ { register WireToEventType oldproc; if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent; @@ -253,16 +251,59 @@ WireToEventType XESetWireToEvent(dpy, event_number, proc) return (WireToEventType)oldproc; } +typedef Bool (*WireToEventCookieType) ( + Display* /* display */, + XGenericEventCookie* /* re */, + xEvent* /* event */ +); + +WireToEventCookieType XESetWireToEventCookie( + Display *dpy, /* display */ + int extension, /* extension major opcode */ + WireToEventCookieType proc /* routine to call for generic events */ + ) +{ + WireToEventCookieType oldproc; + if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie; + LockDisplay (dpy); + oldproc = dpy->generic_event_vec[extension & 0x7F]; + dpy->generic_event_vec[extension & 0x7F] = proc; + UnlockDisplay (dpy); + return (WireToEventCookieType)oldproc; +} + +typedef Bool (*CopyEventCookieType) ( + Display* /* display */, + XGenericEventCookie* /* in */, + XGenericEventCookie* /* out */ +); + +CopyEventCookieType XESetCopyEventCookie( + Display *dpy, /* display */ + int extension, /* extension major opcode */ + CopyEventCookieType proc /* routine to copy generic events */ + ) +{ + CopyEventCookieType oldproc; + if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie; + LockDisplay (dpy); + oldproc = dpy->generic_event_copy_vec[extension & 0x7F]; + dpy->generic_event_copy_vec[extension & 0x7F] = proc; + UnlockDisplay (dpy); + return (CopyEventCookieType)oldproc; +} + + typedef Status (*EventToWireType) ( Display* /* display */, XEvent* /* re */, xEvent* /* event */ ); -EventToWireType XESetEventToWire(dpy, event_number, proc) - Display *dpy; /* display */ - EventToWireType proc; /* routine to call when converting event */ - int event_number; /* event routine to replace */ +EventToWireType XESetEventToWire( + Display *dpy, /* display */ + int event_number, /* event routine to replace */ + EventToWireType proc) /* routine to call when converting event */ { register EventToWireType oldproc; if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent; @@ -279,10 +320,10 @@ typedef Bool (*WireToErrorType) ( xError* /* we */ ); -WireToErrorType XESetWireToError(dpy, error_number, proc) - Display *dpy; /* display */ - WireToErrorType proc; /* routine to call when converting error */ - int error_number; /* error routine to replace */ +WireToErrorType XESetWireToError( + Display *dpy, /* display */ + int error_number, /* error routine to replace */ + WireToErrorType proc) /* routine to call when converting error */ { register WireToErrorType oldproc = NULL; if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError; @@ -301,10 +342,10 @@ WireToErrorType XESetWireToError(dpy, error_number, proc) return (WireToErrorType)oldproc; } -ErrorType XESetError(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - ErrorType proc; /* routine to call when X error happens */ +ErrorType XESetError( + Display *dpy, /* display */ + int extension, /* extension number */ + ErrorType proc) /* routine to call when X error happens */ { register _XExtension *e; /* for lookup of extension */ register ErrorType oldproc; @@ -316,10 +357,10 @@ ErrorType XESetError(dpy, extension, proc) return (ErrorType)oldproc; } -ErrorStringType XESetErrorString(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - ErrorStringType proc; /* routine to call when I/O error happens */ +ErrorStringType XESetErrorString( + Display *dpy, /* display */ + int extension, /* extension number */ + ErrorStringType proc) /* routine to call when I/O error happens */ { register _XExtension *e; /* for lookup of extension */ register ErrorStringType oldproc; @@ -331,10 +372,10 @@ ErrorStringType XESetErrorString(dpy, extension, proc) return (ErrorStringType)oldproc; } -PrintErrorType XESetPrintErrorValues(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - PrintErrorType proc; /* routine to call to print */ +PrintErrorType XESetPrintErrorValues( + Display *dpy, /* display */ + int extension, /* extension number */ + PrintErrorType proc) /* routine to call to print */ { register _XExtension *e; /* for lookup of extension */ register PrintErrorType oldproc; @@ -346,10 +387,10 @@ PrintErrorType XESetPrintErrorValues(dpy, extension, proc) return (PrintErrorType)oldproc; } -BeforeFlushType XESetBeforeFlush(dpy, extension, proc) - Display *dpy; /* display */ - int extension; /* extension number */ - BeforeFlushType proc; /* routine to call on flush */ +BeforeFlushType XESetBeforeFlush( + Display *dpy, /* display */ + int extension, /* extension number */ + BeforeFlushType proc) /* routine to call on flush */ { register _XExtension *e; /* for lookup of extension */ register BeforeFlushType oldproc; @@ -363,7 +404,7 @@ BeforeFlushType XESetBeforeFlush(dpy, extension, proc) if (!ext) { e->next_flush = dpy->flushes; dpy->flushes = e; - } + } UnlockDisplay(dpy); return (BeforeFlushType)oldproc; } diff --git a/nx-X11/lib/X11/InsCmap.c b/nx-X11/lib/X11/InsCmap.c index 17e2c125f..735ab080e 100644 --- a/nx-X11/lib/X11/InsCmap.c +++ b/nx-X11/lib/X11/InsCmap.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XInstallColormap(dpy, cmap) -register Display *dpy; -Colormap cmap; +XInstallColormap( + register Display *dpy, + Colormap cmap) { register xResourceReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/IntAtom.c b/nx-X11/lib/X11/IntAtom.c index a1f9f7f14..7a5625840 100644 --- a/nx-X11/lib/X11/IntAtom.c +++ b/nx-X11/lib/X11/IntAtom.c @@ -37,8 +37,7 @@ from The Open Group. #define REHASH(idx,rehash) ((idx + rehash) & (TABLESIZE-1)) void -_XFreeAtomTable(dpy) - Display *dpy; +_XFreeAtomTable(Display *dpy) { register Entry *table; register int i; @@ -113,13 +112,13 @@ nomatch: if (idx == firstidx) } void -_XUpdateAtomCache(dpy, name, atom, sig, idx, n) - Display *dpy; - const char *name; - Atom atom; - unsigned long sig; - int idx; - int n; +_XUpdateAtomCache( + Display *dpy, + const char *name, + Atom atom, + unsigned long sig, + int idx, + int n) { Entry e, oe; register char *s1; @@ -238,12 +237,12 @@ Bool _XIntAtomHandler( } Status -XInternAtoms (dpy, names, count, onlyIfExists, atoms_return) - Display *dpy; - char **names; - int count; - Bool onlyIfExists; - Atom *atoms_return; +XInternAtoms ( + Display *dpy, + char **names, + int count, + Bool onlyIfExists, + Atom *atoms_return) { int i, idx, n, tidx; unsigned long sig; @@ -283,7 +282,7 @@ XInternAtoms (dpy, names, count, onlyIfExists, atoms_return) } if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { if ((atoms_return[missed] = rep.atom)) - _XUpdateAtomCache(dpy, names[missed], (Atom) rep.atom, + _XUpdateAtomCache(dpy, names[missed], (Atom) rep.atom, sig, idx, n); } else { atoms_return[missed] = None; diff --git a/nx-X11/lib/X11/Key.h b/nx-X11/lib/X11/Key.h index a0ca795d9..0fe89ba37 100644 --- a/nx-X11/lib/X11/Key.h +++ b/nx-X11/lib/X11/Key.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifndef _KEY_H_ #define _KEY_H_ diff --git a/nx-X11/lib/X11/KeyBind.c b/nx-X11/lib/X11/KeyBind.c index 866d296b2..c7f17c4da 100644 --- a/nx-X11/lib/X11/KeyBind.c +++ b/nx-X11/lib/X11/KeyBind.c @@ -1,4 +1,4 @@ -/* +/* Copyright 1985, 1987, 1998 The Open Group @@ -133,9 +133,9 @@ XKeycodeToKeysym(Display *dpy, } KeyCode -XKeysymToKeycode(dpy, ks) - Display *dpy; - KeySym ks; +XKeysymToKeycode( + Display *dpy, + KeySym ks) { register int i, j; @@ -151,9 +151,9 @@ XKeysymToKeycode(dpy, ks) } KeySym -XLookupKeysym(event, col) - register XKeyEvent *event; - int col; +XLookupKeysym( + register XKeyEvent *event, + int col) { if ((! event->display->keysyms) && (! _XKeyInitialize(event->display))) return NoSymbol; @@ -229,8 +229,7 @@ InitModMap( } int -XRefreshKeyboardMapping(event) - register XMappingEvent *event; +XRefreshKeyboardMapping(register XMappingEvent *event) { if(event->request == MappingKeyboard) { @@ -265,7 +264,7 @@ _XKeyInitialize( int per, n; KeySym *keysyms; - /* + /* * lets go get the keysyms from the server. */ if (!dpy->keysyms) { @@ -338,35 +337,35 @@ UCSConvertCase( register unsigned code, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C6, 0x01C6, 0x01C6, 0x01C9, 0x01C9, 0x01C9, 0x01CC, 0x01CC, 0x01CC }; - + static unsigned short const Greek_upper_mapping[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, - 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, + 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x0386, 0x0387, - 0x0388, 0x0389, 0x038A, 0x0000, 0x038C, 0x0000, 0x038E, 0x038F, + 0x0388, 0x0389, 0x038A, 0x0000, 0x038C, 0x0000, 0x038E, 0x038F, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x0386, 0x0388, 0x0389, 0x038A, - 0x03B0, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x03A3, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03B0, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x03A3, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x038C, 0x038E, 0x038F, 0x0000, - 0x0392, 0x0398, 0x03D2, 0x03D3, 0x03D4, 0x03A6, 0x03A0, 0x03D7, - 0x03D8, 0x03D8, 0x03DA, 0x03DA, 0x03DC, 0x03DC, 0x03DE, 0x03DE, - 0x03E0, 0x03E0, 0x03E2, 0x03E2, 0x03E4, 0x03E4, 0x03E6, 0x03E6, + 0x0392, 0x0398, 0x03D2, 0x03D3, 0x03D4, 0x03A6, 0x03A0, 0x03D7, + 0x03D8, 0x03D8, 0x03DA, 0x03DA, 0x03DC, 0x03DC, 0x03DE, 0x03DE, + 0x03E0, 0x03E0, 0x03E2, 0x03E2, 0x03E4, 0x03E4, 0x03E6, 0x03E6, 0x03E8, 0x03E8, 0x03EA, 0x03EA, 0x03EC, 0x03EC, 0x03EE, 0x03EE, - 0x039A, 0x03A1, 0x03F9, 0x03F3, 0x03F4, 0x0395, 0x03F6, 0x03F7, + 0x039A, 0x03A1, 0x03F9, 0x03F3, 0x03F4, 0x0395, 0x03F6, 0x03F7, 0x03F7, 0x03F9, 0x03FA, 0x03FA, 0x0000, 0x0000, 0x0000, 0x0000 }; static unsigned short const Greek_lower_mapping[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x03AC, 0x0387, 0x03AD, 0x03AE, 0x03AF, 0x0000, 0x03CC, 0x0000, 0x03CD, 0x03CE, 0x0390, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x0000, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, @@ -383,71 +382,71 @@ UCSConvertCase( register unsigned code, static unsigned short const GreekExt_lower_mapping[] = { 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, - 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, + 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, - 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, - 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, - 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, - 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, + 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, + 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, + 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, + 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, - 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, - 0x0000, 0x1F51, 0x0000, 0x1F53, 0x0000, 0x1F55, 0x0000, 0x1F57, - 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, - 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, - 0x1F70, 0x1F71, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1F76, 0x1F77, + 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, + 0x0000, 0x1F51, 0x0000, 0x1F53, 0x0000, 0x1F55, 0x0000, 0x1F57, + 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, + 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, + 0x1F70, 0x1F71, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1F76, 0x1F77, 0x1F78, 0x1F79, 0x1F7A, 0x1F7B, 0x1F7C, 0x1F7D, 0x0000, 0x0000, - 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, - 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, - 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, - 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, - 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, - 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, - 0x1FB0, 0x1FB1, 0x1FB2, 0x1FB3, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, - 0x1FB0, 0x1FB1, 0x1F70, 0x1F71, 0x1FB3, 0x1FBD, 0x1FBE, 0x1FBF, - 0x1FC0, 0x1FC1, 0x1FC2, 0x1FC3, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, - 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1FC3, 0x1FCD, 0x1FCE, 0x1FCF, - 0x1FD0, 0x1FD1, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, - 0x1FD0, 0x1FD1, 0x1F76, 0x1F77, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, + 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, + 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, + 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, + 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, + 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, + 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, + 0x1FB0, 0x1FB1, 0x1FB2, 0x1FB3, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, + 0x1FB0, 0x1FB1, 0x1F70, 0x1F71, 0x1FB3, 0x1FBD, 0x1FBE, 0x1FBF, + 0x1FC0, 0x1FC1, 0x1FC2, 0x1FC3, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, + 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1FC3, 0x1FCD, 0x1FCE, 0x1FCF, + 0x1FD0, 0x1FD1, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, + 0x1FD0, 0x1FD1, 0x1F76, 0x1F77, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, 0x1FE0, 0x1FE1, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FE5, 0x1FE6, 0x1FE7, - 0x1FE0, 0x1FE1, 0x1F7A, 0x1F7B, 0x1FE5, 0x1FED, 0x1FEE, 0x1FEF, - 0x0000, 0x0000, 0x1FF2, 0x1FF3, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, + 0x1FE0, 0x1FE1, 0x1F7A, 0x1F7B, 0x1FE5, 0x1FED, 0x1FEE, 0x1FEF, + 0x0000, 0x0000, 0x1FF2, 0x1FF3, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, 0x1F78, 0x1F79, 0x1F7C, 0x1F7D, 0x1FF3, 0x1FFD, 0x1FFE, 0x0000 }; static unsigned short const GreekExt_upper_mapping[] = { - 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, - 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, + 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, + 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, - 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, - 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, - 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, - 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, + 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, + 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, + 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, + 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, - 0x1F50, 0x1F59, 0x1F52, 0x1F5B, 0x1F54, 0x1F5D, 0x1F56, 0x1F5F, - 0x0000, 0x1F59, 0x0000, 0x1F5B, 0x0000, 0x1F5D, 0x0000, 0x1F5F, - 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, - 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, - 0x1FBA, 0x1FBB, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FDA, 0x1FDB, + 0x1F50, 0x1F59, 0x1F52, 0x1F5B, 0x1F54, 0x1F5D, 0x1F56, 0x1F5F, + 0x0000, 0x1F59, 0x0000, 0x1F5B, 0x0000, 0x1F5D, 0x0000, 0x1F5F, + 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, + 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, + 0x1FBA, 0x1FBB, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FDA, 0x1FDB, 0x1FF8, 0x1FF9, 0x1FEA, 0x1FEB, 0x1FFA, 0x1FFB, 0x0000, 0x0000, - 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, - 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, - 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, - 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, - 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, - 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, - 0x1FB8, 0x1FB9, 0x1FB2, 0x1FBC, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, - 0x1FB8, 0x1FB9, 0x1FBA, 0x1FBB, 0x1FBC, 0x1FBD, 0x0399, 0x1FBF, - 0x1FC0, 0x1FC1, 0x1FC2, 0x1FCC, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, - 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FCC, 0x1FCD, 0x1FCE, 0x1FCF, - 0x1FD8, 0x1FD9, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, - 0x1FD8, 0x1FD9, 0x1FDA, 0x1FDB, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, - 0x1FE8, 0x1FE9, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FEC, 0x1FE6, 0x1FE7, - 0x1FE8, 0x1FE9, 0x1FEA, 0x1FEB, 0x1FEC, 0x1FED, 0x1FEE, 0x1FEF, - 0x0000, 0x0000, 0x1FF2, 0x1FFC, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, + 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, + 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, + 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, + 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, + 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, + 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, + 0x1FB8, 0x1FB9, 0x1FB2, 0x1FBC, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, + 0x1FB8, 0x1FB9, 0x1FBA, 0x1FBB, 0x1FBC, 0x1FBD, 0x0399, 0x1FBF, + 0x1FC0, 0x1FC1, 0x1FC2, 0x1FCC, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, + 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FCC, 0x1FCD, 0x1FCE, 0x1FCF, + 0x1FD8, 0x1FD9, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, + 0x1FD8, 0x1FD9, 0x1FDA, 0x1FDB, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, + 0x1FE8, 0x1FE9, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FEC, 0x1FE6, 0x1FE7, + 0x1FE8, 0x1FE9, 0x1FEA, 0x1FEB, 0x1FEC, 0x1FED, 0x1FEE, 0x1FEF, + 0x0000, 0x0000, 0x1FF2, 0x1FFC, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, 0x1FF8, 0x1FF9, 0x1FFA, 0x1FFB, 0x1FFC, 0x1FFD, 0x1FFE, 0x0000 }; @@ -642,10 +641,10 @@ UCSConvertCase( register unsigned code, } void -XConvertCase(sym, lower, upper) - register KeySym sym; - KeySym *lower; - KeySym *upper; +XConvertCase( + register KeySym sym, + KeySym *lower, + KeySym *upper) { /* Latin 1 keysym */ if (sym < 0x100) { @@ -817,14 +816,14 @@ _XTranslateKey( register Display *dpy, } int -_XTranslateKeySym(dpy, symbol, modifiers, buffer, nbytes) - Display *dpy; - register KeySym symbol; - unsigned int modifiers; - char *buffer; - int nbytes; +_XTranslateKeySym( + Display *dpy, + register KeySym symbol, + unsigned int modifiers, + char *buffer, + int nbytes) { - register struct _XKeytrans *p; + register struct _XKeytrans *p; int length; unsigned long hiBytes; register unsigned char c; @@ -874,15 +873,15 @@ _XTranslateKeySym(dpy, symbol, modifiers, buffer, nbytes) buffer[0] = c; return 1; } - + /*ARGSUSED*/ int -XLookupString (event, buffer, nbytes, keysym, status) - register XKeyEvent *event; - char *buffer; /* buffer */ - int nbytes; /* space in buffer for characters */ - KeySym *keysym; - XComposeStatus *status; /* not implemented */ +XLookupString ( + register XKeyEvent *event, + char *buffer, /* buffer */ + int nbytes, /* space in buffer for characters */ + KeySym *keysym, + XComposeStatus *status) /* not implemented */ { unsigned int modifiers; KeySym symbol; @@ -902,7 +901,7 @@ XLookupString (event, buffer, nbytes, keysym, status) status->compose_ptr = NULL; status->chars_matched = 0; } - if ( ((status->chars_matched>0)&&(status->compose_ptr!=NULL)) || + if ( ((status->chars_matched>0)&&(status->compose_ptr!=NULL)) || XimCompIsComposeKey(symbol,event->keycode,status) ) { XimCompRtrn rtrn; switch (XimCompProcessSym(status,symbol,&rtrn)) { @@ -976,7 +975,7 @@ _XFreeKeyBindings( Xfree(p->string); Xfree((char *)p->modifiers); Xfree((char *)p); - } + } } int @@ -998,7 +997,7 @@ XRebindKeysym ( nb = sizeof(KeySym) * nm; if ((! (p = (struct _XKeytrans *) Xmalloc( sizeof(struct _XKeytrans)))) || - ((! (p->string = (char *) Xmalloc( (unsigned) nbytes))) && + ((! (p->string = (char *) Xmalloc( (unsigned) nbytes))) && (nbytes > 0)) || ((! (p->modifiers = (KeySym *) Xmalloc( (unsigned) nb))) && (nb > 0))) { @@ -1036,7 +1035,7 @@ _XKeysymToModifiers( if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) return 0; - kmax = dpy->keysyms + + kmax = dpy->keysyms + (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; k = dpy->keysyms; m = dpy->modifiermap; @@ -1056,7 +1055,7 @@ _XKeysymToModifiers( } return mods; } - + /* * given a list of modifiers, computes the mask necessary for later matching. * This routine must lookup the key in the Keymap and then search to see diff --git a/nx-X11/lib/X11/KeysymStr.c b/nx-X11/lib/X11/KeysymStr.c index 8afca1c5b..896371c31 100644 --- a/nx-X11/lib/X11/KeysymStr.c +++ b/nx-X11/lib/X11/KeysymStr.c @@ -69,8 +69,7 @@ SameValue( return False; } -char *XKeysymToString(ks) - KeySym ks; +char *XKeysymToString(KeySym ks) { register int i, n; int h; @@ -146,7 +145,7 @@ char *XKeysymToString(ks) s[i] = 'A'+ val1 - 10; } s[i] = 'U'; - return s; + return s; } return ((char *) NULL); } diff --git a/nx-X11/lib/X11/KillCl.c b/nx-X11/lib/X11/KillCl.c index f78932fbf..cfd8cb000 100644 --- a/nx-X11/lib/X11/KillCl.c +++ b/nx-X11/lib/X11/KillCl.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XKillClient(dpy, resource) - register Display *dpy; - XID resource; +XKillClient( + register Display *dpy, + XID resource) { register xResourceReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/LiHosts.c b/nx-X11/lib/X11/LiHosts.c index cdc97934a..c27a2e2e1 100644 --- a/nx-X11/lib/X11/LiHosts.c +++ b/nx-X11/lib/X11/LiHosts.c @@ -1,7 +1,6 @@ /* Copyright 1986, 1998 The Open Group -Copyright 2004 Sun Microsystems, Inc. All rights reserved. @@ -34,8 +33,32 @@ X Window System is a trademark of The Open Group. */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /* This can really be considered an os dependent routine */ +#define NEED_REPLIES #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -49,7 +72,7 @@ XHostAddress *XListHosts ( int *nhosts, /* RETURN */ Bool *enabled) /* RETURN */ { - register XHostAddress *outbuf = 0, *op; + register XHostAddress *outbuf = NULL, *op; xListHostsReply reply; long nbytes; unsigned char *buf, *bp; @@ -69,31 +92,32 @@ XHostAddress *XListHosts ( if (reply.nHosts) { nbytes = reply.length << 2; /* compute number of bytes in reply */ + op = outbuf = (XHostAddress *) - Xmalloc((unsigned) (nbytes + + Xmalloc((unsigned) (nbytes + (reply.nHosts * sizeof(XHostAddress)) + (reply.nHosts * sizeof(XServerInterpretedAddress)))); - if (! outbuf) { + if (! outbuf) { _XEatData(dpy, (unsigned long) nbytes); UnlockDisplay(dpy); SyncHandle(); return (XHostAddress *) NULL; } - sip = (XServerInterpretedAddress *) + sip = (XServerInterpretedAddress *) (((unsigned char *) outbuf) + (reply.nHosts * sizeof(XHostAddress))); - bp = buf = ((unsigned char *) sip) + bp = buf = ((unsigned char *) sip) + (reply.nHosts * sizeof(XServerInterpretedAddress)); _XRead (dpy, (char *) buf, nbytes); for (i = 0; i < reply.nHosts; i++) { op->family = ((xHostEntry *) bp)->family; - op->length =((xHostEntry *) bp)->length; + op->length =((xHostEntry *) bp)->length; if (op->family == FamilyServerInterpreted) { char *tp = (char *) (bp + SIZEOF(xHostEntry)); char *vp = memchr(tp, 0, op->length); - + if (vp != NULL) { sip->type = tp; sip->typelength = vp - tp; @@ -121,6 +145,5 @@ XHostAddress *XListHosts ( } - diff --git a/nx-X11/lib/X11/LiICmaps.c b/nx-X11/lib/X11/LiICmaps.c index 09d82ea02..e98161916 100644 --- a/nx-X11/lib/X11/LiICmaps.c +++ b/nx-X11/lib/X11/LiICmaps.c @@ -29,10 +29,10 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Colormap *XListInstalledColormaps(dpy, win, n) -register Display *dpy; -Window win; -int *n; /* RETURN */ +Colormap *XListInstalledColormaps( + register Display *dpy, + Window win, + int *n) /* RETURN */ { long nbytes; Colormap *cmaps; @@ -62,7 +62,7 @@ int *n; /* RETURN */ _XRead32 (dpy, (long *) cmaps, nbytes); } else cmaps = (Colormap *) NULL; - + *n = rep.nColormaps; UnlockDisplay(dpy); SyncHandle(); diff --git a/nx-X11/lib/X11/LiProps.c b/nx-X11/lib/X11/LiProps.c index ef5c5e55a..72560aba7 100644 --- a/nx-X11/lib/X11/LiProps.c +++ b/nx-X11/lib/X11/LiProps.c @@ -29,10 +29,10 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Atom *XListProperties(dpy, window, n_props) -register Display *dpy; -Window window; -int *n_props; /* RETURN */ +Atom *XListProperties( + register Display *dpy, + Window window, + int *n_props) /* RETURN */ { long nbytes; xListPropertiesReply rep; diff --git a/nx-X11/lib/X11/ListExt.c b/nx-X11/lib/X11/ListExt.c index b04c15fea..16b522e88 100644 --- a/nx-X11/lib/X11/ListExt.c +++ b/nx-X11/lib/X11/ListExt.c @@ -29,9 +29,9 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -char **XListExtensions(dpy, nextensions) -register Display *dpy; -int *nextensions; /* RETURN */ +char **XListExtensions( + register Display *dpy, + int *nextensions) /* RETURN */ { xListExtensionsReply rep; char **list; @@ -87,8 +87,7 @@ int *nextensions; /* RETURN */ } int -XFreeExtensionList (list) -char **list; +XFreeExtensionList (char **list) { if (list != NULL) { Xfree (list[0]-1); diff --git a/nx-X11/lib/X11/LockDis.c b/nx-X11/lib/X11/LockDis.c index c4f00e661..12dd97df0 100644 --- a/nx-X11/lib/X11/LockDis.c +++ b/nx-X11/lib/X11/LockDis.c @@ -1,6 +1,6 @@ /* - + Copyright 1993, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -24,7 +24,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86$ */ /* * Author: Stephen Gildea, MIT X Consortium diff --git a/nx-X11/lib/X11/LookupCol.c b/nx-X11/lib/X11/LookupCol.c index b2af4bfd6..f7f969f56 100644 --- a/nx-X11/lib/X11/LookupCol.c +++ b/nx-X11/lib/X11/LookupCol.c @@ -46,6 +46,7 @@ XLookupColor ( XcmsCCC ccc; XcmsColor cmsColor_exact; +#ifdef XCMS /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ @@ -70,6 +71,7 @@ XLookupColor ( break; } } +#endif /* * Xcms and i18n methods failed, so lets pass it to the server diff --git a/nx-X11/lib/X11/LowerWin.c b/nx-X11/lib/X11/LowerWin.c index 1ac6bb19b..d430e6fd7 100644 --- a/nx-X11/lib/X11/LowerWin.c +++ b/nx-X11/lib/X11/LowerWin.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XLowerWindow(dpy, w) -Display *dpy; -Window w; +XLowerWindow( + Display *dpy, + Window w) { register xConfigureWindowReq *req; unsigned long val = Below; /* needed for macro */ diff --git a/nx-X11/lib/X11/Macros.c b/nx-X11/lib/X11/Macros.c index acf44ae7a..cfc083a01 100644 --- a/nx-X11/lib/X11/Macros.c +++ b/nx-X11/lib/X11/Macros.c @@ -37,151 +37,182 @@ in this Software without prior written authorization from The Open Group. * need them. */ -int XConnectionNumber(dpy) Display *dpy; { return (ConnectionNumber(dpy)); } +int XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); } -Window XRootWindow (dpy, scr) - Display *dpy; int scr; - { return (RootWindow(dpy,scr)); } +Window XRootWindow (Display *dpy, int scr) +{ + return (RootWindow(dpy,scr)); +} -int XDefaultScreen(dpy) Display *dpy; { return (DefaultScreen(dpy)); } +int XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); } -Window XDefaultRootWindow (dpy) - Display *dpy; - { return (RootWindow(dpy,DefaultScreen(dpy))); } +Window XDefaultRootWindow (Display *dpy) +{ + return (RootWindow(dpy,DefaultScreen(dpy))); +} -Visual *XDefaultVisual(dpy, scr) - Display *dpy; int scr; - { return (DefaultVisual(dpy, scr)); } +Visual *XDefaultVisual(Display *dpy, int scr) +{ + return (DefaultVisual(dpy, scr)); +} -GC XDefaultGC(dpy, scr) - Display *dpy; int scr; - { return (DefaultGC(dpy,scr)); } +GC XDefaultGC(Display *dpy, int scr) +{ + return (DefaultGC(dpy,scr)); +} -unsigned long XBlackPixel(dpy, scr) - Display *dpy; int scr; - { return (BlackPixel(dpy, scr)); } +unsigned long XBlackPixel(Display *dpy, int scr) +{ + return (BlackPixel(dpy, scr)); +} -unsigned long XWhitePixel(dpy, scr) - Display *dpy; int scr; - { return (WhitePixel(dpy,scr)); } +unsigned long XWhitePixel(Display *dpy, int scr) +{ + return (WhitePixel(dpy,scr)); +} -unsigned long XAllPlanes() { return AllPlanes; } +unsigned long XAllPlanes(void) { return AllPlanes; } -int XQLength(dpy) Display *dpy; { return (QLength(dpy)); } +int XQLength(Display *dpy) { return (QLength(dpy)); } -int XDisplayWidth(dpy, scr) - Display *dpy; int scr; - { return (DisplayWidth(dpy,scr)); } +int XDisplayWidth(Display *dpy, int scr) +{ + return (DisplayWidth(dpy,scr)); +} -int XDisplayHeight(dpy, scr) - Display *dpy; int scr; - { return (DisplayHeight(dpy, scr)); } +int XDisplayHeight(Display *dpy, int scr) +{ + return (DisplayHeight(dpy, scr)); +} -int XDisplayWidthMM(dpy, scr) - Display *dpy; int scr; - { return (DisplayWidthMM(dpy, scr)); } +int XDisplayWidthMM(Display *dpy, int scr) +{ + return (DisplayWidthMM(dpy, scr)); +} -int XDisplayHeightMM(dpy, scr) - Display *dpy; int scr; - { return (DisplayHeightMM(dpy, scr)); } +int XDisplayHeightMM(Display *dpy, int scr) +{ + return (DisplayHeightMM(dpy, scr)); +} -int XDisplayPlanes(dpy, scr) - Display *dpy; int scr; - { return (DisplayPlanes(dpy, scr)); } +int XDisplayPlanes(Display *dpy, int scr) +{ + return (DisplayPlanes(dpy, scr)); +} -int XDisplayCells(dpy, scr) - Display *dpy; int scr; - { return (DisplayCells (dpy, scr)); } +int XDisplayCells(Display *dpy, int scr) +{ + return (DisplayCells (dpy, scr)); +} -int XScreenCount(dpy) Display *dpy; { return (ScreenCount(dpy)); } +int XScreenCount(Display *dpy) { return (ScreenCount(dpy)); } -char *XServerVendor(dpy) Display *dpy; { return (ServerVendor(dpy)); } +char *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); } -int XProtocolVersion(dpy) Display *dpy; { return (ProtocolVersion(dpy)); } +int XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); } -int XProtocolRevision(dpy) Display *dpy; { return (ProtocolRevision(dpy));} +int XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));} -int XVendorRelease(dpy) Display *dpy; { return (VendorRelease(dpy)); } +int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); } -char *XDisplayString(dpy) Display *dpy; { return (DisplayString(dpy)); } +char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); } -int XDefaultDepth(dpy, scr) - Display *dpy; int scr; - { return(DefaultDepth(dpy, scr)); } +int XDefaultDepth(Display *dpy, int scr) +{ + return(DefaultDepth(dpy, scr)); +} -Colormap XDefaultColormap(dpy, scr) - Display *dpy; int scr; - { return (DefaultColormap(dpy, scr)); } +Colormap XDefaultColormap(Display *dpy, int scr) +{ + return (DefaultColormap(dpy, scr)); +} -int XBitmapUnit(dpy) Display *dpy; { return (BitmapUnit(dpy)); } +int XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); } -int XBitmapBitOrder(dpy) Display *dpy; { return (BitmapBitOrder(dpy)); } +int XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); } -int XBitmapPad(dpy) Display *dpy; { return (BitmapPad(dpy)); } +int XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); } -int XImageByteOrder(dpy) Display *dpy; { return (ImageByteOrder(dpy)); } +int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } -unsigned long XNextRequest(dpy) - Display *dpy; - { - return (NextRequest(dpy)); - } +unsigned long XNextRequest(Display *dpy) +{ + return (NextRequest(dpy)); +} -unsigned long XLastKnownRequestProcessed(dpy) - Display *dpy; - { return (LastKnownRequestProcessed(dpy)); } +unsigned long XLastKnownRequestProcessed(Display *dpy) +{ + return (LastKnownRequestProcessed(dpy)); +} /* screen oriented macros (toolkit) */ -Screen *XScreenOfDisplay(dpy, scr) Display *dpy; int scr; - { return (ScreenOfDisplay(dpy, scr)); } +Screen *XScreenOfDisplay(Display *dpy, int scr) +{ + return (ScreenOfDisplay(dpy, scr)); +} -Screen *XDefaultScreenOfDisplay(dpy) Display *dpy; - { return (DefaultScreenOfDisplay(dpy)); } +Screen *XDefaultScreenOfDisplay(Display *dpy) +{ + return (DefaultScreenOfDisplay(dpy)); +} -Display *XDisplayOfScreen(s) Screen *s; { return (DisplayOfScreen(s)); } +Display *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); } -Window XRootWindowOfScreen(s) Screen *s; { return (RootWindowOfScreen(s)); } +Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } -unsigned long XBlackPixelOfScreen(s) Screen *s; - { return (BlackPixelOfScreen(s)); } +unsigned long XBlackPixelOfScreen(Screen *s) +{ + return (BlackPixelOfScreen(s)); +} -unsigned long XWhitePixelOfScreen(s) Screen *s; - { return (WhitePixelOfScreen(s)); } +unsigned long XWhitePixelOfScreen(Screen *s) +{ + return (WhitePixelOfScreen(s)); +} -Colormap XDefaultColormapOfScreen(s) Screen *s; - { return (DefaultColormapOfScreen(s)); } +Colormap XDefaultColormapOfScreen(Screen *s) +{ + return (DefaultColormapOfScreen(s)); +} -int XDefaultDepthOfScreen(s) Screen *s; { return (DefaultDepthOfScreen(s)); } +int XDefaultDepthOfScreen(Screen *s) +{ + return (DefaultDepthOfScreen(s)); +} -GC XDefaultGCOfScreen(s) Screen *s; { return (DefaultGCOfScreen(s)); } +GC XDefaultGCOfScreen(Screen *s) +{ + return (DefaultGCOfScreen(s)); +} -Visual *XDefaultVisualOfScreen(s) Screen *s; - { return (DefaultVisualOfScreen(s)); } +Visual *XDefaultVisualOfScreen(Screen *s) +{ + return (DefaultVisualOfScreen(s)); +} -int XWidthOfScreen(s) Screen *s; { return (WidthOfScreen(s)); } +int XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); } -int XHeightOfScreen(s) Screen *s; { return (HeightOfScreen(s)); } +int XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); } -int XWidthMMOfScreen(s) Screen *s; { return (WidthMMOfScreen(s)); } +int XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); } -int XHeightMMOfScreen(s) Screen *s; { return (HeightMMOfScreen(s)); } +int XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); } -int XPlanesOfScreen(s) Screen *s; { return (PlanesOfScreen(s)); } +int XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); } -int XCellsOfScreen(s) Screen *s; { return (CellsOfScreen(s)); } +int XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); } -int XMinCmapsOfScreen(s) Screen *s; { return (MinCmapsOfScreen(s)); } +int XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); } -int XMaxCmapsOfScreen(s) Screen *s; { return (MaxCmapsOfScreen(s)); } +int XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); } -Bool XDoesSaveUnders(s) Screen *s; { return (DoesSaveUnders(s)); } +Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); } -int XDoesBackingStore(s) Screen *s; { return (DoesBackingStore(s)); } +int XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); } -long XEventMaskOfScreen(s) Screen *s; { return (EventMaskOfScreen(s)); } +long XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); } -int XScreenNumberOfScreen (scr) - register Screen *scr; +int XScreenNumberOfScreen (register Screen *scr) { register Display *dpy = scr->display; register Screen *dpyscr = dpy->screens; @@ -238,8 +269,7 @@ int XAddPixel( int -XNoOp (dpy) - register Display *dpy; +XNoOp (register Display *dpy) { register xReq *req; diff --git a/nx-X11/lib/X11/MapRaised.c b/nx-X11/lib/X11/MapRaised.c index 2e59a96dc..6ad6aef08 100644 --- a/nx-X11/lib/X11/MapRaised.c +++ b/nx-X11/lib/X11/MapRaised.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XMapRaised (dpy, w) - Window w; - register Display *dpy; +XMapRaised ( + register Display *dpy, + Window w) { register xConfigureWindowReq *req; register xResourceReq *req2; diff --git a/nx-X11/lib/X11/MapSubs.c b/nx-X11/lib/X11/MapSubs.c index 6165d2d99..14e8b8af5 100644 --- a/nx-X11/lib/X11/MapSubs.c +++ b/nx-X11/lib/X11/MapSubs.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XMapSubwindows(dpy, win) - register Display *dpy; - Window win; +XMapSubwindows( + register Display *dpy, + Window win) { register xResourceReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/MapWindow.c b/nx-X11/lib/X11/MapWindow.c index 810b1558f..cc041ff51 100644 --- a/nx-X11/lib/X11/MapWindow.c +++ b/nx-X11/lib/X11/MapWindow.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XMapWindow (dpy, w) - Window w; - register Display *dpy; +XMapWindow ( + register Display *dpy, + Window w) { register xResourceReq *req; LockDisplay (dpy); diff --git a/nx-X11/lib/X11/MaskEvent.c b/nx-X11/lib/X11/MaskEvent.c index 1c877cef9..1fadc487e 100644 --- a/nx-X11/lib/X11/MaskEvent.c +++ b/nx-X11/lib/X11/MaskEvent.c @@ -34,28 +34,32 @@ extern long const _Xevent_to_mask[]; #define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ Button4MotionMask|Button5MotionMask) -/* +/* * return the next event in the queue matching one of the events in the mask. * If no event, flush output, and wait until match succeeds. * Events earlier in the queue are not discarded. */ int -XMaskEvent (dpy, mask, event) - register Display *dpy; - long mask; /* Selected event mask. */ - register XEvent *event; /* XEvent to be filled in. */ +XMaskEvent ( + register Display *dpy, + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ { register _XQEvent *prev, *qelt; unsigned long qe_serial = 0; LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + prev = NULL; while (1) { for (qelt = prev ? prev->next : dpy->head; qelt; prev = qelt, qelt = qelt->next) { - if ((qelt->event.type < LASTEvent) && + if ((qelt->event.type < GenericEvent) && (_Xevent_to_mask[qelt->event.type] & mask) && ((qelt->event.type != MotionNotify) || (mask & AllPointers) || diff --git a/nx-X11/lib/X11/Misc.c b/nx-X11/lib/X11/Misc.c index 8a390320d..c3a028408 100644 --- a/nx-X11/lib/X11/Misc.c +++ b/nx-X11/lib/X11/Misc.c @@ -29,42 +29,38 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -long XMaxRequestSize(dpy) - Display *dpy; +long XMaxRequestSize(Display *dpy) { return dpy->max_request_size; } -char *XResourceManagerString(dpy) - Display *dpy; +char *XResourceManagerString(Display *dpy) { return dpy->xdefaults; } -unsigned long XDisplayMotionBufferSize(dpy) - Display *dpy; +unsigned long XDisplayMotionBufferSize(Display *dpy) { return dpy->motion_buffer; } int -XDisplayKeycodes(dpy, min_keycode_return, max_keycode_return) - Display *dpy; - int *min_keycode_return, *max_keycode_return; +XDisplayKeycodes( + Display *dpy, + int *min_keycode_return, + int *max_keycode_return) { *min_keycode_return = dpy->min_keycode; *max_keycode_return = dpy->max_keycode; return 1; } -VisualID XVisualIDFromVisual(visual) - Visual *visual; +VisualID XVisualIDFromVisual(Visual *visual) { return visual->visualid; } -long XExtendedMaxRequestSize(dpy) - Display *dpy; +long XExtendedMaxRequestSize(Display *dpy) { return dpy->bigreq_size; } diff --git a/nx-X11/lib/X11/ModMap.c b/nx-X11/lib/X11/ModMap.c index f83b2ef91..c99bfdd5f 100644 --- a/nx-X11/lib/X11/ModMap.c +++ b/nx-X11/lib/X11/ModMap.c @@ -30,9 +30,8 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" XModifierKeymap * -XGetModifierMapping(dpy) - register Display *dpy; -{ +XGetModifierMapping(register Display *dpy) +{ xGetModifierMappingReply rep; register xReq *req; unsigned long nbytes; @@ -66,9 +65,9 @@ XGetModifierMapping(dpy) * 2 Failed - one or more new modifiers unacceptable */ int -XSetModifierMapping(dpy, modifier_map) - register Display *dpy; - register XModifierKeymap *modifier_map; +XSetModifierMapping( + register Display *dpy, + register XModifierKeymap *modifier_map) { register xSetModifierMappingReq *req; xSetModifierMappingReply rep; @@ -91,8 +90,7 @@ XSetModifierMapping(dpy, modifier_map) } XModifierKeymap * -XNewModifiermap(keyspermodifier) - int keyspermodifier; +XNewModifiermap(int keyspermodifier) { XModifierKeymap *res = (XModifierKeymap *) Xmalloc((sizeof (XModifierKeymap))); if (res) { @@ -110,8 +108,7 @@ XNewModifiermap(keyspermodifier) int -XFreeModifiermap(map) - XModifierKeymap *map; +XFreeModifiermap(XModifierKeymap *map) { if (map) { if (map->modifiermap) @@ -143,7 +140,7 @@ XInsertModifiermapEntry(XModifierKeymap *map, map->modifiermap[ row+i ] = keycode; return(map); /* we added it without stretching the map */ } - } + } /* stretch the map */ if ((newmap = XNewModifiermap(map->max_keypermod+1)) == NULL) diff --git a/nx-X11/lib/X11/MoveWin.c b/nx-X11/lib/X11/MoveWin.c index e2847d381..2eb2283be 100644 --- a/nx-X11/lib/X11/MoveWin.c +++ b/nx-X11/lib/X11/MoveWin.c @@ -30,10 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XMoveWindow (dpy, w, x, y) - register Display *dpy; - Window w; - int x, y; +XMoveWindow ( + register Display *dpy, + Window w, + int x, + int y) { register xConfigureWindowReq *req; diff --git a/nx-X11/lib/X11/NextEvent.c b/nx-X11/lib/X11/NextEvent.c index f0d1e56ff..d3048aee2 100644 --- a/nx-X11/lib/X11/NextEvent.c +++ b/nx-X11/lib/X11/NextEvent.c @@ -29,20 +29,23 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -/* +/* * Return next event in queue, or if none, flush output and wait for * events. */ int -XNextEvent (dpy, event) - register Display *dpy; - register XEvent *event; +XNextEvent ( + register Display *dpy, + register XEvent *event) { register _XQEvent *qelt; - + LockDisplay(dpy); - + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + if (dpy->head == NULL) _XReadEvents(dpy); #ifdef NX_TRANS_SOCKET @@ -54,6 +57,7 @@ XNextEvent (dpy, event) qelt = dpy->head; *event = qelt->event; _XDeq(dpy, NULL, qelt); + _XStoreEventCookie(dpy, event); UnlockDisplay(dpy); return 0; } diff --git a/nx-X11/lib/X11/OCWrap.c b/nx-X11/lib/X11/OCWrap.c index dbb9a86a1..fe23a3495 100644 --- a/nx-X11/lib/X11/OCWrap.c +++ b/nx-X11/lib/X11/OCWrap.c @@ -61,8 +61,7 @@ XCreateOC(XOM om, ...) } void -XDestroyOC(oc) - XOC oc; +XDestroyOC(XOC oc) { XOC prev, oc_list; @@ -83,8 +82,7 @@ XDestroyOC(oc) } XOM -XOMOfOC(oc) - XOC oc; +XOMOfOC(XOC oc) { return oc->core.om; } diff --git a/nx-X11/lib/X11/OMWrap.c b/nx-X11/lib/X11/OMWrap.c index 39d82e476..045ca16bc 100644 --- a/nx-X11/lib/X11/OMWrap.c +++ b/nx-X11/lib/X11/OMWrap.c @@ -45,8 +45,7 @@ XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, } Status -XCloseOM(om) - XOM om; +XCloseOM(XOM om) { XOC oc, next; XLCd lcd = om->core.lcd; @@ -109,7 +108,7 @@ XGetOMValues(XOM om, ...) if (args == (XlcArgList) NULL) return (char *) NULL; - + ret = (*om->methods->get_values)(om, args, num_args); Xfree(args); @@ -118,15 +117,13 @@ XGetOMValues(XOM om, ...) } Display * -XDisplayOfOM(om) - XOM om; +XDisplayOfOM(XOM om) { return om->core.display; } char * -XLocaleOfOM(om) - XOM om; +XLocaleOfOM(XOM om) { return om->core.lcd->core->name; } diff --git a/nx-X11/lib/X11/ParseCmd.c b/nx-X11/lib/X11/ParseCmd.c index fe796d7e5..b4bb97654 100644 --- a/nx-X11/lib/X11/ParseCmd.c +++ b/nx-X11/lib/X11/ParseCmd.c @@ -28,13 +28,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -63,7 +63,7 @@ SOFTWARE. #include <stdio.h> -static void _XReportParseError(XrmOptionDescRec *arg, char *msg) +static void _XReportParseError(XrmOptionDescRec *arg, const char *msg) { (void) fprintf(stderr, "Error parsing argument \"%s\" (%s); %s\n", arg->option, arg->specifier, msg); @@ -98,7 +98,7 @@ XrmParseCommand( XrmQPutStringResource(pdb, bindings, quarks, value_str); \ } /* PutCommandResource */ - myargc = (*argc); + myargc = (*argc); argend = argv + myargc; argsave = ++argv; @@ -157,7 +157,7 @@ XrmParseCommand( --(*argc); PutCommandResource(options[i].value); break; - + case XrmoptionIsArg: --(*argc); PutCommandResource(*argv); @@ -175,7 +175,7 @@ XrmParseCommand( } else (*argsave++) = (*argv); break; - + case XrmoptionResArg: if (myargc > 1) { ++argv; --myargc; --(*argc); --(*argc); @@ -183,13 +183,13 @@ XrmParseCommand( } else (*argsave++) = (*argv); break; - + case XrmoptionSkipArg: if (myargc > 1) { --myargc; (*argsave++) = (*argv++); } - (*argsave++) = (*argv); + (*argsave++) = (*argv); break; case XrmoptionSkipLine: @@ -217,7 +217,7 @@ XrmParseCommand( } } else - (*argsave++) = (*argv); /*compress arglist*/ + (*argsave++) = (*argv); /*compress arglist*/ } if (argsave < argend) diff --git a/nx-X11/lib/X11/ParseCol.c b/nx-X11/lib/X11/ParseCol.c index 5b7ec9f43..e997b1b8c 100644 --- a/nx-X11/lib/X11/ParseCol.c +++ b/nx-X11/lib/X11/ParseCol.c @@ -83,6 +83,7 @@ XParseColor ( } +#ifdef XCMS /* * Let's Attempt to use Xcms and i18n approach to Parse Color */ @@ -106,6 +107,7 @@ XParseColor ( break; } } +#endif /* * Xcms and i18n methods failed, so lets pass it to the server diff --git a/nx-X11/lib/X11/ParseGeom.c b/nx-X11/lib/X11/ParseGeom.c index d77205882..dfd812fc9 100644 --- a/nx-X11/lib/X11/ParseGeom.c +++ b/nx-X11/lib/X11/ParseGeom.c @@ -33,24 +33,6 @@ from The Open Group. #include "Xlibint.h" #include "Xutil.h" -#ifdef notdef -/* - *Returns pointer to first char ins search which is also in what, else NULL. - */ -static char *strscan (search, what) -char *search, *what; -{ - int i, len = strlen (what); - char c; - - while ((c = *(search++)) != NULL) - for (i = 0; i < len; i++) - if (c == what [i]) - return (--search); - return (NULL); -} -#endif - /* * XParseGeometry parses strings of the form * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where @@ -60,7 +42,7 @@ char *search, *what; * It returns a bitmask that indicates which of the four values * were actually found in the string. For each value found, * the corresponding argument is updated; for each value - * not found, the corresponding argument is left unchanged. + * not found, the corresponding argument is left unchanged. */ static int @@ -68,7 +50,7 @@ ReadInteger(char *string, char **NextString) { register int Result = 0; int Sign = 1; - + if (*string == '+') string++; else if (*string == '-') @@ -108,13 +90,13 @@ unsigned int *height) /* RETURN */ strind = (char *)string; if (*strind != '+' && *strind != '-' && *strind != 'x') { tempWidth = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) + if (strind == nextCharacter) return (0); strind = nextCharacter; mask |= WidthValue; } - if (*strind == 'x' || *strind == 'X') { + if (*strind == 'x' || *strind == 'X') { strind++; tempHeight = ReadInteger(strind, &nextCharacter); if (strind == nextCharacter) @@ -162,7 +144,7 @@ unsigned int *height) /* RETURN */ mask |= YValue; } } - + /* If strind isn't at the end of the string the it's an invalid geometry specification. */ diff --git a/nx-X11/lib/X11/PixFormats.c b/nx-X11/lib/X11/PixFormats.c index df67843bd..8e4a10027 100644 --- a/nx-X11/lib/X11/PixFormats.c +++ b/nx-X11/lib/X11/PixFormats.c @@ -34,9 +34,9 @@ in this Software without prior written authorization from The Open Group. * XListPixmapFormats - return info from connection setup */ -XPixmapFormatValues *XListPixmapFormats (dpy, count) - Display *dpy; - int *count; /* RETURN */ +XPixmapFormatValues *XListPixmapFormats ( + Display *dpy, + int *count) /* RETURN */ { XPixmapFormatValues *formats = (XPixmapFormatValues *) Xmalloc((unsigned) (dpy->nformats * sizeof (XPixmapFormatValues))); diff --git a/nx-X11/lib/X11/PmapBgnd.c b/nx-X11/lib/X11/PmapBgnd.c index 3ead3350f..9c5155833 100644 --- a/nx-X11/lib/X11/PmapBgnd.c +++ b/nx-X11/lib/X11/PmapBgnd.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetWindowBackgroundPixmap(dpy, w, pixmap) - register Display *dpy; - Window w; - Pixmap pixmap; +XSetWindowBackgroundPixmap( + register Display *dpy, + Window w, + Pixmap pixmap) { register xChangeWindowAttributesReq *req; LockDisplay (dpy); diff --git a/nx-X11/lib/X11/PmapBord.c b/nx-X11/lib/X11/PmapBord.c index 780948468..7e1be616e 100644 --- a/nx-X11/lib/X11/PmapBord.c +++ b/nx-X11/lib/X11/PmapBord.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetWindowBorderPixmap(dpy, w, pixmap) - register Display *dpy; - Window w; - Pixmap pixmap; +XSetWindowBorderPixmap( + register Display *dpy, + Window w, + Pixmap pixmap) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/PolyReg.c b/nx-X11/lib/X11/PolyReg.c index 6cff945b7..6ac2e2897 100644 --- a/nx-X11/lib/X11/PolyReg.c +++ b/nx-X11/lib/X11/PolyReg.c @@ -27,13 +27,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -82,7 +82,7 @@ InsertEdgeInET( */ pPrevSLL = &ET->scanlines; pSLL = pPrevSLL->next; - while (pSLL && (pSLL->scanline < scanline)) + while (pSLL && (pSLL->scanline < scanline)) { pPrevSLL = pSLL; pSLL = pSLL->next; @@ -91,11 +91,11 @@ InsertEdgeInET( /* * reassign pSLL (pointer to ScanLineList) if necessary */ - if ((!pSLL) || (pSLL->scanline > scanline)) + if ((!pSLL) || (pSLL->scanline > scanline)) { - if (*iSLLBlock > SLLSPERBLOCK-1) + if (*iSLLBlock > SLLSPERBLOCK-1) { - tmpSLLBlock = + tmpSLLBlock = (ScanLineListBlock *)Xmalloc(sizeof(ScanLineListBlock)); (*SLLBlock)->next = tmpSLLBlock; tmpSLLBlock->next = (ScanLineListBlock *)NULL; @@ -115,7 +115,7 @@ InsertEdgeInET( */ prev = (EdgeTableEntry *)NULL; start = pSLL->edgelist; - while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) + while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) { prev = start; start = start->next; @@ -132,7 +132,7 @@ InsertEdgeInET( * CreateEdgeTable * * This routine creates the edge table for - * scan converting polygons. + * scan converting polygons. * The Edge Table (ET) looks like: * * EdgeTable @@ -192,19 +192,19 @@ CreateETandAET( * In this loop we are dealing with two vertices at * a time -- these make up one edge of the polygon. */ - while (count--) + while (count--) { CurrPt = pts++; /* * find out which point is above and which is below. */ - if (PrevPt->y > CurrPt->y) + if (PrevPt->y > CurrPt->y) { bottom = PrevPt, top = CurrPt; pETEs->ClockWise = 0; } - else + else { bottom = CurrPt, top = PrevPt; pETEs->ClockWise = 1; @@ -213,7 +213,7 @@ CreateETandAET( /* * don't add horizontal edges to the Edge table. */ - if (bottom->y != top->y) + if (bottom->y != top->y) { pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */ @@ -255,9 +255,9 @@ loadAET( pPrevAET = AET; AET = AET->next; - while (ETEs) + while (ETEs) { - while (AET && (AET->bres.minor_axis < ETEs->bres.minor_axis)) + while (AET && (AET->bres.minor_axis < ETEs->bres.minor_axis)) { pPrevAET = AET; AET = AET->next; @@ -279,13 +279,13 @@ loadAET( * * This routine links the AET by the * nextWETE (winding EdgeTableEntry) link for - * use by the winding number rule. The final + * use by the winding number rule. The final * Active Edge Table (AET) might look something * like: * * AET * ---------- --------- --------- - * |ymax | |ymax | |ymax | + * |ymax | |ymax | |ymax | * | ... | |... | |... | * |next |->|next |->|next |->... * |nextWETE| |nextWETE| |nextWETE| @@ -305,7 +305,7 @@ computeWAET( AET->nextWETE = (EdgeTableEntry *)NULL; pWETE = AET; AET = AET->next; - while (AET) + while (AET) { if (AET->ClockWise) isInside++; @@ -313,7 +313,7 @@ computeWAET( isInside--; if ((!inside && !isInside) || - ( inside && isInside)) + ( inside && isInside)) { pWETE->nextWETE = AET; pWETE = AET; @@ -343,7 +343,7 @@ InsertionSort( register int changed = 0; AET = AET->next; - while (AET) + while (AET) { pETEinsert = AET; pETEchase = AET; @@ -351,7 +351,7 @@ InsertionSort( pETEchase = pETEchase->back; AET = AET->next; - if (pETEchase != pETEinsert) + if (pETEchase != pETEinsert) { pETEchaseBackTMP = pETEchase->back; pETEinsert->back->next = AET; @@ -376,7 +376,7 @@ FreeStorage( { register ScanLineListBlock *tmpSLLBlock; - while (pSLLBlock) + while (pSLLBlock) { tmpSLLBlock = pSLLBlock->next; Xfree((char *)pSLLBlock); @@ -407,21 +407,21 @@ static int PtsToRegion( BOX *prevRects = reg->rects; extents = ®->extents; - + numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; - - if (!(reg->rects = (BOX *)Xrealloc((char *)reg->rects, + + if (!(reg->rects = (BOX *)Xrealloc((char *)reg->rects, (unsigned) (sizeof(BOX) * numRects)))) { Xfree(prevRects); return(0); } - + reg->size = numRects; CurPtBlock = FirstPtBlock; rects = reg->rects - 1; numRects = 0; extents->x1 = MAXSHORT, extents->x2 = MINSHORT; - + for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) { /* the loop uses 2 points per iteration */ i = NUMPTSTOBUFFER >> 1; @@ -459,7 +459,7 @@ static int PtsToRegion( extents->y2 = 0; } reg->numRects = numRects; - + return(TRUE); } @@ -470,11 +470,11 @@ static int PtsToRegion( * encoding of the resultant bitmap -- the run-length * encoding is in the form of an array of rectangles. */ -Region -XPolygonRegion(Pts, Count, rule) - int Count; /* number of pts */ - XPoint *Pts; /* the pts */ - int rule; /* winding rule */ +Region +XPolygonRegion( + XPoint *Pts, /* the pts */ + int Count, /* number of pts */ + int rule) /* winding rule */ { Region region; register EdgeTableEntry *pAET; /* Active Edge Table */ @@ -492,7 +492,7 @@ XPolygonRegion(Pts, Count, rule) POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */ POINTBLOCK *tmpPtBlock; int numFullPtBlocks = 0; - + if (! (region = XCreateRegion())) return (Region) NULL; /* special case a rectangle */ @@ -518,18 +518,20 @@ XPolygonRegion(Pts, Count, rule) } return(region); } - + if (Count < 2) return region; if (! (pETEs = (EdgeTableEntry *) - Xmalloc((unsigned) (sizeof(EdgeTableEntry) * Count)))) + Xmalloc((unsigned) (sizeof(EdgeTableEntry) * Count)))) { + XDestroyRegion(region); return (Region) NULL; + } pts = FirstPtBlock.pts; CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); pSLL = ET.scanlines.next; curPtBlock = &FirstPtBlock; - + if (rule == EvenOddRule) { /* * for each scanline @@ -545,14 +547,14 @@ XPolygonRegion(Pts, Count, rule) } pPrevAET = &AET; pAET = AET.next; - + /* * for each active edge */ while (pAET) { pts->x = pAET->bres.minor_axis, pts->y = y; pts++, iPts++; - + /* * send out the buffer */ @@ -586,7 +588,7 @@ XPolygonRegion(Pts, Count, rule) pPrevAET = &AET; pAET = AET.next; pWETE = pAET; - + /* * for each active edge */ @@ -598,7 +600,7 @@ XPolygonRegion(Pts, Count, rule) if (pWETE == pAET) { pts->x = pAET->bres.minor_axis, pts->y = y; pts++, iPts++; - + /* * send out the buffer */ @@ -613,7 +615,7 @@ XPolygonRegion(Pts, Count, rule) } EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); } - + /* * recompute the winding active edge table if * we just resorted or have exited an edge. @@ -624,7 +626,7 @@ XPolygonRegion(Pts, Count, rule) } } } - FreeStorage(SLLBlock.next); + FreeStorage(SLLBlock.next); (void) PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { tmpPtBlock = curPtBlock->next; diff --git a/nx-X11/lib/X11/PolyTxt.c b/nx-X11/lib/X11/PolyTxt.c index 39beefe92..2f43c43d3 100644 --- a/nx-X11/lib/X11/PolyTxt.c +++ b/nx-X11/lib/X11/PolyTxt.c @@ -30,14 +30,15 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDrawText(dpy, d, gc, x, y, items, nitems) - register Display *dpy; - Drawable d; - GC gc; - int x, y; - XTextItem *items; - int nitems; -{ +XDrawText( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XTextItem *items, + int nitems) +{ register int i; register XTextItem *item; int length = 0; @@ -78,11 +79,11 @@ XDrawText(dpy, d, gc, x, y, items, nitems) req->length += (length + 3)>>2; /* convert to number of 32-bit words */ - /* + /* * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. + * the buffer 32-bit aligned. */ if (dpy->bufptr + length > dpy->bufmax) @@ -120,9 +121,9 @@ XDrawText(dpy, d, gc, x, y, items, nitems) { int nb = SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nb); + BufAlloc (char *, tbuf, nb); *tbuf = 0; /* elt->len */ - if (PartialDelta > 0 ) + if (PartialDelta > 0 ) { *(tbuf+1) = 127; /* elt->delta */ PartialDelta = PartialDelta - 127; @@ -136,7 +137,7 @@ XDrawText(dpy, d, gc, x, y, items, nitems) } if (PartialDelta) { - BufAlloc (char *, tbuf , nbytes); + BufAlloc (char *, tbuf , nbytes); *tbuf = 0; /* elt->len */ *(tbuf+1) = PartialDelta; /* elt->delta */ } @@ -147,9 +148,9 @@ XDrawText(dpy, d, gc, x, y, items, nitems) { FirstTimeThrough = False; if (!item->delta) - { + { nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); + BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } else @@ -178,9 +179,9 @@ XDrawText(dpy, d, gc, x, y, items, nitems) { FirstTimeThrough = False; if (!item->delta) - { + { nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); + BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } else @@ -192,7 +193,7 @@ XDrawText(dpy, d, gc, x, y, items, nitems) else { nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); + BufAlloc (char *, tbuf, nbytes); *(tbuf+1) = 0; /* elt->delta */ } *tbuf = PartialNChars; /* elt->len */ @@ -206,23 +207,23 @@ XDrawText(dpy, d, gc, x, y, items, nitems) if (length &= 3) { char *pad; - /* + /* * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - length; BufAlloc (char *, pad, length); - /* + /* * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt + * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } - /* + /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. + * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) diff --git a/nx-X11/lib/X11/PolyTxt16.c b/nx-X11/lib/X11/PolyTxt16.c index 28aa9adbd..6c7cc49ec 100644 --- a/nx-X11/lib/X11/PolyTxt16.c +++ b/nx-X11/lib/X11/PolyTxt16.c @@ -30,14 +30,15 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XDrawText16(dpy, d, gc, x, y, items, nitems) - register Display *dpy; - Drawable d; - GC gc; - int x, y; - XTextItem16 *items; - int nitems; -{ +XDrawText16( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XTextItem16 *items, + int nitems) +{ register int i; register XTextItem16 *item; int length = 0; @@ -82,7 +83,7 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. + * the buffer 32-bit aligned. */ if (dpy->bufptr + length > dpy->bufmax) @@ -119,9 +120,9 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) { int nb = SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nb); + BufAlloc (xTextElt *, elt, nb); elt->len = 0; - if (PartialDelta > 0 ) + if (PartialDelta > 0 ) { elt->delta = 127; PartialDelta = PartialDelta - 127; @@ -134,7 +135,7 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) } if (PartialDelta) { - BufAlloc (xTextElt *, elt, nbytes); + BufAlloc (xTextElt *, elt, nbytes); elt->len = 0; elt->delta = PartialDelta; } @@ -145,9 +146,9 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) { FirstTimeThrough = False; if (!item->delta) - { + { nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); + BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } else @@ -179,9 +180,9 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) { FirstTimeThrough = False; if (!item->delta) - { + { nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); + BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } else @@ -196,7 +197,7 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) else { nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); + BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; } elt->len = PartialNChars; @@ -214,21 +215,21 @@ XDrawText16(dpy, d, gc, x, y, items, nitems) char *pad; /* * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - length; BufAlloc (char *, pad, length); - /* + /* * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt + * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } - /* + /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. + * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) diff --git a/nx-X11/lib/X11/PropAlloc.c b/nx-X11/lib/X11/PropAlloc.c index ecfb11e2b..bad768153 100644 --- a/nx-X11/lib/X11/PropAlloc.c +++ b/nx-X11/lib/X11/PropAlloc.c @@ -33,30 +33,30 @@ in this Software without prior written authorization from The Open Group. /* - * Routines for allocating space for structures that are expected to get + * Routines for allocating space for structures that are expected to get * longer at some point. */ -XSizeHints *XAllocSizeHints () +XSizeHints *XAllocSizeHints (void) { return ((XSizeHints *) Xcalloc (1, (unsigned) sizeof (XSizeHints))); } -XStandardColormap *XAllocStandardColormap () +XStandardColormap *XAllocStandardColormap (void) { return ((XStandardColormap *) Xcalloc (1, (unsigned) sizeof (XStandardColormap))); } -XWMHints *XAllocWMHints () +XWMHints *XAllocWMHints (void) { return ((XWMHints *) Xcalloc (1, (unsigned) sizeof (XWMHints))); } -XClassHint *XAllocClassHint () +XClassHint *XAllocClassHint (void) { register XClassHint *h; @@ -67,7 +67,7 @@ XClassHint *XAllocClassHint () } -XIconSize *XAllocIconSize () +XIconSize *XAllocIconSize (void) { return ((XIconSize *) Xcalloc (1, (unsigned) sizeof (XIconSize))); } diff --git a/nx-X11/lib/X11/PutBEvent.c b/nx-X11/lib/X11/PutBEvent.c index 63c92e627..f9d4c29bd 100644 --- a/nx-X11/lib/X11/PutBEvent.c +++ b/nx-X11/lib/X11/PutBEvent.c @@ -34,10 +34,11 @@ from The Open Group. int _XPutBackEvent ( - register Display *dpy, + register Display *dpy, register XEvent *event) { register _XQEvent *qelt; + XEvent store = *event; if (!dpy->qfree) { if ((dpy->qfree = (_XQEvent *) Xmalloc (sizeof (_XQEvent))) == NULL) { @@ -45,11 +46,26 @@ _XPutBackEvent ( } dpy->qfree->next = NULL; } + + /* unclaimed cookie? */ + if (_XIsEventCookie(dpy, event)) + { + XEvent copy = {0}; + /* if not claimed, then just fetch and store again */ + if (!event->xcookie.data) { + _XFetchEventCookie(dpy, &event->xcookie); + store = *event; + } else { /* if claimed, copy, client must free */ + _XCopyEventCookie(dpy, &event->xcookie, ©.xcookie); + store = copy; + } + } + qelt = dpy->qfree; dpy->qfree = qelt->next; qelt->qserial_num = dpy->next_event_serial_num++; qelt->next = dpy->head; - qelt->event = *event; + qelt->event = store; dpy->head = qelt; if (dpy->tail == NULL) dpy->tail = qelt; @@ -59,7 +75,7 @@ _XPutBackEvent ( int XPutBackEvent ( - register Display * dpy, + register Display * dpy, register XEvent *event) { int ret; diff --git a/nx-X11/lib/X11/PutImage.c b/nx-X11/lib/X11/PutImage.c index 9e461cb18..6dad4f13a 100644 --- a/nx-X11/lib/X11/PutImage.c +++ b/nx-X11/lib/X11/PutImage.c @@ -682,7 +682,7 @@ SendXYImage( if ((dpy->bufptr + length) > dpy->bufmax) { if ((buf = _XAllocScratch(dpy, (unsigned long) (length))) == NULL) { UnGetReq(PutImage); - return; + return; } } else @@ -870,7 +870,7 @@ PutImageRequest( SendZImage(dpy, req, image, req_xoffset, req_yoffset, dest_bits_per_pixel, dest_scanline_pad); } - + static void PutSubImage ( register Display *dpy, @@ -889,7 +889,7 @@ PutSubImage ( if ((req_width == 0) || (req_height == 0)) return; - + Available = ((65536 < dpy->max_request_size) ? (65536 << 2) : (dpy->max_request_size << 2)) - SIZEOF(xPutImageReq); @@ -905,7 +905,7 @@ PutSubImage ( } if ((BytesPerRow * req_height) <= Available) { - PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, req_height, dest_bits_per_pixel, dest_scanline_pad); } else if (req_height > 1) { @@ -914,11 +914,11 @@ PutSubImage ( if (SubImageHeight == 0) SubImageHeight = 1; - PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, (unsigned int) SubImageHeight, dest_bits_per_pixel, dest_scanline_pad); - PutSubImage(dpy, d, gc, image, req_xoffset, + PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset + SubImageHeight, x, y + SubImageHeight, req_width, req_height - SubImageHeight, dest_bits_per_pixel, dest_scanline_pad); @@ -926,11 +926,11 @@ PutSubImage ( int SubImageWidth = (((Available << 3) / dest_scanline_pad) * dest_scanline_pad) - left_pad; - PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, (unsigned int) SubImageWidth, 1, dest_bits_per_pixel, dest_scanline_pad); - PutSubImage(dpy, d, gc, image, req_xoffset + SubImageWidth, + PutSubImage(dpy, d, gc, image, req_xoffset + SubImageWidth, req_yoffset, x + SubImageWidth, y, req_width - SubImageWidth, 1, dest_bits_per_pixel, dest_scanline_pad); @@ -939,15 +939,17 @@ PutSubImage ( int -XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width, - req_height) - register Display *dpy; - Drawable d; - GC gc; - register XImage *image; - int x, y; - unsigned int req_width, req_height; - int req_xoffset, req_yoffset; +XPutImage ( + register Display *dpy, + Drawable d, + GC gc, + register XImage *image, + int req_xoffset, + int req_yoffset, + int x, + int y, + unsigned int req_width, + unsigned int req_height) { long width = req_width; diff --git a/nx-X11/lib/X11/QuBest.c b/nx-X11/lib/X11/QuBest.c index a26ee952a..97b1f116b 100644 --- a/nx-X11/lib/X11/QuBest.c +++ b/nx-X11/lib/X11/QuBest.c @@ -29,13 +29,15 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XQueryBestSize(dpy, class, drawable, width, height, ret_width, ret_height) - register Display *dpy; - int class; - Drawable drawable; - unsigned int width, height; - unsigned int *ret_width, *ret_height; -{ +Status XQueryBestSize( + register Display *dpy, + int class, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ xQueryBestSizeReply rep; register xQueryBestSizeReq *req; diff --git a/nx-X11/lib/X11/QuColor.c b/nx-X11/lib/X11/QuColor.c index dceeb9595..7aca7d7b8 100644 --- a/nx-X11/lib/X11/QuColor.c +++ b/nx-X11/lib/X11/QuColor.c @@ -24,16 +24,17 @@ in this Software without prior written authorization from The Open Group. */ +#define NEED_REPLIES #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "Xlibint.h" int -XQueryColor(dpy, cmap, def) - register Display *dpy; - Colormap cmap; - XColor *def; /* RETURN */ +XQueryColor( + register Display *dpy, + Colormap cmap, + XColor *def) /* RETURN */ { xrgb color; xQueryColorsReply rep; diff --git a/nx-X11/lib/X11/QuColors.c b/nx-X11/lib/X11/QuColors.c index cdd58a0e5..e51375fa0 100644 --- a/nx-X11/lib/X11/QuColors.c +++ b/nx-X11/lib/X11/QuColors.c @@ -30,11 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XQueryColors(dpy, cmap, defs, ncolors) - register Display *dpy; - Colormap cmap; - XColor *defs; /* RETURN */ - int ncolors; +XQueryColors( + register Display *dpy, + Colormap cmap, + XColor *defs, /* RETURN */ + int ncolors) { register int i; xrgb *color; diff --git a/nx-X11/lib/X11/QuCurShp.c b/nx-X11/lib/X11/QuCurShp.c index bfce63486..bb17c42fc 100644 --- a/nx-X11/lib/X11/QuCurShp.c +++ b/nx-X11/lib/X11/QuCurShp.c @@ -29,12 +29,14 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XQueryBestCursor(dpy, drawable, width, height, ret_width, ret_height) - register Display *dpy; - Drawable drawable; - unsigned int width, height; - unsigned int *ret_width, *ret_height; -{ +Status XQueryBestCursor( + register Display *dpy, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ xQueryBestSizeReply rep; register xQueryBestSizeReq *req; diff --git a/nx-X11/lib/X11/QuExt.c b/nx-X11/lib/X11/QuExt.c index 018d537bb..4e230e776 100644 --- a/nx-X11/lib/X11/QuExt.c +++ b/nx-X11/lib/X11/QuExt.c @@ -23,7 +23,6 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86$ */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -37,7 +36,7 @@ XQueryExtension( int *major_opcode, /* RETURN */ int *first_event, /* RETURN */ int *first_error) /* RETURN */ -{ +{ xQueryExtensionReply rep; register xQueryExtensionReq *req; diff --git a/nx-X11/lib/X11/QuKeybd.c b/nx-X11/lib/X11/QuKeybd.c index 68e1cbadf..4b8431d50 100644 --- a/nx-X11/lib/X11/QuKeybd.c +++ b/nx-X11/lib/X11/QuKeybd.c @@ -34,17 +34,16 @@ struct kmap { }; int -XQueryKeymap(dpy, keys) - register Display *dpy; - char keys[32]; - -{ +XQueryKeymap( + register Display *dpy, + char keys[32]) +{ xQueryKeymapReply rep; register xReq *req; LockDisplay(dpy); GetEmptyReq(QueryKeymap, req); - (void) _XReply(dpy, (xReply *)&rep, + (void) _XReply(dpy, (xReply *)&rep, (SIZEOF(xQueryKeymapReply) - SIZEOF(xReply)) >> 2, xTrue); *(struct kmap *) keys = *(struct kmap *)rep.map; /* faster than memcpy */ UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/QuPntr.c b/nx-X11/lib/X11/QuPntr.c index 795106d4d..e1379a6f5 100644 --- a/nx-X11/lib/X11/QuPntr.c +++ b/nx-X11/lib/X11/QuPntr.c @@ -29,13 +29,17 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Bool XQueryPointer(dpy, w, root, child, root_x, root_y, win_x, win_y, mask) - register Display *dpy; - Window w, *root, *child; - int *root_x, *root_y, *win_x, *win_y; - unsigned int *mask; - -{ +Bool XQueryPointer( + register Display *dpy, + Window w, + Window *root, + Window *child, + int *root_x, + int *root_y, + int *win_x, + int *win_y, + unsigned int *mask) +{ xQueryPointerReply rep; xResourceReq *req; diff --git a/nx-X11/lib/X11/QuStipShp.c b/nx-X11/lib/X11/QuStipShp.c index ff5e631ad..9f612fcb1 100644 --- a/nx-X11/lib/X11/QuStipShp.c +++ b/nx-X11/lib/X11/QuStipShp.c @@ -29,12 +29,14 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XQueryBestStipple(dpy, drawable, width, height, ret_width, ret_height) - register Display *dpy; - Drawable drawable; - unsigned int width, height; - unsigned int *ret_width, *ret_height; -{ +Status XQueryBestStipple( + register Display *dpy, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ xQueryBestSizeReply rep; register xQueryBestSizeReq *req; diff --git a/nx-X11/lib/X11/QuTileShp.c b/nx-X11/lib/X11/QuTileShp.c index b021ad4d7..f713f4248 100644 --- a/nx-X11/lib/X11/QuTileShp.c +++ b/nx-X11/lib/X11/QuTileShp.c @@ -29,12 +29,14 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XQueryBestTile(dpy, drawable, width, height, ret_width, ret_height) - register Display *dpy; - Drawable drawable; - unsigned int width, height; - unsigned int *ret_width, *ret_height; -{ +Status XQueryBestTile( + register Display *dpy, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ xQueryBestSizeReply rep; register xQueryBestSizeReq *req; diff --git a/nx-X11/lib/X11/QuTree.c b/nx-X11/lib/X11/QuTree.c index aaf26bfa6..3cea282fa 100644 --- a/nx-X11/lib/X11/QuTree.c +++ b/nx-X11/lib/X11/QuTree.c @@ -29,13 +29,13 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Status XQueryTree (dpy, w, root, parent, children, nchildren) - register Display *dpy; - Window w; - Window *root; /* RETURN */ - Window *parent; /* RETURN */ - Window **children; /* RETURN */ - unsigned int *nchildren; /* RETURN */ +Status XQueryTree ( + register Display *dpy, + Window w, + Window *root, /* RETURN */ + Window *parent, /* RETURN */ + Window **children, /* RETURN */ + unsigned int *nchildren) /* RETURN */ { long nbytes; xQueryTreeReply rep; @@ -49,7 +49,7 @@ Status XQueryTree (dpy, w, root, parent, children, nchildren) return (0); } - *children = (Window *) NULL; + *children = (Window *) NULL; if (rep.nChildren != 0) { nbytes = rep.nChildren * sizeof(Window); *children = (Window *) Xmalloc((unsigned) nbytes); diff --git a/nx-X11/lib/X11/Quarks.c b/nx-X11/lib/X11/Quarks.c index 58ec5b3f6..9a7cb04d5 100644 --- a/nx-X11/lib/X11/Quarks.c +++ b/nx-X11/lib/X11/Quarks.c @@ -4,13 +4,13 @@ Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -353,7 +353,7 @@ XrmStringToQuark( if (!name) return (NULLQUARK); - + for (tname = (char *)name; (c = *tname++); ) sig = (sig << 1) + c; @@ -376,7 +376,7 @@ XrmPermStringToQuark( return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); } -XrmQuark XrmUniqueQuark() +XrmQuark XrmUniqueQuark(void) { XrmQuark q; @@ -389,8 +389,7 @@ XrmQuark XrmUniqueQuark() return q; } -XrmString XrmQuarkToString(quark) - register XrmQuark quark; +XrmString XrmQuarkToString(register XrmQuark quark) { XrmString s; diff --git a/nx-X11/lib/X11/RaiseWin.c b/nx-X11/lib/X11/RaiseWin.c index 2985eb531..f431db579 100644 --- a/nx-X11/lib/X11/RaiseWin.c +++ b/nx-X11/lib/X11/RaiseWin.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XRaiseWindow (dpy, w) - register Display *dpy; - Window w; +XRaiseWindow ( + register Display *dpy, + Window w) { register xConfigureWindowReq *req; unsigned long val = Above; /* needed for macro below */ diff --git a/nx-X11/lib/X11/RdBitF.c b/nx-X11/lib/X11/RdBitF.c index ffb703ba3..b3c21bc53 100644 --- a/nx-X11/lib/X11/RdBitF.c +++ b/nx-X11/lib/X11/RdBitF.c @@ -27,17 +27,17 @@ from The Open Group. */ /* - * Code to read bitmaps from disk files. Interprets + * Code to read bitmaps from disk files. Interprets * data from X10 and X11 bitmap files and creates * Pixmap representations of files. Returns Pixmap * ID and specifics about image. * * Modified for speedup by Jim Becker, changed image - * data parsing logic (removed some fscanf()s). + * data parsing logic (removed some fscanf()s). * Aug 5, 1988 * * Note that this file and ../Xmu/RdBitF.c look very similar.... Keep them - * that way (but don't use common source code so that people can have one + * that way (but don't use common source code so that people can have one * without the other). */ @@ -54,43 +54,23 @@ from The Open Group. #define MAX_SIZE 255 /* shared data for the image read/parse logic */ -static short hexTable[256]; /* conversion value */ -static Bool initialized = False; /* easier to fill in at run time */ - - -/* - * Table index for the hex values. Initialized once, first time. - * Used for translation value or delimiter significance lookup. - */ -static void initHexTable(void) -{ - /* - * We build the table at run time for several reasons: - * - * 1. portable to non-ASCII machines. - * 2. still reentrant since we set the init flag after setting table. - * 3. easier to extend. - * 4. less prone to bugs. - */ - hexTable['0'] = 0; hexTable['1'] = 1; - hexTable['2'] = 2; hexTable['3'] = 3; - hexTable['4'] = 4; hexTable['5'] = 5; - hexTable['6'] = 6; hexTable['7'] = 7; - hexTable['8'] = 8; hexTable['9'] = 9; - hexTable['A'] = 10; hexTable['B'] = 11; - hexTable['C'] = 12; hexTable['D'] = 13; - hexTable['E'] = 14; hexTable['F'] = 15; - hexTable['a'] = 10; hexTable['b'] = 11; - hexTable['c'] = 12; hexTable['d'] = 13; - hexTable['e'] = 14; hexTable['f'] = 15; - - /* delimiters of significance are flagged w/ negative value */ - hexTable[' '] = -1; hexTable[','] = -1; - hexTable['}'] = -1; hexTable['\n'] = -1; - hexTable['\t'] = -1; - - initialized = True; -} +static const short hexTable[256] = { + ['0'] = 0, ['1'] = 1, + ['2'] = 2, ['3'] = 3, + ['4'] = 4, ['5'] = 5, + ['6'] = 6, ['7'] = 7, + ['8'] = 8, ['9'] = 9, + ['A'] = 10, ['B'] = 11, + ['C'] = 12, ['D'] = 13, + ['E'] = 14, ['F'] = 15, + ['a'] = 10, ['b'] = 11, + ['c'] = 12, ['d'] = 13, + ['e'] = 14, ['f'] = 15, + + [' '] = -1, [','] = -1, + ['}'] = -1, ['\n'] = -1, + ['\t'] = -1 +}; /* * read next hex value in the input stream, return -1 if EOF @@ -103,7 +83,7 @@ NextInt ( int value = 0; int gotone = 0; int done = 0; - + /* loop, accumulate hex value until find delimiter */ /* skip any initial delimiters found in read stream */ @@ -149,9 +129,6 @@ XReadBitmapFileData ( int hx = -1; /* x hotspot */ int hy = -1; /* y hotspot */ - /* first time initialization */ - if (initialized == False) initHexTable(); - #ifdef __UNIXOS2__ filename = __XOS2RedirRoot(filename); #endif @@ -185,7 +162,7 @@ XReadBitmapFileData ( } continue; } - + if (sscanf(line, "static short %s = {", name_and_type) == 1) version10p = 1; else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1) @@ -202,7 +179,7 @@ XReadBitmapFileData ( if (strcmp("bits[]", type)) continue; - + if (!ww || !hh) RETURN (BitmapFileInvalid); @@ -215,7 +192,7 @@ XReadBitmapFileData ( size = bytes_per_line * hh; bits = (unsigned char *) Xmalloc ((unsigned int) size); - if (!bits) + if (!bits) RETURN (BitmapNoMemory); if (version10p) { @@ -234,7 +211,7 @@ XReadBitmapFileData ( int bytes; for (bytes=0, ptr=bits; bytes<size; bytes++, ptr++) { - if ((value = NextInt(fstream)) < 0) + if ((value = NextInt(fstream)) < 0) RETURN (BitmapFileInvalid); *ptr=value; } diff --git a/nx-X11/lib/X11/RecolorC.c b/nx-X11/lib/X11/RecolorC.c index ca1771934..a54b48cb8 100644 --- a/nx-X11/lib/X11/RecolorC.c +++ b/nx-X11/lib/X11/RecolorC.c @@ -30,11 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XRecolorCursor(dpy, cursor, foreground, background) - register Display *dpy; - Cursor cursor; - XColor *foreground, *background; -{ +XRecolorCursor( + register Display *dpy, + Cursor cursor, + XColor *foreground, + XColor *background) +{ register xRecolorCursorReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/ReconfWM.c b/nx-X11/lib/X11/ReconfWM.c index 76cf1d46e..1776f2e15 100644 --- a/nx-X11/lib/X11/ReconfWM.c +++ b/nx-X11/lib/X11/ReconfWM.c @@ -34,12 +34,12 @@ from The Open Group. #define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ CWBorderWidth|CWSibling|CWStackMode) -Status XReconfigureWMWindow (dpy, w, screen, mask, changes) - register Display *dpy; - Window w; - int screen; - unsigned int mask; - XWindowChanges *changes; +Status XReconfigureWMWindow ( + register Display *dpy, + Window w, + int screen, + unsigned int mask, + XWindowChanges *changes) { XConfigureRequestEvent ev; Window root = RootWindow (dpy, screen); diff --git a/nx-X11/lib/X11/ReconfWin.c b/nx-X11/lib/X11/ReconfWin.c index 63a1fa150..bfa99f528 100644 --- a/nx-X11/lib/X11/ReconfWin.c +++ b/nx-X11/lib/X11/ReconfWin.c @@ -33,12 +33,12 @@ in this Software without prior written authorization from The Open Group. CWBorderWidth|CWSibling|CWStackMode) int -XConfigureWindow(dpy, w, mask, changes) - register Display *dpy; - Window w; - unsigned int mask; - XWindowChanges *changes; - { +XConfigureWindow( + register Display *dpy, + Window w, + unsigned int mask, + XWindowChanges *changes) +{ unsigned long values[7]; register unsigned long *value = values; long nvalues; @@ -52,7 +52,7 @@ XConfigureWindow(dpy, w, mask, changes) if (mask & CWX) *value++ = changes->x; - + if (mask & CWY) *value++ = changes->y; diff --git a/nx-X11/lib/X11/Region.c b/nx-X11/lib/X11/Region.c index 06f7e2547..5ce276279 100644 --- a/nx-X11/lib/X11/Region.c +++ b/nx-X11/lib/X11/Region.c @@ -27,13 +27,13 @@ Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -322,9 +322,9 @@ XOffsetRegion( return 1; } -/* +/* Utility procedure Compress: - Replace r by the region r', where + Replace r by the region r', where p in r' iff (Quantifer m <= dx) (p + m in r), and Quantifier is Exists if grow is TRUE, For all if grow is FALSE, and (x,y) + m = (x+m,y) if xdir is TRUE; (x,y+m) if xdir is FALSE. @@ -395,23 +395,6 @@ XShrinkRegion( return 0; } -#ifdef notdef -/*********************************************************** - * Bop down the array of rects until we have passed - * scanline y. numRects is the size of the array. - ***********************************************************/ - -static BOX -*IndexRects( - register BOX *rects, - register int numRects, - register int y) -{ - while ((numRects--) && (rects->y2 <= y)) - rects++; - return(rects); -} -#endif /*====================================================================== * Region Intersection @@ -505,9 +488,9 @@ XIntersectRegion( (!EXTENTCHECK(®1->extents, ®2->extents))) newReg->numRects = 0; else - miRegionOp (newReg, reg1, reg2, + miRegionOp (newReg, reg1, reg2, miIntersectO, NULL, NULL); - + /* * Can't alter newReg's extents before we call miRegionOp because * it might be one of the source regions and miRegionOp depends @@ -526,13 +509,13 @@ miRegionCopy( { if (dstrgn != rgn) /* don't want to copy to itself */ - { + { if (dstrgn->size < rgn->numRects) { if (dstrgn->rects) { BOX *prevRects = dstrgn->rects; - + if (! (dstrgn->rects = (BOX *) Xrealloc((char *) dstrgn->rects, (unsigned) rgn->numRects * (sizeof(BOX))))) { @@ -553,135 +536,6 @@ miRegionCopy( } } -#ifdef notdef - -/* - * combinRegs(newReg, reg1, reg2) - * if one region is above or below the other. -*/ - -static void -combineRegs( - register Region newReg, - Region reg1, - Region reg2) -{ - register Region tempReg; - register BOX *rects; - register BOX *rects1; - register BOX *rects2; - register int total; - - rects1 = reg1->rects; - rects2 = reg2->rects; - - total = reg1->numRects + reg2->numRects; - if (! (tempReg = XCreateRegion())) - return; - tempReg->size = total; - /* region 1 is below region 2 */ - if (reg1->extents.y1 > reg2->extents.y1) - { - miRegionCopy(tempReg, reg2); - rects = &tempReg->rects[tempReg->numRects]; - total -= tempReg->numRects; - while (total--) - *rects++ = *rects1++; - } - else - { - miRegionCopy(tempReg, reg1); - rects = &tempReg->rects[tempReg->numRects]; - total -= tempReg->numRects; - while (total--) - *rects++ = *rects2++; - } - tempReg->extents = reg1->extents; - tempReg->numRects = reg1->numRects + reg2->numRects; - EXTENTS(®2->extents, tempReg); - miRegionCopy(newReg, tempReg); - Xfree((char *)tempReg); -} - -/* - * QuickCheck checks to see if it does not have to go through all the - * the ugly code for the region call. It returns 1 if it did all - * the work for Union, otherwise 0 - still work to be done. -*/ - -static int -QuickCheck(Region newReg, Region reg1, Region reg2) -{ - - /* if unioning with itself or no rects to union with */ - if ( (reg1 == reg2) || (!(reg1->numRects)) ) - { - miRegionCopy(newReg, reg2); - return TRUE; - } - - /* if nothing to union */ - if (!(reg2->numRects)) - { - miRegionCopy(newReg, reg1); - return TRUE; - } - - /* could put an extent check to see if add above or below */ - - if ((reg1->extents.y1 >= reg2->extents.y2) || - (reg2->extents.y1 >= reg1->extents.y2) ) - { - combineRegs(newReg, reg1, reg2); - return TRUE; - } - return FALSE; -} - -/* TopRects(rects, reg1, reg2) - * N.B. We now assume that reg1 and reg2 intersect. Therefore we are - * NOT checking in the two while loops for stepping off the end of the - * region. - */ - -static int -TopRects( - register Region newReg, - register BOX *rects, - register Region reg1, - register Region reg2, - BOX *FirstRect) -{ - register BOX *tempRects; - - /* need to add some rects from region 1 */ - if (reg1->extents.y1 < reg2->extents.y1) - { - tempRects = reg1->rects; - while(tempRects->y1 < reg2->extents.y1) - { - MEMCHECK(newReg, rects, FirstRect); - ADDRECTNOX(newReg,rects, tempRects->x1, tempRects->y1, - tempRects->x2, MIN(tempRects->y2, reg2->extents.y1)); - tempRects++; - } - } - /* need to add some rects from region 2 */ - if (reg2->extents.y1 < reg1->extents.y1) - { - tempRects = reg2->rects; - while (tempRects->y1 < reg1->extents.y1) - { - MEMCHECK(newReg, rects, FirstRect); - ADDRECTNOX(newReg, rects, tempRects->x1,tempRects->y1, - tempRects->x2, MIN(tempRects->y2, reg1->extents.y1)); - tempRects++; - } - } - return 1; -} -#endif - /*====================================================================== * Generic Region Operator *====================================================================*/ @@ -737,7 +591,7 @@ miCoalesce( { pCurBox++; } - + if (pCurBox != pRegEnd) { /* @@ -754,7 +608,7 @@ miCoalesce( curStart = pRegEnd - pReg->rects; pRegEnd = pReg->rects + pReg->numRects; } - + if ((curNumRects == prevNumRects) && (curNumRects != 0)) { pCurBox -= curNumRects; /* @@ -822,7 +676,7 @@ miCoalesce( *pPrevBox++ = *pCurBox++; } while (pCurBox != pRegEnd); } - + } } return (curStart); @@ -903,7 +757,7 @@ miRegionOp( * band */ short bot; /* Bottom of non-overlapping * band */ - + /* * Initialization: * set r1, r2, r1End and r2End appropriately, preserve the important @@ -915,9 +769,9 @@ miRegionOp( r2 = reg2->rects; r1End = r1 + reg1->numRects; r2End = r2 + reg2->numRects; - + oldRects = newReg->rects; - + EMPTY_REGION(newReg); /* @@ -934,7 +788,7 @@ miRegionOp( newReg->size = 0; return; } - + /* * Initialize ybot and ytop. * In the upcoming loop, ybot and ytop serve different functions depending @@ -952,7 +806,7 @@ miRegionOp( ybot = reg1->extents.y1; else ybot = reg2->extents.y1; - + /* * prevBand serves to mark the start of the previous band so rectangles * can be coalesced into larger rectangles. qv. miCoalesce, above. @@ -963,7 +817,7 @@ miRegionOp( * array of rectangles. */ prevBand = 0; - + do { curBand = newReg->numRects; @@ -980,13 +834,13 @@ miRegionOp( { r1BandEnd++; } - + r2BandEnd = r2; while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1)) { r2BandEnd++; } - + /* * First handle the band that doesn't intersect, if any. * @@ -1046,7 +900,7 @@ miRegionOp( (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot); } - + if (newReg->numRects != curBand) { prevBand = miCoalesce (newReg, prevBand, curBand); @@ -1223,7 +1077,7 @@ miUnionO ( register short y2) { register BoxPtr pNextRect; - + pNextRect = &pReg->rects[pReg->numRects]; #define MERGERECT(r) \ @@ -1250,7 +1104,7 @@ miUnionO ( } \ assert(pReg->numRects<=pReg->size);\ r++; - + assert (y1<y2); while ((r1 != r1End) && (r2 != r2End)) { @@ -1263,7 +1117,7 @@ miUnionO ( MERGERECT(r2); } } - + if (r1 != r1End) { do @@ -1309,7 +1163,7 @@ XUnionRegion( /* * Region 1 completely subsumes region 2 */ - if ((reg1->numRects == 1) && + if ((reg1->numRects == 1) && (reg1->extents.x1 <= reg2->extents.x1) && (reg1->extents.y1 <= reg2->extents.y1) && (reg1->extents.x2 >= reg2->extents.x2) && @@ -1323,7 +1177,7 @@ XUnionRegion( /* * Region 2 completely subsumes region 1 */ - if ((reg2->numRects == 1) && + if ((reg2->numRects == 1) && (reg2->extents.x1 <= reg1->extents.x1) && (reg2->extents.y1 <= reg1->extents.y1) && (reg2->extents.x2 >= reg1->extents.x2) && @@ -1334,7 +1188,7 @@ XUnionRegion( return 1; } - miRegionOp (newReg, reg1, reg2, miUnionO, + miRegionOp (newReg, reg1, reg2, miUnionO, miUnionNonO, miUnionNonO); newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1); @@ -1374,9 +1228,9 @@ miSubtractNonO1 ( register short y2) { register BoxPtr pNextRect; - + pNextRect = &pReg->rects[pReg->numRects]; - + assert(y1<y2); while (r != rEnd) @@ -1424,9 +1278,9 @@ miSubtractO ( { register BoxPtr pNextRect; register int x1; - + x1 = r1->x1; - + assert(y1<y2); pNextRect = &pReg->rects[pReg->numRects]; @@ -1545,7 +1399,7 @@ miSubtractO ( } return 0; /* lint */ } - + /*- *----------------------------------------------------------------------- * miSubtract -- @@ -1564,7 +1418,7 @@ miSubtractO ( int XSubtractRegion( Region regM, - Region regS, + Region regS, register Region regD) { /* check for trivial reject */ @@ -1574,8 +1428,8 @@ XSubtractRegion( miRegionCopy(regD, regM); return 1; } - - miRegionOp (regD, regM, regS, miSubtractO, + + miRegionOp (regD, regM, regS, miSubtractO, miSubtractNonO1, NULL); /* @@ -1605,10 +1459,10 @@ XXorRegion(Region sra, Region srb, Region dr) } /* - * Check to see if the region is empty. Assumes a region is passed + * Check to see if the region is empty. Assumes a region is passed * as a parameter */ -int +int XEmptyRegion( Region r) { @@ -1617,9 +1471,9 @@ XEmptyRegion( } /* - * Check to see if two regions are equal + * Check to see if two regions are equal */ -int +int XEqualRegion(Region r1, Region r2) { int i; @@ -1639,7 +1493,7 @@ XEqualRegion(Region r1, Region r2) return TRUE; } -int +int XPointInRegion( Region pRegion, int x, int y) @@ -1658,7 +1512,7 @@ XPointInRegion( return FALSE; } -int +int XRectInRegion( register Region region, int rx, int ry, @@ -1674,7 +1528,7 @@ XRectInRegion( prect->y1 = ry; prect->x2 = rwidth + rx; prect->y2 = rheight + ry; - + /* this is (just) a useful optimization */ if ((region->numRects == 0) || !EXTENTCHECK(®ion->extents, prect)) return(RectangleOut); @@ -1736,6 +1590,6 @@ XRectInRegion( } - return(partIn ? ((ry < prect->y2) ? RectanglePart : RectangleIn) : + return(partIn ? ((ry < prect->y2) ? RectanglePart : RectangleIn) : RectangleOut); } diff --git a/nx-X11/lib/X11/RepWindow.c b/nx-X11/lib/X11/RepWindow.c index 51d2c77e9..1fde8d80f 100644 --- a/nx-X11/lib/X11/RepWindow.c +++ b/nx-X11/lib/X11/RepWindow.c @@ -30,10 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XReparentWindow(dpy, w, p, x, y) - register Display *dpy; - Window w, p; - int x, y; +XReparentWindow( + register Display *dpy, + Window w, + Window p, + int x, + int y) { register xReparentWindowReq *req; diff --git a/nx-X11/lib/X11/RestackWs.c b/nx-X11/lib/X11/RestackWs.c index a3ddd7211..b2a77fcdf 100644 --- a/nx-X11/lib/X11/RestackWs.c +++ b/nx-X11/lib/X11/RestackWs.c @@ -30,11 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XRestackWindows (dpy, windows, n) - register Display *dpy; - register Window *windows; - int n; - { +XRestackWindows ( + register Display *dpy, + register Window *windows, + int n) +{ int i = 0; LockDisplay(dpy); @@ -50,12 +50,10 @@ XRestackWindows (dpy, windows, n) *values++ = *(windows-1); *values = Below; } - } + } UnlockDisplay(dpy); SyncHandle(); return 1; } - - diff --git a/nx-X11/lib/X11/RotProp.c b/nx-X11/lib/X11/RotProp.c index eb7257a58..98d7dbd81 100644 --- a/nx-X11/lib/X11/RotProp.c +++ b/nx-X11/lib/X11/RotProp.c @@ -30,13 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XRotateWindowProperties(dpy, w, properties, nprops, npositions) - register Display *dpy; - Window w; - Atom *properties; - register int nprops; - int npositions; - { +XRotateWindowProperties( + register Display *dpy, + Window w, + Atom *properties, + register int nprops, + int npositions) +{ register long nbytes; register xRotatePropertiesReq *req; @@ -45,7 +45,7 @@ XRotateWindowProperties(dpy, w, properties, nprops, npositions) req->window = w; req->nAtoms = nprops; req->nPositions = npositions; - + req->length += nprops; nbytes = nprops << 2; /* XXX Cray needs packing here.... */ diff --git a/nx-X11/lib/X11/ScrResStr.c b/nx-X11/lib/X11/ScrResStr.c index 2a5553f4a..3e8d39071 100644 --- a/nx-X11/lib/X11/ScrResStr.c +++ b/nx-X11/lib/X11/ScrResStr.c @@ -30,8 +30,7 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" #include <nx-X11/Xatom.h> -char *XScreenResourceString(screen) - Screen *screen; +char *XScreenResourceString(Screen *screen) { Atom prop_name; Atom actual_type; diff --git a/nx-X11/lib/X11/SelInput.c b/nx-X11/lib/X11/SelInput.c index 83c1e4d9d..a3fa294f4 100644 --- a/nx-X11/lib/X11/SelInput.c +++ b/nx-X11/lib/X11/SelInput.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSelectInput (dpy, w, mask) - register Display *dpy; - Window w; - long mask; +XSelectInput ( + register Display *dpy, + Window w, + long mask) { register xChangeWindowAttributesReq *req; diff --git a/nx-X11/lib/X11/SendEvent.c b/nx-X11/lib/X11/SendEvent.c index 34c04f3a9..1de986007 100644 --- a/nx-X11/lib/X11/SendEvent.c +++ b/nx-X11/lib/X11/SendEvent.c @@ -34,12 +34,12 @@ in this Software without prior written authorization from The Open Group. * event converter here if it has never been installed. */ Status -XSendEvent(dpy, w, propagate, event_mask, event) - register Display *dpy; - Window w; - Bool propagate; - long event_mask; - XEvent *event; +XSendEvent( + register Display *dpy, + Window w, + Bool propagate, + long event_mask, + XEvent *event) { register xSendEventReq *req; xEvent ev; @@ -49,6 +49,11 @@ XSendEvent(dpy, w, propagate, event_mask, event) xEvent * /* event */); Status status; + /* initialize all of the event's fields first, before setting + * the meaningful ones later. + */ + memset (&ev, 0, sizeof (ev)); + LockDisplay (dpy); /* call through display to find proper conversion routine */ diff --git a/nx-X11/lib/X11/SetBack.c b/nx-X11/lib/X11/SetBack.c index c10d17c1e..269d10cc7 100644 --- a/nx-X11/lib/X11/SetBack.c +++ b/nx-X11/lib/X11/SetBack.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetBackground (dpy, gc, background) -register Display *dpy; -GC gc; -unsigned long background; /* CARD32 */ +XSetBackground ( + register Display *dpy, + GC gc, + unsigned long background) /* CARD32 */ { LockDisplay(dpy); if (gc->values.background != background) { diff --git a/nx-X11/lib/X11/SetCRects.c b/nx-X11/lib/X11/SetCRects.c index 60812e898..21b68f8a2 100644 --- a/nx-X11/lib/X11/SetCRects.c +++ b/nx-X11/lib/X11/SetCRects.c @@ -62,14 +62,14 @@ void _XSetClipRectangles ( } int -XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, - ordering) - register Display *dpy; - GC gc; - int clip_x_origin, clip_y_origin; - XRectangle *rectangles; - int n; - int ordering; +XSetClipRectangles ( + register Display *dpy, + GC gc, + int clip_x_origin, + int clip_y_origin, + XRectangle *rectangles, + int n, + int ordering) { LockDisplay(dpy); _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, @@ -78,4 +78,3 @@ XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, SyncHandle(); return 1; } - diff --git a/nx-X11/lib/X11/SetClMask.c b/nx-X11/lib/X11/SetClMask.c index 9060a9ab1..82cdb2cce 100644 --- a/nx-X11/lib/X11/SetClMask.c +++ b/nx-X11/lib/X11/SetClMask.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetClipMask (dpy, gc, mask) -register Display *dpy; -GC gc; -Pixmap mask; +XSetClipMask ( + register Display *dpy, + GC gc, + Pixmap mask) { LockDisplay(dpy); /* always update, since client may have changed pixmap contents */ diff --git a/nx-X11/lib/X11/SetClOrig.c b/nx-X11/lib/X11/SetClOrig.c index 533fba8c5..800e1570d 100644 --- a/nx-X11/lib/X11/SetClOrig.c +++ b/nx-X11/lib/X11/SetClOrig.c @@ -30,10 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetClipOrigin (dpy, gc, xorig, yorig) -register Display *dpy; -GC gc; -int xorig, yorig; +XSetClipOrigin ( + register Display *dpy, + GC gc, + int xorig, + int yorig) { XGCValues *gv = &gc->values; diff --git a/nx-X11/lib/X11/SetFPath.c b/nx-X11/lib/X11/SetFPath.c index 623605c9b..89955c23e 100644 --- a/nx-X11/lib/X11/SetFPath.c +++ b/nx-X11/lib/X11/SetFPath.c @@ -32,10 +32,10 @@ in this Software without prior written authorization from The Open Group. #define safestrlen(s) ((s) ? strlen(s) : 0) int -XSetFontPath (dpy, directories, ndirs) -register Display *dpy; -char **directories; -int ndirs; +XSetFontPath ( + register Display *dpy, + char **directories, + int ndirs) { register int n = 0; register int i; diff --git a/nx-X11/lib/X11/SetFont.c b/nx-X11/lib/X11/SetFont.c index 6ab429236..33ffca02d 100644 --- a/nx-X11/lib/X11/SetFont.c +++ b/nx-X11/lib/X11/SetFont.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetFont (dpy, gc, font) -register Display *dpy; -GC gc; -Font font; +XSetFont ( + register Display *dpy, + GC gc, + Font font) { LockDisplay(dpy); if (gc->values.font != font) { diff --git a/nx-X11/lib/X11/SetFore.c b/nx-X11/lib/X11/SetFore.c index ab73b2d23..50c9f1228 100644 --- a/nx-X11/lib/X11/SetFore.c +++ b/nx-X11/lib/X11/SetFore.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetForeground (dpy, gc, foreground) -register Display *dpy; -GC gc; -unsigned long foreground; /* CARD32 */ +XSetForeground ( + register Display *dpy, + GC gc, + unsigned long foreground) /* CARD32 */ { LockDisplay(dpy); if (gc->values.foreground != foreground) { diff --git a/nx-X11/lib/X11/SetFunc.c b/nx-X11/lib/X11/SetFunc.c index 624f3bd7a..ffe4ec0cc 100644 --- a/nx-X11/lib/X11/SetFunc.c +++ b/nx-X11/lib/X11/SetFunc.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetFunction (dpy, gc, function) -register Display *dpy; -GC gc; -int function; +XSetFunction ( + register Display *dpy, + GC gc, + int function) { LockDisplay(dpy); if (gc->values.function != function) { diff --git a/nx-X11/lib/X11/SetHints.c b/nx-X11/lib/X11/SetHints.c index cea5624de..7301ce42a 100644 --- a/nx-X11/lib/X11/SetHints.c +++ b/nx-X11/lib/X11/SetHints.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -58,86 +58,108 @@ SOFTWARE. #define safestrlen(s) ((s) ? strlen(s) : 0) int -XSetSizeHints(dpy, w, hints, property) /* old routine */ - Display *dpy; - Window w; - XSizeHints *hints; - Atom property; +XSetSizeHints( /* old routine */ + Display *dpy, + Window w, + XSizeHints *hints, + Atom property) { - xPropSizeHints prop; + xPropSizeHints prop; + memset(&prop, 0, sizeof(prop)); prop.flags = (hints->flags & (USPosition|USSize|PAllHints)); - prop.x = hints->x; - prop.y = hints->y; - prop.width = hints->width; - prop.height = hints->height; - prop.minWidth = hints->min_width; - prop.minHeight = hints->min_height; - prop.maxWidth = hints->max_width; - prop.maxHeight = hints->max_height; - prop.widthInc = hints->width_inc; - prop.heightInc = hints->height_inc; - prop.minAspectX = hints->min_aspect.x; - prop.minAspectY = hints->min_aspect.y; - prop.maxAspectX = hints->max_aspect.x; - prop.maxAspectY = hints->max_aspect.y; + if (hints->flags & (USPosition|PPosition)) { + prop.x = hints->x; + prop.y = hints->y; + } + if (hints->flags & (USSize|PSize)) { + prop.width = hints->width; + prop.height = hints->height; + } + if (hints->flags & PMinSize) { + prop.minWidth = hints->min_width; + prop.minHeight = hints->min_height; + } + if (hints->flags & PMaxSize) { + prop.maxWidth = hints->max_width; + prop.maxHeight = hints->max_height; + } + if (hints->flags & PResizeInc) { + prop.widthInc = hints->width_inc; + prop.heightInc = hints->height_inc; + } + if (hints->flags & PAspect) { + prop.minAspectX = hints->min_aspect.x; + prop.minAspectY = hints->min_aspect.y; + prop.maxAspectX = hints->max_aspect.x; + prop.maxAspectY = hints->max_aspect.y; + } return XChangeProperty (dpy, w, property, XA_WM_SIZE_HINTS, 32, - PropModeReplace, (unsigned char *) &prop, + PropModeReplace, (unsigned char *) &prop, OldNumPropSizeElements); } -/* - * XSetWMHints sets the property +/* + * XSetWMHints sets the property * WM_HINTS type: WM_HINTS format:32 */ int -XSetWMHints (dpy, w, wmhints) - Display *dpy; - Window w; - XWMHints *wmhints; +XSetWMHints ( + Display *dpy, + Window w, + XWMHints *wmhints) { xPropWMHints prop; + memset(&prop, 0, sizeof(prop)); prop.flags = wmhints->flags; - prop.input = (wmhints->input == True ? 1 : 0); - prop.initialState = wmhints->initial_state; - prop.iconPixmap = wmhints->icon_pixmap; - prop.iconWindow = wmhints->icon_window; - prop.iconX = wmhints->icon_x; - prop.iconY = wmhints->icon_y; - prop.iconMask = wmhints->icon_mask; - prop.windowGroup = wmhints->window_group; + if (wmhints->flags & InputHint) + prop.input = (wmhints->input == True ? 1 : 0); + if (wmhints->flags & StateHint) + prop.initialState = wmhints->initial_state; + if (wmhints->flags & IconPixmapHint) + prop.iconPixmap = wmhints->icon_pixmap; + if (wmhints->flags & IconWindowHint) + prop.iconWindow = wmhints->icon_window; + if (wmhints->flags & IconPositionHint) { + prop.iconX = wmhints->icon_x; + prop.iconY = wmhints->icon_y; + } + if (wmhints->flags & IconMaskHint) + prop.iconMask = wmhints->icon_mask; + if (wmhints->flags & WindowGroupHint) + prop.windowGroup = wmhints->window_group; return XChangeProperty (dpy, w, XA_WM_HINTS, XA_WM_HINTS, 32, - PropModeReplace, (unsigned char *) &prop, + PropModeReplace, (unsigned char *) &prop, NumPropWMHintsElements); } -/* - * XSetZoomHints sets the property +/* + * XSetZoomHints sets the property * WM_ZOOM_HINTS type: WM_SIZE_HINTS format: 32 */ int -XSetZoomHints (dpy, w, zhints) - Display *dpy; - Window w; - XSizeHints *zhints; +XSetZoomHints ( + Display *dpy, + Window w, + XSizeHints *zhints) { return XSetSizeHints (dpy, w, zhints, XA_WM_ZOOM_HINTS); } -/* - * XSetNormalHints sets the property +/* + * XSetNormalHints sets the property * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 */ int -XSetNormalHints (dpy, w, hints) /* old routine */ - Display *dpy; - Window w; - XSizeHints *hints; +XSetNormalHints ( /* old routine */ + Display *dpy, + Window w, + XSizeHints *hints) { return XSetSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); } @@ -151,11 +173,11 @@ XSetNormalHints (dpy, w, hints) /* old routine */ */ int -XSetIconSizes (dpy, w, list, count) - Display *dpy; - Window w; /* typically, root */ - XIconSize *list; - int count; /* number of items on the list */ +XSetIconSizes ( + Display *dpy, + Window w, /* typically, root */ + XIconSize *list, + int count) /* number of items on the list */ { register int i; xPropIconSize *pp, *prop; @@ -173,8 +195,8 @@ XSetIconSizes (dpy, w, list, count) pp += 1; list += 1; } - XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, - PropModeReplace, (unsigned char *) prop, + XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, + PropModeReplace, (unsigned char *) prop, count * NumPropIconSizeElements); Xfree ((char *)prop); } @@ -182,11 +204,11 @@ XSetIconSizes (dpy, w, list, count) } int -XSetCommand (dpy, w, argv, argc) - Display *dpy; - Window w; - char **argv; - int argc; +XSetCommand ( + Display *dpy, + Window w, + char **argv, + int argc) { register int i; register int nbytes; @@ -194,10 +216,10 @@ XSetCommand (dpy, w, argv, argc) for (i = 0, nbytes = 0; i < argc; i++) { nbytes += safestrlen(argv[i]) + 1; } - if ((bp = buf = Xmalloc((unsigned) nbytes))) { + if ((bp = buf = Xmalloc((unsigned) nbytes))) { /* copy arguments into single buffer */ for (i = 0; i < argc; i++) { - if (argv[i]) { + if (argv[i]) { (void) strcpy(bp, argv[i]); bp += strlen(argv[i]) + 1; } @@ -206,11 +228,11 @@ XSetCommand (dpy, w, argv, argc) } XChangeProperty (dpy, w, XA_WM_COMMAND, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, nbytes); - Xfree(buf); + Xfree(buf); } return 1; } -/* +/* * XSetStandardProperties sets the following properties: * WM_NAME type: STRING format: 8 * WM_ICON_NAME type: STRING format: 8 @@ -245,7 +267,7 @@ XSetStandardProperties ( phints.flags |= IconPixmapHint; } if (argv != NULL) XSetCommand(dpy, w, argv, argc); - + if (hints != NULL) XSetNormalHints(dpy, w, hints); if (phints.flags != 0) XSetWMHints(dpy, w, &phints); @@ -254,20 +276,20 @@ XSetStandardProperties ( } int -XSetTransientForHint(dpy, w, propWindow) - Display *dpy; - Window w; - Window propWindow; +XSetTransientForHint( + Display *dpy, + Window w, + Window propWindow) { return XChangeProperty(dpy, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, PropModeReplace, (unsigned char *) &propWindow, 1); } int -XSetClassHint(dpy, w, classhint) - Display *dpy; - Window w; - XClassHint *classhint; +XSetClassHint( + Display *dpy, + Window w, + XClassHint *classhint) { char *class_string; char *s; @@ -275,7 +297,7 @@ XSetClassHint(dpy, w, classhint) len_nm = safestrlen(classhint->res_name); len_cl = safestrlen(classhint->res_class); - if ((class_string = s = Xmalloc((unsigned) (len_nm + len_cl + 2)))) { + if ((class_string = s = Xmalloc((unsigned) (len_nm + len_cl + 2)))) { if (len_nm) { strcpy(s, classhint->res_name); s += len_nm + 1; @@ -287,7 +309,7 @@ XSetClassHint(dpy, w, classhint) else *s = '\0'; XChangeProperty(dpy, w, XA_WM_CLASS, XA_STRING, 8, - PropModeReplace, (unsigned char *) class_string, + PropModeReplace, (unsigned char *) class_string, len_nm+len_cl+2); Xfree(class_string); } diff --git a/nx-X11/lib/X11/SetIFocus.c b/nx-X11/lib/X11/SetIFocus.c index a71bb9455..bee96ca82 100644 --- a/nx-X11/lib/X11/SetIFocus.c +++ b/nx-X11/lib/X11/SetIFocus.c @@ -30,12 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetInputFocus(dpy, focus, revert_to, time) - register Display *dpy; - Window focus; - int revert_to; - Time time; -{ +XSetInputFocus( + register Display *dpy, + Window focus, + int revert_to, + Time time) +{ register xSetInputFocusReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/SetLStyle.c b/nx-X11/lib/X11/SetLStyle.c index 596489a06..8b00fae9c 100644 --- a/nx-X11/lib/X11/SetLStyle.c +++ b/nx-X11/lib/X11/SetLStyle.c @@ -30,13 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetLineAttributes(dpy, gc, linewidth, linestyle, capstyle, joinstyle) -register Display *dpy; -GC gc; -unsigned int linewidth; /* CARD16 */ -int linestyle; -int capstyle; -int joinstyle; +XSetLineAttributes( + register Display *dpy, + GC gc, + unsigned int linewidth, /* CARD16 */ + int linestyle, + int capstyle, + int joinstyle) { XGCValues *gv = &gc->values; diff --git a/nx-X11/lib/X11/SetLocale.c b/nx-X11/lib/X11/SetLocale.c index c8998d8b8..6936cbf87 100644 --- a/nx-X11/lib/X11/SetLocale.c +++ b/nx-X11/lib/X11/SetLocale.c @@ -17,7 +17,7 @@ * OMRON, NTT SOFTWARE, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT, BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. @@ -25,7 +25,7 @@ * Authors: Li Yuhong OMRON Corporation * Tetsuya Kato NTT Software Corporation * Hiroshi Kuribayashi OMRON Corporation - * + * */ /* @@ -118,7 +118,7 @@ _Xsetlocale( #else /* X_LOCALE */ -#ifdef __DARWIN__ +#if defined(__APPLE__) || defined(__CYGWIN__) char * _Xsetlocale( int category, @@ -127,7 +127,7 @@ _Xsetlocale( { return setlocale(category, name); } -#endif /* __DARWIN__ */ +#endif /* __APPLE__ || __CYGWIN__ */ /* * _XlcMapOSLocaleName is an implementation dependent routine that derives @@ -135,12 +135,12 @@ _Xsetlocale( * returned by setlocale. * * Should match the code in Xt ExtractLocaleName. - * + * * This function name is a bit of a misnomer. Even the siname parameter - * name is a misnomer. On most modern operating systems this function is - * a no-op, simply returning the osname; but on older operating systems - * like Ultrix, or HPUX 9.x and earlier, when you set LANG=german.88591 - * then the string returned by setlocale(LC_ALL, "") will look something + * name is a misnomer. On most modern operating systems this function is + * a no-op, simply returning the osname; but on older operating systems + * like Ultrix, or HPUX 9.x and earlier, when you set LANG=german.88591 + * then the string returned by setlocale(LC_ALL, "") will look something * like: "german.88591 german.88591 ... german.88591". Then this function * will pick out the LC_CTYPE component and return a pointer to that. */ @@ -208,7 +208,7 @@ _XlcMapOSLocaleName( start = osname; # endif # ifdef STARTCHAR - if (start && (start = strchr (start, STARTCHAR))) + if (start && (start = strchr (start, STARTCHAR))) # elif defined (STARTSTR) if (start && (start = strstr (start,STARTSTR))) # endif diff --git a/nx-X11/lib/X11/SetNrmHint.c b/nx-X11/lib/X11/SetNrmHint.c index ec9e7cfb4..937f4eb6b 100644 --- a/nx-X11/lib/X11/SetNrmHint.c +++ b/nx-X11/lib/X11/SetNrmHint.c @@ -59,15 +59,16 @@ from The Open Group. #include <nx-X11/Xatom.h> #include <nx-X11/Xos.h> -void XSetWMSizeHints (dpy, w, hints, prop) - Display *dpy; - Window w; - XSizeHints *hints; - Atom prop; +void XSetWMSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + Atom prop) { xPropSizeHints data; - data.flags = (hints->flags & + memset(&data, 0, sizeof(data)); + data.flags = (hints->flags & (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize| PResizeInc|PAspect|PBaseSize|PWinGravity)); @@ -75,35 +76,51 @@ void XSetWMSizeHints (dpy, w, hints, prop) * The x, y, width, and height fields are obsolete; but, applications * that want to work with old window managers might set them. */ - data.x = hints->x; - data.y = hints->y; - data.width = hints->width; - data.height = hints->height; - - data.minWidth = hints->min_width; - data.minHeight = hints->min_height; - data.maxWidth = hints->max_width; - data.maxHeight = hints->max_height; - data.widthInc = hints->width_inc; - data.heightInc = hints->height_inc; - data.minAspectX = hints->min_aspect.x; - data.minAspectY = hints->min_aspect.y; - data.maxAspectX = hints->max_aspect.x; - data.maxAspectY = hints->max_aspect.y; - data.baseWidth = hints->base_width; - data.baseHeight = hints->base_height; - data.winGravity = hints->win_gravity; - + if (hints->flags & (USPosition|PPosition)) { + data.x = hints->x; + data.y = hints->y; + } + if (hints->flags & (USSize|PSize)) { + data.width = hints->width; + data.height = hints->height; + } + + if (hints->flags & PMinSize) { + data.minWidth = hints->min_width; + data.minHeight = hints->min_height; + } + if (hints->flags & PMaxSize) { + data.maxWidth = hints->max_width; + data.maxHeight = hints->max_height; + } + if (hints->flags & PResizeInc) { + data.widthInc = hints->width_inc; + data.heightInc = hints->height_inc; + } + if (hints->flags & PAspect) { + data.minAspectX = hints->min_aspect.x; + data.minAspectY = hints->min_aspect.y; + data.maxAspectX = hints->max_aspect.x; + data.maxAspectY = hints->max_aspect.y; + } + if (hints->flags & PBaseSize) { + data.baseWidth = hints->base_width; + data.baseHeight = hints->base_height; + } + if (hints->flags & PWinGravity) { + data.winGravity = hints->win_gravity; + } + XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, PropModeReplace, (unsigned char *) &data, NumPropSizeElements); } -void XSetWMNormalHints (dpy, w, hints) - Display *dpy; - Window w; - XSizeHints *hints; +void XSetWMNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints) { XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); } diff --git a/nx-X11/lib/X11/SetPMask.c b/nx-X11/lib/X11/SetPMask.c index dc2faf8f3..9f236b00b 100644 --- a/nx-X11/lib/X11/SetPMask.c +++ b/nx-X11/lib/X11/SetPMask.c @@ -30,17 +30,17 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetPlaneMask (dpy, gc, planemask) -register Display *dpy; -GC gc; -unsigned long planemask; /* CARD32 */ +XSetPlaneMask ( + register Display *dpy, + GC gc, + unsigned long planemask) /* CARD32 */ { LockDisplay(dpy); if (gc->values.plane_mask != planemask) { gc->values.plane_mask = planemask; gc->dirty |= GCPlaneMask; } - UnlockDisplay(dpy); + UnlockDisplay(dpy); SyncHandle(); return 1; } diff --git a/nx-X11/lib/X11/SetPntMap.c b/nx-X11/lib/X11/SetPntMap.c index 138b788a5..45571ada0 100644 --- a/nx-X11/lib/X11/SetPntMap.c +++ b/nx-X11/lib/X11/SetPntMap.c @@ -44,7 +44,7 @@ XSetPointerMapping ( req->nElts = nmaps; req->length += (nmaps + 3)>>2; Data (dpy, (char *)map, (long) nmaps); - if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) + if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) rep.success = MappingSuccess; UnlockDisplay(dpy); SyncHandle(); @@ -52,14 +52,13 @@ XSetPointerMapping ( } int -XChangeKeyboardMapping (dpy, first_keycode, keysyms_per_keycode, - keysyms, nkeycodes) - register Display *dpy; - int first_keycode; - int keysyms_per_keycode; - KeySym *keysyms; - int nkeycodes; - { +XChangeKeyboardMapping ( + register Display *dpy, + int first_keycode, + int keysyms_per_keycode, + KeySym *keysyms, + int nkeycodes) +{ register long nbytes; register xChangeKeyboardMappingReq *req; @@ -68,7 +67,6 @@ XChangeKeyboardMapping (dpy, first_keycode, keysyms_per_keycode, req->firstKeyCode = first_keycode; req->keyCodes = nkeycodes; req->keySymsPerKeyCode = keysyms_per_keycode; - req->firstKeyCode = first_keycode; req->length += nkeycodes * keysyms_per_keycode; nbytes = keysyms_per_keycode * nkeycodes * 4; Data32 (dpy, (long *)keysyms, nbytes); @@ -76,4 +74,3 @@ XChangeKeyboardMapping (dpy, first_keycode, keysyms_per_keycode, SyncHandle(); return 0; } - diff --git a/nx-X11/lib/X11/SetRGBCMap.c b/nx-X11/lib/X11/SetRGBCMap.c index 27d9a1efb..def7a22ca 100644 --- a/nx-X11/lib/X11/SetRGBCMap.c +++ b/nx-X11/lib/X11/SetRGBCMap.c @@ -35,12 +35,12 @@ from The Open Group. #include "Xatomtype.h" #include <nx-X11/Xatom.h> -void XSetRGBColormaps (dpy, w, cmaps, count, property) - Display *dpy; - Window w; - XStandardColormap *cmaps; - int count; - Atom property; /* XA_RGB_BEST_MAP, etc. */ +void XSetRGBColormaps ( + Display *dpy, + Window w, + XStandardColormap *cmaps, + int count, + Atom property) /* XA_RGB_BEST_MAP, etc. */ { register int i; /* iterator variable */ register xPropStandardColormap *map; /* tmp variable, data in prop */ @@ -48,7 +48,7 @@ void XSetRGBColormaps (dpy, w, cmaps, count, property) xPropStandardColormap *data, tmpdata; /* scratch data */ int mode = PropModeReplace; /* for partial writes */ Bool alloced_scratch_space; /* do we need to free? */ - + if (count < 1) return; diff --git a/nx-X11/lib/X11/SetSOwner.c b/nx-X11/lib/X11/SetSOwner.c index 5ed7a56f2..bc8f56403 100644 --- a/nx-X11/lib/X11/SetSOwner.c +++ b/nx-X11/lib/X11/SetSOwner.c @@ -30,11 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetSelectionOwner(dpy, selection, owner, time) -register Display *dpy; -Atom selection; -Window owner; -Time time; +XSetSelectionOwner( + register Display *dpy, + Atom selection, + Window owner, + Time time) { register xSetSelectionOwnerReq *req; diff --git a/nx-X11/lib/X11/SetSSaver.c b/nx-X11/lib/X11/SetSSaver.c index 5536b833b..adce749e1 100644 --- a/nx-X11/lib/X11/SetSSaver.c +++ b/nx-X11/lib/X11/SetSSaver.c @@ -30,9 +30,12 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetScreenSaver(dpy, timeout, interval, prefer_blank, allow_exp) - register Display *dpy; - int timeout, interval, prefer_blank, allow_exp; +XSetScreenSaver( + register Display *dpy, + int timeout, + int interval, + int prefer_blank, + int allow_exp) { register xSetScreenSaverReq *req; diff --git a/nx-X11/lib/X11/SetStCmap.c b/nx-X11/lib/X11/SetStCmap.c index 82e01e4d0..7b8aa862d 100644 --- a/nx-X11/lib/X11/SetStCmap.c +++ b/nx-X11/lib/X11/SetStCmap.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -56,16 +56,16 @@ SOFTWARE. /* * WARNING - * + * * This is a pre-ICCCM routine. It must not reference any of the new fields * in the XStandardColormap structure. */ -void XSetStandardColormap(dpy, w, cmap, property) - Display *dpy; - Window w; - XStandardColormap *cmap; - Atom property; /* XA_RGB_BEST_MAP, etc. */ +void XSetStandardColormap( + Display *dpy, + Window w, + XStandardColormap *cmap, + Atom property) /* XA_RGB_BEST_MAP, etc. */ { Screen *sp; XStandardColormap stdcmap; @@ -87,6 +87,9 @@ void XSetStandardColormap(dpy, w, cmap, property) stdcmap.visualid = sp->root_visual->visualid; stdcmap.killid = None; /* don't know how to kill this one */ +#ifdef XCMS XSetRGBColormaps (dpy, w, &stdcmap, 1, property); +#endif + return; } diff --git a/nx-X11/lib/X11/SetState.c b/nx-X11/lib/X11/SetState.c index c37442bb2..e5aa21c05 100644 --- a/nx-X11/lib/X11/SetState.c +++ b/nx-X11/lib/X11/SetState.c @@ -30,12 +30,13 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetState(dpy, gc, foreground, background, function, planemask) -register Display *dpy; -GC gc; -int function; -unsigned long planemask; -unsigned long foreground, background; +XSetState( + register Display *dpy, + GC gc, + unsigned long foreground, + unsigned long background, + int function, + unsigned long planemask) { XGCValues *gv = &gc->values; diff --git a/nx-X11/lib/X11/SetStip.c b/nx-X11/lib/X11/SetStip.c index 0e6e6a74f..e95882786 100644 --- a/nx-X11/lib/X11/SetStip.c +++ b/nx-X11/lib/X11/SetStip.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetStipple (dpy, gc, stipple) -register Display *dpy; -GC gc; -Pixmap stipple; +XSetStipple ( + register Display *dpy, + GC gc, + Pixmap stipple) { LockDisplay(dpy); /* always update, since client may have changed pixmap contents */ diff --git a/nx-X11/lib/X11/SetTSOrig.c b/nx-X11/lib/X11/SetTSOrig.c index 53b6eab55..0117c818b 100644 --- a/nx-X11/lib/X11/SetTSOrig.c +++ b/nx-X11/lib/X11/SetTSOrig.c @@ -30,10 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetTSOrigin (dpy, gc, x, y) -register Display *dpy; -GC gc; -int x, y; +XSetTSOrigin ( + register Display *dpy, + GC gc, + int x, + int y) { XGCValues *gv = &gc->values; diff --git a/nx-X11/lib/X11/SetTile.c b/nx-X11/lib/X11/SetTile.c index 5836cf80d..d32edff06 100644 --- a/nx-X11/lib/X11/SetTile.c +++ b/nx-X11/lib/X11/SetTile.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XSetTile (dpy, gc, tile) -register Display *dpy; -GC gc; -Pixmap tile; +XSetTile ( + register Display *dpy, + GC gc, + Pixmap tile) { LockDisplay(dpy); /* always update, since client may have changed pixmap contents */ diff --git a/nx-X11/lib/X11/SetTxtProp.c b/nx-X11/lib/X11/SetTxtProp.c index b3161c972..c3f272712 100644 --- a/nx-X11/lib/X11/SetTxtProp.c +++ b/nx-X11/lib/X11/SetTxtProp.c @@ -3,13 +3,13 @@ Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Wyse not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -57,36 +57,36 @@ from The Open Group. #include <nx-X11/Xos.h> #include <stdio.h> -void XSetTextProperty (dpy, w, tp, property) - Display *dpy; - Window w; - Atom property; - XTextProperty *tp; +void XSetTextProperty ( + Display *dpy, + Window w, + XTextProperty *tp, + Atom property) { XChangeProperty (dpy, w, property, tp->encoding, tp->format, PropModeReplace, tp->value, tp->nitems); } -void XSetWMName (dpy, w, tp) - Display *dpy; - Window w; - XTextProperty *tp; +void XSetWMName ( + Display *dpy, + Window w, + XTextProperty *tp) { XSetTextProperty (dpy, w, tp, XA_WM_NAME); } -void XSetWMIconName (dpy, w, tp) - Display *dpy; - Window w; - XTextProperty *tp; +void XSetWMIconName ( + Display *dpy, + Window w, + XTextProperty *tp) { XSetTextProperty (dpy, w, tp, XA_WM_ICON_NAME); } -void XSetWMClientMachine (dpy, w, tp) - Display *dpy; - Window w; - XTextProperty *tp; +void XSetWMClientMachine ( + Display *dpy, + Window w, + XTextProperty *tp) { XSetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE); } diff --git a/nx-X11/lib/X11/SetWMCMapW.c b/nx-X11/lib/X11/SetWMCMapW.c index 2e1a5c184..98d6c80b3 100644 --- a/nx-X11/lib/X11/SetWMCMapW.c +++ b/nx-X11/lib/X11/SetWMCMapW.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -52,16 +52,16 @@ SOFTWARE. #include "Xlibint.h" #include <nx-X11/Xatom.h> -/* - * XSetWMProtocols sets the property +/* + * XSetWMProtocols sets the property * WM_COLORMAP_WINDOWS type: WINDOW format:32 */ -Status XSetWMColormapWindows (dpy, w, windows, count) - Display *dpy; - Window w; - Window *windows; - int count; +Status XSetWMColormapWindows ( + Display *dpy, + Window w, + Window *windows, + int count) { Atom prop; diff --git a/nx-X11/lib/X11/SetWMProto.c b/nx-X11/lib/X11/SetWMProto.c index 4a8f798af..14067b870 100644 --- a/nx-X11/lib/X11/SetWMProto.c +++ b/nx-X11/lib/X11/SetWMProto.c @@ -28,13 +28,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -52,16 +52,16 @@ SOFTWARE. #include "Xlibint.h" #include <nx-X11/Xatom.h> -/* - * XSetWMProtocols sets the property +/* + * XSetWMProtocols sets the property * WM_PROTOCOLS type: ATOM format: 32 */ -Status XSetWMProtocols (dpy, w, protocols, count) - Display *dpy; - Window w; - Atom *protocols; - int count; +Status XSetWMProtocols ( + Display *dpy, + Window w, + Atom *protocols, + int count) { Atom prop; diff --git a/nx-X11/lib/X11/StBytes.c b/nx-X11/lib/X11/StBytes.c index b968d2114..0cbbb25f6 100644 --- a/nx-X11/lib/X11/StBytes.c +++ b/nx-X11/lib/X11/StBytes.c @@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group. #include <nx-X11/Xatom.h> /* insulate predefined atom numbers from cut routines */ -static Atom n_to_atom[8] = { +static const Atom n_to_atom[8] = { XA_CUT_BUFFER0, XA_CUT_BUFFER1, XA_CUT_BUFFER2, @@ -42,17 +42,20 @@ static Atom n_to_atom[8] = { XA_CUT_BUFFER7}; int -XRotateBuffers (dpy, rotate) - register Display *dpy; - int rotate; +XRotateBuffers ( + register Display *dpy, + int rotate) { - return XRotateWindowProperties(dpy, RootWindow(dpy, 0), n_to_atom, 8, rotate); + /* XRotateWindowProperties wants a non-const Atom*, but it doesn't + * modify it, so this is safe. + */ + return XRotateWindowProperties(dpy, RootWindow(dpy, 0), (Atom *)n_to_atom, 8, rotate); } - -char *XFetchBuffer (dpy, nbytes, buffer) - register Display *dpy; - int *nbytes; - register int buffer; + +char *XFetchBuffer ( + register Display *dpy, + int *nbytes, + register int buffer) { Atom actual_type; int actual_format; @@ -62,8 +65,8 @@ char *XFetchBuffer (dpy, nbytes, buffer) *nbytes = 0; if ((buffer < 0) || (buffer > 7)) return (NULL); /* XXX should be (sizeof (maxint) - 1)/4 */ - if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], - 0L, 10000000L, False, XA_STRING, + if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], + 0L, 10000000L, False, XA_STRING, &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { return (NULL); } @@ -75,9 +78,9 @@ char *XFetchBuffer (dpy, nbytes, buffer) return(NULL); } -char *XFetchBytes (dpy, nbytes) - register Display *dpy; - int *nbytes; +char *XFetchBytes ( + register Display *dpy, + int *nbytes) { return (XFetchBuffer (dpy, nbytes, 0)); } @@ -90,7 +93,7 @@ XStoreBuffer ( register int buffer) { if ((buffer < 0) || (buffer > 7)) return 0; - return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], + return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], XA_STRING, 8, PropModeReplace, (unsigned char *) bytes, nbytes); } diff --git a/nx-X11/lib/X11/StColor.c b/nx-X11/lib/X11/StColor.c index 9c7685517..b19f0a5dc 100644 --- a/nx-X11/lib/X11/StColor.c +++ b/nx-X11/lib/X11/StColor.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XStoreColor(dpy, cmap, def) -register Display *dpy; -Colormap cmap; -XColor *def; +XStoreColor( + register Display *dpy, + Colormap cmap, + XColor *def) { xColorItem *citem; register xStoreColorsReq *req; diff --git a/nx-X11/lib/X11/StColors.c b/nx-X11/lib/X11/StColors.c index 2eb0c79f8..17a215cc0 100644 --- a/nx-X11/lib/X11/StColors.c +++ b/nx-X11/lib/X11/StColors.c @@ -30,17 +30,17 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XStoreColors(dpy, cmap, defs, ncolors) -register Display *dpy; -Colormap cmap; -XColor *defs; -int ncolors; +XStoreColors( + register Display *dpy, + Colormap cmap, + XColor *defs, + int ncolors) { register int i; xColorItem citem; register xStoreColorsReq *req; - LockDisplay(dpy); + LockDisplay(dpy); GetReq(StoreColors, req); req->cmap = cmap; @@ -56,7 +56,7 @@ int ncolors; /* note that xColorItem doesn't contain all 16-bit quantities, so we can't use Data16 */ - Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); + Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); /* assume size is 4*n */ } UnlockDisplay(dpy); diff --git a/nx-X11/lib/X11/StNColor.c b/nx-X11/lib/X11/StNColor.c index a557721e0..8b821c3ef 100644 --- a/nx-X11/lib/X11/StNColor.c +++ b/nx-X11/lib/X11/StNColor.c @@ -46,6 +46,7 @@ int flags) /* DoRed, DoGreen, DoBlue */ XcmsColor cmsColor_exact; XColor scr_def; +#ifdef XCMS /* * Let's Attempt to use Xcms approach to Parse Color */ @@ -62,6 +63,7 @@ int flags) /* DoRed, DoGreen, DoBlue */ * name. Thus pass name to the X Server. */ } +#endif /* * The Xcms and i18n methods failed, so lets pass it to the server diff --git a/nx-X11/lib/X11/StName.c b/nx-X11/lib/X11/StName.c index 5b1d720dc..3f33472d3 100644 --- a/nx-X11/lib/X11/StName.c +++ b/nx-X11/lib/X11/StName.c @@ -36,7 +36,7 @@ XStoreName ( Window w, _Xconst char *name) { - return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, + return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, 8, PropModeReplace, (unsigned char *)name, name ? strlen(name) : 0); } @@ -47,7 +47,7 @@ XSetIconName ( Window w, _Xconst char *icon_name) { - return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, + return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, PropModeReplace, (unsigned char *)icon_name, icon_name ? strlen(icon_name) : 0); } diff --git a/nx-X11/lib/X11/StrKeysym.c b/nx-X11/lib/X11/StrKeysym.c index 1ef32e594..9bdc80d32 100644 --- a/nx-X11/lib/X11/StrKeysym.c +++ b/nx-X11/lib/X11/StrKeysym.c @@ -53,7 +53,7 @@ _XInitKeysymDB(void) { if (!initialized) { - char *dbname; + const char *dbname; XrmInitialize(); /* use and name of this env var is not part of the standard */ diff --git a/nx-X11/lib/X11/StrToText.c b/nx-X11/lib/X11/StrToText.c index 22e7708d1..64ed5fd24 100644 --- a/nx-X11/lib/X11/StrToText.c +++ b/nx-X11/lib/X11/StrToText.c @@ -32,16 +32,16 @@ in this Software without prior written authorization from The Open Group. #include <nx-X11/Xutil.h> /* - * XStringListToTextProperty - fill in TextProperty structure with - * concatenated list of null-separated strings. Return True if successful + * XStringListToTextProperty - fill in TextProperty structure with + * concatenated list of null-separated strings. Return True if successful * else False. Allocate room on end for trailing NULL, but don't include in * count. */ -Status XStringListToTextProperty (argv, argc, textprop) - char **argv; - int argc; - XTextProperty *textprop; +Status XStringListToTextProperty ( + char **argv, + int argc, + XTextProperty *textprop) { register int i; register unsigned int nbytes; diff --git a/nx-X11/lib/X11/Sync.c b/nx-X11/lib/X11/Sync.c index 50fa0c571..6326de768 100644 --- a/nx-X11/lib/X11/Sync.c +++ b/nx-X11/lib/X11/Sync.c @@ -32,9 +32,9 @@ in this Software without prior written authorization from The Open Group. /* Synchronize with errors and events, optionally discarding pending events */ int -XSync (dpy, discard) - register Display *dpy; - Bool discard; +XSync ( + register Display *dpy, + Bool discard) { xGetInputFocusReply rep; register xReq *req; diff --git a/nx-X11/lib/X11/Text16.c b/nx-X11/lib/X11/Text16.c index 01dea7d03..008a3f7a5 100644 --- a/nx-X11/lib/X11/Text16.c +++ b/nx-X11/lib/X11/Text16.c @@ -38,7 +38,7 @@ XDrawString16( int y, _Xconst XChar2b *string, int length) -{ +{ int Datalength = 0; register xPolyText16Req *req; @@ -60,11 +60,11 @@ XDrawString16( req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ - /* + /* * If the entire request does not fit into the remaining space in the * buffer, flush the buffer first. If the request does fit into the * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. + * the buffer 32-bit aligned. */ if (dpy->bufptr + Datalength > dpy->bufmax) @@ -86,11 +86,11 @@ XDrawString16( PartialNChars = PartialNChars - 254; CharacterOffset += 254; } - + if (PartialNChars) { nbytes = PartialNChars * 2 + SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); + BufAlloc (xTextElt *, elt, nbytes); elt->delta = 0; elt->len = PartialNChars; memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2); @@ -101,23 +101,23 @@ XDrawString16( if (Datalength &= 3) { char *pad; - /* + /* * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" */ length = 4 - Datalength; BufAlloc (char *, pad, length); - /* + /* * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt + * so the pad bytes aren't mistaken for a final xTextElt */ *pad = 0; } - /* + /* * If the buffer pointer is not now pointing to a 32-bit boundary, * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. + * at the end of this routine. */ if ((dpy->bufptr - dpy->buffer) & 3) diff --git a/nx-X11/lib/X11/TextToStr.c b/nx-X11/lib/X11/TextToStr.c index d8cf80c91..e75b7fcea 100644 --- a/nx-X11/lib/X11/TextToStr.c +++ b/nx-X11/lib/X11/TextToStr.c @@ -38,10 +38,10 @@ in this Software without prior written authorization from The Open Group. * null-separated STRING property. */ -Status XTextPropertyToStringList (tp, list_return, count_return) - XTextProperty *tp; - char ***list_return; - int *count_return; +Status XTextPropertyToStringList ( + XTextProperty *tp, + char ***list_return, + int *count_return) { char **list; /* return value */ int nelements; /* return value */ @@ -74,7 +74,7 @@ Status XTextPropertyToStringList (tp, list_return, count_return) */ list = (char **) Xmalloc (nelements * sizeof (char *)); if (!list) return False; - + start = (char *) Xmalloc ((datalen + 1) * sizeof (char)); /* for <NUL> */ if (!start) { Xfree ((char *) list); @@ -107,8 +107,7 @@ Status XTextPropertyToStringList (tp, list_return, count_return) } -void XFreeStringList (list) - char **list; +void XFreeStringList (char **list) { if (list) { if (list[0]) Xfree (list[0]); diff --git a/nx-X11/lib/X11/TrCoords.c b/nx-X11/lib/X11/TrCoords.c index 692eca958..77c1f0672 100644 --- a/nx-X11/lib/X11/TrCoords.c +++ b/nx-X11/lib/X11/TrCoords.c @@ -29,14 +29,16 @@ in this Software without prior written authorization from The Open Group. #endif #include "Xlibint.h" -Bool XTranslateCoordinates(dpy, src_win, dest_win, src_x, src_y, - dst_x, dst_y, child) - register Display *dpy; - Window src_win, dest_win; - int src_x, src_y; - int *dst_x, *dst_y; - Window *child; -{ +Bool XTranslateCoordinates( + register Display *dpy, + Window src_win, + Window dest_win, + int src_x, + int src_y, + int *dst_x, + int *dst_y, + Window *child) +{ register xTranslateCoordsReq *req; xTranslateCoordsReply rep; @@ -51,7 +53,7 @@ Bool XTranslateCoordinates(dpy, src_win, dest_win, src_x, src_y, SyncHandle(); return(False); } - + *child = rep.child; *dst_x = cvtINT16toInt (rep.dstX); *dst_y = cvtINT16toInt (rep.dstY); diff --git a/nx-X11/lib/X11/UIThrStubs.c b/nx-X11/lib/X11/UIThrStubs.c index 13df9e7ce..a3bcdfc41 100644 --- a/nx-X11/lib/X11/UIThrStubs.c +++ b/nx-X11/lib/X11/UIThrStubs.c @@ -1,5 +1,4 @@ /* - * $XFree86: xc/lib/XThrStub/UIThrStubs.c,v 3.3 2001/11/18 21:13:26 herrb Exp $ * * Copyright (c) 1995 David E. Wexelblat. All rights reserved * @@ -10,10 +9,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -21,16 +20,16 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. - * + * * Except as contained in this notice, the name of David E. Wexelblat shall * not be used in advertising or otherwise to promote the sale, use or * other dealings in this Software without prior written authorization * from David E. Wexelblat. - * + * */ /* - * Stubs for thread functions needed by the X library. Supports + * Stubs for thread functions needed by the X library. Supports * UnixWare 2.x threads; may support Solaris 2 threads as well, but not * tested. Defining things this way removes the dependency of the X * library on the threads library, but still supports threads if the user @@ -145,7 +144,7 @@ _Xthr_equal_stub_() #endif /* SVR4 */ #endif /* CTHREADS */ -static xthread_t +static xthread_t _Xthr_self_stub_() { static xthread_t _X_no_thread_id; @@ -153,7 +152,7 @@ _Xthr_self_stub_() return(_X_no_thread_id); /* defined by <X11/Xthreads.h> */ } -static int +static int _Xthr_zero_stub_() { return(0); diff --git a/nx-X11/lib/X11/UndefCurs.c b/nx-X11/lib/X11/UndefCurs.c index 73a1c2efa..1d46ff946 100644 --- a/nx-X11/lib/X11/UndefCurs.c +++ b/nx-X11/lib/X11/UndefCurs.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUndefineCursor (dpy,w) - register Display *dpy; - Window w; +XUndefineCursor ( + register Display *dpy, + Window w) { register xChangeWindowAttributesReq *req; unsigned long defcurs = None; diff --git a/nx-X11/lib/X11/UngrabBut.c b/nx-X11/lib/X11/UngrabBut.c index a586852f6..13545ed98 100644 --- a/nx-X11/lib/X11/UngrabBut.c +++ b/nx-X11/lib/X11/UngrabBut.c @@ -30,11 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUngrabButton(dpy, button, modifiers, grab_window) -register Display *dpy; -unsigned int button; /* CARD8 */ -unsigned int modifiers; /* CARD16 */ -Window grab_window; +XUngrabButton( + register Display *dpy, + unsigned int button, /* CARD8 */ + unsigned int modifiers, /* CARD16 */ + Window grab_window) { register xUngrabButtonReq *req; diff --git a/nx-X11/lib/X11/UngrabKbd.c b/nx-X11/lib/X11/UngrabKbd.c index d0db7c9c0..974e8a324 100644 --- a/nx-X11/lib/X11/UngrabKbd.c +++ b/nx-X11/lib/X11/UngrabKbd.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUngrabKeyboard (dpy, time) - register Display *dpy; - Time time; +XUngrabKeyboard ( + register Display *dpy, + Time time) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/UngrabKey.c b/nx-X11/lib/X11/UngrabKey.c index b0b42a731..919c4e76c 100644 --- a/nx-X11/lib/X11/UngrabKey.c +++ b/nx-X11/lib/X11/UngrabKey.c @@ -30,12 +30,11 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUngrabKey(dpy, key, modifiers, grab_window) - register Display *dpy; - int key; - unsigned int modifiers; - Window grab_window; - +XUngrabKey( + register Display *dpy, + int key, + unsigned int modifiers, + Window grab_window) { register xUngrabKeyReq *req; diff --git a/nx-X11/lib/X11/UngrabPtr.c b/nx-X11/lib/X11/UngrabPtr.c index 113d6fd8f..16417921c 100644 --- a/nx-X11/lib/X11/UngrabPtr.c +++ b/nx-X11/lib/X11/UngrabPtr.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUngrabPointer(dpy, time) -register Display *dpy; -Time time; +XUngrabPointer( + register Display *dpy, + Time time) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/UngrabSvr.c b/nx-X11/lib/X11/UngrabSvr.c index 6577603b9..ea0084879 100644 --- a/nx-X11/lib/X11/UngrabSvr.c +++ b/nx-X11/lib/X11/UngrabSvr.c @@ -30,8 +30,8 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUngrabServer (dpy) -register Display *dpy; +XUngrabServer ( + register Display *dpy) { register xReq *req; diff --git a/nx-X11/lib/X11/UninsCmap.c b/nx-X11/lib/X11/UninsCmap.c index 5388d9339..db574ef7c 100644 --- a/nx-X11/lib/X11/UninsCmap.c +++ b/nx-X11/lib/X11/UninsCmap.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUninstallColormap(dpy, cmap) -register Display *dpy; -Colormap cmap; +XUninstallColormap( + register Display *dpy, + Colormap cmap) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/UnldFont.c b/nx-X11/lib/X11/UnldFont.c index aab81b5a9..a4f69fee4 100644 --- a/nx-X11/lib/X11/UnldFont.c +++ b/nx-X11/lib/X11/UnldFont.c @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUnloadFont(dpy, font) - register Display *dpy; - Font font; -{ +XUnloadFont( + register Display *dpy, + Font font) +{ register xResourceReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/UnmapSubs.c b/nx-X11/lib/X11/UnmapSubs.c index b097af3d3..7490a70e9 100644 --- a/nx-X11/lib/X11/UnmapSubs.c +++ b/nx-X11/lib/X11/UnmapSubs.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUnmapSubwindows(dpy, win) -register Display *dpy; -Window win; +XUnmapSubwindows( + register Display *dpy, + Window win) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/UnmapWin.c b/nx-X11/lib/X11/UnmapWin.c index 108e2dcac..51ae16319 100644 --- a/nx-X11/lib/X11/UnmapWin.c +++ b/nx-X11/lib/X11/UnmapWin.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XUnmapWindow (dpy, w) - register Display *dpy; - Window w; +XUnmapWindow ( + register Display *dpy, + Window w) { register xResourceReq *req; diff --git a/nx-X11/lib/X11/VisUtil.c b/nx-X11/lib/X11/VisUtil.c index 70f3d999a..3434c0161 100644 --- a/nx-X11/lib/X11/VisUtil.c +++ b/nx-X11/lib/X11/VisUtil.c @@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group. #include <stdio.h> /* * This procedure returns a list of visual information structures - * that match the specified attributes given in the visual information + * that match the specified attributes given in the visual information * template. * * If no visuals exist that match the specified attributes, a NULL is @@ -53,12 +53,11 @@ in this Software without prior written authorization from The Open Group. * VisualAllMask */ -XVisualInfo *XGetVisualInfo( dpy, visual_info_mask, - visual_info_template, nitems) -Display *dpy; -register long visual_info_mask; -register XVisualInfo *visual_info_template; -int *nitems; /* RETURN */ +XVisualInfo *XGetVisualInfo( + Display *dpy, + register long visual_info_mask, + register XVisualInfo *visual_info_template, + int *nitems) /* RETURN */ { register Visual *vp; @@ -76,7 +75,7 @@ int *nitems; /* RETURN */ count = 0; total = 10; - if (! (vip_base = vip = (XVisualInfo *) + if (! (vip_base = vip = (XVisualInfo *) Xmalloc((unsigned) (sizeof(XVisualInfo) * total)))) { UnlockDisplay(dpy); return (XVisualInfo *) NULL; @@ -128,13 +127,13 @@ int *nitems; /* RETURN */ (vp->bits_per_rgb != visual_info_template->bits_per_rgb)) continue; /* YEA!!! WE FOUND A GOOD ONE */ - + if (count+1 > total) { XVisualInfo *old_vip_base = vip_base; total += 10; if (! (vip_base = (XVisualInfo *) - Xrealloc((char *) vip_base, + Xrealloc((char *) vip_base, (unsigned) (sizeof(XVisualInfo) * total)))) { Xfree((char *) old_vip_base); UnlockDisplay(dpy); @@ -160,7 +159,7 @@ int *nitems; /* RETURN */ } /* END OF LOOP ON VISUALS */ } /* END OF IF THERE ARE ANY VISUALS AT THIS DEPTH */ - + } /* END OF LOOP ON DEPTHS */ } /* END OF LOOP ON SCREENS */ @@ -180,21 +179,21 @@ int *nitems; /* RETURN */ /* - * This procedure will return the visual information for a visual - * that matches the specified depth and class for a screen. Since - * multiple visuals may exist that match the specified depth and + * This procedure will return the visual information for a visual + * that matches the specified depth and class for a screen. Since + * multiple visuals may exist that match the specified depth and * class, which visual chosen is undefined. * * If a visual is found, True is returned as the function value, * otherwise False is returned. */ -Status XMatchVisualInfo( dpy, screen, depth, class, visual_info) - Display *dpy; - int screen; - int depth; - int class; - XVisualInfo *visual_info; /* RETURNED */ +Status XMatchVisualInfo( + Display *dpy, + int screen, + int depth, + int class, + XVisualInfo *visual_info) /* RETURNED */ { Visual *vp; @@ -225,7 +224,7 @@ Status XMatchVisualInfo( dpy, screen, depth, class, visual_info) /* if nvisuals == 0 then vp will be NULL */ for (jj=0; jj<dp->nvisuals; jj++) { - if (vp->class == class) + if (vp->class == class) { visual_info->visual = _XVIDtoVisual(dpy, vp->visualid); visual_info->visualid = vp->visualid; diff --git a/nx-X11/lib/X11/WMProps.c b/nx-X11/lib/X11/WMProps.c index b610f70e0..249072936 100644 --- a/nx-X11/lib/X11/WMProps.c +++ b/nx-X11/lib/X11/WMProps.c @@ -32,13 +32,13 @@ Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name of Wyse not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -60,7 +60,7 @@ SOFTWARE. #include <nx-X11/Xlocale.h> -/* +/* * XSetWMProperties sets the following properties: * WM_NAME type: TEXT format: varies? * WM_ICON_NAME type: TEXT format: varies? @@ -69,19 +69,19 @@ SOFTWARE. * WM_CLIENT_MACHINE type: TEXT format: varies? * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 * WM_CLASS type: STRING/STRING format: 8 + * WM_LOCALE_NAME type: STRING format: 8 */ - -void XSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints, - wmHints, classHints) - Display *dpy; - Window w; /* window to decorate */ - XTextProperty *windowName; /* name of application */ - XTextProperty *iconName; /* name string for icon */ - char **argv; /* command line */ - int argc; /* size of command line */ - XSizeHints *sizeHints; /* size hints for window in its normal state */ - XWMHints *wmHints; /* miscelaneous window manager hints */ - XClassHint *classHints; /* resource name and class */ + +void XSetWMProperties ( + Display *dpy, + Window w, /* window to decorate */ + XTextProperty *windowName, /* name of application */ + XTextProperty *iconName, /* name string for icon */ + char **argv, /* command line */ + int argc, /* size of command line */ + XSizeHints *sizeHints, /* size hints for window in its normal state */ + XWMHints *wmHints, /* miscelaneous window manager hints */ + XClassHint *classHints) /* resource name and class */ { XTextProperty textprop; char hostName[256]; @@ -107,7 +107,7 @@ void XSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints, textprop.format = 8; textprop.nitems = len; XSetWMClientMachine (dpy, w, &textprop); - + /* set hints about how geometry and window manager interaction */ if (sizeHints) XSetWMNormalHints (dpy, w, sizeHints); if (wmHints) XSetWMHints (dpy, w, wmHints); @@ -137,7 +137,7 @@ void XSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints, } XSetClassHint (dpy, w, classHints); } - + locale = setlocale(LC_CTYPE, (char *)NULL); if (locale) XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False), diff --git a/nx-X11/lib/X11/WarpPtr.c b/nx-X11/lib/X11/WarpPtr.c index a59482b5a..c88ca4704 100644 --- a/nx-X11/lib/X11/WarpPtr.c +++ b/nx-X11/lib/X11/WarpPtr.c @@ -30,14 +30,17 @@ in this Software without prior written authorization from The Open Group. #include "Xlibint.h" int -XWarpPointer(dpy, src_win, dest_win, src_x, src_y, src_width, src_height, - dest_x, dest_y) - register Display *dpy; - Window src_win, dest_win; - int src_x, src_y; - unsigned int src_width, src_height; - int dest_x, dest_y; -{ +XWarpPointer( + register Display *dpy, + Window src_win, + Window dest_win, + int src_x, + int src_y, + unsigned int src_width, + unsigned int src_height, + int dest_x, + int dest_y) +{ register xWarpPointerReq *req; LockDisplay(dpy); diff --git a/nx-X11/lib/X11/Window.c b/nx-X11/lib/X11/Window.c index 3f2d48528..85a28f372 100644 --- a/nx-X11/lib/X11/Window.c +++ b/nx-X11/lib/X11/Window.c @@ -41,7 +41,7 @@ void _XProcessWindowAttributes ( if (valuemask & CWBackPixmap) *value++ = attributes->background_pixmap; - + if (valuemask & CWBackPixel) *value++ = attributes->background_pixel; @@ -59,7 +59,7 @@ void _XProcessWindowAttributes ( if (valuemask & CWBackingStore) *value++ = attributes->backing_store; - + if (valuemask & CWBackingPlanes) *value++ = attributes->backing_planes; @@ -97,17 +97,19 @@ void _XProcessWindowAttributes ( CWOverrideRedirect|CWSaveUnder|CWEventMask|\ CWDontPropagate|CWColormap|CWCursor) -Window XCreateWindow(dpy, parent, x, y, width, height, - borderWidth, depth, class, visual, valuemask, attributes) - register Display *dpy; - Window parent; - int x, y; - unsigned int width, height, borderWidth; - int depth; - unsigned int class; - Visual *visual; - unsigned long valuemask; - XSetWindowAttributes *attributes; +Window XCreateWindow( + register Display *dpy, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int borderWidth, + int depth, + unsigned int class, + Visual *visual, + unsigned long valuemask, + XSetWindowAttributes *attributes) { Window wid; register xCreateWindowReq *req; @@ -129,7 +131,7 @@ Window XCreateWindow(dpy, parent, x, y, width, height, wid = req->wid = XAllocID(dpy); valuemask &= AllMaskBits; if ((req->mask = valuemask)) - _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req, + _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req, valuemask, attributes); UnlockDisplay(dpy); SyncHandle(); diff --git a/nx-X11/lib/X11/Withdraw.c b/nx-X11/lib/X11/Withdraw.c index fae80d67a..bca1f8d9b 100644 --- a/nx-X11/lib/X11/Withdraw.c +++ b/nx-X11/lib/X11/Withdraw.c @@ -4,13 +4,13 @@ Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Wyse not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -62,10 +62,10 @@ from The Open Group. * This function instructs the window manager to change this window from * NormalState or IconicState to Withdrawn. */ -Status XWithdrawWindow (dpy, w, screen) - Display *dpy; - Window w; - int screen; +Status XWithdrawWindow ( + Display *dpy, + Window w, + int screen) { XUnmapEvent ev; Window root = RootWindow (dpy, screen); diff --git a/nx-X11/lib/X11/WrBitF.c b/nx-X11/lib/X11/WrBitF.c index dad8d5989..c9ed6b47e 100644 --- a/nx-X11/lib/X11/WrBitF.c +++ b/nx-X11/lib/X11/WrBitF.c @@ -34,7 +34,7 @@ from The Open Group. #include "Xutil.h" #include <stdio.h> -#define ERR_RETURN 0 +#define ERR_RETURN NULL static char *Format_Image( XImage *image, @@ -80,7 +80,7 @@ static char *Format_Image( return(data); } - + #define BYTES_PER_OUTPUT_LINE 12 int diff --git a/nx-X11/lib/X11/Xintatom.h b/nx-X11/lib/X11/Xintatom.h index 756d3445b..f4057798d 100644 --- a/nx-X11/lib/X11/Xintatom.h +++ b/nx-X11/lib/X11/Xintatom.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifndef _XINTATOM_H_ #define _XINTATOM_H_ 1 diff --git a/nx-X11/lib/X11/Xintconn.h b/nx-X11/lib/X11/Xintconn.h index 7f7ff485b..54200ed9f 100644 --- a/nx-X11/lib/X11/Xintconn.h +++ b/nx-X11/lib/X11/Xintconn.h @@ -6,6 +6,7 @@ _XFUNCPROTOBEGIN +#if !USE_XCB /* ConnDis.c */ int _XConnectDisplay ( @@ -26,6 +27,7 @@ extern XtransConnInfo _X11TransConnectDisplay(char *display_name, int *screenp, char **auth_namep, int *auth_namelenp, char **auth_datap, int *auth_datalenp); +#endif /* !USE_XCB */ /* OpenDis.c */ extern void _XFreeDisplayStructure(Display *dpy); diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c index 8a622d55d..44c77af52 100644 --- a/nx-X11/lib/X11/XlibInt.c +++ b/nx-X11/lib/X11/XlibInt.c @@ -118,9 +118,7 @@ xthread_t (*_Xthread_self_fn)(void) = NULL; #define UnlockNextEventReader(d) #endif /* !USE_XCB */ -#endif /* XTHREADS else */ - -#include <nx/NX.h> +#endif /* XTHREADS else */ #ifdef NX_TRANS_SOCKET @@ -141,9 +139,7 @@ static struct timeval retry; */ #ifdef NX_TRANS_CHANGE - extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); - #endif #endif /* #ifdef NX_TRANS_SOCKET */ @@ -170,20 +166,16 @@ extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); #endif /* WIN32 */ #ifdef WIN32 -# define ECHECK(err) (WSAGetLastError() == err) -# define ESET(val) WSASetLastError(val) +#define ECHECK(err) (WSAGetLastError() == err) +#define ESET(val) WSASetLastError(val) +#else +#ifdef __UNIXOS2__ +#define ECHECK(err) (errno == err) +#define ESET(val) #else -# ifdef __UNIXOS2__ -# define ECHECK(err) (errno == err) -# define ESET(val) -# else -# ifdef ISC -# define ECHECK(err) ((errno == err) || ETEST()) -# else -# define ECHECK(err) (errno == err) -# endif -# define ESET(val) errno = val -# endif +#define ECHECK(err) (errno == err) +#define ESET(val) errno = val +#endif #endif #if defined(LOCALCONN) || defined(LACHMAN) @@ -383,16 +375,13 @@ _XWaitForWritable( #endif int nfound; +#ifdef NX_TRANS_SOCKET #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) int congestion; #endif - -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { return; } - #endif #ifdef USE_POLL @@ -431,28 +420,57 @@ _XWaitForWritable( #endif #ifndef NX_TRANS_SOCKET -# ifdef USE_POLL +#ifdef USE_POLL filedes.events = POLLIN; filedes.events |= POLLOUT; -# else +#else FD_SET(dpy->fd, &r_mask); FD_SET(dpy->fd, &w_mask); -# endif +#endif #endif /* #ifndef NX_TRANS_SOCKET */ do { +#ifdef NX_TRANS_SOCKET + /* + * Give a chance to the registered client to perform + * any needed operation before entering the select. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XWaitForWritable: WAIT! Waiting for the display to become writable.\n"); +#endif + NXTransFlush(dpy->fd); + + if (_NXDisplayBlockFunction != NULL) { + (*_NXDisplayBlockFunction)(dpy, NXBlockWrite); + } + + /* + * Need to set again the descriptors as we could have + * run multiple selects before having the possibility + * to read or write to the X connection. + */ + +#ifdef USE_POLL + filedes.events = POLLIN; + filedes.events |= POLLOUT; +#else + FD_SET(dpy->fd, &r_mask); + FD_SET(dpy->fd, &w_mask); +#endif +#endif /* #ifdef NX_TRANS_SOCKET */ UnlockDisplay(dpy); #ifdef USE_POLL -# if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForWritable: Calling poll().\n"); -# endif +#endif nfound = poll (&filedes, 1, -1); #else /* USE_POLL */ -# if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n", NXTransTime()); -# endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ -# ifdef NX_TRANS_SOCKET +#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ +#ifdef NX_TRANS_SOCKET /* * Give a chance to the callback to detect * the failure of the display even if we @@ -466,10 +484,10 @@ _XWaitForWritable( } else { nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); } -# else /* NX_TRANS_SOCKET */ +#else /* NX_TRANS_SOCKET */ nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); -# endif /* NX_TRANS_SOCKET */ -# if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) +#endif /* NX_TRANS_SOCKET */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n", nfound, NXTransTime()); @@ -488,17 +506,16 @@ _XWaitForWritable( fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n", dpy->fd); } -# endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ +#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ #endif /* USE_POLL */ InternalLockDisplay(dpy, cv != NULL); +#ifdef NX_TRANS_SOCKET #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) if (_NXDisplayCongestionFunction != NULL && _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { (*_NXDisplayCongestionFunction)(dpy, congestion); } #endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) */ - -#ifdef NX_TRANS_SOCKET if (nfound <= 0) { if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) || (_NXDisplayErrorFunction != NULL && @@ -772,10 +789,27 @@ _XWaitForReadable( result, (result < 0 ? errno : 0)); #endif InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply); +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } +#endif +#ifdef NX_TRANS_SOCKET + if (result <= 0) { + if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return -1; + } + continue; + } +#else if (result == -1 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy); if (result <= 0) continue; - +#endif #ifdef USE_POLL if (filedes[0].revents & (POLLIN|POLLHUP|POLLERR)) #else @@ -869,7 +903,6 @@ void _XSeqSyncFunction( return; } #endif /* NX_TRANS_SOCKET */ - if ((dpy->request - dpy->last_request_read) >= (65535 - BUFSIZE/SIZEOF(xReq))) { GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); @@ -1234,7 +1267,6 @@ _XEventsQueued( { UnlockNextEventReader(dpy); } - #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); #endif @@ -1373,15 +1405,12 @@ void _XReadEvents( #endif /* XTHREADS */ /* find out how much data can be read */ if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) -#ifdef NX_TRANS_SOCKET { _XIOError(dpy); - +#ifdef NX_TRANS_SOCKET return; - } -#else - _XIOError(dpy); #endif + } len = pend; /* must read at least one xEvent; if none is pending, then @@ -2204,31 +2233,20 @@ _XSetLastRequestRead( if (newseq < lastseq) { newseq += 0x10000; if (newseq > dpy->request) { - #ifdef NX_TRANS_SOCKET - if (_NXLostSequenceFunction != NULL) { (*_NXLostSequenceFunction)(dpy, newseq, dpy->request, (unsigned int) rep->type); } else +#endif /* #ifdef NX_TRANS_SOCKET */ { (void) fprintf (stderr, "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", newseq, dpy->request, (unsigned int) rep->type); } - -#else /* #ifdef NX_TRANS_SOCKET */ - - (void) fprintf (stderr, - "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", - newseq, dpy->request, - (unsigned int) rep->type); - -#endif /* #ifdef NX_TRANS_SOCKET */ - newseq -= 0x10000; } } @@ -2316,7 +2334,6 @@ _XReply ( #ifdef NX_TRANS_TEST fprintf(stderr, "_XReply: Requesting a flush of the NX transport.\n"); #endif - NXTransFlush(dpy->fd); #endif @@ -2592,7 +2609,6 @@ _XRegisterInternalConnection( #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); #endif - new_conni = (struct _XConnectionInfo*)Xmalloc(sizeof(struct _XConnectionInfo)); if (!new_conni) return 0; @@ -2643,7 +2659,6 @@ _XUnregisterInternalConnection( #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); #endif - for (prev = &dpy->im_fd_info; (info_list = *prev); prev = &info_list->next) { if (info_list->fd == fd) { @@ -2686,7 +2701,6 @@ XInternalConnectionNumbers( #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); #endif - LockDisplay(dpy); count = 0; for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) @@ -2780,7 +2794,6 @@ XAddConnectionWatch( #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XAddConnectionWatch: Got called.\n"); #endif - LockDisplay(dpy); /* allocate new watch data */ @@ -2840,7 +2853,6 @@ XRemoveConnectionWatch( #if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); #endif - LockDisplay(dpy); for (watch=dpy->conn_watchers; watch; watch=watch->next) { if (watch->fn == callback && watch->client_data == client_data) { @@ -2890,6 +2902,30 @@ void _XEatData( } #undef SCRATCHSIZE } + +/* + Port from libXfixes commit + b031e3b60fa1af9e49449f23d4a84395868be3ab We need this here to + enable linking of current libXrender against libNX_X11 instead of + the system's libX11 + + The original implementation of this function (libX11 commit + 9f5d83706543696fc944c1835a403938c06f2cc5) uses xcb stuff which we + do not have in libNX_X11. So we take a workaround from another + lib. This workaround had been implemented temporarily in a couple + of X libs, see e.g. https://lists.x.org/archives/xorg-devel/2013-July/036763.html. +*/ +#include <nx-X11/Xmd.h> /* for LONG64 on 64-bit platforms */ +#include <limits.h> + +void _XEatDataWords(Display *dpy, unsigned long n) +{ +#ifndef LONG64 + if (n >= (ULONG_MAX >> 2)) + _XIOError(dpy); +#endif + _XEatData (dpy, n << 2); +} #endif /* !USE_XCB */ /* Cookie jar implementation @@ -3592,7 +3628,6 @@ int _XDefaultIOError( #else exit(1); #endif /* #ifdef NX_TRANS_SOCKET */ - return(0); /* dummy - function should never return */ } @@ -4178,6 +4213,36 @@ Screen *_XScreenOfWindow(Display *dpy, Window w) return NULL; } +/* + * WARNING: This implementation's pre-conditions and post-conditions + * must remain compatible with the old macro-based implementations of + * GetReq, GetReqExtra, GetResReq, and GetEmptyReq. The portions of the + * Display structure affected by those macros are part of libX11's + * ABI. + */ +void *_XGetRequest(Display *dpy, CARD8 type, size_t len) +{ + xReq *req; + + WORD64ALIGN + + if (dpy->bufptr + len > dpy->bufmax) + _XFlush(dpy); + + if (len % 4) + fprintf(stderr, + "Xlib: request %d length %zd not a multiple of 4.\n", + type, len); + + dpy->last_req = dpy->bufptr; + + req = (xReq*)dpy->bufptr; + req->reqType = type; + req->length = len / 4; + dpy->bufptr += len; + dpy->request++; + return req; +} #if defined(WIN32) diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h index 6763b8afe..92338be2f 100644 --- a/nx-X11/lib/X11/Xlibint.h +++ b/nx-X11/lib/X11/Xlibint.h @@ -254,9 +254,6 @@ typedef struct _XSQEvent } _XQEvent; #endif -#ifdef XTHREADS /* for xReply */ -#endif - #include <nx-X11/Xproto.h> #ifdef __sgi #define _SGI_MP_SOURCE /* turn this on to get MP safe errno */ diff --git a/nx-X11/lib/X11/Xresinternal.h b/nx-X11/lib/X11/Xresinternal.h index fc752855b..b4b1b00f8 100644 --- a/nx-X11/lib/X11/Xresinternal.h +++ b/nx-X11/lib/X11/Xresinternal.h @@ -1,4 +1,3 @@ -/* $XFree86$ */ #ifndef _XRESINTERNAL_H_ #define _XRESINTERNAL_H_ diff --git a/nx-X11/lib/X11/Xrm.c b/nx-X11/lib/X11/Xrm.c index 1469b745d..d88442c6e 100644 --- a/nx-X11/lib/X11/Xrm.c +++ b/nx-X11/lib/X11/Xrm.c @@ -4,13 +4,13 @@ Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard All Rights Reserved -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in +both that copyright notice and this permission notice appear in supporting documentation, and that the name Digital not be used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. +software without specific, written prior permission. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL @@ -333,7 +333,6 @@ void XrmInitialize(void) XrmQANY = XrmPermStringToQuark("?"); } -#ifndef _XP_PRINT_SERVER_ XrmDatabase XrmGetDatabase( Display *display) { @@ -357,7 +356,6 @@ void XrmSetDatabase( display->db = database; UnlockDisplay(display); } -#endif /* !_XP_PRINT_SERVER_ */ void XrmStringToQuarkList( @@ -501,11 +499,7 @@ static XrmDatabase NewDatabase(void) _XCreateMutex(&db->linfo); db->table = (NTable)NULL; db->mbstate = (XPointer)NULL; -#ifdef _XP_PRINT_SERVER_ - db->methods = NULL; -#else db->methods = _XrmInitParseInfo(&db->mbstate); -#endif if (!db->methods) db->methods = &mb_methods; } @@ -806,6 +800,7 @@ void XrmCombineDatabase( } } (from->methods->destroy)(from->mbstate); + _XUnlockMutex(&from->linfo); _XFreeMutex(&from->linfo); Xfree((char *)from); _XUnlockMutex(&(*into)->linfo); @@ -1068,20 +1063,20 @@ XrmQPutStringResource( */ /* - * This function is highly optimized to inline as much as possible. - * Be very careful with modifications, or simplifications, as they + * This function is highly optimized to inline as much as possible. + * Be very careful with modifications, or simplifications, as they * may adversely affect the performance. * * Chris Peterson, MIT X Consortium 5/17/90. */ -/* +/* * Xlib spec says max 100 quarks in a lookup, will stop and return if * return if any single production's lhs has more than 100 components. */ #define QLIST_SIZE 100 -/* +/* * This should be big enough to handle things like the XKeysymDB or biggish * ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on * the heap. @@ -1122,14 +1117,14 @@ static void GetDatabase( if (!db) return; - /* - * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for + /* + * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for * speed otherwise malloc the buffer. From a buffer overflow standpoint * we can be sure that neither: a) a component on the lhs, or b) a * value on the rhs, will be longer than the overall length of str, * i.e. strlen(str). * - * This should give good performance when parsing "*foo: bar" type + * This should give good performance when parsing "*foo: bar" type * databases as might be passed with -xrm command line options; but * with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB * files, the size of the buffers will be overly large. One way @@ -1140,7 +1135,7 @@ static void GetDatabase( str_len = strlen (str); if (DEF_BUFF_SIZE > str_len) lhs = lhs_s; - else if ((lhs = (char*) Xmalloc (str_len)) == NULL) + else if ((lhs = (char*) Xmalloc (str_len)) == NULL) return; alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE; @@ -1156,7 +1151,7 @@ static void GetDatabase( dolines = doall; /* - * First: Remove extra whitespace. + * First: Remove extra whitespace. */ do { @@ -1228,13 +1223,13 @@ static void GetDatabase( * Third: loop through the LHS of the resource specification * storing characters and converting this to a Quark. */ - + num_quarks = 0; t_bindings = bindings; sig = 0; ptr = lhs; - *t_bindings = XrmBindTightly; + *t_bindings = XrmBindTightly; for(;;) { if (!is_binding(bits)) { while (!is_EOQ(bits)) { @@ -1243,7 +1238,7 @@ static void GetDatabase( bits = next_char(c, str); } - quarks[num_quarks++] = + quarks[num_quarks++] = _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False); if (num_quarks > QLIST_SIZE) { @@ -1263,9 +1258,9 @@ static void GetDatabase( sig = (sig << 1) + c; /* Compute the signature. */ } while (is_space(bits = next_char(c, str))); - /* + /* * The spec doesn't permit it, but support spaces - * internal to resource name/class + * internal to resource name/class */ if (is_separator(bits)) @@ -1289,7 +1284,7 @@ static void GetDatabase( * If two separators appear with no Text between them then * ignore them. * - * If anyone of those separators is a '*' then the binding + * If anyone of those separators is a '*' then the binding * will be loose, otherwise it will be tight. */ @@ -1334,7 +1329,7 @@ static void GetDatabase( * the right hand side. */ - /* + /* * Fourth: Remove more whitespace */ @@ -1352,7 +1347,7 @@ static void GetDatabase( break; } - /* + /* * Fifth: Process the right hand side. */ @@ -1453,8 +1448,8 @@ static void GetDatabase( else { int tcount; - /* - * Otherwise just insert those characters into the + /* + * Otherwise just insert those characters into the * string, since no special processing is needed on * numerics we can skip the special processing. */ @@ -1477,7 +1472,7 @@ static void GetDatabase( } } - /* + /* * It is important to make sure that there is room for at least * four more characters in the buffer, since I can add that * many characters into the buffer after a backslash has occured. @@ -1486,7 +1481,7 @@ static void GetDatabase( if (ptr + len > ptr_max) { char * temp_str; - alloc_chars += BUFSIZ/10; + alloc_chars += BUFSIZ/10; temp_str = Xrealloc(rhs, sizeof(char) * alloc_chars); if (!temp_str) { @@ -1503,7 +1498,7 @@ static void GetDatabase( } /* - * Lastly: Terminate the value string, and store this entry + * Lastly: Terminate the value string, and store this entry * into the database. */ @@ -1512,7 +1507,7 @@ static void GetDatabase( /* Store it in database */ value.size = ptr - rhs; value.addr = (XPointer) rhs; - + PutEntry(db, bindings, quarks, XrmQString, &value); } @@ -2277,7 +2272,7 @@ Bool XrmQGetSearchList( } else { if (table && !table->leaf) table = table->next; - if (table && + if (table && AppendLEntry((LTable)table, names, classes, &closure)) { _XUnlockMutex(&db->linfo); return False; @@ -2570,12 +2565,8 @@ Bool XrmQGetResource( } Bool -XrmGetResource(db, name_str, class_str, pType_str, pValue) - XrmDatabase db; - _Xconst char *name_str; - _Xconst char *class_str; - XrmString *pType_str; /* RETURN */ - XrmValuePtr pValue; /* RETURN */ +XrmGetResource(XrmDatabase db, _Xconst char *name_str, _Xconst char *class_str, + XrmString *pType_str, XrmValuePtr pValue) { XrmName names[MAXDBDEPTH+1]; XrmClass classes[MAXDBDEPTH+1]; @@ -2654,6 +2645,7 @@ void XrmDestroyDatabase( else DestroyNTable(table); } + _XUnlockMutex(&db->linfo); _XFreeMutex(&db->linfo); (*db->methods->destroy)(db->mbstate); Xfree((char *)db); diff --git a/nx-X11/lib/X11/globals.c b/nx-X11/lib/X11/globals.c index d8c79d064..d1cab6ba5 100644 --- a/nx-X11/lib/X11/globals.c +++ b/nx-X11/lib/X11/globals.c @@ -45,7 +45,7 @@ from The Open Group. */ #ifdef NULL_NOT_ZERO /* then need to initialize */ #define SetZero(t,var,z) t var = z -#else +#else #define SetZero(t,var,z) t var #endif @@ -114,25 +114,25 @@ extern int close(); #ifdef SVR4 extern int _XsSetupSpStream(); extern int _XsSetupNamedStream(); -#endif +#endif extern int _XsSetupLocalStream(); extern int _XsConnectLocalClient(); extern int _XsCallLocalServer(); extern int _XsReadLocalStream(); extern int _XsErrorCall(); extern int _XsWriteLocalStream(); -extern int _XsCloseLocalStream(); +extern int _XsCloseLocalStream(); extern int _XsSetupTliStream(); extern int _XsConnectTliClient(); -extern int _XsCallTliServer(); -extern int _XsReadTliStream(); +extern int _XsCallTliServer(); +extern int _XsReadTliStream(); extern int _XsWriteTliStream(); extern int _XsCloseTliStream(); Xstream _XsStream[] = { - { + { /* local connections using pseudo-ttys */ _XsSetupLocalStream, @@ -144,7 +144,7 @@ Xstream _XsStream[] = { close, NULL }, - { + { #ifdef SVR4 /* local connections using named streams */ diff --git a/nx-X11/lib/X11/imConv.c b/nx-X11/lib/X11/imConv.c index 1f3d6006f..c3c1974de 100644 --- a/nx-X11/lib/X11/imConv.c +++ b/nx-X11/lib/X11/imConv.c @@ -1,4 +1,3 @@ -/* $TOG: imConv.c /main/20 1998/06/17 15:46:41 kaleb $ */ /****************************************************************** Copyright 1991, 1992 by Fuji Xerox Co.,Ltd. @@ -44,9 +43,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "XlcPubI.h" #ifdef XKB -/* - * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) - * do this because with XKB the event may have some funky modifiers that +/* + * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) + * do this because with XKB the event may have some funky modifiers that * _XLookupString doesn't grok. */ #include "XKBlib.h" @@ -65,11 +64,11 @@ typedef int (*ucstocsConvProc)( ); struct SubstRec { - char* encoding_name; - char* charset_name; + const char encoding_name[8]; + const char charset_name[12]; }; -static struct SubstRec SubstTable[] = { +static const struct SubstRec SubstTable[] = { {"STRING", "ISO8859-1"}, {"TIS620", "TIS620-0"}, {"UTF-8", "ISO10646-1"} @@ -105,7 +104,7 @@ _XimGetLocaleCode ( * locale */ /*ARGSUSED*/ -int +int _XimGetCharCode ( XPointer ucs_conv, KeySym keysym, @@ -144,7 +143,7 @@ static int lookup_string( { int ret; unsigned ctrls = XkbGetXlibControls (event->display); - XkbSetXlibControls (event->display, + XkbSetXlibControls (event->display, XkbLC_ForceLatin1Lookup, XkbLC_ForceLatin1Lookup); ret = XLookupString(event, (char *)buffer, nbytes, keysym, status); XkbSetXlibControls (event->display, @@ -156,13 +155,13 @@ static int lookup_string( #define BUF_SIZE (20) int -_XimLookupMBText(ic, event, buffer, nbytes, keysym, status) - Xic ic; - XKeyEvent* event; - char* buffer; - int nbytes; - KeySym* keysym; - XComposeStatus* status; +_XimLookupMBText( + Xic ic, + XKeyEvent* event, + char* buffer, + int nbytes, + KeySym* keysym, + XComposeStatus* status) { int count; KeySym symbol; @@ -181,11 +180,11 @@ _XimLookupMBText(ic, event, buffer, nbytes, keysym, status) memcpy(look, (char *)buffer,count); look[count] = '\0'; if ((count = im->methods->ctstombs(ic->core.im, - (char*) look, count, + (char*) look, count, buffer, nbytes, &dummy)) < 0) { count = 0; } - } else if ((count == 0) || + } else if ((count == 0) || (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { XPointer from = (XPointer) &ucs4; @@ -227,13 +226,13 @@ _XimLookupMBText(ic, event, buffer, nbytes, keysym, status) } int -_XimLookupWCText(ic, event, buffer, nbytes, keysym, status) - Xic ic; - XKeyEvent* event; - wchar_t* buffer; - int nbytes; - KeySym* keysym; - XComposeStatus* status; +_XimLookupWCText( + Xic ic, + XKeyEvent* event, + wchar_t* buffer, + int nbytes, + KeySym* keysym, + XComposeStatus* status) { int count; KeySym symbol; @@ -250,7 +249,7 @@ _XimLookupWCText(ic, event, buffer, nbytes, keysym, status) if (count > 1) { if ((count = im->methods->ctstowcs(ic->core.im, - (char*) look, count, + (char*) look, count, buffer, nbytes, &dummy)) < 0) { count = 0; } @@ -299,13 +298,13 @@ _XimLookupWCText(ic, event, buffer, nbytes, keysym, status) } int -_XimLookupUTF8Text(ic, event, buffer, nbytes, keysym, status) - Xic ic; - XKeyEvent* event; - char* buffer; - int nbytes; - KeySym* keysym; - XComposeStatus* status; +_XimLookupUTF8Text( + Xic ic, + XKeyEvent* event, + char* buffer, + int nbytes, + KeySym* keysym, + XComposeStatus* status) { int count; KeySym symbol; @@ -324,11 +323,11 @@ _XimLookupUTF8Text(ic, event, buffer, nbytes, keysym, status) memcpy(look, (char *)buffer,count); look[count] = '\0'; if ((count = im->methods->ctstoutf8(ic->core.im, - (char*) look, count, + (char*) look, count, buffer, nbytes, &dummy)) < 0) { count = 0; } - } else if ((count == 0) || + } else if ((count == 0) || (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { XPointer from = (XPointer) &ucs4; diff --git a/nx-X11/lib/X11/locking.c b/nx-X11/lib/X11/locking.c index a888be4f2..4f9a40fbd 100644 --- a/nx-X11/lib/X11/locking.c +++ b/nx-X11/lib/X11/locking.c @@ -1,5 +1,5 @@ /* - + Copyright 1992, 1998 The Open Group Permission to use, copy, modify, distribute, and sell this software and its @@ -45,11 +45,23 @@ in this Software without prior written authorization from The Open Group. #include <dlfcn.h> #endif +#include "Xprivate.h" #include "locking.h" #ifdef XTHREADS_WARN #include <stdio.h> /* for warn/debug stuff */ #endif +/* Additional arguments for source code location lock call was made from */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) +# define XTHREADS_FILE_LINE_ARGS \ + , \ + char* file, /* source file, from macro */ \ + int line +#else +# define XTHREADS_FILE_LINE_ARGS /* None */ +#endif + + #define NUM_FREE_CVLS 4 /* in lcWrap.c */ @@ -58,14 +70,14 @@ extern LockInfoPtr _Xi18n_lock; #ifdef WIN32 static DWORD _X_TlsIndex = (DWORD)-1; -_Xthread_init() +void _Xthread_init(void) { if (_X_TlsIndex == (DWORD)-1) _X_TlsIndex = TlsAlloc(); } struct _xthread_waiter * -_Xthread_waiter() +_Xthread_waiter(void) { struct _xthread_waiter *me; @@ -87,28 +99,18 @@ static xthread_t _Xthread_self(void) static LockInfoRec global_lock; static LockInfoRec i18n_lock; -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XLockMutex(lip,file,line) - LockInfoPtr lip; - char* file; - int line; -#else static void _XLockMutex( - LockInfoPtr lip) -#endif + LockInfoPtr lip + XTHREADS_FILE_LINE_ARGS + ) { xmutex_lock(lip->lock); } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) static void _XUnlockMutex( - LockInfoPtr lip, - char* file, - int line) -#else -static void _XUnlockMutex( - LockInfoPtr lip) -#endif + LockInfoPtr lip + XTHREADS_FILE_LINE_ARGS + ) { xmutex_unlock(lip->lock); } @@ -200,15 +202,10 @@ static void _XLockDisplayWarn( } #endif /* XTHREADS_WARN */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XUnlockDisplay(dpy,file,line) - Display *dpy; - char *file; - int line; -#else static void _XUnlockDisplay( - Display *dpy) -#endif + Display *dpy + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN xthread_t self = xthread_self(); @@ -328,23 +325,17 @@ static void _XPopReader( } } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XConditionWait(cv, mutex,file,line) - xcondition_t cv; - xmutex_t mutex; - char *file; - int line; -#else static void _XConditionWait( xcondition_t cv, - xmutex_t mutex) -#endif + xmutex_t mutex + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN xthread_t self = xthread_self(); char *old_file = locking_file; int old_line = locking_line; - + #ifdef XTHREADS_DEBUG printf("line %d thread %x in condition wait\n", line, self); #endif @@ -379,15 +370,10 @@ static void _XConditionWait( #endif /* XTHREADS_WARN */ } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XConditionSignal(cv,file,line) - xcondition_t cv; - char *file; - int line; -#else static void _XConditionSignal( - xcondition_t cv) -#endif + xcondition_t cv + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG @@ -396,17 +382,12 @@ static void _XConditionSignal( #endif xcondition_signal(cv); } - -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XConditionBroadcast(cv,file,line) - xcondition_t cv; - char *file; - int line; -#else + static void _XConditionBroadcast( - xcondition_t cv) -#endif + xcondition_t cv + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN #ifdef XTHREADS_DEBUG @@ -415,7 +396,7 @@ static void _XConditionBroadcast( #endif xcondition_broadcast(cv); } - + static void _XFreeDisplayLock( Display *dpy) @@ -467,15 +448,10 @@ static void _XDisplayLockWait( } } -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XLockDisplay(dpy, file, line) - Display *dpy; - char *file; /* source file, from macro */ - int line; -#else static void _XLockDisplay( - Display *dpy) -#endif + Display *dpy + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); @@ -484,23 +460,19 @@ static void _XLockDisplay( #endif if (dpy->lock->locking_level > 0) _XDisplayLockWait(dpy); + _XIDHandler(dpy); + _XSeqSyncFunction(dpy); } /* * _XReply is allowed to exit from select/poll and clean up even if a * user-level lock is in force, so it uses this instead of _XFancyLockDisplay. */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -static void _XInternalLockDisplay(dpy, wskip, file, line) - Display *dpy; - Bool wskip; - char *file; /* source file, from macro */ - int line; -#else static void _XInternalLockDisplay( Display *dpy, - Bool wskip) -#endif + Bool wskip + XTHREADS_FILE_LINE_ARGS + ) { #ifdef XTHREADS_WARN _XLockDisplayWarn(dpy, file, line); @@ -595,7 +567,7 @@ xthread_t (*_x11_thr_self)() = __x11_thr_self; #endif -Status XInitThreads() +Status XInitThreads(void) { if (_Xglobal_lock) return 1; @@ -644,7 +616,7 @@ Status XInitThreads() } #else /* XTHREADS */ -Status XInitThreads() +Status XInitThreads(void) { return 0; } |