45e9809aff7304721fddb95654901b32195c9c7avboxsync//
45e9809aff7304721fddb95654901b32195c9c7avboxsync// XServer.h
45e9809aff7304721fddb95654901b32195c9c7avboxsync//
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (c) 2001 Andreas Monitzer. All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining a
45e9809aff7304721fddb95654901b32195c9c7avboxsync * copy of this software and associated documentation files (the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * "Software"), to deal in the Software without restriction, including
45e9809aff7304721fddb95654901b32195c9c7avboxsync * without limitation the rights to use, copy, modify, merge, publish,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * distribute, sublicense, and/or sell copies of the Software, and to
45e9809aff7304721fddb95654901b32195c9c7avboxsync * permit persons to whom the Software is furnished to do so, subject to
45e9809aff7304721fddb95654901b32195c9c7avboxsync * the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice and this permission notice shall be included
45e9809aff7304721fddb95654901b32195c9c7avboxsync * in all copies or substantial portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
45e9809aff7304721fddb95654901b32195c9c7avboxsync * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45e9809aff7304721fddb95654901b32195c9c7avboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Except as contained in this notice, the name(s) of the above copyright
45e9809aff7304721fddb95654901b32195c9c7avboxsync * holders shall not be used in advertising or otherwise to promote the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * sale, use or other dealings in this Software without prior written
45e9809aff7304721fddb95654901b32195c9c7avboxsync * authorization.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define BOOL xBOOL
45e9809aff7304721fddb95654901b32195c9c7avboxsync#include <X11/Xproto.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync#undef BOOL
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#import <Cocoa/Cocoa.h>
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync@interface XServer : NSObject {
45e9809aff7304721fddb95654901b32195c9c7avboxsync // Server state
45e9809aff7304721fddb95654901b32195c9c7avboxsync int serverState;
45e9809aff7304721fddb95654901b32195c9c7avboxsync NSRecursiveLock *serverLock;
45e9809aff7304721fddb95654901b32195c9c7avboxsync NSMutableArray *pendingClients;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL serverVisible;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL rootlessMenuBarVisible;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL queueShowServer;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL quitWithoutQuery;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL pendingAppQuitReply;
45e9809aff7304721fddb95654901b32195c9c7avboxsync UInt32 mouseState;
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned short swallowedKey;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL sendServerEvents;
45e9809aff7304721fddb95654901b32195c9c7avboxsync BOOL x11Active;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync // Aqua interface
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSWindow *modeWindow;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSButton *startupModeButton;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSButton *startFullScreenButton;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSButton *startRootlessButton;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSWindow *helpWindow;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSButton *startupHelpButton;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSPanel *switchWindow;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync // Menu elements setable by Apple-WM extension
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSMenu *windowMenu;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSMenuItem *windowSeparator;
45e9809aff7304721fddb95654901b32195c9c7avboxsync IBOutlet NSMenu *dockMenu;
45e9809aff7304721fddb95654901b32195c9c7avboxsync int checkedWindowItem;
45e9809aff7304721fddb95654901b32195c9c7avboxsync}
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (id)init;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (BOOL)translateEvent:(NSEvent *)anEvent;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (BOOL)getMousePosition:(xEvent *)xe fromEvent:(NSEvent *)anEvent;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (NSString *)makeSafePath:(NSString *)path;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (BOOL)loadDisplayBundle;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)startX;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)finishStartX;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (BOOL)startXClients;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)runClient:(NSString *)filename;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)run;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)toggle;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)showServer:(BOOL)show;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)forceShowServer:(BOOL)show;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)setRootClip:(BOOL)enable;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)readPasteboard;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)writePasteboard;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)quitServer;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)sendXEvent:(xEvent *)xe;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)sendShowHide:(BOOL)show;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)clientProcessDone:(int)clientStatus;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)activateX11:(BOOL)state;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)windowBecameKey:(NSNotification *)notification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)setX11WindowList:(NSArray *)list;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)setX11WindowCheck:(NSNumber *)nn;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync// Aqua interface actions
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)startFullScreen:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)startRootless:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)closeHelpAndShow:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)showSwitchPanel:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)showAction:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)itemSelected:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)nextWindow:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)previousWindow:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)performClose:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)performMiniaturize:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)performZoom:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)bringAllToFront:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (IBAction)copy:(id)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync// NSApplication delegate
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)applicationWillTerminate:(NSNotification *)aNotification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)applicationDidHide:(NSNotification *)aNotification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)applicationDidUnhide:(NSNotification *)aNotification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)applicationWillResignActive:(NSNotification *)aNotification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)applicationWillBecomeActive:(NSNotification *)aNotification;
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync// NSPort delegate
45e9809aff7304721fddb95654901b32195c9c7avboxsync- (void)handlePortMessage:(NSPortMessage *)portMessage;
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync@end
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync// X server states
45e9809aff7304721fddb95654901b32195c9c7avboxsyncenum {
45e9809aff7304721fddb95654901b32195c9c7avboxsync server_NotStarted,
45e9809aff7304721fddb95654901b32195c9c7avboxsync server_Starting,
45e9809aff7304721fddb95654901b32195c9c7avboxsync server_Running,
45e9809aff7304721fddb95654901b32195c9c7avboxsync server_Quitting,
45e9809aff7304721fddb95654901b32195c9c7avboxsync server_Done
45e9809aff7304721fddb95654901b32195c9c7avboxsync};