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 |
|
---|
33 | #define BOOL xBOOL
|
---|
34 | #include <X11/Xproto.h>
|
---|
35 | #undef BOOL
|
---|
36 |
|
---|
37 | #import <Cocoa/Cocoa.h>
|
---|
38 |
|
---|
39 | @interface XServer : NSObject {
|
---|
40 | // Server state
|
---|
41 | int serverState;
|
---|
42 | NSRecursiveLock *serverLock;
|
---|
43 | NSMutableArray *pendingClients;
|
---|
44 | BOOL serverVisible;
|
---|
45 | BOOL rootlessMenuBarVisible;
|
---|
46 | BOOL queueShowServer;
|
---|
47 | BOOL quitWithoutQuery;
|
---|
48 | BOOL pendingAppQuitReply;
|
---|
49 | UInt32 mouseState;
|
---|
50 | unsigned short swallowedKey;
|
---|
51 | BOOL sendServerEvents;
|
---|
52 | BOOL x11Active;
|
---|
53 |
|
---|
54 | // Aqua interface
|
---|
55 | IBOutlet NSWindow *modeWindow;
|
---|
56 | IBOutlet NSButton *startupModeButton;
|
---|
57 | IBOutlet NSButton *startFullScreenButton;
|
---|
58 | IBOutlet NSButton *startRootlessButton;
|
---|
59 | IBOutlet NSWindow *helpWindow;
|
---|
60 | IBOutlet NSButton *startupHelpButton;
|
---|
61 | IBOutlet NSPanel *switchWindow;
|
---|
62 |
|
---|
63 | // Menu elements setable by Apple-WM extension
|
---|
64 | IBOutlet NSMenu *windowMenu;
|
---|
65 | IBOutlet NSMenuItem *windowSeparator;
|
---|
66 | IBOutlet NSMenu *dockMenu;
|
---|
67 | int checkedWindowItem;
|
---|
68 | }
|
---|
69 |
|
---|
70 | - (id)init;
|
---|
71 |
|
---|
72 | - (BOOL)translateEvent:(NSEvent *)anEvent;
|
---|
73 | - (BOOL)getMousePosition:(xEvent *)xe fromEvent:(NSEvent *)anEvent;
|
---|
74 |
|
---|
75 | - (NSString *)makeSafePath:(NSString *)path;
|
---|
76 |
|
---|
77 | - (BOOL)loadDisplayBundle;
|
---|
78 | - (void)startX;
|
---|
79 | - (void)finishStartX;
|
---|
80 | - (BOOL)startXClients;
|
---|
81 | - (void)runClient:(NSString *)filename;
|
---|
82 | - (void)run;
|
---|
83 | - (void)toggle;
|
---|
84 | - (void)showServer:(BOOL)show;
|
---|
85 | - (void)forceShowServer:(BOOL)show;
|
---|
86 | - (void)setRootClip:(BOOL)enable;
|
---|
87 | - (void)readPasteboard;
|
---|
88 | - (void)writePasteboard;
|
---|
89 | - (void)quitServer;
|
---|
90 | - (void)sendXEvent:(xEvent *)xe;
|
---|
91 | - (void)sendShowHide:(BOOL)show;
|
---|
92 | - (void)clientProcessDone:(int)clientStatus;
|
---|
93 | - (void)activateX11:(BOOL)state;
|
---|
94 | - (void)windowBecameKey:(NSNotification *)notification;
|
---|
95 | - (void)setX11WindowList:(NSArray *)list;
|
---|
96 | - (void)setX11WindowCheck:(NSNumber *)nn;
|
---|
97 |
|
---|
98 | // Aqua interface actions
|
---|
99 | - (IBAction)startFullScreen:(id)sender;
|
---|
100 | - (IBAction)startRootless:(id)sender;
|
---|
101 | - (IBAction)closeHelpAndShow:(id)sender;
|
---|
102 | - (IBAction)showSwitchPanel:(id)sender;
|
---|
103 | - (IBAction)showAction:(id)sender;
|
---|
104 | - (IBAction)itemSelected:(id)sender;
|
---|
105 | - (IBAction)nextWindow:(id)sender;
|
---|
106 | - (IBAction)previousWindow:(id)sender;
|
---|
107 | - (IBAction)performClose:(id)sender;
|
---|
108 | - (IBAction)performMiniaturize:(id)sender;
|
---|
109 | - (IBAction)performZoom:(id)sender;
|
---|
110 | - (IBAction)bringAllToFront:(id)sender;
|
---|
111 | - (IBAction)copy:(id)sender;
|
---|
112 |
|
---|
113 | // NSApplication delegate
|
---|
114 | - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
|
---|
115 | - (void)applicationWillTerminate:(NSNotification *)aNotification;
|
---|
116 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
|
---|
117 | - (void)applicationDidHide:(NSNotification *)aNotification;
|
---|
118 | - (void)applicationDidUnhide:(NSNotification *)aNotification;
|
---|
119 | - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag;
|
---|
120 | - (void)applicationWillResignActive:(NSNotification *)aNotification;
|
---|
121 | - (void)applicationWillBecomeActive:(NSNotification *)aNotification;
|
---|
122 | - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
|
---|
123 |
|
---|
124 | // NSPort delegate
|
---|
125 | - (void)handlePortMessage:(NSPortMessage *)portMessage;
|
---|
126 |
|
---|
127 | @end
|
---|
128 |
|
---|
129 | // X server states
|
---|
130 | enum {
|
---|
131 | server_NotStarted,
|
---|
132 | server_Starting,
|
---|
133 | server_Running,
|
---|
134 | server_Quitting,
|
---|
135 | server_Done
|
---|
136 | };
|
---|