From b45a2b51cfa17d21b31444c8f48e0866ea405594 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Wed, 5 Mar 2008 16:17:42 -0300 Subject: [PATCH] Ansify libAppleWM. Special attention may be required here due to functions with arguments of type short. proto/applewmproto/applewm.h already declares ansi prototypes with short arguments, so, theoretically, this patch should be correct, but there may exist problems (probably not, at least with gcc, as the functions had a prototype). --- src/applewm.c | 179 +++++++++++++++++++++++++++++++++------------------------ 1 files changed, 104 insertions(+), 75 deletions(-) diff --git a/src/applewm.c b/src/applewm.c index c627762..38872bc 100644 --- a/src/applewm.c +++ b/src/applewm.c @@ -53,8 +53,18 @@ static char *applewm_extension_name = APPLEWMNAME; *****************************************************************************/ static int close_display(Display *dpy, XExtCodes *extCodes); -static Bool wire_to_event(); -static Status event_to_wire(); + +static Bool wire_to_event( + Display * /* dpy */, + XEvent * /* re */, + xEvent * /* event */ +); + +static Status event_to_wire( + Display * /* dpy */, + XEvent * /* re */, + xEvent * /* event */ +); static /* const */ XExtensionHooks applewm_extension_hooks = { NULL, /* create_gc */ @@ -77,10 +87,10 @@ static XEXT_GENERATE_FIND_DISPLAY (find_display, applewm_info, static XEXT_GENERATE_CLOSE_DISPLAY (close_display, applewm_info) -static Bool wire_to_event (dpy, re, event) - Display *dpy; - XEvent *re; - xEvent *event; +static Bool wire_to_event ( + Display *dpy, + XEvent *re, + xEvent *event) { XExtDisplayInfo *info = find_display (dpy); XAppleWMNotifyEvent *se; @@ -107,10 +117,10 @@ static Bool wire_to_event (dpy, re, event) return False; } -static Status event_to_wire (dpy, re, event) - Display *dpy; - XEvent *re; - xEvent *event; +static Status event_to_wire ( + Display *dpy, + XEvent *re, + xEvent *event) { XExtDisplayInfo *info = find_display (dpy); XAppleWMNotifyEvent *se; @@ -148,9 +158,10 @@ static Status event_to_wire (dpy, re, event) #endif -Bool XAppleWMQueryExtension (dpy, event_basep, error_basep) - Display *dpy; - int *event_basep, *error_basep; +Bool XAppleWMQueryExtension ( + Display *dpy, + int *event_basep, + int *error_basep) { XExtDisplayInfo *info = find_display (dpy); @@ -166,11 +177,11 @@ Bool XAppleWMQueryExtension (dpy, event_basep, error_basep) } } -Bool XAppleWMQueryVersion(dpy, majorVersion, minorVersion, patchVersion) - Display* dpy; - int* majorVersion; - int* minorVersion; - int* patchVersion; +Bool XAppleWMQueryVersion( + Display *dpy, + int *majorVersion, + int *minorVersion, + int *patchVersion) { XExtDisplayInfo *info = find_display (dpy); xAppleWMQueryVersionReply rep; @@ -198,9 +209,9 @@ Bool XAppleWMQueryVersion(dpy, majorVersion, minorVersion, patchVersion) return True; } -Bool XAppleWMDisableUpdate(dpy, screen) - Display* dpy; - int screen; +Bool XAppleWMDisableUpdate( + Display *dpy, + int screen) { XExtDisplayInfo *info = find_display (dpy); xAppleWMDisableUpdateReq *req; @@ -219,9 +230,9 @@ Bool XAppleWMDisableUpdate(dpy, screen) return True; } -Bool XAppleWMReenableUpdate(dpy, screen) - Display* dpy; - int screen; +Bool XAppleWMReenableUpdate( + Display *dpy, + int screen) { XExtDisplayInfo *info = find_display (dpy); xAppleWMReenableUpdateReq *req; @@ -240,9 +251,9 @@ Bool XAppleWMReenableUpdate(dpy, screen) return True; } -Bool XAppleWMSelectInput(dpy, mask) - Display* dpy; - unsigned long mask; +Bool XAppleWMSelectInput( + Display *dpy, + unsigned long mask) { XExtDisplayInfo *info = find_display (dpy); xAppleWMSelectInputReq *req; @@ -261,11 +272,11 @@ Bool XAppleWMSelectInput(dpy, mask) return True; } -Bool XAppleWMSetWindowMenuWithShortcuts(dpy, nitems, items, shortcuts) - Display* dpy; - int nitems; - const char **items; - const char *shortcuts; +Bool XAppleWMSetWindowMenuWithShortcuts( + Display *dpy, + int nitems, + const char **items, + const char *shortcuts) { XExtDisplayInfo *info = find_display (dpy); xAppleWMSetWindowMenuReq *req; @@ -304,17 +315,17 @@ Bool XAppleWMSetWindowMenuWithShortcuts(dpy, nitems, items, shortcuts) return True; } -Bool XAppleWMSetWindowMenu(dpy, nitems, items) - Display* dpy; - int nitems; - const char **items; +Bool XAppleWMSetWindowMenu( + Display *dpy, + int nitems, + const char **items) { return XAppleWMSetWindowMenuWithShortcuts (dpy, nitems, items, NULL); } -Bool XAppleWMSetWindowMenuCheck(dpy, idx) - Display* dpy; - int idx; +Bool XAppleWMSetWindowMenuCheck( + Display *dpy, + int idx) { XExtDisplayInfo *info = find_display (dpy); xAppleWMSetWindowMenuCheckReq *req; @@ -333,8 +344,7 @@ Bool XAppleWMSetWindowMenuCheck(dpy, idx) return True; } -Bool XAppleWMSetFrontProcess(dpy) - Display* dpy; +Bool XAppleWMSetFrontProcess(Display* dpy) { XExtDisplayInfo *info = find_display (dpy); xAppleWMSetFrontProcessReq *req; @@ -352,10 +362,10 @@ Bool XAppleWMSetFrontProcess(dpy) return True; } -Bool XAppleWMSetWindowLevel(dpy, id, level) - Display* dpy; - Window id; - int level; +Bool XAppleWMSetWindowLevel( + Display *dpy, + Window id, + int level) { XExtDisplayInfo *info = find_display (dpy); xAppleWMSetWindowLevelReq *req; @@ -375,9 +385,9 @@ Bool XAppleWMSetWindowLevel(dpy, id, level) return True; } -Bool XAppleWMSetCanQuit(dpy, state) - Display* dpy; - Bool state; +Bool XAppleWMSetCanQuit( + Display *dpy, + Bool state) { XExtDisplayInfo *info = find_display (dpy); xAppleWMSetCanQuitReq *req; @@ -396,13 +406,22 @@ Bool XAppleWMSetCanQuit(dpy, state) return True; } -Bool XAppleWMFrameGetRect(dpy, frame_class, frame_rect, - ix, iy, iw, ih, ox, oy, ow, oh, rx, ry, rw, rh) - Display* dpy; - unsigned int frame_class, frame_rect; - short ix, iy, iw, ih; - short ox, oy, ow, oh; - short *rx, *ry, *rw, *rh; +Bool XAppleWMFrameGetRect( + Display *dpy, + unsigned int frame_class, + unsigned int frame_rect, + short ix, + short iy, + short iw, + short ih, + short ox, + short oy, + short ow, + short oh, + short *rx, + short *ry, + short *rw, + short *rh) { XExtDisplayInfo *info = find_display (dpy); xAppleWMFrameGetRectReply rep; @@ -440,13 +459,19 @@ Bool XAppleWMFrameGetRect(dpy, frame_class, frame_rect, return True; } -unsigned int XAppleWMFrameHitTest(dpy, frame_class, px, py, - ix, iy, iw, ih, ox, oy, ow, oh) - Display* dpy; - unsigned int frame_class; - short px, py; - short ix, iy, iw, ih; - short ox, oy, ow, oh; +unsigned int XAppleWMFrameHitTest( + Display *dpy, + unsigned int frame_class, + short px, + short py, + short ix, + short iy, + short iw, + short ih, + short ox, + short oy, + short ow, + short oh) { XExtDisplayInfo *info = find_display (dpy); xAppleWMFrameHitTestReply rep; @@ -483,18 +508,22 @@ unsigned int XAppleWMFrameHitTest(dpy, frame_class, px, py, return rep.ret; } -Bool XAppleWMFrameDraw(dpy, screen, window, - frame_class, frame_attr, - ix, iy, iw, ih, ox, oy, ow, oh, - title_length, title_bytes) - Display* dpy; - int screen; - Window window; - unsigned int frame_class, frame_attr; - short ix, iy, iw, ih; - short ox, oy, ow, oh; - unsigned int title_length; - const unsigned char *title_bytes; +Bool XAppleWMFrameDraw( + Display *dpy, + int screen, + Window window, + unsigned int frame_class, + unsigned int frame_attr, + short ix, + short iy, + short iw, + short ih, + short ox, + short oy, + short ow, + short oh, + unsigned int title_length, + const unsigned char *title_bytes) { XExtDisplayInfo *info = find_display (dpy); xAppleWMFrameDrawReq *req; @@ -521,7 +550,7 @@ Bool XAppleWMFrameDraw(dpy, screen, window, req->title_length = title_length; req->length += (title_length + 3)>>2; - Data (dpy, title_bytes, title_length); + Data (dpy, (char *)title_bytes, title_length); UnlockDisplay(dpy); SyncHandle(); -- 1.5.4.3