summaryrefslogtreecommitdiff
path: root/hw/xquartz/X11Controller.m
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-05-04 22:24:56 -0700
committerKeith Packard <keithp@keithp.com>2008-05-04 22:24:56 -0700
commit33e5a176e62a0114cb8cca9447798c6d6b6665ed (patch)
tree8efa34606aae171fe1bad7aff993a2a94910d76e /hw/xquartz/X11Controller.m
parente48f6bcd94b310e5c79939bdb1703f9555a3cdd1 (diff)
parentefa65a0317e12c9ad34fa00fe90bf5eae9fa2670 (diff)
Merge commit 'origin/master' into transform-proposal-oldtransform-proposal
Conflicts: configure.ac exa/exa.c
Diffstat (limited to 'hw/xquartz/X11Controller.m')
-rw-r--r--hw/xquartz/X11Controller.m63
1 files changed, 29 insertions, 34 deletions
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 2fd988661..107d8ee9b 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -27,6 +27,8 @@
promote the sale, use or other dealings in this Software without
prior written authorization. */
+#include "sanitizedCarbon.h"
+
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
@@ -37,17 +39,14 @@
#import "X11Controller.h"
#import "X11Application.h"
-#import <Carbon/Carbon.h>
-/* ouch! */
-#define BOOL X_BOOL
#include "opaque.h"
-# include "darwin.h"
-# include "quartz.h"
-# define _APPLEWM_SERVER_
-# include "X11/extensions/applewm.h"
-# include "applewmExt.h"
-#undef BOOL
+#include "darwin.h"
+#include "darwinEvents.h"
+#include "quartz.h"
+#define _APPLEWM_SERVER_
+#include "X11/extensions/applewm.h"
+#include "applewmExt.h"
#include <stdio.h>
#include <unistd.h>
@@ -602,7 +601,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
#endif
}
-- (void) set_can_quit:(BOOL)state
+- (void) set_can_quit:(OSX_BOOL)state
{
can_quit = state;
}
@@ -669,7 +668,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
AHLookupAnchor ((CFStringRef)NSLocalizedString(@"Mac Help", no comment), CFSTR ("mchlp2276"));
}
-- (BOOL) validateMenuItem:(NSMenuItem *)item
+- (OSX_BOOL) validateMenuItem:(NSMenuItem *)item
{
NSMenu *menu = [item menu];
@@ -692,24 +691,26 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
DarwinSendDDXEvent(kXquartzControllerNotify, 1, AppleWMShowAll);
}
-- (NSApplicationTerminateReply) applicationShouldTerminate:sender
-{
- NSString *msg;
+- (NSApplicationTerminateReply) applicationShouldTerminate:sender {
+ NSString *msg;
+ NSString *title;
- if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
- return NSTerminateNow;
-
- /* Make sure we're frontmost. */
- [NSApp activateIgnoringOtherApps:YES];
+ if (can_quit || [X11App prefs_get_boolean:@PREFS_NO_QUIT_ALERT default:NO])
+ return NSTerminateNow;
- msg = NSLocalizedString (@"Are you sure you want to quit X11?\n\nIf you quit X11, any X11 applications you are running will stop immediately and you will lose any changes you have not saved.", @"Dialog when quitting");
+ /* Make sure we're frontmost. */
+ [NSApp activateIgnoringOtherApps:YES];
- /* FIXME: safe to run the alert in here? Or should we return Later
- and then run the alert on a timer? It seems to work here, so.. */
+ title = NSLocalizedString(@"Do you really want to quit X11?", @"Dialog title when quitting");
+ msg = NSLocalizedString(@"Any open X11 applications will stop immediately, and you will lose any unsaved changes.", @"Dialog when quitting");
+
+ /* FIXME: safe to run the alert in here? Or should we return Later
+ * and then run the alert on a timer? It seems to work here, so..
+ */
- return (NSRunAlertPanel (nil, msg, NSLocalizedString (@"Quit", @""),
- NSLocalizedString (@"Cancel", @""), nil)
- == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
+ return (NSRunAlertPanel (title, msg, NSLocalizedString (@"Quit", @""),
+ NSLocalizedString (@"Cancel", @""), nil)
+ == NSAlertDefaultReturn) ? NSTerminateNow : NSTerminateCancel;
}
- (void) applicationWillTerminate:(NSNotification *)aNotification
@@ -741,7 +742,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
pending_apps = NULL;
}
-- (BOOL) application:(NSApplication *)app openFile:(NSString *)filename
+- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename
{
const char *name = [filename UTF8String];
@@ -754,14 +755,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
return YES;
}
-- (BOOL) applicationShouldHandleReopen:(NSApplication *)app
- hasVisibleWindows:(BOOL)hasVis {
- DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
- return YES;
-}
-
@end
-void X11ControllerMain(int argc, const char **argv, void (*server_thread) (void *), void *server_arg) {
- X11ApplicationMain (argc, argv, server_thread, server_arg);
+void X11ControllerMain(int argc, char **argv, char **envp) {
+ X11ApplicationMain (argc, argv, envp);
}