summaryrefslogtreecommitdiff
path: root/src/xtoq/XtoqWindow.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/xtoq/XtoqWindow.m')
-rw-r--r--src/xtoq/XtoqWindow.m94
1 files changed, 50 insertions, 44 deletions
diff --git a/src/xtoq/XtoqWindow.m b/src/xtoq/XtoqWindow.m
index c61629e..3114bfa 100644
--- a/src/xtoq/XtoqWindow.m
+++ b/src/xtoq/XtoqWindow.m
@@ -1,22 +1,22 @@
/*Copyright (C) 2012 Ben Huddle, Braden Wooley, David Snyder
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
@@ -27,56 +27,62 @@
@implementation XtoqWindow
+-(id) initWithContentRect:(NSRect)contentRect
+ styleMask:(NSUInteger)aStyle
+ backing:(NSBackingStoreType)bufferingType
+ defer:(BOOL)flag
+{
-
--(id) initWithContentRect:(NSRect)contentRect
- styleMask:(NSUInteger)aStyle
- backing:(NSBackingStoreType)bufferingType
- defer:(BOOL)flag {
-
notificationCenter = [NSNotificationCenter defaultCenter];
-
+
// Hack job, probably -- David
- [[NSNotificationCenter defaultCenter] addObserver: self
- selector: @selector(windowDidBecomeKey:)
- name: @"NSWindowDidBecomeKeyNotification"
- object: self];
+ [[NSNotificationCenter defaultCenter] addObserver: self
+ selector: @selector(
+ windowDidBecomeKey:)
+ name:
+ @"NSWindowDidBecomeKeyNotification"
+ object: self];
// End Hack job -- David
-
+
XtoqWindow *result = [super initWithContentRect:contentRect
- styleMask:aStyle
- backing:bufferingType
- defer:flag];
+ styleMask:aStyle
+ backing:bufferingType
+ defer:flag];
return result;
}
--(void) makeKeyAndOrderFront:(id)sender {
+-(void) makeKeyAndOrderFront:(id)sender
+{
[super makeKeyAndOrderFront:sender];
}
--(void) setContext:(xcwm_context_t *)aContext {
+-(void) setContext:(xcwm_context_t *)aContext
+{
winContext = aContext;
}
--(xcwm_context_t *) getContext {
+-(xcwm_context_t *) getContext
+{
return winContext;
}
-- (BOOL) windowShouldClose:(id)sender {
+- (BOOL) windowShouldClose:(id)sender
+{
// send notification to controller to close the window
XtoqWindow * aWindow = self;
- NSDictionary * dictionary = [NSDictionary dictionaryWithObject:aWindow
- forKey:@"1"];
- [notificationCenter postNotificationName:@"XTOQdestroyTheWindow"
+ NSDictionary * dictionary = [NSDictionary dictionaryWithObject:aWindow
+ forKey:@"1"];
+ [notificationCenter postNotificationName:@"XTOQdestroyTheWindow"
object:self
- userInfo:dictionary];
-
+ userInfo:dictionary];
+
// keep window from closing till server tells it to
return NO;
}
--(void)windowDidBecomeKey:(NSNotification *)note {
-
+-(void)windowDidBecomeKey:(NSNotification *)note
+{
+
xcwm_set_input_focus(winContext);
xcwm_set_window_to_top(winContext);
}