4 Mac OS X OpenGL and input module, using Carbon and AGL
6 Copyright (C) 2005-2006 Mathieu Olivier
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <Carbon/Carbon.h>
28 #include "vid_agl_mackeys.h" // this is SDL/src/video/maccommon/SDL_mackeys.h
32 // Tell startup code that we have a client
33 int cl_available = true;
35 qboolean vid_supportrefreshrate = true;
38 AGLPixelFormat (*qaglChoosePixelFormat) (const AGLDevice *gdevs, GLint ndev, const GLint *attribList);
39 AGLContext (*qaglCreateContext) (AGLPixelFormat pix, AGLContext share);
40 GLboolean (*qaglDestroyContext) (AGLContext ctx);
41 void (*qaglDestroyPixelFormat) (AGLPixelFormat pix);
42 const GLubyte* (*qaglErrorString) (GLenum code);
43 GLenum (*qaglGetError) (void);
44 GLboolean (*qaglSetCurrentContext) (AGLContext ctx);
45 GLboolean (*qaglSetDrawable) (AGLContext ctx, AGLDrawable draw);
46 GLboolean (*qaglSetFullScreen) (AGLContext ctx, GLsizei width, GLsizei height, GLsizei freq, GLint device);
47 GLboolean (*qaglSetInteger) (AGLContext ctx, GLenum pname, const GLint *params);
48 void (*qaglSwapBuffers) (AGLContext ctx);
50 static qboolean multithreadedgl;
51 static qboolean mouse_avail = true;
52 static qboolean vid_usingmouse = false;
53 static float mouse_x, mouse_y;
55 static qboolean vid_isfullscreen = false;
56 static qboolean vid_usingvsync = false;
58 static qboolean sound_active = true;
60 static int scr_width, scr_height;
62 static cvar_t apple_multithreadedgl = {CVAR_SAVE, "apple_multithreadedgl", "0", "makes use of a second thread for the OpenGL driver (if possible) rather than using the engine thread (note: this is done automatically on most other operating systems)"};
64 static AGLContext context;
65 static WindowRef window;
68 void VID_GetWindowSize (int *x, int *y, int *width, int *height)
75 static void IN_Activate( qboolean grab )
79 if (!vid_usingmouse && mouse_avail && window)
85 CGDisplayHideCursor(CGMainDisplayID());
87 // Put the mouse cursor at the center of the window
88 GetWindowBounds (window, kWindowContentRgn, &winBounds);
89 winCenter.x = (winBounds.left + winBounds.right) / 2;
90 winCenter.y = (winBounds.top + winBounds.bottom) / 2;
91 CGWarpMouseCursorPosition(winCenter);
93 // Lock the mouse pointer at its current position
94 CGAssociateMouseAndMouseCursorPosition(false);
96 mouse_x = mouse_y = 0;
97 vid_usingmouse = true;
104 CGAssociateMouseAndMouseCursorPosition(true);
105 CGDisplayShowCursor(CGMainDisplayID());
107 vid_usingmouse = false;
112 #define GAMMA_TABLE_SIZE 256
113 void VID_Finish (qboolean allowmousegrab)
115 qboolean vid_usemouse;
116 qboolean vid_usevsync;
118 // handle the mouse state when windowed if that's changed
119 vid_usemouse = false;
120 if (allowmousegrab && vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))
122 if (!vid_activewindow)
123 vid_usemouse = false;
124 if (vid_isfullscreen)
126 IN_Activate(vid_usemouse);
128 // handle changes of the vsync option
129 vid_usevsync = (vid_vsync.integer && !cls.timedemo);
130 if (vid_usingvsync != vid_usevsync)
132 GLint sync = (vid_usevsync ? 1 : 0);
134 if (qaglSetInteger(context, AGL_SWAP_INTERVAL, &sync) == GL_TRUE)
136 vid_usingvsync = vid_usevsync;
137 Con_DPrintf("Vsync %s\n", vid_usevsync ? "activated" : "deactivated");
140 Con_Printf("ERROR: can't %s vsync\n", vid_usevsync ? "activate" : "deactivate");
143 if (r_render.integer)
146 if (r_speeds.integer || gl_finish.integer)
148 qglFinish();CHECKGLERROR
150 qaglSwapBuffers(context);
152 VID_UpdateGamma(false, GAMMA_TABLE_SIZE);
154 #ifdef kCGLCEMPEngine
155 if (apple_multithreadedgl.integer)
157 if (!multithreadedgl)
160 CGLContextObj ctx = CGLGetCurrentContext();
161 err = CGLEnable(ctx, kCGLEMPEngine);
162 if (err == kCGLNoError)
163 multithreadedgl = true;
165 Cvar_SetValueQuick(&apple_multithreadedgl, 0);
172 multithreadedgl = false;
173 CGLDisable(ctx, kCGLEMPEngine);
177 if (apple_multithreadedgl.integer)
178 Cvar_SetValueQuick(&apple_multithreadedgl, 0);
182 int VID_SetGamma(unsigned short *ramps, int rampsize)
184 CGGammaValue table_red [GAMMA_TABLE_SIZE];
185 CGGammaValue table_green [GAMMA_TABLE_SIZE];
186 CGGammaValue table_blue [GAMMA_TABLE_SIZE];
189 // Convert the unsigned short table into 3 float tables
190 for (i = 0; i < rampsize; i++)
191 table_red[i] = (float)ramps[i] / 65535.0f;
192 for (i = 0; i < rampsize; i++)
193 table_green[i] = (float)ramps[i + rampsize] / 65535.0f;
194 for (i = 0; i < rampsize; i++)
195 table_blue[i] = (float)ramps[i + 2 * rampsize] / 65535.0f;
197 if (CGSetDisplayTransferByTable(CGMainDisplayID(), rampsize, table_red, table_green, table_blue) != CGDisplayNoErr)
199 Con_Print("VID_SetGamma: ERROR: CGSetDisplayTransferByTable failed!\n");
206 int VID_GetGamma(unsigned short *ramps, int rampsize)
208 CGGammaValue table_red [GAMMA_TABLE_SIZE];
209 CGGammaValue table_green [GAMMA_TABLE_SIZE];
210 CGGammaValue table_blue [GAMMA_TABLE_SIZE];
211 CGTableCount actualsize = 0;
214 // Get the gamma ramps from the system
215 if (CGGetDisplayTransferByTable(CGMainDisplayID(), rampsize, table_red, table_green, table_blue, &actualsize) != CGDisplayNoErr)
217 Con_Print("VID_GetGamma: ERROR: CGGetDisplayTransferByTable failed!\n");
220 if (actualsize != (unsigned int)rampsize)
222 Con_Printf("VID_GetGamma: ERROR: invalid gamma table size (%u != %u)\n", actualsize, rampsize);
226 // Convert the 3 float tables into 1 unsigned short table
227 for (i = 0; i < rampsize; i++)
228 ramps[i] = table_red[i] * 65535.0f;
229 for (i = 0; i < rampsize; i++)
230 ramps[i + rampsize] = table_green[i] * 65535.0f;
231 for (i = 0; i < rampsize; i++)
232 ramps[i + 2 * rampsize] = table_blue[i] * 65535.0f;
237 void signal_handler(int sig)
239 printf("Received signal %d, exiting...\n", sig);
240 VID_RestoreSystemGamma();
247 signal(SIGHUP, signal_handler);
248 signal(SIGINT, signal_handler);
249 signal(SIGQUIT, signal_handler);
250 signal(SIGILL, signal_handler);
251 signal(SIGTRAP, signal_handler);
252 signal(SIGIOT, signal_handler);
253 signal(SIGBUS, signal_handler);
254 signal(SIGFPE, signal_handler);
255 signal(SIGSEGV, signal_handler);
256 signal(SIGTERM, signal_handler);
261 InitSig(); // trap evil signals
262 Cvar_RegisterVariable(&apple_multithreadedgl);
263 // COMMANDLINEOPTION: Input: -nomouse disables mouse support (see also vid_mouse cvar)
264 if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe"))
268 static void *prjobj = NULL;
270 static void GL_CloseLibrary(void)
278 gl_platformextensions = "";
281 static int GL_OpenLibrary(void)
283 const char *name = "/System/Library/Frameworks/AGL.framework/AGL";
285 Con_Printf("Loading OpenGL driver %s\n", name);
287 if (!(prjobj = dlopen(name, RTLD_LAZY)))
289 Con_Printf("Unable to open symbol list for %s\n", name);
292 strlcpy(gl_driver, name, sizeof(gl_driver));
296 void *GL_GetProcAddress(const char *name)
298 return dlsym(prjobj, name);
301 void VID_Shutdown(void)
303 if (context == NULL && window == NULL)
307 VID_RestoreSystemGamma();
311 qaglDestroyContext(context);
315 if (vid_isfullscreen)
316 CGReleaseAllDisplays();
320 DisposeWindow(window);
325 vid_isfullscreen = false;
331 // Since the event handler can be called at any time, we store the events for later processing
332 static qboolean AsyncEvent_Quitting = false;
333 static qboolean AsyncEvent_Collapsed = false;
334 static OSStatus MainWindowEventHandler (EventHandlerCallRef nextHandler, EventRef event, void *userData)
336 OSStatus err = noErr;
338 switch (GetEventKind (event))
340 case kEventWindowClosed:
341 AsyncEvent_Quitting = true;
345 case kEventWindowCollapsing:
346 AsyncEvent_Collapsed = true;
349 // Undocked / restored (end)
350 case kEventWindowExpanded:
351 AsyncEvent_Collapsed = false;
355 err = eventNotHandledErr;
362 static void VID_AppFocusChanged(qboolean windowIsActive)
364 if (vid_activewindow != windowIsActive)
366 vid_activewindow = windowIsActive;
367 if (!vid_activewindow)
368 VID_RestoreSystemGamma();
371 if (sound_active != windowIsActive)
373 sound_active = windowIsActive;
381 static void VID_ProcessPendingAsyncEvents (void)
383 // Collapsed / expanded
384 if (AsyncEvent_Collapsed != vid_hidden)
386 vid_hidden = !vid_hidden;
387 VID_AppFocusChanged(!vid_hidden);
391 if (AsyncEvent_Quitting)
395 static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscreen, qboolean stereobuffer)
397 *attrib++ = AGL_RGBA;
398 *attrib++ = AGL_RED_SIZE;*attrib++ = 1;
399 *attrib++ = AGL_GREEN_SIZE;*attrib++ = 1;
400 *attrib++ = AGL_BLUE_SIZE;*attrib++ = 1;
401 *attrib++ = AGL_DOUBLEBUFFER;
402 *attrib++ = AGL_DEPTH_SIZE;*attrib++ = 1;
404 // if stencil is enabled, ask for alpha too
407 *attrib++ = AGL_STENCIL_SIZE;*attrib++ = 8;
408 *attrib++ = AGL_ALPHA_SIZE;*attrib++ = 1;
411 *attrib++ = AGL_FULLSCREEN;
413 *attrib++ = AGL_STEREO;
414 *attrib++ = AGL_NONE;
417 int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer)
419 const EventTypeSpec winEvents[] =
421 { kEventClassWindow, kEventWindowClosed },
422 { kEventClassWindow, kEventWindowCollapsing },
423 { kEventClassWindow, kEventWindowExpanded },
425 OSStatus carbonError;
427 CFStringRef windowTitle;
428 AGLPixelFormat pixelFormat;
429 GLint attributes [32];
432 if (!GL_OpenLibrary())
434 Con_Printf("Unable to load GL driver\n");
438 if ((qaglChoosePixelFormat = (AGLPixelFormat (*) (const AGLDevice *gdevs, GLint ndev, const GLint *attribList))GL_GetProcAddress("aglChoosePixelFormat")) == NULL
439 || (qaglCreateContext = (AGLContext (*) (AGLPixelFormat pix, AGLContext share))GL_GetProcAddress("aglCreateContext")) == NULL
440 || (qaglDestroyContext = (GLboolean (*) (AGLContext ctx))GL_GetProcAddress("aglDestroyContext")) == NULL
441 || (qaglDestroyPixelFormat = (void (*) (AGLPixelFormat pix))GL_GetProcAddress("aglDestroyPixelFormat")) == NULL
442 || (qaglErrorString = (const GLubyte* (*) (GLenum code))GL_GetProcAddress("aglErrorString")) == NULL
443 || (qaglGetError = (GLenum (*) (void))GL_GetProcAddress("aglGetError")) == NULL
444 || (qaglSetCurrentContext = (GLboolean (*) (AGLContext ctx))GL_GetProcAddress("aglSetCurrentContext")) == NULL
445 || (qaglSetDrawable = (GLboolean (*) (AGLContext ctx, AGLDrawable draw))GL_GetProcAddress("aglSetDrawable")) == NULL
446 || (qaglSetFullScreen = (GLboolean (*) (AGLContext ctx, GLsizei width, GLsizei height, GLsizei freq, GLint device))GL_GetProcAddress("aglSetFullScreen")) == NULL
447 || (qaglSetInteger = (GLboolean (*) (AGLContext ctx, GLenum pname, const GLint *params))GL_GetProcAddress("aglSetInteger")) == NULL
448 || (qaglSwapBuffers = (void (*) (AGLContext ctx))GL_GetProcAddress("aglSwapBuffers")) == NULL
451 Con_Printf("AGL functions not found\n");
452 ReleaseWindow(window);
456 // Ignore the events from the previous window
457 AsyncEvent_Quitting = false;
458 AsyncEvent_Collapsed = false;
460 // Create the window, a bit towards the center of the screen
461 windowBounds.left = 100;
462 windowBounds.top = 100;
463 windowBounds.right = width + 100;
464 windowBounds.bottom = height + 100;
465 carbonError = CreateNewWindow(kDocumentWindowClass, kWindowStandardFloatingAttributes | kWindowStandardHandlerAttribute, &windowBounds, &window);
466 if (carbonError != noErr || window == NULL)
468 Con_Printf("Unable to create window (error %u)\n", (unsigned)carbonError);
472 // Set the window title
473 windowTitle = CFSTR("DarkPlaces AGL");
474 SetWindowTitleWithCFString(window, windowTitle);
476 // Install the callback function for the window events we can't get
477 // through ReceiveNextEvent (i.e. close, collapse, and expand)
478 InstallWindowEventHandler (window, NewEventHandlerUPP (MainWindowEventHandler),
479 GetEventTypeCount(winEvents), winEvents, window, NULL);
481 // Create the desired attribute list
482 VID_BuildAGLAttrib(attributes, bpp == 32, fullscreen, stereobuffer);
487 pixelFormat = qaglChoosePixelFormat(NULL, 0, attributes);
488 error = qaglGetError();
489 if (error != AGL_NO_ERROR)
491 Con_Printf("qaglChoosePixelFormat FAILED: %s\n",
492 (char *)qaglErrorString(error));
493 ReleaseWindow(window);
497 else // Output is fullScreen
499 CGDirectDisplayID mainDisplay;
500 CFDictionaryRef refDisplayMode;
503 // Get the mainDisplay and set resolution to current
504 mainDisplay = CGMainDisplayID();
505 CGDisplayCapture(mainDisplay);
507 // TOCHECK: not sure whether or not it's necessary to change the resolution
508 // "by hand", or if aglSetFullscreen does the job anyway
509 refDisplayMode = CGDisplayBestModeForParametersAndRefreshRate(mainDisplay, bpp, width, height, refreshrate, NULL);
510 CGDisplaySwitchToMode(mainDisplay, refDisplayMode);
511 DMGetGDeviceByDisplayID((DisplayIDType)mainDisplay, &gdhDisplay, false);
513 // Set pixel format with built attribs
514 // Note: specifying a device is *required* for AGL_FullScreen
515 pixelFormat = qaglChoosePixelFormat(&gdhDisplay, 1, attributes);
516 error = qaglGetError();
517 if (error != AGL_NO_ERROR)
519 Con_Printf("qaglChoosePixelFormat FAILED: %s\n",
520 (char *)qaglErrorString(error));
521 ReleaseWindow(window);
526 // Create a context using the pform
527 context = qaglCreateContext(pixelFormat, NULL);
528 error = qaglGetError();
529 if (error != AGL_NO_ERROR)
531 Con_Printf("qaglCreateContext FAILED: %s\n",
532 (char *)qaglErrorString(error));
535 // Make the context the current one ('enable' it)
536 qaglSetCurrentContext(context);
537 error = qaglGetError();
538 if (error != AGL_NO_ERROR)
540 Con_Printf("qaglSetCurrentContext FAILED: %s\n",
541 (char *)qaglErrorString(error));
542 ReleaseWindow(window);
547 qaglDestroyPixelFormat(pixelFormat);
549 // Attempt fullscreen if requested
552 qaglSetFullScreen (context, width, height, refreshrate, 0);
553 error = qaglGetError();
554 if (error != AGL_NO_ERROR)
556 Con_Printf("qaglSetFullScreen FAILED: %s\n",
557 (char *)qaglErrorString(error));
563 // Set Window as Drawable
564 qaglSetDrawable(context, GetWindowPort(window));
565 error = qaglGetError();
566 if (error != AGL_NO_ERROR)
568 Con_Printf("qaglSetDrawable FAILED: %s\n",
569 (char *)qaglErrorString(error));
570 ReleaseWindow(window);
578 if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
579 Sys_Error("glGetString not found in %s", gl_driver);
581 gl_renderer = (const char *)qglGetString(GL_RENDERER);
582 gl_vendor = (const char *)qglGetString(GL_VENDOR);
583 gl_version = (const char *)qglGetString(GL_VERSION);
584 gl_extensions = (const char *)qglGetString(GL_EXTENSIONS);
586 gl_videosyncavailable = true;
588 multithreadedgl = false;
589 vid_isfullscreen = fullscreen;
590 vid_usingmouse = false;
592 vid_activewindow = true;
596 SelectWindow(window);
602 static void Handle_KeyMod(UInt32 keymod)
604 const struct keymod_to_event_s { UInt32 keybit; keynum_t event; } keymod_events [] =
607 { shiftKey, K_SHIFT },
608 { alphaLock, K_CAPSLOCK },
609 { optionKey, K_ALT },
610 { controlKey, K_CTRL },
611 { kEventKeyModifierNumLockMask, K_NUMLOCK },
612 { kEventKeyModifierFnMask, K_AUX2 }
614 static UInt32 prev_keymod = 0;
618 modChanges = prev_keymod ^ keymod;
622 for (i = 0; i < sizeof(keymod_events) / sizeof(keymod_events[0]); i++)
624 UInt32 keybit = keymod_events[i].keybit;
626 if ((modChanges & keybit) != 0)
627 Key_Event(keymod_events[i].event, '\0', (keymod & keybit) != 0);
630 prev_keymod = keymod;
633 static void Handle_Key(unsigned char charcode, UInt32 mackeycode, qboolean keypressed)
635 unsigned int keycode = 0;
680 keycode = K_SCROLLOCK;
686 keycode = K_BACKSPACE;
701 keycode = K_KP_EQUALS;
704 keycode = K_KP_DIVIDE;
707 keycode = K_KP_MULTIPLY;
731 keycode = K_KP_MINUS;
734 keycode = K_CAPSLOCK;
762 keycode = K_KP_ENTER;
768 keycode = K_KP_PERIOD;
773 case kUpArrowCharCode:
776 case kLeftArrowCharCode:
777 keycode = K_LEFTARROW;
779 case kDownArrowCharCode:
780 keycode = K_DOWNARROW;
782 case kRightArrowCharCode:
783 keycode = K_RIGHTARROW;
787 // characters 0 and 191 are sent by the mouse buttons (?!)
790 if ('A' <= charcode && charcode <= 'Z')
792 keycode = charcode + ('a' - 'A'); // lowercase it
795 else if (charcode >= 32)
801 Con_Printf(">> UNKNOWN char/keycode: %d/%u <<\n", charcode, (unsigned) mackeycode);
806 Key_Event(keycode, ascii, keypressed);
809 void Sys_SendKeyEvents(void)
812 EventTargetRef theTarget;
814 // Start by processing the asynchronous events we received since the previous frame
815 VID_ProcessPendingAsyncEvents();
817 theTarget = GetEventDispatcherTarget();
818 while (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &theEvent) == noErr)
820 UInt32 eventClass = GetEventClass(theEvent);
821 UInt32 eventKind = GetEventKind(theEvent);
825 case kEventClassMouse:
827 EventMouseButton theButton;
832 case kEventMouseDown:
834 GetEventParameter(theEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof(theButton), NULL, &theButton);
838 case kEventMouseButtonPrimary:
841 case kEventMouseButtonSecondary:
844 case kEventMouseButtonTertiary:
848 Key_Event(key, '\0', eventKind == kEventMouseDown);
851 // Note: These two events are mutual exclusives
852 // Treat MouseDragged in the same statement, so we don't block MouseMoved while a mousebutton is held
853 case kEventMouseMoved:
854 case kEventMouseDragged:
858 GetEventParameter(theEvent, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(deltaPos), NULL, &deltaPos);
860 mouse_x += deltaPos.x;
861 mouse_y += deltaPos.y;
865 case kEventMouseWheelMoved:
868 unsigned int wheelEvent;
870 GetEventParameter(theEvent, kEventParamMouseWheelDelta, typeSInt32, NULL, sizeof(delta), NULL, &delta);
872 wheelEvent = (delta > 0) ? K_MWHEELUP : K_MWHEELDOWN;
873 Key_Event(wheelEvent, 0, true);
874 Key_Event(wheelEvent, 0, false);
879 Con_Printf (">> kEventClassMouse (UNKNOWN eventKind: %u) <<\n", (unsigned)eventKind);
884 case kEventClassKeyboard:
891 case kEventRawKeyDown:
892 GetEventParameter(theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(charcode), NULL, &charcode);
893 GetEventParameter(theEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(keycode), NULL, &keycode);
894 Handle_Key(charcode, keycode, true);
897 case kEventRawKeyRepeat:
901 GetEventParameter(theEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(charcode), NULL, &charcode);
902 GetEventParameter(theEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(keycode), NULL, &keycode);
903 Handle_Key(charcode, keycode, false);
906 case kEventRawKeyModifiersChanged:
909 GetEventParameter(theEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(keymod), NULL, &keymod);
910 Handle_KeyMod(keymod);
914 case kEventHotKeyPressed:
917 case kEventHotKeyReleased:
920 case kEventMouseWheelMoved:
924 Con_Printf (">> kEventClassKeyboard (UNKNOWN eventKind: %u) <<\n", (unsigned)eventKind);
930 case kEventClassTextInput:
931 Con_Printf(">> kEventClassTextInput (%d) <<\n", (int)eventKind);
934 case kEventClassApplication:
937 case kEventAppActivated :
938 VID_AppFocusChanged(true);
940 case kEventAppDeactivated:
941 VID_AppFocusChanged(false);
946 case kEventAppActiveWindowChanged:
949 Con_Printf(">> kEventClassApplication (UNKNOWN eventKind: %u) <<\n", (unsigned)eventKind);
954 case kEventClassAppleEvent:
957 case kEventAppleEvent :
960 Con_Printf(">> kEventClassAppleEvent (UNKNOWN eventKind: %u) <<\n", (unsigned)eventKind);
965 case kEventClassWindow:
968 case kEventWindowUpdate :
971 Con_Printf(">> kEventClassWindow (UNKNOWN eventKind: %u) <<\n", (unsigned)eventKind);
976 case kEventClassControl:
980 /*Con_Printf(">> UNKNOWN eventClass: %c%c%c%c, eventKind: %d <<\n",
981 eventClass >> 24, (eventClass >> 16) & 0xFF,
982 (eventClass >> 8) & 0xFF, eventClass & 0xFF,
987 SendEventToEventTarget (theEvent, theTarget);
988 ReleaseEvent(theEvent);
996 in_mouse_x = mouse_x;
997 in_mouse_y = mouse_y;