comparison src/video/quartz/SDL_QuartzWindow.m @ 4240:cb44bf8f8a0f SDL-1.2

Fixed bug #719 Mike Blaguszewski 2009-03-23 13:32:22 PDT Patch to 1.2 HEAD that fixes the issue Fixes bug in SDL 1.2.13 where clicking on an app's title bar to activate the app, when cursor capturing is enabled, will cause the window to jump. This is because SDL's handler for activate events calls a low-level Quartz function to move the cursor. Calling this when the mouse is down in the title bar confuses the WindowServer into thinking the title bar has been dragged. The patch defers processing of activate events in this case. The bottom line is that CGWarpMouseCursorPosition() is not safe to call when the mouse in down in a window's title bar.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 23 Sep 2009 07:18:02 +0000
parents 976bc19f8f6b
children
comparison
equal deleted inserted replaced
4239:3d467ee2af5e 4240:cb44bf8f8a0f
126 126
127 SDL_PrivateResize (newViewFrame.size.width, newViewFrame.size.height); 127 SDL_PrivateResize (newViewFrame.size.width, newViewFrame.size.height);
128 } 128 }
129 } 129 }
130 130
131 /* QZ_DoActivate() calls a low-level CoreGraphics routine to adjust
132 the cursor position, if input is being grabbed. If app activation is
133 triggered by a mouse click in the title bar, then the window manager
134 gets confused and thinks we're dragging the window. The solution
135 below postpones the activate event to avoid this scenario. */
136 - (void)becomeKeyWindow
137 {
138 NSEvent *event = [self currentEvent];
139 if ([event type] == NSLeftMouseDown && [event window] == self)
140 watchForMouseUp = YES;
141 else
142 [super becomeKeyWindow];
143 }
144
145 - (void)sendEvent:(NSEvent *)event
146 {
147 [super sendEvent:event];
148 if (watchForMouseUp && [event type] == NSLeftMouseUp)
149 {
150 watchForMouseUp = NO;
151 [super becomeKeyWindow];
152 }
153 }
154
131 - (void)appDidHide:(NSNotification*)note 155 - (void)appDidHide:(NSNotification*)note
132 { 156 {
133 SDL_PrivateAppActive (0, SDL_APPACTIVE); 157 SDL_PrivateAppActive (0, SDL_APPACTIVE);
134 } 158 }
135 159