diff options
Diffstat (limited to 'nx-X11/lib/X11/InitExt.c')
-rw-r--r-- | nx-X11/lib/X11/InitExt.c | 179 |
1 files changed, 110 insertions, 69 deletions
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; } |