From 8a8239f2e21795602fcff5281833b350e6b2a286 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Wed, 5 Dec 2007 21:23:36 -0800 Subject: [PATCH] Darwin: Renamed DarwinModeBlah to QuartzBlah (cherry picked from commit 08ebf86d379b1ddfb08df65d29aea5df66de4327) --- hw/xquartz/X11Application.m | 1 + hw/xquartz/darwin.c | 13 ++++++++----- hw/xquartz/darwin.h | 24 ----------------------- hw/xquartz/darwinEvents.c | 3 ++- hw/xquartz/darwinEvents.h | 39 +++++++++++++++++++++++++++++++++++++ hw/xquartz/darwinKeyboard.c | 4 +++- hw/xquartz/quartz.c | 37 ++++++++++++++++++----------------- hw/xquartz/quartz.h | 7 +++++++ hw/xquartz/quartzAudio.c | 4 ++-- hw/xquartz/quartzKeyboard.h | 1 + hw/xquartz/xpr/xprCursor.c | 1 + 11 files changed, 83 insertions(+), 51 deletions(-) create mode 100644 hw/xquartz/darwinEvents.h diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 3e37dd436..8d4076a0a 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -39,6 +39,7 @@ /* ouch! */ #define BOOL X_BOOL # include "darwin.h" +# include "darwinEvents.h" # include "quartz.h" # define _APPLEWM_SERVER_ # include "X11/extensions/applewm.h" diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index b46b7687e..e091f25ba 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -75,6 +75,9 @@ #endif #include "darwin.h" +#include "darwinEvents.h" +#include "darwinKeyboard.h" +#include "quartz.h" #include "darwinClut8.h" #ifdef ENABLE_DEBUG_LOG @@ -195,7 +198,7 @@ static Bool DarwinAddScreen( pScreen->devPrivates[darwinScreenIndex].ptr = dfb; // setup hardware/mode specific details - ret = DarwinModeAddScreen(foundIndex, pScreen); + ret = QuartzAddScreen(foundIndex, pScreen); foundIndex++; if (! ret) return FALSE; @@ -274,7 +277,7 @@ static Bool DarwinAddScreen( pScreen->SaveScreen = DarwinSaveScreen; // finish mode dependent screen setup including cursor support - if (!DarwinModeSetupScreen(index, pScreen)) { + if (!QuartzSetupScreen(index, pScreen)) { return FALSE; } @@ -539,7 +542,7 @@ void InitInput( int argc, char **argv ) DarwinEQInit( (DevicePtr)darwinKeyboard, (DevicePtr)darwinPointer ); - DarwinModeInitInput(argc, argv); + QuartzInitInput(argc, argv); } @@ -629,7 +632,7 @@ void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv ) } // Discover screens and do mode specific initialization - DarwinModeInitOutput(argc, argv); + QuartzInitOutput(argc, argv); // Add screens for (i = 0; i < darwinScreensFound; i++) { @@ -895,7 +898,7 @@ void ddxGiveUp( void ) { ErrorF( "Quitting XQuartz...\n" ); - DarwinModeGiveUp(); + QuartzGiveUp(); } diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h index 0f5f492b6..a332229be 100644 --- a/hw/xquartz/darwin.h +++ b/hw/xquartz/darwin.h @@ -52,26 +52,6 @@ int DarwinParseModifierList(const char *constmodifiers); void DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo); void xf86SetRootClip (ScreenPtr pScreen, BOOL enable); -// From darwinEvents.c -Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr); -void DarwinEQEnqueue(const xEvent *e); -void DarwinEQPointerPost(xEvent *e); -void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); -void DarwinPokeEQ(void); -void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y); -void DarwinSendKeyboardEvents(int ev_type, int keycode); -void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y); - -// Mode specific functions -Bool DarwinModeAddScreen(int index, ScreenPtr pScreen); -Bool DarwinModeSetupScreen(int index, ScreenPtr pScreen); -void DarwinModeInitOutput(int argc,char **argv); -void DarwinModeInitInput(int argc, char **argv); -void DarwinModeProcessEvent(xEvent *xe); -void DarwinModeGiveUp(void); -void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class); - - #undef assert #define assert(x) { if ((x) == 0) \ FatalError("assert failed on line %d of %s!\n", __LINE__, __FILE__); } @@ -81,10 +61,6 @@ void DarwinModeBell(int volume, DeviceIntPtr pDevice, pointer ctrl, int class); #define SCREEN_PRIV(pScreen) \ ((DarwinFramebufferPtr)pScreen->devPrivates[darwinScreenIndex].ptr) - -#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0... - - /* * Global variables from darwin.c */ diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 629fb2c9d..ae82f5b14 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. #include "mipointer.h" #include "darwin.h" +#include "quartz.h" #include "darwinKeyboard.h" #include @@ -361,7 +362,7 @@ void ProcessInputEvents(void) { // fall through default: // Check for mode specific event - DarwinModeProcessEvent(&xe); + QuartzProcessEvent(&xe); } } } diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h new file mode 100644 index 000000000..d6cab2e6c --- /dev/null +++ b/hw/xquartz/darwinEvents.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved. + * + * 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 ABOVE LISTED COPYRIGHT HOLDER(S) 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. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + */ + +#ifndef _DARWIN_EVENTS_H +#define _DARWIN_EVENTS_H + +Bool DarwinEQInit(DevicePtr pKbd, DevicePtr pPtr); +void DarwinEQEnqueue(const xEvent *e); +void DarwinEQPointerPost(xEvent *e); +void DarwinEQSwitchScreen(ScreenPtr pScreen, Bool fromDIX); +void DarwinPokeEQ(void); +void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y); +void DarwinSendKeyboardEvents(int ev_type, int keycode); +void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y); + +#endif /* _DARWIN_EVENTS_H */ diff --git a/hw/xquartz/darwinKeyboard.c b/hw/xquartz/darwinKeyboard.c index 1c83cbce4..f6dcfb34a 100644 --- a/hw/xquartz/darwinKeyboard.c +++ b/hw/xquartz/darwinKeyboard.c @@ -73,6 +73,8 @@ #include // For the NXSwap* #include "darwin.h" #include "darwinKeyboard.h" +#include "quartzKeyboard.h" +#include "quartzAudio.h" #ifdef NDEBUG #undef NDEBUG @@ -791,7 +793,7 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) { DarwinModeSystemKeymapSeed(); assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms, - keyInfo.modMap, DarwinModeBell, + keyInfo.modMap, QuartzBell, DarwinChangeKeyboardControl )); } diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c index 2483d12d7..7be91ec6d 100644 --- a/hw/xquartz/quartz.c +++ b/hw/xquartz/quartz.c @@ -35,6 +35,7 @@ #include "quartzCommon.h" #include "quartz.h" #include "darwin.h" +#include "darwinEvents.h" #include "quartzAudio.h" #include "pseudoramiX.h" #define _APPLEWM_SERVER_ @@ -74,25 +75,25 @@ QuartzModeProcsPtr quartzProcs = NULL; const char *quartzOpenGLBundle = NULL; #if defined(RANDR) && !defined(FAKE_RANDR) -Bool DarwinModeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) { +Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) { return FALSE; } -Bool DarwinModeRandRSetConfig (ScreenPtr pScreen, +Bool QuartzRandRSetConfig (ScreenPtr pScreen, Rotation randr, int rate, RRScreenSizePtr pSize) { return FALSE; } -Bool DarwinModeRandRInit (ScreenPtr pScreen) { +Bool QuartzRandRInit (ScreenPtr pScreen) { rrScrPrivPtr pScrPriv; if (!RRScreenInit (pScreen)) return FALSE; pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = DarwinModeRandRGetInfo; - pScrPriv->rrSetConfig = DarwinModeRandRSetConfig; + pScrPriv->rrGetInfo = QuartzRandRGetInfo; + pScrPriv->rrSetConfig = QuartzRandRSetConfig; return TRUE; } #endif @@ -106,10 +107,10 @@ Bool DarwinModeRandRInit (ScreenPtr pScreen) { */ /* - * DarwinModeAddScreen + * QuartzAddScreen * Do mode dependent initialization of each screen for Quartz. */ -Bool DarwinModeAddScreen( +Bool QuartzAddScreen( int index, ScreenPtr pScreen) { @@ -125,10 +126,10 @@ Bool DarwinModeAddScreen( /* - * DarwinModeSetupScreen + * QuartzSetupScreen * Finalize mode specific setup of each screen. */ -Bool DarwinModeSetupScreen( +Bool QuartzSetupScreen( int index, ScreenPtr pScreen) { @@ -145,10 +146,10 @@ Bool DarwinModeSetupScreen( /* - * DarwinModeInitOutput + * QuartzInitOutput * Quartz display initialization. */ -void DarwinModeInitOutput( +void QuartzInitOutput( int argc, char **argv ) { @@ -184,10 +185,10 @@ void DarwinModeInitOutput( /* - * DarwinModeInitInput + * QuartzInitInput * Inform the main thread the X server is ready to handle events. */ -void DarwinModeInitInput( +void QuartzInitInput( int argc, char **argv ) { @@ -279,7 +280,7 @@ static void QuartzUpdateScreens(void) pScreen->height = height; #ifndef FAKE_RANDR - if(!DarwinModeRandRInit(pScreen)) + if(!QuartzRandRInit(pScreen)) FatalError("Failed to init RandR extension.\n"); #endif @@ -412,10 +413,10 @@ QuartzMessageServerThread( /* - * DarwinModeProcessEvent + * QuartzProcessEvent * Process Quartz specific events. */ -void DarwinModeProcessEvent( +void QuartzProcessEvent( xEvent *xe) { switch (xe->u.u.type) { @@ -516,11 +517,11 @@ void DarwinModeProcessEvent( /* - * DarwinModeGiveUp + * QuartzGiveUp * Cleanup before X server shutdown * Release the screen and restore the Aqua cursor. */ -void DarwinModeGiveUp(void) +void QuartzGiveUp(void) { #if 0 // Trying to switch cursors when quitting causes deadlock diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h index e74a1082b..fbe308a92 100644 --- a/hw/xquartz/quartz.h +++ b/hw/xquartz/quartz.h @@ -124,4 +124,11 @@ typedef struct _QuartzModeProcs { extern QuartzModeProcsPtr quartzProcs; extern int quartzHasRoot, quartzEnableRootless; +Bool QuartzAddScreen(int index, ScreenPtr pScreen); +Bool QuartzSetupScreen(int index, ScreenPtr pScreen); +void QuartzInitOutput(int argc,char **argv); +void QuartzInitInput(int argc, char **argv); +void QuartzGiveUp(void); +void QuartzProcessEvent(xEvent *xe); + #endif diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c index 1eb099ba6..86bb20015 100644 --- a/hw/xquartz/quartzAudio.c +++ b/hw/xquartz/quartzAudio.c @@ -246,10 +246,10 @@ static void QuartzCoreAudioBell( /* - * DarwinModeBell + * QuartzBell * Ring the bell */ -void DarwinModeBell( +void QuartzBell( int volume, // volume in percent of max DeviceIntPtr pDevice, pointer ctrl, diff --git a/hw/xquartz/quartzKeyboard.h b/hw/xquartz/quartzKeyboard.h index f27fcdeac..c5f22bf14 100644 --- a/hw/xquartz/quartzKeyboard.h +++ b/hw/xquartz/quartzKeyboard.h @@ -36,6 +36,7 @@ // unshifted, shifted, modeswitch unshifted, modeswitch shifted #define GLYPHS_PER_KEY 4 #define NUM_KEYCODES 248 // NX_NUMKEYCODES might be better +#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0... #define MAX_KEYCODE NUM_KEYCODES + MIN_KEYCODE - 1 typedef struct darwinKeyboardInfo_struct { diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c index db195a8ec..dc7a73eab 100644 --- a/hw/xquartz/xpr/xprCursor.c +++ b/hw/xquartz/xpr/xprCursor.c @@ -36,6 +36,7 @@ #include "quartzCommon.h" #include "xpr.h" #include "darwin.h" +#include "darwinEvents.h" #include "Xplugin.h" #include "mi.h"