1 | //
|
---|
2 | // XServer.h
|
---|
3 | //
|
---|
4 | /*
|
---|
5 | * Copyright (c) 2001 Andreas Monitzer. All Rights Reserved.
|
---|
6 | * Copyright (c) 2002-2003 Torrey T. Lyons. All Rights Reserved.
|
---|
7 | *
|
---|
8 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
9 | * copy of this software and associated documentation files (the
|
---|
10 | * "Software"), to deal in the Software without restriction, including
|
---|
11 | * without limitation the rights to use, copy, modify, merge, publish,
|
---|
12 | * distribute, sublicense, and/or sell copies of the Software, and to
|
---|
13 | * permit persons to whom the Software is furnished to do so, subject to
|
---|
14 | * the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included
|
---|
17 | * in all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
---|
22 | * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
|
---|
23 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
---|
24 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
---|
25 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
26 | *
|
---|
27 | * Except as contained in this notice, the name(s) of the above copyright
|
---|
28 | * holders shall not be used in advertising or otherwise to promote the
|
---|
29 | * sale, use or other dealings in this Software without prior written
|
---|
30 | * authorization.
|
---|
31 | */
|
---|
32 | /* $XdotOrg: xserver/xorg/hw/darwin/quartz/XServer.h,v 1.5 2005/07/01 22:43:07 daniels Exp $ */
|
---|
33 | /* $XFree86: xc/programs/Xserver/hw/darwin/quartz/XServer.h,v 1.16 2003/11/23 06:04:01 torrey Exp $ */
|
---|
34 |
|
---|
35 | #define BOOL xBOOL
|
---|
36 | #include <X11/Xproto.h>
|
---|
37 | #undef BOOL
|
---|
38 |
|
---|
39 | #import <Cocoa/Cocoa.h>
|
---|
40 |
|
---|
41 | @interface XServer : NSObject {
|
---|
42 | // Server state
|
---|
43 | int serverState;
|
---|
44 | NSRecursiveLock *serverLock;
|
---|
45 | NSMutableArray *pendingClients;
|
---|
46 | BOOL serverVisible;
|
---|
47 | BOOL rootlessMenuBarVisible;
|
---|
48 | BOOL queueShowServer;
|
---|
49 | BOOL quitWithoutQuery;
|
---|
50 | BOOL pendingAppQuitReply;
|
---|
51 | UInt32 mouseState;
|
---|
52 | unsigned short swallowedKey;
|
---|
53 | BOOL sendServerEvents;
|
---|
54 | BOOL x11Active;
|
---|
55 |
|
---|
56 | // Aqua interface
|
---|
57 | IBOutlet NSWindow *modeWindow;
|
---|
58 | IBOutlet NSButton *startupModeButton;
|
---|
59 | IBOutlet NSButton *startFullScreenButton;
|
---|
60 | IBOutlet NSButton *startRootlessButton;
|
---|
61 | IBOutlet NSWindow *helpWindow;
|
---|
62 | IBOutlet NSButton *startupHelpButton;
|
---|
63 | IBOutlet NSPanel *switchWindow;
|
---|
64 |
|
---|
65 | // Menu elements setable by Apple-WM extension
|
---|
66 | IBOutlet NSMenu *windowMenu;
|
---|
67 | IBOutlet NSMenuItem *windowSeparator;
|
---|
68 | IBOutlet NSMenu *dockMenu;
|
---|
69 | int checkedWindowItem;
|
---|
70 | }
|
---|
71 |
|
---|
72 | - (id)init;
|
---|
73 |
|
---|
74 | - (BOOL)translateEvent:(NSEvent *)anEvent;
|
---|
75 | - (BOOL)getMousePosition:(xEvent *)xe fromEvent:(NSEvent *)anEvent;
|
---|
76 |
|
---|
77 | - (NSString *)makeSafePath:(NSString *)path;
|
---|
78 |
|
---|
79 | - (BOOL)loadDisplayBundle;
|
---|
80 | - (void)startX;
|
---|
81 | - (void)finishStartX;
|
---|
82 | - (BOOL)startXClients;
|
---|
83 | - (void)runClient:(NSString *)filename;
|
---|
84 | - (void)run;
|
---|
85 | - (void)toggle;
|
---|
86 | - (void)showServer:(BOOL)show;
|
---|
87 | - (void)forceShowServer:(BOOL)show;
|
---|
88 | - (void)setRootClip:(BOOL)enable;
|
---|
89 | - (void)readPasteboard;
|
---|
90 | - (void)writePasteboard;
|
---|
91 | - (void)quitServer;
|
---|
92 | - (void)sendXEvent:(xEvent *)xe;
|
---|
93 | - (void)sendShowHide:(BOOL)show;
|
---|
94 | - (void)clientProcessDone:(int)clientStatus;
|
---|
95 | - (void)activateX11:(BOOL)state;
|
---|
96 | - (void)windowBecameKey:(NSNotification *)notification;
|
---|
97 | - (void)setX11WindowList:(NSArray *)list;
|
---|
98 | - (void)setX11WindowCheck:(NSNumber *)nn;
|
---|
99 |
|
---|
100 | // Aqua interface actions
|
---|
101 | - (IBAction)startFullScreen:(id)sender;
|
---|
102 | - (IBAction)startRootless:(id)sender;
|
---|
103 | - (IBAction)closeHelpAndShow:(id)sender;
|
---|
104 | - (IBAction)showSwitchPanel:(id)sender;
|
---|
105 | - (IBAction)showAction:(id)sender;
|
---|
106 | - (IBAction)itemSelected:(id)sender;
|
---|
107 | - (IBAction)nextWindow:(id)sender;
|
---|
108 | - (IBAction)previousWindow:(id)sender;
|
---|
109 | - (IBAction)performClose:(id)sender;
|
---|
110 | - (IBAction)performMiniaturize:(id)sender;
|
---|
111 | - (IBAction)performZoom:(id)sender;
|
---|
112 | - (IBAction)bringAllToFront:(id)sender;
|
---|
113 | - (IBAction)copy:(id)sender;
|
---|
114 |
|
---|
115 | // NSApplication delegate
|
---|
116 | - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
---|
117 | - (void)applicationWillTerminate:(NSNotification *)aNotification;
|
---|
118 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
|
---|
119 | - (void)applicationDidHide:(NSNotification *)aNotification;
|
---|
120 | - (void)applicationDidUnhide:(NSNotification *)aNotification;
|
---|
121 | - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag;
|
---|
122 | - (void)applicationWillResignActive:(NSNotification *)aNotification;
|
---|
123 | - (void)applicationWillBecomeActive:(NSNotification *)aNotification;
|
---|
124 | - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
|
---|
125 |
|
---|
126 | // NSPort delegate
|
---|
127 | - (void)handlePortMessage:(NSPortMessage *)portMessage;
|
---|
128 |
|
---|
129 | @end
|
---|
130 |
|
---|
131 | // X server states
|
---|
132 | enum {
|
---|
133 | server_NotStarted,
|
---|
134 | server_Starting,
|
---|
135 | server_Running,
|
---|
136 | server_Quitting,
|
---|
137 | server_Done
|
---|
138 | };
|
---|