XQuartz: Fix a bunch of compilation warnings about style

(cherry picked from commit 54000bdcbca52a2de31f7c1a1147de6d8e9dbbb8)
This commit is contained in:
Jeremy Huddleston 2009-09-27 22:57:25 -07:00
parent 96780eaf32
commit 67a51cd9ef
15 changed files with 53 additions and 49 deletions

View File

@ -277,7 +277,7 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
(c-1)->next = NULL; (c-1)->next = NULL;
if (c - visualConfigs != numConfigs) { if (c - visualConfigs != numConfigs) {
FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, c - visualConfigs); FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, (int)(c - visualConfigs));
} }
freeGlCapabilities(&caps); freeGlCapabilities(&caps);

View File

@ -243,6 +243,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
if(!for_appkit) { if(!for_appkit) {
NSPoint NSlocation = [e locationInWindow]; NSPoint NSlocation = [e locationInWindow];
NSWindow *window = [e window]; NSWindow *window = [e window];
NSRect NSframe, NSvisibleFrame;
CGRect CGframe, CGvisibleFrame;
CGPoint CGlocation;
if (window != nil) { if (window != nil) {
NSRect frame = [window frame]; NSRect frame = [window frame];
@ -250,16 +253,16 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
NSlocation.y += frame.origin.y; NSlocation.y += frame.origin.y;
} }
NSRect NSframe = [[NSScreen mainScreen] frame]; NSframe = [[NSScreen mainScreen] frame];
NSRect NSvisibleFrame = [[NSScreen mainScreen] visibleFrame]; NSvisibleFrame = [[NSScreen mainScreen] visibleFrame];
CGRect CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y, CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y,
NSframe.size.width, NSframe.size.height); NSframe.size.width, NSframe.size.height);
CGRect CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x, CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x,
NSvisibleFrame.origin.y, NSvisibleFrame.origin.y,
NSvisibleFrame.size.width, NSvisibleFrame.size.width,
NSvisibleFrame.size.height); NSvisibleFrame.size.height);
CGPoint CGlocation = CGPointMake(NSlocation.x, NSlocation.y); CGlocation = CGPointMake(NSlocation.x, NSlocation.y);
if(CGRectContainsPoint(CGframe, CGlocation) && if(CGRectContainsPoint(CGframe, CGlocation) &&
!CGRectContainsPoint(CGvisibleFrame, CGlocation)) !CGRectContainsPoint(CGvisibleFrame, CGlocation))
@ -334,6 +337,7 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
case NSApplicationActivatedEventType: case NSApplicationActivatedEventType:
for_x = NO; for_x = NO;
if ([self modalWindow] == nil) { if ([self modalWindow] == nil) {
BOOL switch_on_activate, ok;
for_appkit = NO; for_appkit = NO;
/* FIXME: hack to avoid having to pass the event to appkit, /* FIXME: hack to avoid having to pass the event to appkit,
@ -344,7 +348,6 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
/* Get the Spaces preference for SwitchOnActivate */ /* Get the Spaces preference for SwitchOnActivate */
(void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences")); (void)CFPreferencesAppSynchronize(CFSTR(".GlobalPreferences"));
BOOL switch_on_activate, ok;
switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok); switch_on_activate = CFPreferencesGetAppBooleanValue(CFSTR("AppleSpacesSwitchOnActivate"), CFSTR(".GlobalPreferences"), &ok);
if(!ok) if(!ok)
switch_on_activate = YES; switch_on_activate = YES;

View File

@ -632,6 +632,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
- (IBAction)prefs_changed:sender - (IBAction)prefs_changed:sender
{ {
BOOL pbproxy_active;
darwinFakeButtons = [fake_buttons intValue]; darwinFakeButtons = [fake_buttons intValue];
quartzUseSysBeep = [use_sysbeep intValue]; quartzUseSysBeep = [use_sysbeep intValue];
X11EnableKeyEquivalents = [enable_keyequivs intValue]; X11EnableKeyEquivalents = [enable_keyequivs intValue];
@ -653,7 +655,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
[NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]]; [NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
[NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]]; [NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
BOOL pbproxy_active = [sync_pasteboard intValue]; pbproxy_active = [sync_pasteboard intValue];
[NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active]; [NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active];
[NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]]; [NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]];

View File

@ -210,10 +210,7 @@ updateEventMask (WMEventPtr *pHead)
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
WMFreeClient (data, id) WMFreeClient (pointer data, XID id) {
pointer data;
XID id;
{
WMEventPtr pEvent; WMEventPtr pEvent;
WMEventPtr *pHead, pCur, pPrev; WMEventPtr *pHead, pCur, pPrev;
@ -237,10 +234,7 @@ WMFreeClient (data, id)
/*ARGSUSED*/ /*ARGSUSED*/
static int static int
WMFreeEvents (data, id) WMFreeEvents (pointer data, XID id) {
pointer data;
XID id;
{
WMEventPtr *pHead, pCur, pNext; WMEventPtr *pHead, pCur, pNext;
pHead = (WMEventPtr *) data; pHead = (WMEventPtr *) data;
@ -344,10 +338,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
*/ */
void void
AppleWMSendEvent (type, mask, which, arg) AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
int type, which, arg;
unsigned int mask;
{
WMEventPtr *pHead, pEvent; WMEventPtr *pHead, pEvent;
ClientPtr client; ClientPtr client;
xAppleWMNotifyEvent se; xAppleWMNotifyEvent se;
@ -712,9 +703,7 @@ ProcAppleWMDispatch (
} }
static void static void
SNotifyEvent(from, to) SNotifyEvent(xAppleWMNotifyEvent *from, xAppleWMNotifyEvent *to) {
xAppleWMNotifyEvent *from, *to;
{
to->type = from->type; to->type = from->type;
to->kind = from->kind; to->kind = from->kind;
cpswaps (from->sequenceNumber, to->sequenceNumber); cpswaps (from->sequenceNumber, to->sequenceNumber);

View File

@ -513,13 +513,14 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) {
void DarwinSendScrollEvents(float count_x, float count_y, void DarwinSendScrollEvents(float count_x, float count_y,
float pointer_x, float pointer_y, float pointer_x, float pointer_y,
float pressure, float tilt_x, float tilt_y) { float pressure, float tilt_x, float tilt_y) {
int sign_x, sign_y;
if(!darwinEvents) { if(!darwinEvents) {
DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n"); DEBUG_LOG("DarwinSendScrollEvents called before darwinEvents was initialized\n");
return; return;
} }
int sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE; sign_x = count_x > 0.0f ? SCROLLWHEELLEFTFAKE : SCROLLWHEELRIGHTFAKE;
int sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE; sign_y = count_y > 0.0f ? SCROLLWHEELUPFAKE : SCROLLWHEELDOWNFAKE;
count_x = fabs(count_x); count_x = fabs(count_x);
count_y = fabs(count_y); count_y = fabs(count_y);

View File

@ -149,15 +149,17 @@ static int accept_fd_handoff(int connected_fd) {
char databuf[] = "display"; char databuf[] = "display";
struct iovec iov[1]; struct iovec iov[1];
iov[0].iov_base = databuf;
iov[0].iov_len = sizeof(databuf);
union { union {
struct cmsghdr hdr; struct cmsghdr hdr;
char bytes[CMSG_SPACE(sizeof(int))]; char bytes[CMSG_SPACE(sizeof(int))];
} buf; } buf;
struct msghdr msg; struct msghdr msg;
struct cmsghdr *cmsg;
iov[0].iov_base = databuf;
iov[0].iov_len = sizeof(databuf);
msg.msg_iov = iov; msg.msg_iov = iov;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
msg.msg_control = buf.bytes; msg.msg_control = buf.bytes;
@ -166,7 +168,7 @@ static int accept_fd_handoff(int connected_fd) {
msg.msg_namelen = 0; msg.msg_namelen = 0;
msg.msg_flags = 0; msg.msg_flags = 0;
struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); cmsg = CMSG_FIRSTHDR (&msg);
cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_len = CMSG_LEN(sizeof(int));
@ -197,6 +199,7 @@ static void socket_handoff_thread(void *arg) {
socket_handoff_t *handoff_data = (socket_handoff_t *)arg; socket_handoff_t *handoff_data = (socket_handoff_t *)arg;
int launchd_fd = -1; int launchd_fd = -1;
int connected_fd; int connected_fd;
unsigned remain;
/* Now actually get the passed file descriptor from this connection /* Now actually get the passed file descriptor from this connection
* If we encounter an error, keep listening. * If we encounter an error, keep listening.
@ -229,7 +232,7 @@ static void socket_handoff_thread(void *arg) {
* into it. * into it.
*/ */
unsigned remain = 3000000; remain = 3000000;
fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd); fprintf(stderr, "X11.app: Received new $DISPLAY fd: %d ... sleeping to allow xinitrc to catchup.\n", launchd_fd);
while((remain = usleep(remain)) > 0); while((remain = usleep(remain)) > 0);
@ -626,11 +629,11 @@ static char *command_from_prefs(const char *key, const char *default_value) {
if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) { if ((PlistRef == NULL) || (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII); CFStringRef cfDefaultValue = CFStringCreateWithCString(NULL, default_value, kCFStringEncodingASCII);
int len = strlen(default_value) + 1;
CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication); CFPreferencesSetAppValue(cfKey, cfDefaultValue, kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
int len = strlen(default_value) + 1;
command = (char *)malloc(len * sizeof(char)); command = (char *)malloc(len * sizeof(char));
if(!command) if(!command)
return NULL; return NULL;

View File

@ -36,7 +36,7 @@
#include "launchd_fd.h" #include "launchd_fd.h"
int launchd_display_fd() { int launchd_display_fd(void) {
launch_data_t sockets_dict, checkin_request, checkin_response; launch_data_t sockets_dict, checkin_request, checkin_response;
launch_data_t listening_fd_array, listening_fd; launch_data_t listening_fd_array, listening_fd;

View File

@ -69,13 +69,12 @@ static char x11_path[PATH_MAX + 1];
static pid_t x11app_pid = 0; static pid_t x11app_pid = 0;
static void set_x11_path() { static void set_x11_path(void) {
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
CFURLRef appURL = NULL; CFURLRef appURL = NULL;
CFBundleRef bundle = NULL; CFBundleRef bundle = NULL;
OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL); OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId), nil, nil, &appURL);
UInt32 ver;
switch (osstatus) { switch (osstatus) {
case noErr: case noErr:
@ -148,15 +147,17 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
char databuf[] = "display"; char databuf[] = "display";
struct iovec iov[1]; struct iovec iov[1];
iov[0].iov_base = databuf;
iov[0].iov_len = sizeof(databuf);
union { union {
struct cmsghdr hdr; struct cmsghdr hdr;
char bytes[CMSG_SPACE(sizeof(int))]; char bytes[CMSG_SPACE(sizeof(int))];
} buf; } buf;
struct msghdr msg; struct msghdr msg;
struct cmsghdr *cmsg;
iov[0].iov_base = databuf;
iov[0].iov_len = sizeof(databuf);
msg.msg_iov = iov; msg.msg_iov = iov;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
msg.msg_control = buf.bytes; msg.msg_control = buf.bytes;
@ -165,7 +166,7 @@ static void send_fd_handoff(int connected_fd, int launchd_fd) {
msg.msg_namelen = 0; msg.msg_namelen = 0;
msg.msg_flags = 0; msg.msg_flags = 0;
struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg); cmsg = CMSG_FIRSTHDR (&msg);
cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_len = CMSG_LEN(sizeof(int));
@ -231,10 +232,11 @@ int main(int argc, char **argv, char **envp) {
kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp); kr = bootstrap_look_up(bootstrap_port, server_bootstrap_name, &mp);
if(kr != KERN_SUCCESS) { if(kr != KERN_SUCCESS) {
pid_t child;
set_x11_path(); set_x11_path();
/* This forking is ugly and will be cleaned up later */ /* This forking is ugly and will be cleaned up later */
pid_t child = fork(); child = fork();
if(child == -1) { if(child == -1) {
fprintf(stderr, "Xquartz: Could not fork: %s\n", strerror(errno)); fprintf(stderr, "Xquartz: Could not fork: %s\n", strerror(errno));
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@ -366,7 +366,7 @@ void QuartzSetRootless(Bool state) {
* Calls mode specific screen resume to restore the X clip regions * Calls mode specific screen resume to restore the X clip regions
* (if needed) and the X server cursor state. * (if needed) and the X server cursor state.
*/ */
void QuartzShow() { void QuartzShow(void) {
int i; int i;
if (quartzServerVisible) if (quartzServerVisible)

View File

@ -130,4 +130,6 @@ void QuartzSpaceChanged(uint32_t space_id);
void QuartzSetFullscreen(Bool state); void QuartzSetFullscreen(Bool state);
void QuartzSetRootless(Bool state); void QuartzSetRootless(Bool state);
int server_main(int argc, char **argv, char **envp);
#endif #endif

View File

@ -311,8 +311,10 @@ void QuartzAudioInit(void)
// Prepare for playback // Prepare for playback
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
{
AudioDeviceIOProcID sInputIOProcID = NULL; AudioDeviceIOProcID sInputIOProcID = NULL;
status = AudioDeviceCreateIOProcID( outputDevice, QuartzAudioIOProc, &data, &sInputIOProcID ); status = AudioDeviceCreateIOProcID( outputDevice, QuartzAudioIOProc, &data, &sInputIOProcID );
}
#else #else
status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data); status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data);
#endif #endif

View File

@ -255,10 +255,10 @@ ProcAppleDRIDestroySurface(
register ClientPtr client register ClientPtr client
) )
{ {
int rc;
REQUEST(xAppleDRIDestroySurfaceReq); REQUEST(xAppleDRIDestroySurfaceReq);
DrawablePtr pDrawable; DrawablePtr pDrawable;
REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq);
int rc;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess); DixReadAccess);

View File

@ -72,7 +72,7 @@ X_PFX (cvt_vptr_to_uint) (void * val) __attribute__((always_inline));
static __inline__ void * static __inline__ void *
X_PFX (cvt_uint_to_vptr) (unsigned int val) X_PFX (cvt_uint_to_vptr) (unsigned int val)
{ {
return (void*)((size_t)(val)); return (void*)((unsigned long)(val));
} }
static __inline__ unsigned int static __inline__ unsigned int

View File

@ -215,10 +215,10 @@ xprDestroyFrame(RootlessFrameID wid)
static void static void
xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY) xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
{ {
TA_SERVER();
xp_window_changes wc; xp_window_changes wc;
TA_SERVER();
wc.x = newX; wc.x = newX;
wc.y = newY; wc.y = newY;
// ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY); // ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY);
@ -272,7 +272,7 @@ static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid) {
} }
if(window_hash) { if(window_hash) {
RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr((xp_window_id)wid), NULL); RootlessWindowRec *winRec = x_hash_table_lookup(window_hash, wid, NULL);
if(winRec) { if(winRec) {
if(quartzEnableRootless) if(quartzEnableRootless)
@ -566,8 +566,8 @@ xprHideWindows(Bool hide)
TA_SERVER(); TA_SERVER();
for (screen = 0; screen < screenInfo.numScreens; screen++) { for (screen = 0; screen < screenInfo.numScreens; screen++) {
pRoot = WindowTable[screenInfo.screens[screen]->myNum];
RootlessFrameID prevWid = NULL; RootlessFrameID prevWid = NULL;
pRoot = WindowTable[screenInfo.screens[screen]->myNum];
for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) {
RootlessWindowRec *winRec = WINREC(pWin); RootlessWindowRec *winRec = WINREC(pWin);

View File

@ -317,11 +317,11 @@ xprAddScreen(int index, ScreenPtr pScreen)
if (noPseudoramiXExtension) if (noPseudoramiXExtension)
{ {
ErrorF("Warning: noPseudoramiXExtension!\n");
CGDirectDisplayID dpy; CGDirectDisplayID dpy;
CGRect frame; CGRect frame;
ErrorF("Warning: noPseudoramiXExtension!\n");
dpy = displayAtIndex(index); dpy = displayAtIndex(index);
frame = displayScreenBounds(dpy); frame = displayScreenBounds(dpy);