comparison src/video/cocoa/SDL_cocoawindow.m @ 1962:c92e5f3e68d9

Hack to stop the beeping Fixed keyboard window focus.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 30 Jul 2006 08:09:20 +0000
parents 25d6537feea4
children 81255f93dfcd
comparison
equal deleted inserted replaced
1961:f42f10fc309e 1962:c92e5f3e68d9
125 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESTORED, 0, 0); 125 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_RESTORED, 0, 0);
126 } 126 }
127 127
128 - (void)windowDidBecomeKey:(NSNotification *)aNotification 128 - (void)windowDidBecomeKey:(NSNotification *)aNotification
129 { 129 {
130 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); 130 int index;
131
132 index = _data->videodata->keyboard;
133 SDL_SetKeyboardFocus(index, _data->windowID);
131 } 134 }
132 135
133 - (void)windowDidResignKey:(NSNotification *)aNotification 136 - (void)windowDidResignKey:(NSNotification *)aNotification
134 { 137 {
135 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); 138 int index;
139
140 index = _data->videodata->keyboard;
141 SDL_SetKeyboardFocus(index, 0);
136 } 142 }
137 143
138 - (void)windowDidHide:(NSNotification *)aNotification 144 - (void)windowDidHide:(NSNotification *)aNotification
139 { 145 {
140 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0); 146 SDL_SendWindowEvent(_data->windowID, SDL_WINDOWEVENT_HIDDEN, 0, 0);
250 { 256 {
251 int index; 257 int index;
252 258
253 index = _data->videodata->mouse; 259 index = _data->videodata->mouse;
254 SDL_SendMouseWheel(index, (int)([theEvent deltaY]+0.9f)); 260 SDL_SendMouseWheel(index, (int)([theEvent deltaY]+0.9f));
255 }
256
257 - (void)keyDown:(NSEvent *)theEvent
258 {
259 int index;
260
261 index = _data->videodata->keyboard;
262 fprintf(stderr, "keyDown\n");
263 const char *text = [[theEvent characters] UTF8String];
264 if(text && *text) {
265 SDL_SendKeyboardText(index, text);
266 }
267 }
268
269 - (void)keyUp:(NSEvent *)theEvent
270 {
271 int index;
272
273 index = _data->videodata->keyboard;
274 fprintf(stderr, "keyUp\n");
275 } 261 }
276 262
277 @end 263 @end
278 264
279 static int 265 static int