2003-11-14 17:48:57 +01:00
|
|
|
/**************************************************************
|
|
|
|
*
|
2008-04-30 08:37:58 +02:00
|
|
|
* Xquartz initialization code
|
2003-11-14 17:48:57 +01:00
|
|
|
*
|
2008-04-30 08:37:58 +02:00
|
|
|
* Copyright (c) 2007-2008 Apple Inc.
|
2004-04-23 21:54:30 +02:00
|
|
|
* Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
|
2003-11-14 17:48:57 +01:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-11-29 11:19:22 +01:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
2007-09-19 14:58:22 +02:00
|
|
|
#include <dix-config.h>
|
2007-11-29 11:19:22 +01:00
|
|
|
#endif
|
2007-02-15 14:22:21 +01:00
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "os.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "servermd.h"
|
|
|
|
#include "inputstr.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "mibstore.h" // mi backing store implementation
|
|
|
|
#include "mipointer.h" // mi software cursor
|
|
|
|
#include "micmap.h" // mi colormap code
|
|
|
|
#include "fb.h" // fb framebuffer code
|
|
|
|
#include "site.h"
|
|
|
|
#include "globals.h"
|
|
|
|
#include "dix.h"
|
2010-02-11 00:52:14 +01:00
|
|
|
#include "xkbsrv.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2008-10-22 13:59:54 +02:00
|
|
|
#include <X11/extensions/XI.h>
|
|
|
|
#include <X11/extensions/XIproto.h>
|
|
|
|
#include "exevents.h"
|
|
|
|
#include "extinit.h"
|
2004-07-30 20:22:13 +02:00
|
|
|
|
2009-06-16 08:38:11 +02:00
|
|
|
#include "xserver-properties.h"
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/syslimits.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <fcntl.h>
|
2003-11-25 20:29:01 +01:00
|
|
|
#include <unistd.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2004-04-23 21:54:30 +02:00
|
|
|
#define HAS_UTSNAME 1
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#define NO_CFPLUGIN
|
|
|
|
#include <IOKit/hidsystem/IOHIDLib.h>
|
|
|
|
|
2007-11-22 04:51:14 +01:00
|
|
|
#ifdef MITSHM
|
2009-08-07 09:02:21 +02:00
|
|
|
#include "shmint.h"
|
2007-11-22 04:51:14 +01:00
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "darwin.h"
|
2007-12-06 06:23:36 +01:00
|
|
|
#include "darwinEvents.h"
|
2008-04-17 20:03:31 +02:00
|
|
|
#include "quartzKeyboard.h"
|
2007-12-06 06:23:36 +01:00
|
|
|
#include "quartz.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2007-11-15 11:25:50 +01:00
|
|
|
#ifdef ENABLE_DEBUG_LOG
|
|
|
|
FILE *debug_log_fp = NULL;
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* X server shared global variables
|
|
|
|
*/
|
|
|
|
int darwinScreensFound = 0;
|
2008-08-29 00:05:40 +02:00
|
|
|
static int darwinScreenKeyIndex;
|
|
|
|
DevPrivateKey darwinScreenKey = &darwinScreenKeyIndex;
|
2003-11-14 17:48:57 +01:00
|
|
|
io_connect_t darwinParamConnect = 0;
|
2003-11-25 20:29:01 +01:00
|
|
|
int darwinEventReadFD = -1;
|
|
|
|
int darwinEventWriteFD = -1;
|
2007-09-07 03:52:26 +02:00
|
|
|
// int darwinMouseAccelChange = 1;
|
2003-11-14 17:48:57 +01:00
|
|
|
int darwinFakeButtons = 0;
|
|
|
|
|
|
|
|
// location of X11's (0,0) point in global screen coordinates
|
|
|
|
int darwinMainScreenX = 0;
|
|
|
|
int darwinMainScreenY = 0;
|
|
|
|
|
|
|
|
// parameters read from the command line or user preferences
|
|
|
|
int darwinDesiredDepth = -1;
|
2004-09-23 01:38:33 +02:00
|
|
|
int darwinSyncKeymap = FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2008-08-20 18:21:44 +02:00
|
|
|
// modifier masks for faking mouse buttons - ANY of these bits trigger it (not all)
|
2008-08-20 18:56:06 +02:00
|
|
|
#ifdef NX_DEVICELCMDKEYMASK
|
|
|
|
int darwinFakeMouse2Mask = NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK;
|
|
|
|
int darwinFakeMouse3Mask = NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK;
|
|
|
|
#else
|
2007-11-01 07:46:50 +01:00
|
|
|
int darwinFakeMouse2Mask = NX_ALTERNATEMASK;
|
|
|
|
int darwinFakeMouse3Mask = NX_COMMANDMASK;
|
2008-08-20 18:56:06 +02:00
|
|
|
#endif
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2008-08-19 11:02:11 +02:00
|
|
|
// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
|
2008-11-21 19:53:39 +01:00
|
|
|
unsigned int darwinAppKitModMask = 0; // Any of these bits
|
2008-08-20 18:21:44 +02:00
|
|
|
|
|
|
|
// Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled)
|
2008-11-21 19:53:39 +01:00
|
|
|
unsigned int windowItemModMask = NX_COMMANDMASK;
|
2008-08-19 11:02:11 +02:00
|
|
|
|
2004-09-23 01:38:33 +02:00
|
|
|
// devices
|
|
|
|
DeviceIntPtr darwinKeyboard = NULL;
|
2008-09-03 18:11:25 +02:00
|
|
|
DeviceIntPtr darwinPointer = NULL;
|
|
|
|
DeviceIntPtr darwinTabletCurrent = NULL;
|
|
|
|
DeviceIntPtr darwinTabletStylus = NULL;
|
|
|
|
DeviceIntPtr darwinTabletCursor = NULL;
|
|
|
|
DeviceIntPtr darwinTabletEraser = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
// Common pixmap formats
|
|
|
|
static PixmapFormatRec formats[] = {
|
|
|
|
{ 1, 1, BITMAP_SCANLINE_PAD },
|
|
|
|
{ 4, 8, BITMAP_SCANLINE_PAD },
|
|
|
|
{ 8, 8, BITMAP_SCANLINE_PAD },
|
|
|
|
{ 15, 16, BITMAP_SCANLINE_PAD },
|
|
|
|
{ 16, 16, BITMAP_SCANLINE_PAD },
|
|
|
|
{ 24, 32, BITMAP_SCANLINE_PAD },
|
|
|
|
{ 32, 32, BITMAP_SCANLINE_PAD }
|
|
|
|
};
|
|
|
|
const int NUMFORMATS = sizeof(formats)/sizeof(formats[0]);
|
|
|
|
|
|
|
|
#ifndef OSNAME
|
|
|
|
#define OSNAME " Darwin"
|
|
|
|
#endif
|
|
|
|
#ifndef OSVENDOR
|
|
|
|
#define OSVENDOR ""
|
|
|
|
#endif
|
|
|
|
#ifndef PRE_RELEASE
|
2004-04-23 21:54:30 +02:00
|
|
|
#define PRE_RELEASE XORG_VERSION_SNAP
|
2003-11-14 17:48:57 +01:00
|
|
|
#endif
|
2007-09-07 03:52:26 +02:00
|
|
|
#ifndef BUILD_DATE
|
|
|
|
#define BUILD_DATE ""
|
2003-11-14 17:48:57 +01:00
|
|
|
#endif
|
2007-09-07 03:52:26 +02:00
|
|
|
#ifndef XORG_RELEASE
|
|
|
|
#define XORG_RELEASE "?"
|
2003-11-14 17:48:57 +01:00
|
|
|
#endif
|
|
|
|
|
2007-09-07 03:52:26 +02:00
|
|
|
void
|
|
|
|
DarwinPrintBanner(void)
|
|
|
|
{
|
|
|
|
// this should change depending on which specific server we are building
|
2008-03-29 01:00:08 +01:00
|
|
|
ErrorF("Xquartz starting:\n");
|
2007-12-21 02:33:38 +01:00
|
|
|
ErrorF("X.Org X Server %s\nBuild Date: %s\n", XSERVER_VERSION, BUILD_DATE );
|
2007-02-17 11:23:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
|
|
|
* DarwinSaveScreen
|
|
|
|
* X screensaver support. Not implemented.
|
|
|
|
*/
|
|
|
|
static Bool DarwinSaveScreen(ScreenPtr pScreen, int on)
|
|
|
|
{
|
|
|
|
// FIXME
|
|
|
|
if (on == SCREEN_SAVER_FORCER) {
|
|
|
|
} else if (on == SCREEN_SAVER_ON) {
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2009-07-26 11:32:17 +02:00
|
|
|
* DarwinScreenInit
|
2003-11-14 17:48:57 +01:00
|
|
|
* This is a callback from dix during AddScreen() from InitOutput().
|
|
|
|
* Initialize the screen and communicate information about it back to dix.
|
|
|
|
*/
|
2009-07-26 11:32:17 +02:00
|
|
|
static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) {
|
2007-12-23 00:09:12 +01:00
|
|
|
int dpi;
|
2003-11-14 17:48:57 +01:00
|
|
|
static int foundIndex = 0;
|
|
|
|
Bool ret;
|
|
|
|
DarwinFramebufferPtr dfb;
|
|
|
|
|
|
|
|
// reset index of found screens for each server generation
|
2009-07-26 11:32:17 +02:00
|
|
|
if (index == 0) {
|
|
|
|
foundIndex = 0;
|
|
|
|
|
|
|
|
// reset the visual list
|
|
|
|
miClearVisualTypes();
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
// allocate space for private per screen storage
|
|
|
|
dfb = xalloc(sizeof(DarwinFramebufferRec));
|
2007-11-22 04:51:14 +01:00
|
|
|
|
|
|
|
// SCREEN_PRIV(pScreen) = dfb;
|
2007-12-14 00:38:25 +01:00
|
|
|
dixSetPrivate(&pScreen->devPrivates, darwinScreenKey, dfb);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
// setup hardware/mode specific details
|
2007-12-06 06:23:36 +01:00
|
|
|
ret = QuartzAddScreen(foundIndex, pScreen);
|
2003-11-14 17:48:57 +01:00
|
|
|
foundIndex++;
|
|
|
|
if (! ret)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
// setup a single visual appropriate for our pixel type
|
2007-12-23 00:09:12 +01:00
|
|
|
if(!miSetVisualTypesAndMasks(dfb->depth, dfb->visuals, dfb->bitsPerRGB,
|
|
|
|
dfb->preferredCVC, dfb->redMask,
|
|
|
|
dfb->greenMask, dfb->blueMask)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2008-09-17 19:11:00 +02:00
|
|
|
|
|
|
|
// TODO: Make PseudoColor visuals not suck in TrueColor mode
|
|
|
|
// if(dfb->depth > 8)
|
|
|
|
// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
|
2008-09-06 02:05:03 +02:00
|
|
|
if(dfb->depth > 15)
|
2009-08-01 00:32:07 +02:00
|
|
|
miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor, RM_ARGB(0,5,5,5), GM_ARGB(0,5,5,5), BM_ARGB(0,5,5,5));
|
2008-09-06 02:05:03 +02:00
|
|
|
if(dfb->depth > 24)
|
2009-08-01 00:32:07 +02:00
|
|
|
miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor, RM_ARGB(0,8,8,8), GM_ARGB(0,8,8,8), BM_ARGB(0,8,8,8));
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
miSetPixmapDepths();
|
|
|
|
|
|
|
|
// machine independent screen init
|
|
|
|
// setup _Screen structure in pScreen
|
|
|
|
if (monitorResolution)
|
|
|
|
dpi = monitorResolution;
|
|
|
|
else
|
2008-10-21 20:23:42 +02:00
|
|
|
dpi = 96;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
// initialize fb
|
|
|
|
if (! fbScreenInit(pScreen,
|
|
|
|
dfb->framebuffer, // pointer to screen bitmap
|
|
|
|
dfb->width, dfb->height, // screen size in pixels
|
|
|
|
dpi, dpi, // dots per inch
|
|
|
|
dfb->pitch/(dfb->bitsPerPixel/8), // pixel width of framebuffer
|
|
|
|
dfb->bitsPerPixel)) // bits per pixel for screen
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef RENDER
|
|
|
|
if (! fbPictureInit(pScreen, 0, 0)) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MITSHM
|
|
|
|
ShmRegisterFbFuncs(pScreen);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// this must be initialized (why doesn't X have a default?)
|
|
|
|
pScreen->SaveScreen = DarwinSaveScreen;
|
|
|
|
|
|
|
|
// finish mode dependent screen setup including cursor support
|
2007-12-06 06:23:36 +01:00
|
|
|
if (!QuartzSetupScreen(index, pScreen)) {
|
2003-11-25 20:29:01 +01:00
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// create and install the default colormap and
|
|
|
|
// set pScreen->blackPixel / pScreen->white
|
|
|
|
if (!miCreateDefColormap( pScreen )) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
dixScreenOrigins[index].x = dfb->x;
|
|
|
|
dixScreenOrigins[index].y = dfb->y;
|
|
|
|
|
2007-09-07 03:52:26 +02:00
|
|
|
/* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n",
|
|
|
|
index, dfb->width, dfb->height, dfb->x, dfb->y); */
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============================================================================
|
|
|
|
|
|
|
|
mouse and keyboard callbacks
|
|
|
|
|
|
|
|
=============================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2008-04-30 08:37:58 +02:00
|
|
|
* DarwinMouseProc: Handle the initialization, etc. of a mouse
|
2003-11-14 17:48:57 +01:00
|
|
|
*/
|
2008-04-19 05:38:31 +02:00
|
|
|
static int DarwinMouseProc(DeviceIntPtr pPointer, int what) {
|
2009-06-16 08:38:11 +02:00
|
|
|
#define NBUTTONS 7
|
|
|
|
#define NAXES 2
|
2008-04-30 08:37:58 +02:00
|
|
|
// 7 buttons: left, right, middle, then four scroll wheel "buttons"
|
2009-06-16 08:38:11 +02:00
|
|
|
CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3, 4, 5, 6, 7};
|
2009-09-27 07:48:49 +02:00
|
|
|
Atom btn_labels[NBUTTONS] = {0};
|
|
|
|
Atom axes_labels[NAXES] = {0};
|
2009-06-16 08:38:11 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
switch (what) {
|
|
|
|
case DEVICE_INIT:
|
|
|
|
pPointer->public.on = FALSE;
|
2009-06-16 08:38:11 +02:00
|
|
|
|
|
|
|
btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
|
|
|
|
btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
|
|
|
|
btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
|
|
|
|
btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
|
|
|
|
btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
|
|
|
|
btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
|
|
|
|
btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
|
|
|
|
|
|
|
|
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
|
|
|
|
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
|
|
|
|
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
// Set button map.
|
2009-06-16 08:38:11 +02:00
|
|
|
InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
|
|
|
|
btn_labels,
|
2008-04-19 05:38:31 +02:00
|
|
|
(PtrCtrlProcPtr)NoopDDA,
|
2009-06-16 08:38:11 +02:00
|
|
|
GetMotionHistorySize(), NAXES,
|
|
|
|
axes_labels);
|
2008-09-03 18:11:25 +02:00
|
|
|
pPointer->valuator->mode = Absolute; // Relative
|
2008-12-06 23:11:52 +01:00
|
|
|
InitAbsoluteClassDeviceStruct(pPointer);
|
|
|
|
// InitValuatorAxisStruct(pPointer, 0, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
|
|
|
// InitValuatorAxisStruct(pPointer, 1, 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
break;
|
|
|
|
case DEVICE_ON:
|
|
|
|
pPointer->public.on = TRUE;
|
2003-11-25 20:29:01 +01:00
|
|
|
AddEnabledDevice( darwinEventReadFD );
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
|
|
|
case DEVICE_CLOSE:
|
|
|
|
case DEVICE_OFF:
|
|
|
|
pPointer->public.on = FALSE;
|
2008-04-19 05:38:31 +02:00
|
|
|
RemoveEnabledDevice(darwinEventReadFD);
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
|
|
|
}
|
2008-04-19 05:38:31 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
2009-06-16 08:38:11 +02:00
|
|
|
#undef NBUTTONS
|
|
|
|
#undef NAXES
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2008-04-30 08:37:58 +02:00
|
|
|
static int DarwinTabletProc(DeviceIntPtr pPointer, int what) {
|
2009-06-16 08:38:11 +02:00
|
|
|
#define NBUTTONS 3
|
|
|
|
#define NAXES 5
|
|
|
|
CARD8 map[NBUTTONS + 1] = {0, 1, 2, 3};
|
|
|
|
Atom btn_labels[NBUTTONS] = {0};
|
2009-09-27 07:48:49 +02:00
|
|
|
Atom axes_labels[NAXES] = {0};
|
2009-06-16 08:38:11 +02:00
|
|
|
|
2008-04-30 08:37:58 +02:00
|
|
|
switch (what) {
|
|
|
|
case DEVICE_INIT:
|
|
|
|
pPointer->public.on = FALSE;
|
2009-06-16 08:38:11 +02:00
|
|
|
|
|
|
|
btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
|
|
|
|
btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
|
|
|
|
btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
|
|
|
|
|
|
|
|
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X);
|
|
|
|
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y);
|
2009-09-27 07:52:39 +02:00
|
|
|
axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE);
|
|
|
|
axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X);
|
|
|
|
axes_labels[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y);
|
2009-06-16 08:38:11 +02:00
|
|
|
|
2008-04-30 08:37:58 +02:00
|
|
|
// Set button map.
|
2009-06-16 08:38:11 +02:00
|
|
|
InitPointerDeviceStruct((DevicePtr)pPointer, map, NBUTTONS,
|
|
|
|
btn_labels,
|
2008-04-30 08:37:58 +02:00
|
|
|
(PtrCtrlProcPtr)NoopDDA,
|
2009-06-16 08:38:11 +02:00
|
|
|
GetMotionHistorySize(), NAXES,
|
|
|
|
axes_labels);
|
2008-09-03 18:11:25 +02:00
|
|
|
pPointer->valuator->mode = Absolute; // Relative
|
2008-04-30 08:37:58 +02:00
|
|
|
InitProximityClassDeviceStruct(pPointer);
|
2008-09-03 18:11:25 +02:00
|
|
|
InitAbsoluteClassDeviceStruct(pPointer);
|
|
|
|
|
2009-06-16 08:38:11 +02:00
|
|
|
InitValuatorAxisStruct(pPointer, 0, axes_labels[0], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
|
|
|
InitValuatorAxisStruct(pPointer, 1, axes_labels[1], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
|
|
|
InitValuatorAxisStruct(pPointer, 2, axes_labels[2], 0, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
|
|
|
InitValuatorAxisStruct(pPointer, 3, axes_labels[3], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
|
|
|
InitValuatorAxisStruct(pPointer, 4, axes_labels[4], -XQUARTZ_VALUATOR_LIMIT, XQUARTZ_VALUATOR_LIMIT, 1, 0, 1);
|
2008-09-30 17:46:08 +02:00
|
|
|
// pPointer->use = IsXExtensionDevice;
|
2008-04-30 08:37:58 +02:00
|
|
|
break;
|
|
|
|
case DEVICE_ON:
|
|
|
|
pPointer->public.on = TRUE;
|
|
|
|
AddEnabledDevice( darwinEventReadFD );
|
|
|
|
return Success;
|
|
|
|
case DEVICE_CLOSE:
|
|
|
|
case DEVICE_OFF:
|
|
|
|
pPointer->public.on = FALSE;
|
|
|
|
RemoveEnabledDevice(darwinEventReadFD);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
return Success;
|
2009-06-16 08:38:11 +02:00
|
|
|
#undef NBUTTONS
|
|
|
|
#undef NAXES
|
2008-04-30 08:37:58 +02:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DarwinKeybdProc
|
|
|
|
* Callback from X
|
|
|
|
*/
|
|
|
|
static int DarwinKeybdProc( DeviceIntPtr pDev, int onoff )
|
|
|
|
{
|
|
|
|
switch ( onoff ) {
|
|
|
|
case DEVICE_INIT:
|
|
|
|
DarwinKeyboardInit( pDev );
|
|
|
|
break;
|
|
|
|
case DEVICE_ON:
|
|
|
|
pDev->public.on = TRUE;
|
2003-11-25 20:29:01 +01:00
|
|
|
AddEnabledDevice( darwinEventReadFD );
|
2003-11-14 17:48:57 +01:00
|
|
|
break;
|
|
|
|
case DEVICE_OFF:
|
|
|
|
pDev->public.on = FALSE;
|
2003-11-25 20:29:01 +01:00
|
|
|
RemoveEnabledDevice( darwinEventReadFD );
|
2003-11-14 17:48:57 +01:00
|
|
|
break;
|
|
|
|
case DEVICE_CLOSE:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Utility routines
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DarwinParseModifierList
|
|
|
|
* Parse a list of modifier names and return a corresponding modifier mask
|
|
|
|
*/
|
2008-08-20 18:21:44 +02:00
|
|
|
int DarwinParseModifierList(const char *constmodifiers, int separatelr)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
if (constmodifiers) {
|
|
|
|
char *modifiers = strdup(constmodifiers);
|
|
|
|
char *modifier;
|
|
|
|
int nxkey;
|
|
|
|
char *p = modifiers;
|
|
|
|
|
|
|
|
while (p) {
|
|
|
|
modifier = strsep(&p, " ,+&|/"); // allow lots of separators
|
2008-08-20 18:21:44 +02:00
|
|
|
nxkey = DarwinModifierStringToNXMask(modifier, separatelr);
|
2008-08-20 18:56:06 +02:00
|
|
|
if(nxkey)
|
|
|
|
result |= nxkey;
|
2003-11-14 17:48:57 +01:00
|
|
|
else
|
|
|
|
ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier);
|
|
|
|
}
|
|
|
|
free(modifiers);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Functions needed to link against device independent X
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* InitInput
|
|
|
|
* Register the keyboard and mouse devices
|
|
|
|
*/
|
|
|
|
void InitInput( int argc, char **argv )
|
|
|
|
{
|
2010-02-11 00:52:14 +01:00
|
|
|
XkbRMLVOSet rmlvo = { .rules = "base", .model = "empty", .layout = "empty",
|
|
|
|
.variant = NULL, .options = NULL };
|
|
|
|
/* We need to really have rules... or something... */
|
|
|
|
XkbSetRulesDflts(&rmlvo);
|
|
|
|
|
2008-11-22 22:57:45 +01:00
|
|
|
darwinKeyboard = AddInputDevice(serverClient, DarwinKeybdProc, TRUE);
|
2008-09-03 18:11:25 +02:00
|
|
|
RegisterKeyboardDevice( darwinKeyboard );
|
2008-09-30 22:54:08 +02:00
|
|
|
darwinKeyboard->name = strdup("keyboard");
|
|
|
|
|
|
|
|
/* here's the snippet from the current gdk sources:
|
|
|
|
if (!strcmp (tmp_name, "pointer"))
|
|
|
|
gdkdev->info.source = GDK_SOURCE_MOUSE;
|
|
|
|
else if (!strcmp (tmp_name, "wacom") ||
|
|
|
|
!strcmp (tmp_name, "pen"))
|
|
|
|
gdkdev->info.source = GDK_SOURCE_PEN;
|
|
|
|
else if (!strcmp (tmp_name, "eraser"))
|
|
|
|
gdkdev->info.source = GDK_SOURCE_ERASER;
|
|
|
|
else if (!strcmp (tmp_name, "cursor"))
|
|
|
|
gdkdev->info.source = GDK_SOURCE_CURSOR;
|
|
|
|
else
|
|
|
|
gdkdev->info.source = GDK_SOURCE_PEN;
|
|
|
|
*/
|
2008-09-03 18:11:25 +02:00
|
|
|
|
2008-11-22 22:57:45 +01:00
|
|
|
darwinPointer = AddInputDevice(serverClient, DarwinMouseProc, TRUE);
|
2003-11-14 17:48:57 +01:00
|
|
|
RegisterPointerDevice( darwinPointer );
|
2008-09-30 22:54:08 +02:00
|
|
|
darwinPointer->name = strdup("pointer");
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2008-11-22 22:57:45 +01:00
|
|
|
darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
|
2008-09-03 18:11:25 +02:00
|
|
|
RegisterPointerDevice( darwinTabletStylus );
|
2008-09-30 22:54:08 +02:00
|
|
|
darwinTabletStylus->name = strdup("pen");
|
2008-04-30 08:37:58 +02:00
|
|
|
|
2008-11-22 22:57:45 +01:00
|
|
|
darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
|
2008-09-03 18:11:25 +02:00
|
|
|
RegisterPointerDevice( darwinTabletCursor );
|
|
|
|
darwinTabletCursor->name = strdup("cursor");
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2008-11-22 22:57:45 +01:00
|
|
|
darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE);
|
2008-09-03 18:11:25 +02:00
|
|
|
RegisterPointerDevice( darwinTabletEraser );
|
|
|
|
darwinTabletEraser->name = strdup("eraser");
|
|
|
|
|
|
|
|
darwinTabletCurrent = darwinTabletStylus;
|
2009-01-11 10:55:26 +01:00
|
|
|
|
2008-04-30 08:00:09 +02:00
|
|
|
DarwinEQInit();
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2007-12-06 06:23:36 +01:00
|
|
|
QuartzInitInput(argc, argv);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DarwinAdjustScreenOrigins
|
|
|
|
* Shift all screens so the X11 (0, 0) coordinate is at the top
|
|
|
|
* left of the global screen coordinates.
|
|
|
|
*
|
|
|
|
* Screens can be arranged so the top left isn't on any screen, so
|
|
|
|
* instead use the top left of the leftmost screen as (0,0). This
|
|
|
|
* may mean some screen space is in -y, but it's better that (0,0)
|
|
|
|
* be onscreen, or else default xterms disappear. It's better that
|
|
|
|
* -y be used than -x, because when popup menus are forced
|
|
|
|
* "onscreen" by dumb window managers like twm, they'll shift the
|
|
|
|
* menus down instead of left, which still looks funny but is an
|
|
|
|
* easier target to hit.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
DarwinAdjustScreenOrigins(ScreenInfo *pScreenInfo)
|
|
|
|
{
|
|
|
|
int i, left, top;
|
|
|
|
|
|
|
|
left = dixScreenOrigins[0].x;
|
|
|
|
top = dixScreenOrigins[0].y;
|
|
|
|
|
|
|
|
/* Find leftmost screen. If there's a tie, take the topmost of the two. */
|
|
|
|
for (i = 1; i < pScreenInfo->numScreens; i++) {
|
|
|
|
if (dixScreenOrigins[i].x < left ||
|
2008-04-25 08:48:11 +02:00
|
|
|
(dixScreenOrigins[i].x == left && dixScreenOrigins[i].y < top))
|
2003-11-25 20:29:01 +01:00
|
|
|
{
|
|
|
|
left = dixScreenOrigins[i].x;
|
|
|
|
top = dixScreenOrigins[i].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
darwinMainScreenX = left;
|
|
|
|
darwinMainScreenY = top;
|
2008-04-25 08:48:11 +02:00
|
|
|
|
|
|
|
DEBUG_LOG("top = %d, left=%d\n", top, left);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
/* Shift all screens so that there is a screen whose top left
|
2008-04-25 08:48:11 +02:00
|
|
|
* is at X11 (0,0) and at global screen coordinate
|
|
|
|
* (darwinMainScreenX, darwinMainScreenY).
|
|
|
|
*/
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
if (darwinMainScreenX != 0 || darwinMainScreenY != 0) {
|
|
|
|
for (i = 0; i < pScreenInfo->numScreens; i++) {
|
|
|
|
dixScreenOrigins[i].x -= darwinMainScreenX;
|
|
|
|
dixScreenOrigins[i].y -= darwinMainScreenY;
|
2008-04-25 08:48:11 +02:00
|
|
|
DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n",
|
|
|
|
i, dixScreenOrigins[i].x, dixScreenOrigins[i].y);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* InitOutput
|
|
|
|
* Initialize screenInfo for all actually accessible framebuffers.
|
|
|
|
*
|
|
|
|
* The display mode dependent code gets called three times. The mode
|
|
|
|
* specific InitOutput routines are expected to discover the number
|
|
|
|
* of potentially useful screens and cache routes to them internally.
|
2009-07-26 11:32:17 +02:00
|
|
|
* Inside DarwinScreenInit are two other mode specific calls.
|
2003-11-14 17:48:57 +01:00
|
|
|
* A mode specific AddScreen routine is called for each screen to
|
|
|
|
* actually initialize the screen with the ScreenPtr structure.
|
|
|
|
* After other screen setup has been done, a mode specific
|
|
|
|
* SetupScreen function can be called to finalize screen setup.
|
|
|
|
*/
|
|
|
|
void InitOutput( ScreenInfo *pScreenInfo, int argc, char **argv )
|
|
|
|
{
|
2003-11-25 20:29:01 +01:00
|
|
|
int i;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
|
|
|
|
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
|
|
|
|
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
|
|
|
|
pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER;
|
|
|
|
|
|
|
|
// List how we want common pixmap formats to be padded
|
|
|
|
pScreenInfo->numPixmapFormats = NUMFORMATS;
|
|
|
|
for (i = 0; i < NUMFORMATS; i++)
|
|
|
|
pScreenInfo->formats[i] = formats[i];
|
|
|
|
|
|
|
|
// Discover screens and do mode specific initialization
|
2007-12-06 06:23:36 +01:00
|
|
|
QuartzInitOutput(argc, argv);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
// Add screens
|
|
|
|
for (i = 0; i < darwinScreensFound; i++) {
|
2009-07-26 11:32:17 +02:00
|
|
|
AddScreen(DarwinScreenInit, argc, argv);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
DarwinAdjustScreenOrigins(pScreenInfo);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2010-03-28 01:35:10 +01:00
|
|
|
* OsVendorFatalError
|
2003-11-14 17:48:57 +01:00
|
|
|
*/
|
|
|
|
void OsVendorFatalError( void )
|
|
|
|
{
|
|
|
|
ErrorF( " OsVendorFatalError\n" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OsVendorInit
|
|
|
|
* Initialization of Darwin OS support.
|
|
|
|
*/
|
|
|
|
void OsVendorInit(void)
|
|
|
|
{
|
|
|
|
if (serverGeneration == 1) {
|
|
|
|
DarwinPrintBanner();
|
2007-11-15 11:25:50 +01:00
|
|
|
#ifdef ENABLE_DEBUG_LOG
|
|
|
|
{
|
|
|
|
char *home_dir=NULL, *log_file_path=NULL;
|
|
|
|
home_dir = getenv("HOME");
|
|
|
|
if (home_dir) asprintf(&log_file_path, "%s/%s", home_dir, DEBUG_LOG_NAME);
|
|
|
|
if (log_file_path) {
|
|
|
|
if (!access(log_file_path, F_OK)) {
|
|
|
|
debug_log_fp = fopen(log_file_path, "a");
|
|
|
|
if (debug_log_fp) ErrorF("Debug logging enabled to %s\n", log_file_path);
|
|
|
|
}
|
|
|
|
free(log_file_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-30 20:22:13 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/*
|
2004-07-30 20:22:13 +02:00
|
|
|
* ddxProcessArgument
|
2003-11-14 17:48:57 +01:00
|
|
|
* Process device-dependent command line args. Returns 0 if argument is
|
|
|
|
* not device dependent, otherwise Count of number of elements of argv
|
|
|
|
* that are part of a device dependent commandline option.
|
|
|
|
*/
|
|
|
|
int ddxProcessArgument( int argc, char *argv[], int i )
|
|
|
|
{
|
2007-12-21 03:29:57 +01:00
|
|
|
// if ( !strcmp( argv[i], "-fullscreen" ) ) {
|
|
|
|
// ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" );
|
|
|
|
// return 1;
|
|
|
|
// }
|
2007-11-22 04:51:14 +01:00
|
|
|
|
2007-12-21 03:29:57 +01:00
|
|
|
// if ( !strcmp( argv[i], "-rootless" ) ) {
|
|
|
|
// ErrorF( "Running rootless inside Mac OS X window server.\n" );
|
|
|
|
// return 1;
|
|
|
|
// }
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2007-11-22 04:51:14 +01:00
|
|
|
// This command line arg is passed when launched from the Aqua GUI.
|
|
|
|
if ( !strncmp( argv[i], "-psn_", 5 ) ) {
|
|
|
|
return 1;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if ( !strcmp( argv[i], "-fakebuttons" ) ) {
|
|
|
|
darwinFakeButtons = TRUE;
|
|
|
|
ErrorF( "Faking a three button mouse\n" );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !strcmp( argv[i], "-nofakebuttons" ) ) {
|
|
|
|
darwinFakeButtons = FALSE;
|
|
|
|
ErrorF( "Not faking a three button mouse\n" );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp( argv[i], "-fakemouse2" ) ) {
|
|
|
|
if ( i == argc-1 ) {
|
|
|
|
FatalError( "-fakemouse2 must be followed by a modifer list\n" );
|
|
|
|
}
|
|
|
|
if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
|
|
|
|
darwinFakeMouse2Mask = 0;
|
|
|
|
else
|
2008-08-20 18:21:44 +02:00
|
|
|
darwinFakeMouse2Mask = DarwinParseModifierList(argv[i+1], 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n",
|
|
|
|
darwinFakeMouse2Mask);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp( argv[i], "-fakemouse3" ) ) {
|
|
|
|
if ( i == argc-1 ) {
|
|
|
|
FatalError( "-fakemouse3 must be followed by a modifer list\n" );
|
|
|
|
}
|
|
|
|
if (!strcasecmp(argv[i+1], "none") || !strcmp(argv[i+1], ""))
|
|
|
|
darwinFakeMouse3Mask = 0;
|
|
|
|
else
|
2008-08-20 18:21:44 +02:00
|
|
|
darwinFakeMouse3Mask = DarwinParseModifierList(argv[i+1], 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n",
|
|
|
|
darwinFakeMouse3Mask);
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2004-09-23 01:38:33 +02:00
|
|
|
if ( !strcmp( argv[i], "+synckeymap" ) ) {
|
|
|
|
darwinSyncKeymap = TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !strcmp( argv[i], "-synckeymap" ) ) {
|
|
|
|
darwinSyncKeymap = FALSE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if ( !strcmp( argv[i], "-depth" ) ) {
|
|
|
|
if ( i == argc-1 ) {
|
|
|
|
FatalError( "-depth must be followed by a number\n" );
|
|
|
|
}
|
2007-12-23 00:09:12 +01:00
|
|
|
darwinDesiredDepth = atoi( argv[i+1] );
|
|
|
|
if(darwinDesiredDepth != -1 &&
|
|
|
|
darwinDesiredDepth != 8 &&
|
|
|
|
darwinDesiredDepth != 15 &&
|
|
|
|
darwinDesiredDepth != 24) {
|
2003-11-14 17:48:57 +01:00
|
|
|
FatalError( "Unsupported pixel depth. Use 8, 15, or 24 bits\n" );
|
2007-12-23 00:09:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrorF( "Attempting to use pixel depth of %i\n", darwinDesiredDepth );
|
2003-11-14 17:48:57 +01:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!strcmp( argv[i], "-showconfig" ) || !strcmp( argv[i], "-version" )) {
|
|
|
|
DarwinPrintBanner();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ddxUseMsg --
|
|
|
|
* Print out correct use of device dependent commandline options.
|
|
|
|
* Maybe the user now knows what really to do ...
|
|
|
|
*/
|
|
|
|
void ddxUseMsg( void )
|
|
|
|
{
|
|
|
|
ErrorF("\n");
|
|
|
|
ErrorF("\n");
|
|
|
|
ErrorF("Device Dependent Usage:\n");
|
|
|
|
ErrorF("\n");
|
2010-01-28 02:12:12 +01:00
|
|
|
ErrorF("-depth <8,15,24> : use this bit depth.\n");
|
2003-11-14 17:48:57 +01:00
|
|
|
ErrorF("-fakebuttons : fake a three button mouse with Command and Option keys.\n");
|
|
|
|
ErrorF("-nofakebuttons : don't fake a three button mouse.\n");
|
|
|
|
ErrorF("-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
|
|
|
|
ErrorF("-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
|
|
|
|
ErrorF(" ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
|
|
|
|
ErrorF("-version : show the server version.\n");
|
|
|
|
ErrorF("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ddxGiveUp --
|
|
|
|
* Device dependent cleanup. Called by dix before normal server death.
|
|
|
|
*/
|
|
|
|
void ddxGiveUp( void )
|
|
|
|
{
|
2010-03-28 01:35:10 +01:00
|
|
|
ErrorF( "Quitting Xquartz\n" );
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* AbortDDX --
|
|
|
|
* DDX - specific abort routine. Called by AbortServer(). The attempt is
|
|
|
|
* made to restore all original setting of the displays. Also all devices
|
|
|
|
* are closed.
|
|
|
|
*/
|
|
|
|
void AbortDDX( void )
|
|
|
|
{
|
|
|
|
ErrorF( " AbortDDX\n" );
|
2010-03-28 01:35:10 +01:00
|
|
|
OsAbort();
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "mivalidate.h" // for union _Validate used by windowstr.h
|
|
|
|
#include "windowstr.h" // for struct _Window
|
|
|
|
#include "scrnintstr.h" // for struct _Screen
|
|
|
|
|
|
|
|
// This is copied from Xserver/hw/xfree86/common/xf86Helper.c.
|
|
|
|
// Quartz mode uses this when switching in and out of Quartz.
|
|
|
|
// Quartz or IOKit can use this when waking from sleep.
|
|
|
|
// Copyright (c) 1997-1998 by The XFree86 Project, Inc.
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xf86SetRootClip --
|
|
|
|
* Enable or disable rendering to the screen by
|
|
|
|
* setting the root clip list and revalidating
|
|
|
|
* all of the windows
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2008-04-01 05:18:58 +02:00
|
|
|
xf86SetRootClip (ScreenPtr pScreen, int enable)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin = WindowTable[pScreen->myNum];
|
|
|
|
WindowPtr pChild;
|
|
|
|
Bool WasViewable = (Bool)(pWin->viewable);
|
|
|
|
Bool anyMarked = TRUE;
|
2007-11-22 22:17:44 +01:00
|
|
|
RegionPtr pOldClip = NULL, bsExposed;
|
2003-11-14 17:48:57 +01:00
|
|
|
WindowPtr pLayerWin;
|
|
|
|
BoxRec box;
|
|
|
|
|
|
|
|
if (WasViewable)
|
|
|
|
{
|
|
|
|
for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
|
|
|
|
{
|
|
|
|
(void) (*pScreen->MarkOverlappedWindows)(pChild,
|
|
|
|
pChild,
|
|
|
|
&pLayerWin);
|
|
|
|
}
|
|
|
|
(*pScreen->MarkWindow) (pWin);
|
|
|
|
anyMarked = TRUE;
|
|
|
|
if (pWin->valdata)
|
|
|
|
{
|
|
|
|
if (HasBorder (pWin))
|
|
|
|
{
|
|
|
|
RegionPtr borderVisible;
|
|
|
|
|
|
|
|
borderVisible = REGION_CREATE(pScreen, NullBox, 1);
|
|
|
|
REGION_SUBTRACT(pScreen, borderVisible,
|
|
|
|
&pWin->borderClip, &pWin->winSize);
|
|
|
|
pWin->valdata->before.borderVisible = borderVisible;
|
|
|
|
}
|
|
|
|
pWin->valdata->before.resized = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Use REGION_BREAK to avoid optimizations in ValidateTree
|
|
|
|
* that assume the root borderClip can't change well, normally
|
|
|
|
* it doesn't...)
|
|
|
|
*/
|
|
|
|
if (enable)
|
|
|
|
{
|
|
|
|
box.x1 = 0;
|
|
|
|
box.y1 = 0;
|
|
|
|
box.x2 = pScreen->width;
|
|
|
|
box.y2 = pScreen->height;
|
|
|
|
REGION_RESET(pScreen, &pWin->borderClip, &box);
|
|
|
|
REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
REGION_EMPTY(pScreen, &pWin->borderClip);
|
|
|
|
REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList);
|
|
|
|
}
|
|
|
|
|
|
|
|
ResizeChildrenWinSize (pWin, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
if (WasViewable)
|
|
|
|
{
|
2007-11-22 22:17:44 +01:00
|
|
|
if (pWin->backStorage)
|
|
|
|
{
|
|
|
|
pOldClip = REGION_CREATE(pScreen, NullBox, 1);
|
|
|
|
REGION_COPY(pScreen, pOldClip, &pWin->clipList);
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if (pWin->firstChild)
|
|
|
|
{
|
|
|
|
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild,
|
|
|
|
pWin->firstChild,
|
|
|
|
(WindowPtr *)NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(*pScreen->MarkWindow) (pWin);
|
|
|
|
anyMarked = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (anyMarked)
|
|
|
|
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
|
|
|
|
}
|
|
|
|
|
2007-11-22 22:17:44 +01:00
|
|
|
if (pWin->backStorage &&
|
|
|
|
((pWin->backingStore == Always) || WasViewable))
|
|
|
|
{
|
|
|
|
if (!WasViewable)
|
|
|
|
pOldClip = &pWin->clipList; /* a convenient empty region */
|
|
|
|
bsExposed = (*pScreen->TranslateBackingStore)
|
|
|
|
(pWin, 0, 0, pOldClip,
|
|
|
|
pWin->drawable.x, pWin->drawable.y);
|
|
|
|
if (WasViewable)
|
|
|
|
REGION_DESTROY(pScreen, pOldClip);
|
|
|
|
if (bsExposed)
|
|
|
|
{
|
|
|
|
RegionPtr valExposed = NullRegion;
|
|
|
|
|
|
|
|
if (pWin->valdata)
|
|
|
|
valExposed = &pWin->valdata->after.exposed;
|
|
|
|
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
|
|
|
|
if (valExposed)
|
|
|
|
REGION_EMPTY(pScreen, valExposed);
|
|
|
|
REGION_DESTROY(pScreen, bsExposed);
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
if (WasViewable)
|
|
|
|
{
|
|
|
|
if (anyMarked)
|
|
|
|
(*pScreen->HandleExposures)(pWin);
|
|
|
|
if (anyMarked && pScreen->PostValidateTree)
|
|
|
|
(*pScreen->PostValidateTree)(pWin, NullWindow, VTOther);
|
|
|
|
}
|
|
|
|
if (pWin->realized)
|
|
|
|
WindowsRestructured ();
|
|
|
|
FlushAllOutput ();
|
|
|
|
}
|