Xquartz: General Cleanup

General code cleanup, whitespace, dead code removal, added missing prototypes.
Made Xquartz come to foreground later in startup, so it doesn't appear for Xquartz -version
(cherry picked from commit 36922e8ff4)
This commit is contained in:
Jeremy Huddleston 2007-12-20 13:17:30 -08:00
parent 7ef7727b80
commit 42802a8e6b
10 changed files with 85 additions and 149 deletions

View File

@ -238,6 +238,10 @@ static int indexForScanlinePad[ 65 ] = {
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifdef __APPLE__
void DarwinHandleGUI(int argc, char **argv, char **envp);
#endif
int
main(int argc, char *argv[], char *envp[])
{

View File

@ -64,17 +64,15 @@ extern X11Application *X11App;
#endif /* __OBJC__ */
extern void X11ApplicationSetWindowMenu (int nitems, const char **items,
void X11ApplicationSetWindowMenu (int nitems, const char **items,
const char *shortcuts);
extern void X11ApplicationSetWindowMenuCheck (int idx);
extern void X11ApplicationSetFrontProcess (void);
extern void X11ApplicationSetCanQuit (int state);
extern void X11ApplicationServerReady (void);
extern void X11ApplicationShowHideMenubar (int state);
void X11ApplicationSetWindowMenuCheck (int idx);
void X11ApplicationSetFrontProcess (void);
void X11ApplicationSetCanQuit (int state);
void X11ApplicationServerReady (void);
void X11ApplicationShowHideMenubar (int state);
extern void X11ApplicationMain (int argc, const char *argv[],
void (*server_thread) (void *),
void *server_arg);
void X11ApplicationMain(int argc, char **argv, void (*server_thread) (void *), void *server_arg);
extern int X11EnableKeyEquivalents;
extern int quartzHasRoot, quartzEnableRootless;

View File

@ -32,6 +32,7 @@
#endif
#include "quartzCommon.h"
#include "quartzForeground.h"
#import "X11Application.h"
#include <Carbon/Carbon.h>
@ -83,7 +84,7 @@ static void send_nsevent (NSEventType type, NSEvent *e);
/* Quartz mode initialization routine. This is often dynamically loaded
but is statically linked into this X server. */
extern Bool QuartzModeBundleInit(void);
Bool QuartzModeBundleInit(void);
static void init_ports (void) {
kern_return_t r;
@ -789,8 +790,7 @@ environment?", @"Startup xinitrc dialog");
[X11App prefs_synchronize];
}
void X11ApplicationMain (int argc, const char *argv[],
void (*server_thread) (void *), void *server_arg) {
void X11ApplicationMain (int argc, char **argv, void (*server_thread) (void *), void *server_arg) {
NSAutoreleasePool *pool;
#ifdef DEBUG
@ -822,12 +822,12 @@ void X11ApplicationMain (int argc, const char *argv[],
exit (1);
}
[NSApp run];
QuartzMoveToForeground();
[NSApp run];
/* not reached */
}
/* event conversion */
static inline unsigned short

View File

@ -78,8 +78,4 @@
#endif /* __OBJC__ */
extern void X11ControllerMain (int argc, const char *argv[],
void (*server_thread) (void *),
void *server_arg);
#endif /* X11CONTROLLER_H */

View File

@ -741,9 +741,3 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
}
@end
void X11ControllerMain (int argc, const char *argv[],
void (*server_thread) (void *), void *server_arg)
{
X11ApplicationMain (argc, argv, server_thread, server_arg);
}

View File

@ -715,16 +715,6 @@ int ddxProcessArgument( int argc, char *argv[], int i )
return 1;
}
if ( !strcmp( argv[i], "-quartz" ) ) {
ErrorF( "Running in parallel with Mac OS X Quartz window server.\n" );
return 1;
}
// The Mac OS X front end uses this argument, which we just ignore here.
if ( !strcmp( argv[i], "-nostartx" ) ) {
return 1;
}
// This command line arg is passed when launched from the Aqua GUI.
if ( !strncmp( argv[i], "-psn_", 5 ) ) {
return 1;
@ -876,9 +866,9 @@ void ddxUseMsg( void )
ErrorF("-keymap <file> : read the keymapping from a file instead of the kernel.\n");
ErrorF("-version : show the server version.\n");
ErrorF("\n");
ErrorF("Quartz modes (Experimental / In Development):\n");
ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n");
ErrorF("-rootless : run rootless inside Mac OS X window server.\n");
// ErrorF("Quartz modes (Experimental / In Development):\n");
// ErrorF("-fullscreen : run full screen in parallel with Mac OS X window server.\n");
// ErrorF("-rootless : run rootless inside Mac OS X window server.\n");
ErrorF("\n");
ErrorF("Options ignored in rootless mode:\n");
ErrorF("-size <height> <width> : use a screen resolution of <height> x <width>.\n");
@ -896,7 +886,8 @@ void ddxGiveUp( void )
{
ErrorF( "Quitting XQuartz...\n" );
QuartzGiveUp();
//if (!quartzRootless)
// quartzProcs->ReleaseScreens();
}

View File

@ -61,7 +61,6 @@
// Shared global variables for Quartz modes
int quartzEventWriteFD = -1;
int quartzStartClients = 1;
int quartzRootless = -1;
int quartzUseSysBeep = 0;
int quartzUseAGL = 1;
@ -408,9 +407,7 @@ QuartzMessageServerThread(
* QuartzProcessEvent
* Process Quartz specific events.
*/
void QuartzProcessEvent(
xEvent *xe)
{
void QuartzProcessEvent(xEvent *xe) {
switch (xe->u.u.type) {
case kXDarwinControllerNotify:
DEBUG_LOG("kXDarwinControllerNotify\n");
@ -473,6 +470,7 @@ void QuartzProcessEvent(
break;
case kXDarwinSetRootless:
DEBUG_LOG("kXDarwinSetRootless\n");
#ifdef DARWIN_DDX_MISSING
QuartzSetRootless(xe->u.clientMessage.u.l.longs0);
if (!quartzEnableRootless && !quartzHasRoot) QuartzHide();
@ -506,26 +504,3 @@ void QuartzProcessEvent(
ErrorF("Unknown application defined event type %d.\n", xe->u.u.type);
}
}
/*
* QuartzGiveUp
* Cleanup before X server shutdown
* Release the screen and restore the Aqua cursor.
*/
void QuartzGiveUp(void)
{
#if 0
// Trying to switch cursors when quitting causes deadlock
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
if (screenInfo.screens[i]) {
QuartzSuspendXCursor(screenInfo.screens[i]);
}
}
#endif
if (!quartzRootless)
quartzProcs->ReleaseScreens();
}

View File

@ -64,7 +64,6 @@ typedef struct {
// Data stored at startup for Cocoa front end
extern int quartzEventWriteFD;
extern int quartzStartClients;
// User preferences used by Quartz modes
extern int quartzRootless;

View File

@ -34,8 +34,8 @@
#include <fcntl.h>
#include <unistd.h>
#include <CoreFoundation/CoreFoundation.h>
#include "quartzForeground.h"
#include "quartzCommon.h"
#include "X11Application.h"
#include "darwin.h"
#include "quartz.h"
#include "opaque.h"
@ -52,9 +52,6 @@
char **envpGlobal; // argcGlobal and argvGlobal
// are from dix/globals.c
void X11ControllerMain(int argc, char *argv[], void (*server_thread) (void *), void *server_arg);
static void server_thread (void *arg) {
extern int main(int argc, char **argv, char **envp);
exit (main (argcGlobal, argvGlobal, envpGlobal));
@ -68,17 +65,11 @@ static void server_thread (void *arg) {
* server. On the second call this function loads the user
* preferences set by the Mac OS X front end.
*/
void DarwinHandleGUI(
int argc,
char *argv[],
char *envp[] )
{
void DarwinHandleGUI(int argc, char **argv, char **envp) {
static Bool been_here = FALSE;
int i;
int fd[2];
QuartzMoveToForeground();
if (been_here) {
return;
}
@ -95,25 +86,13 @@ void DarwinHandleGUI(
argvGlobal = argv;
envpGlobal = envp;
quartzStartClients = 1;
for (i = 1; i < argc; i++) {
// Display version info without starting Mac OS X UI if requested
if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
DarwinPrintBanner();
exit(0);
}
// Determine if we need to start X clients
// and what display mode to use
if (!strcmp(argv[i], "-nostartx")) {
quartzStartClients = 0;
} else if (!strcmp( argv[i], "-fullscreen")) {
quartzRootless = 0;
} else if (!strcmp( argv[i], "-rootless")) {
quartzRootless = 1;
}
}
/* Initially I ran the X server on the main thread, and received
events on the second thread. But now we may be using Carbon,
@ -127,6 +106,6 @@ void DarwinHandleGUI(
extern void _InitHLTB(void);
_InitHLTB();
X11ControllerMain(argc, argv, server_thread, NULL);
X11ApplicationMain(argc, argv, server_thread, NULL);
exit(0);
}

View File

@ -31,7 +31,7 @@
#include "screenint.h"
extern Bool QuartzModeBundleInit(void);
Bool QuartzModeBundleInit(void);
void AppleDRIExtensionInit(void);
void xprAppleWMInit(void);