diff options
author | bhuddle <benjaminhuddle@hotmail.com> | 2012-03-06 14:30:56 -0800 |
---|---|---|
committer | bhuddle <benjaminhuddle@hotmail.com> | 2012-03-06 14:30:56 -0800 |
commit | 9ca6e2101e3d34f5d17f8c6fa5c43246eefed062 (patch) | |
tree | 8da7d97b41dd4b1d623d6ffe55f9de598af87ebd | |
parent | f02cd4fb74f87146a02044d8fcfd5569b03db1a9 (diff) | |
parent | 7fa37b2403f1d3d7524dd8aeaf36b9bf422a8ac0 (diff) |
Merge branch 'master' into startup
-rw-r--r-- | src/libcompositewm/window.c | 7 | ||||
-rw-r--r-- | src/libcompositewm/xtoq_internal.h | 11 | ||||
-rw-r--r-- | src/xtoq/XtoqController.h | 4 | ||||
-rw-r--r-- | src/xtoq/XtoqController.m | 68 | ||||
-rw-r--r-- | src/xtoq/XtoqImageRep.h | 6 | ||||
-rw-r--r-- | src/xtoq/XtoqImageRep.m | 12 | ||||
-rw-r--r-- | src/xtoq/XtoqView.m | 8 |
7 files changed, 52 insertions, 64 deletions
diff --git a/src/libcompositewm/window.c b/src/libcompositewm/window.c index b323acd..17ec836 100644 --- a/src/libcompositewm/window.c +++ b/src/libcompositewm/window.c @@ -82,11 +82,12 @@ xtoq_set_input_focus(xtoq_context_t *context) { } xtoq_context_t * -_xtoq_window_created(xcb_connection_t * conn, xcb_create_notify_event_t *event) { +_xtoq_window_created(xcb_connection_t * conn, xcb_map_request_event_t *event) { - // Check to see if the window is already created - if (_xtoq_get_context_node_by_window_id(event->window)) + /* Check to see if the window is already created */ + if (_xtoq_get_context_node_by_window_id(event->window)) { return NULL; + } // allocate memory for new xtoq_context_t xtoq_context_t *context = malloc(sizeof(xtoq_context_t)); diff --git a/src/libcompositewm/xtoq_internal.h b/src/libcompositewm/xtoq_internal.h index 7774417..fe9c3e5 100644 --- a/src/libcompositewm/xtoq_internal.h +++ b/src/libcompositewm/xtoq_internal.h @@ -196,7 +196,16 @@ _xtoq_get_context_node_by_window_id (xcb_window_t window_id); /**************** * window.c ****************/ -xtoq_context_t *_xtoq_window_created(xcb_connection_t * conn, xcb_create_notify_event_t *evt); + +/** + * Create a new context for the window specified in the event. + * @param conn The connection to xserver + * @param evt The map event for the window + * @return Pointer to new context. NULL if window already exists. + */ +xtoq_context_t *_xtoq_window_created(xcb_connection_t * conn, + xcb_map_request_event_t *evt); + xtoq_context_t *_xtoq_destroy_window(xcb_destroy_notify_event_t *event); /** diff --git a/src/xtoq/XtoqController.h b/src/xtoq/XtoqController.h index 6e5e654..933059e 100644 --- a/src/xtoq/XtoqController.h +++ b/src/xtoq/XtoqController.h @@ -50,8 +50,6 @@ #define environ (*_NSGetEnviron()) #endif -@class DisplayNumberController; - id referenceToSelf; @interface XtoqController : NSObject { @@ -106,7 +104,7 @@ id referenceToSelf; /** * Sets the screen to command line argument. */ -- (void) setScreen: (const char *) scrn; +- (void) setScreen: (char *) scrn; - (void)windowWillMove:(NSNotification*)notification; - (void)windowDidMove:(NSNotification*)notification; diff --git a/src/xtoq/XtoqController.m b/src/xtoq/XtoqController.m index 6c7f9f1..ccec753 100644 --- a/src/xtoq/XtoqController.m +++ b/src/xtoq/XtoqController.m @@ -100,44 +100,44 @@ // Register for the key down notifications from the view - [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(keyDownInView:) - name: @"XTOQviewKeyDownEvent" - object: nil]; - - [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(mouseButtonDownInView:) - name: @"XTOQmouseButtonDownEvent" - object: nil]; + [nc addObserver: self + selector: @selector(keyDownInView:) + name: @"XTOQviewKeyDownEvent" + object: nil]; + + [nc addObserver: self + selector: @selector(mouseButtonDownInView:) + name: @"XTOQmouseButtonDownEvent" + object: nil]; // register for destroy event - [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(destroy:) - name: @"XTOQdestroyTheWindow" - object: nil]; - - [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(mouseMovedInView:) - name: @"XTOQviewMouseMovedEvent" - object: nil]; + [nc addObserver: self + selector: @selector(destroy:) + name: @"XTOQdestroyTheWindow" + object: nil]; + + [nc addObserver: self + selector: @selector(mouseMovedInView:) + name: @"XTOQviewMouseMovedEvent" + object: nil]; // regester for window will/did movement notification - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowWillMove:) - name:NSWindowWillMoveNotification - object:nil]; + [nc addObserver:self + selector:@selector(windowWillMove:) + name:NSWindowWillMoveNotification + object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowDidMove:) - name:NSWindowDidMoveNotification - object:nil]; + [nc addObserver:self + selector:@selector(windowDidMove:) + name:NSWindowDidMoveNotification + object:nil]; // regester for window resize notification - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(windowDidResize:) - name:NSWindowDidResizeNotification - object:nil]; - /* [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(applicationWillTerminate:) - name:NSApplicationWillTerminateNotification object:nil]; */ + [nc addObserver:self + selector:@selector(windowDidResize:) + name:NSWindowDidResizeNotification + object:nil]; + /* [nc addObserver:self + selector:@selector(applicationWillTerminate:) + name:NSApplicationWillTerminateNotification object:nil]; */ @@ -462,7 +462,7 @@ - (void) reshape { - XtoqWindow *moveWindow = [NSApp mainWindow]; + XtoqWindow *moveWindow = (XtoqWindow *)[NSApp mainWindow]; if (moveWindow != nil) { xtoq_context_t *moveContext = [moveWindow getContext]; diff --git a/src/xtoq/XtoqImageRep.h b/src/xtoq/XtoqImageRep.h index 6cb07f6..7b915f4 100644 --- a/src/xtoq/XtoqImageRep.h +++ b/src/xtoq/XtoqImageRep.h @@ -86,11 +86,5 @@ - (CGFloat)getHeight; - (BOOL)drawInRect:(NSRect)rect; -/** - * testing function - */ -- (id)topCrop; - - - (void)destroy; @end diff --git a/src/xtoq/XtoqImageRep.m b/src/xtoq/XtoqImageRep.m index 2495547..ca2b5f5 100644 --- a/src/xtoq/XtoqImageRep.m +++ b/src/xtoq/XtoqImageRep.m @@ -77,18 +77,6 @@ return self; } -// testing function -- (id)topCrop{ - CGSize sizeH = [self size]; - CGRect rect = CGRectMake(0, 30, - sizeH.width - 30, sizeH.height-30 ); - - CGImageRef imageRef = CGImageCreateWithImageInRect(cgImage, rect); - cgImage = imageRef; - return self; -} - - - (BOOL)draw{ CGContextRef contextMac = [[NSGraphicsContext currentContext] graphicsPort]; if (contextMac == NULL) diff --git a/src/xtoq/XtoqView.m b/src/xtoq/XtoqView.m index f9a4a18..38d60bd 100644 --- a/src/xtoq/XtoqView.m +++ b/src/xtoq/XtoqView.m @@ -80,9 +80,8 @@ acceptsFirstResponder { - (void)mouseMoved:(NSEvent *)mouseMovedEvent { - NSRect bnd = [self bounds]; - CGFloat f = CGRectGetHeight(bnd); - NSNumber *n = [[NSNumber alloc] initWithFloat:f]; + CGFloat f = [self bounds].size.height; + NSNumber *n = [[NSNumber alloc] initWithFloat:f]; NSMutableDictionary *twoInfoDict = [[NSMutableDictionary alloc] initWithCapacity:2]; [twoInfoDict setObject:mouseMovedEvent forKey:@"1"]; [twoInfoDict setObject:n forKey:@"2"]; @@ -117,8 +116,7 @@ keyDown:(NSEvent *)theEvent { -(void) mouseDown:(NSEvent *)mouseEvent { - NSRect bnd = [self bounds]; - CGFloat f = CGRectGetHeight(bnd); + CGFloat f = [self bounds].size.height; NSNumber *n = [[NSNumber alloc] initWithFloat:f]; NSMutableDictionary *twoInfoDict = [[NSMutableDictionary alloc] initWithCapacity:2]; [twoInfoDict setObject:mouseEvent forKey:@"1"]; |