1 /**************************************************************
3 * Xquartz initialization code
5 * Copyright (c) 2007-2012 Apple Inc.
6 * Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE.
26 * Except as contained in this notice, the name(s) of the above copyright
27 * holders shall not be used in advertising or otherwise to promote the sale,
28 * use or other dealings in this Software without prior written authorization.
31 #ifdef HAVE_DIX_CONFIG_H
32 #include <dix-config.h>
36 #include <X11/Xproto.h>
40 #include "scrnintstr.h"
41 #include "mipointer.h" // mi software cursor
42 #include "micmap.h" // mi colormap code
43 #include "fb.h" // fb framebuffer code
49 #include <X11/extensions/XI.h>
50 #include <X11/extensions/XIproto.h>
54 #include "xserver-properties.h"
56 #include <sys/types.h>
59 #include <sys/syslimits.h>
66 #include <sys/utsname.h>
69 #include <IOKit/hidsystem/IOHIDLib.h>
76 #include "darwinEvents.h"
77 #include "quartzKeyboard.h"
80 #include "X11Application.h"
85 xq_asl_log(int level
, const char *subsystem
, const char *file
,
86 const char *function
, int line
, const char *fmt
,
90 aslmsg msg
= asl_new(ASL_TYPE_MSG
);
95 asl_set(msg
, "File", file
);
96 asl_set(msg
, "Function", function
);
97 asprintf(&_line
, "%d", line
);
99 asl_set(msg
, "Line", _line
);
103 asl_set(msg
, "Subsystem", subsystem
);
107 asl_vlog(aslc
, msg
, level
, fmt
, args
);
115 * X server shared global variables
117 int darwinScreensFound
= 0;
118 DevPrivateKeyRec darwinScreenKeyRec
;
119 io_connect_t darwinParamConnect
= 0;
120 int darwinEventReadFD
= -1;
121 int darwinEventWriteFD
= -1;
122 // int darwinMouseAccelChange = 1;
123 int darwinFakeButtons
= 0;
125 // location of X11's (0,0) point in global screen coordinates
126 int darwinMainScreenX
= 0;
127 int darwinMainScreenY
= 0;
129 // parameters read from the command line or user preferences
130 int darwinDesiredDepth
= -1;
131 int darwinSyncKeymap
= FALSE
;
133 // modifier masks for faking mouse buttons - ANY of these bits trigger it (not all)
134 #ifdef NX_DEVICELCMDKEYMASK
135 int darwinFakeMouse2Mask
= NX_DEVICELALTKEYMASK
| NX_DEVICERALTKEYMASK
;
136 int darwinFakeMouse3Mask
= NX_DEVICELCMDKEYMASK
| NX_DEVICERCMDKEYMASK
;
138 int darwinFakeMouse2Mask
= NX_ALTERNATEMASK
;
139 int darwinFakeMouse3Mask
= NX_COMMANDMASK
;
142 // Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
143 unsigned int darwinAppKitModMask
= 0; // Any of these bits
145 // Modifier mask for items in the Window menu (0 and -1 cause shortcuts to be disabled)
146 unsigned int windowItemModMask
= NX_COMMANDMASK
;
149 DeviceIntPtr darwinKeyboard
= NULL
;
150 DeviceIntPtr darwinPointer
= NULL
;
151 DeviceIntPtr darwinTabletStylus
= NULL
;
152 DeviceIntPtr darwinTabletCursor
= NULL
;
153 DeviceIntPtr darwinTabletEraser
= NULL
;
155 // Common pixmap formats
156 static PixmapFormatRec formats
[] = {
157 { 1, 1, BITMAP_SCANLINE_PAD
},
158 { 4, 8, BITMAP_SCANLINE_PAD
},
159 { 8, 8, BITMAP_SCANLINE_PAD
},
160 { 15, 16, BITMAP_SCANLINE_PAD
},
161 { 16, 16, BITMAP_SCANLINE_PAD
},
162 { 24, 32, BITMAP_SCANLINE_PAD
},
163 { 32, 32, BITMAP_SCANLINE_PAD
}
165 const int NUMFORMATS
= sizeof(formats
) / sizeof(formats
[0]);
168 DarwinPrintBanner(void)
170 ErrorF("Xquartz starting:\n");
171 ErrorF("X.Org X Server %s\n", XSERVER_VERSION
);
172 ErrorF("Build Date: %s\n", BUILD_DATE
);
177 * X screensaver support. Not implemented.
180 DarwinSaveScreen(ScreenPtr pScreen
, int on
)
183 if (on
== SCREEN_SAVER_FORCER
) {}
184 else if (on
== SCREEN_SAVER_ON
) {}
191 * This is a callback from dix during AddScreen() from InitOutput().
192 * Initialize the screen and communicate information about it back to dix.
195 DarwinScreenInit(ScreenPtr pScreen
, int argc
, char **argv
)
198 static int foundIndex
= 0;
200 DarwinFramebufferPtr dfb
;
202 if (!dixRegisterPrivateKey(&darwinScreenKeyRec
, PRIVATE_SCREEN
, 0))
205 // reset index of found screens for each server generation
206 if (pScreen
->myNum
== 0) {
209 // reset the visual list
210 miClearVisualTypes();
213 // allocate space for private per screen storage
214 dfb
= malloc(sizeof(DarwinFramebufferRec
));
216 // SCREEN_PRIV(pScreen) = dfb;
217 dixSetPrivate(&pScreen
->devPrivates
, darwinScreenKey
, dfb
);
219 // setup hardware/mode specific details
220 ret
= QuartzAddScreen(foundIndex
, pScreen
);
225 // setup a single visual appropriate for our pixel type
226 if (!miSetVisualTypesAndMasks(dfb
->depth
, dfb
->visuals
, dfb
->bitsPerRGB
,
227 dfb
->preferredCVC
, dfb
->redMask
,
228 dfb
->greenMask
, dfb
->blueMask
)) {
232 // TODO: Make PseudoColor visuals not suck in TrueColor mode
233 // if(dfb->depth > 8)
234 // miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
236 // TODO: Re-add support for 15bit
237 // if (dfb->depth > 15)
238 // miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor,
239 // RM_ARGB(0, 5, 5, 5), GM_ARGB(0, 5, 5,
241 // BM_ARGB(0, 5, 5, 5));
243 miSetVisualTypesAndMasks(24, TrueColorMask
, 8, TrueColor
,
244 RM_ARGB(0, 8, 8, 8), GM_ARGB(0, 8, 8,
246 BM_ARGB(0, 8, 8, 8));
250 // machine independent screen init
251 // setup _Screen structure in pScreen
252 if (monitorResolution
)
253 dpi
= monitorResolution
;
258 if (!fbScreenInit(pScreen
,
259 dfb
->framebuffer
, // pointer to screen bitmap
260 dfb
->width
, dfb
->height
, // screen size in pixels
261 dpi
, dpi
, // dots per inch
262 dfb
->pitch
/ (dfb
->bitsPerPixel
/ 8), // pixel width of framebuffer
263 dfb
->bitsPerPixel
)) { // bits per pixel for screen
267 if (!fbPictureInit(pScreen
, 0, 0)) {
272 ShmRegisterFbFuncs(pScreen
);
275 // this must be initialized (why doesn't X have a default?)
276 pScreen
->SaveScreen
= DarwinSaveScreen
;
278 // finish mode dependent screen setup including cursor support
279 if (!QuartzSetupScreen(pScreen
->myNum
, pScreen
)) {
283 // create and install the default colormap and
284 // set pScreen->blackPixel / pScreen->white
285 if (!miCreateDefColormap(pScreen
)) {
292 /* ErrorF("Screen %d added: %dx%d @ (%d,%d)\n",
293 index, dfb->width, dfb->height, dfb->x, dfb->y); */
299 =============================================================================
301 mouse and keyboard callbacks
303 =============================================================================
307 * DarwinMouseProc: Handle the initialization, etc. of a mouse
310 DarwinMouseProc(DeviceIntPtr pPointer
, int what
)
314 // 3 buttons: left, middle, right
315 CARD8 map
[NBUTTONS
+ 1] = { 0, 1, 2, 3};
316 Atom btn_labels
[NBUTTONS
] = { 0 };
317 Atom axes_labels
[NAXES
] = { 0 };
321 pPointer
->public.on
= FALSE
;
323 btn_labels
[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT
);
324 btn_labels
[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE
);
325 btn_labels
[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT
);
327 axes_labels
[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X
);
328 axes_labels
[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y
);
329 axes_labels
[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X
);
330 axes_labels
[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y
);
331 axes_labels
[4] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL
);
332 axes_labels
[5] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL
);
335 InitPointerDeviceStruct((DevicePtr
)pPointer
, map
, NBUTTONS
,
337 (PtrCtrlProcPtr
)NoopDDA
,
338 GetMotionHistorySize(), NAXES
,
340 InitValuatorAxisStruct(pPointer
, 0, axes_labels
[0],
341 NO_AXIS_LIMITS
, NO_AXIS_LIMITS
,
343 InitValuatorAxisStruct(pPointer
, 1, axes_labels
[1],
344 NO_AXIS_LIMITS
, NO_AXIS_LIMITS
,
346 InitValuatorAxisStruct(pPointer
, 2, axes_labels
[2],
347 NO_AXIS_LIMITS
, NO_AXIS_LIMITS
,
349 InitValuatorAxisStruct(pPointer
, 3, axes_labels
[3],
350 NO_AXIS_LIMITS
, NO_AXIS_LIMITS
,
352 InitValuatorAxisStruct(pPointer
, 4, axes_labels
[4],
353 NO_AXIS_LIMITS
, NO_AXIS_LIMITS
,
355 InitValuatorAxisStruct(pPointer
, 5, axes_labels
[5],
356 NO_AXIS_LIMITS
, NO_AXIS_LIMITS
,
359 SetScrollValuator(pPointer
, 4, SCROLL_TYPE_VERTICAL
, -1.0, SCROLL_FLAG_PREFERRED
);
360 SetScrollValuator(pPointer
, 5, SCROLL_TYPE_HORIZONTAL
, -1.0, SCROLL_FLAG_NONE
);
364 pPointer
->public.on
= TRUE
;
365 AddEnabledDevice(darwinEventReadFD
);
370 pPointer
->public.on
= FALSE
;
371 RemoveEnabledDevice(darwinEventReadFD
);
381 DarwinTabletProc(DeviceIntPtr pPointer
, int what
)
385 CARD8 map
[NBUTTONS
+ 1] = { 0, 1, 2, 3 };
386 Atom btn_labels
[NBUTTONS
] = { 0 };
387 Atom axes_labels
[NAXES
] = { 0 };
391 pPointer
->public.on
= FALSE
;
393 btn_labels
[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT
);
394 btn_labels
[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE
);
395 btn_labels
[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT
);
397 axes_labels
[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X
);
398 axes_labels
[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y
);
399 axes_labels
[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE
);
400 axes_labels
[3] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_X
);
401 axes_labels
[4] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_TILT_Y
);
404 InitPointerDeviceStruct((DevicePtr
)pPointer
, map
, NBUTTONS
,
406 (PtrCtrlProcPtr
)NoopDDA
,
407 GetMotionHistorySize(), NAXES
,
409 InitProximityClassDeviceStruct(pPointer
);
411 InitValuatorAxisStruct(pPointer
, 0, axes_labels
[0],
412 0, XQUARTZ_VALUATOR_LIMIT
,
414 InitValuatorAxisStruct(pPointer
, 1, axes_labels
[1],
415 0, XQUARTZ_VALUATOR_LIMIT
,
417 InitValuatorAxisStruct(pPointer
, 2, axes_labels
[2],
418 0, XQUARTZ_VALUATOR_LIMIT
,
420 InitValuatorAxisStruct(pPointer
, 3, axes_labels
[3],
421 -XQUARTZ_VALUATOR_LIMIT
,
422 XQUARTZ_VALUATOR_LIMIT
,
424 InitValuatorAxisStruct(pPointer
, 4, axes_labels
[4],
425 -XQUARTZ_VALUATOR_LIMIT
,
426 XQUARTZ_VALUATOR_LIMIT
,
429 // pPointer->use = IsXExtensionDevice;
433 pPointer
->public.on
= TRUE
;
434 AddEnabledDevice(darwinEventReadFD
);
439 pPointer
->public.on
= FALSE
;
440 RemoveEnabledDevice(darwinEventReadFD
);
453 DarwinKeybdProc(DeviceIntPtr pDev
, int onoff
)
457 DarwinKeyboardInit(pDev
);
461 pDev
->public.on
= TRUE
;
462 AddEnabledDevice(darwinEventReadFD
);
466 pDev
->public.on
= FALSE
;
467 RemoveEnabledDevice(darwinEventReadFD
);
478 ===========================================================================
482 ===========================================================================
486 * DarwinParseModifierList
487 * Parse a list of modifier names and return a corresponding modifier mask
490 DarwinParseModifierList(const char *constmodifiers
, int separatelr
)
494 if (constmodifiers
) {
495 char *modifiers
= strdup(constmodifiers
);
501 modifier
= strsep(&p
, " ,+&|/"); // allow lots of separators
502 nxkey
= DarwinModifierStringToNXMask(modifier
, separatelr
);
506 ErrorF("fakebuttons: Unknown modifier \"%s\"\n", modifier
);
514 ===========================================================================
516 Functions needed to link against device independent X
518 ===========================================================================
523 * Register the keyboard and mouse devices
526 InitInput(int argc
, char **argv
)
528 XkbRMLVOSet rmlvo
= {
529 .rules
= "base", .model
= "empty", .layout
= "empty",
530 .variant
= NULL
, .options
= NULL
533 /* We need to really have rules... or something... */
534 XkbSetRulesDflts(&rmlvo
);
536 assert(Success
== AllocDevicePair(serverClient
, "xquartz virtual",
537 &darwinPointer
, &darwinKeyboard
,
538 DarwinMouseProc
, DarwinKeybdProc
, FALSE
));
540 /* here's the snippet from the current gdk sources:
541 if (!strcmp (tmp_name, "pointer"))
542 gdkdev->info.source = GDK_SOURCE_MOUSE;
543 else if (!strcmp (tmp_name, "wacom") ||
544 !strcmp (tmp_name, "pen"))
545 gdkdev->info.source = GDK_SOURCE_PEN;
546 else if (!strcmp (tmp_name, "eraser"))
547 gdkdev->info.source = GDK_SOURCE_ERASER;
548 else if (!strcmp (tmp_name, "cursor"))
549 gdkdev->info.source = GDK_SOURCE_CURSOR;
551 gdkdev->info.source = GDK_SOURCE_PEN;
554 darwinTabletStylus
= AddInputDevice(serverClient
, DarwinTabletProc
, TRUE
);
555 assert(darwinTabletStylus
);
556 darwinTabletStylus
->name
= strdup("pen");
558 darwinTabletCursor
= AddInputDevice(serverClient
, DarwinTabletProc
, TRUE
);
559 assert(darwinTabletCursor
);
560 darwinTabletCursor
->name
= strdup("cursor");
562 darwinTabletEraser
= AddInputDevice(serverClient
, DarwinTabletProc
, TRUE
);
563 assert(darwinTabletEraser
);
564 darwinTabletEraser
->name
= strdup("eraser");
568 QuartzInitInput(argc
, argv
);
578 * DarwinAdjustScreenOrigins
579 * Shift all screens so the X11 (0, 0) coordinate is at the top
580 * left of the global screen coordinates.
582 * Screens can be arranged so the top left isn't on any screen, so
583 * instead use the top left of the leftmost screen as (0,0). This
584 * may mean some screen space is in -y, but it's better that (0,0)
585 * be onscreen, or else default xterms disappear. It's better that
586 * -y be used than -x, because when popup menus are forced
587 * "onscreen" by dumb window managers like twm, they'll shift the
588 * menus down instead of left, which still looks funny but is an
589 * easier target to hit.
592 DarwinAdjustScreenOrigins(ScreenInfo
*pScreenInfo
)
596 left
= pScreenInfo
->screens
[0]->x
;
597 top
= pScreenInfo
->screens
[0]->y
;
599 /* Find leftmost screen. If there's a tie, take the topmost of the two. */
600 for (i
= 1; i
< pScreenInfo
->numScreens
; i
++) {
601 if (pScreenInfo
->screens
[i
]->x
< left
||
602 (pScreenInfo
->screens
[i
]->x
== left
&&
603 pScreenInfo
->screens
[i
]->y
< top
)) {
604 left
= pScreenInfo
->screens
[i
]->x
;
605 top
= pScreenInfo
->screens
[i
]->y
;
609 darwinMainScreenX
= left
;
610 darwinMainScreenY
= top
;
612 DEBUG_LOG("top = %d, left=%d\n", top
, left
);
614 /* Shift all screens so that there is a screen whose top left
615 * is at X11 (0,0) and at global screen coordinate
616 * (darwinMainScreenX, darwinMainScreenY).
619 if (darwinMainScreenX
!= 0 || darwinMainScreenY
!= 0) {
620 for (i
= 0; i
< pScreenInfo
->numScreens
; i
++) {
621 pScreenInfo
->screens
[i
]->x
-= darwinMainScreenX
;
622 pScreenInfo
->screens
[i
]->y
-= darwinMainScreenY
;
623 DEBUG_LOG("Screen %d placed at X11 coordinate (%d,%d).\n",
624 i
, pScreenInfo
->screens
[i
]->x
,
625 pScreenInfo
->screens
[i
]->y
);
629 /* Update screenInfo.x/y */
630 update_desktop_dimensions();
635 * Initialize screenInfo for all actually accessible framebuffers.
637 * The display mode dependent code gets called three times. The mode
638 * specific InitOutput routines are expected to discover the number
639 * of potentially useful screens and cache routes to them internally.
640 * Inside DarwinScreenInit are two other mode specific calls.
641 * A mode specific AddScreen routine is called for each screen to
642 * actually initialize the screen with the ScreenPtr structure.
643 * After other screen setup has been done, a mode specific
644 * SetupScreen function can be called to finalize screen setup.
647 InitOutput(ScreenInfo
*pScreenInfo
, int argc
, char **argv
)
651 pScreenInfo
->imageByteOrder
= IMAGE_BYTE_ORDER
;
652 pScreenInfo
->bitmapScanlineUnit
= BITMAP_SCANLINE_UNIT
;
653 pScreenInfo
->bitmapScanlinePad
= BITMAP_SCANLINE_PAD
;
654 pScreenInfo
->bitmapBitOrder
= BITMAP_BIT_ORDER
;
656 // List how we want common pixmap formats to be padded
657 pScreenInfo
->numPixmapFormats
= NUMFORMATS
;
658 for (i
= 0; i
< NUMFORMATS
; i
++)
659 pScreenInfo
->formats
[i
] = formats
[i
];
661 // Discover screens and do mode specific initialization
662 QuartzInitOutput(argc
, argv
);
665 for (i
= 0; i
< darwinScreensFound
; i
++) {
666 AddScreen(DarwinScreenInit
, argc
, argv
);
669 DarwinAdjustScreenOrigins(pScreenInfo
);
676 OsVendorFatalError(const char *f
, va_list args
)
678 X11ApplicationFatalError(f
, args
);
683 * Initialization of Darwin OS support.
688 if (serverGeneration
== 1) {
690 char *home
= getenv("HOME");
692 assert(0 < asprintf(&lf
, "%s/Library/Logs/X11", home
));
694 /* Ignore errors. If EEXIST, we don't care. If anything else,
695 * LogInit will handle it for us.
697 (void)mkdir(lf
, S_IRWXU
| S_IRWXG
| S_IRWXO
);
701 asprintf(&lf
, "%s/Library/Logs/X11/%s.log", home
,
707 #ifdef ENABLE_DEBUG_LOG
709 char *home_dir
= NULL
, *log_file_path
= NULL
;
710 home_dir
= getenv("HOME");
711 if (home_dir
) asprintf(&log_file_path
, "%s/%s", home_dir
,
714 if (!access(log_file_path
, F_OK
)) {
715 debug_log_fp
= fopen(log_file_path
, "a");
716 if (debug_log_fp
) ErrorF("Debug logging enabled to %s\n",
728 * Process device-dependent command line args. Returns 0 if argument is
729 * not device dependent, otherwise Count of number of elements of argv
730 * that are part of a device dependent commandline option.
733 ddxProcessArgument(int argc
, char *argv
[], int i
)
735 // if ( !strcmp( argv[i], "-fullscreen" ) ) {
736 // ErrorF( "Running full screen in parallel with Mac OS X Quartz window server.\n" );
740 // if ( !strcmp( argv[i], "-rootless" ) ) {
741 // ErrorF( "Running rootless inside Mac OS X window server.\n" );
745 // This command line arg is passed when launched from the Aqua GUI.
746 if (!strncmp(argv
[i
], "-psn_", 5)) {
750 if (!strcmp(argv
[i
], "-fakebuttons")) {
751 darwinFakeButtons
= TRUE
;
752 ErrorF("Faking a three button mouse\n");
756 if (!strcmp(argv
[i
], "-nofakebuttons")) {
757 darwinFakeButtons
= FALSE
;
758 ErrorF("Not faking a three button mouse\n");
762 if (!strcmp(argv
[i
], "-fakemouse2")) {
764 FatalError("-fakemouse2 must be followed by a modifer list\n");
766 if (!strcasecmp(argv
[i
+ 1], "none") || !strcmp(argv
[i
+ 1], ""))
767 darwinFakeMouse2Mask
= 0;
769 darwinFakeMouse2Mask
= DarwinParseModifierList(argv
[i
+ 1], 1);
770 ErrorF("Modifier mask to fake mouse button 2 = 0x%x\n",
771 darwinFakeMouse2Mask
);
775 if (!strcmp(argv
[i
], "-fakemouse3")) {
777 FatalError("-fakemouse3 must be followed by a modifer list\n");
779 if (!strcasecmp(argv
[i
+ 1], "none") || !strcmp(argv
[i
+ 1], ""))
780 darwinFakeMouse3Mask
= 0;
782 darwinFakeMouse3Mask
= DarwinParseModifierList(argv
[i
+ 1], 1);
783 ErrorF("Modifier mask to fake mouse button 3 = 0x%x\n",
784 darwinFakeMouse3Mask
);
788 if (!strcmp(argv
[i
], "+synckeymap")) {
789 darwinSyncKeymap
= TRUE
;
793 if (!strcmp(argv
[i
], "-synckeymap")) {
794 darwinSyncKeymap
= FALSE
;
798 if (!strcmp(argv
[i
], "-depth")) {
800 FatalError("-depth must be followed by a number\n");
802 darwinDesiredDepth
= atoi(argv
[i
+ 1]);
803 if (darwinDesiredDepth
!= -1 &&
804 darwinDesiredDepth
!= 8 &&
805 darwinDesiredDepth
!= 15 &&
806 darwinDesiredDepth
!= 24) {
807 FatalError("Unsupported pixel depth. Use 8, 15, or 24 bits\n");
810 ErrorF("Attempting to use pixel depth of %i\n", darwinDesiredDepth
);
814 if (!strcmp(argv
[i
], "-showconfig") || !strcmp(argv
[i
], "-version")) {
824 * Print out correct use of device dependent commandline options.
825 * Maybe the user now knows what really to do ...
832 ErrorF("Device Dependent Usage:\n");
834 ErrorF("-depth <8,15,24> : use this bit depth.\n");
836 "-fakebuttons : fake a three button mouse with Command and Option keys.\n");
837 ErrorF("-nofakebuttons : don't fake a three button mouse.\n");
839 "-fakemouse2 <modifiers> : fake middle mouse button with modifier keys.\n");
841 "-fakemouse3 <modifiers> : fake right mouse button with modifier keys.\n");
843 " ex: -fakemouse2 \"option,shift\" = option-shift-click is middle button.\n");
844 ErrorF("-version : show the server version.\n");
850 * Device dependent cleanup. Called by dix before normal server death.
853 ddxGiveUp(enum ExitCode error
)
860 * DDX - specific abort routine. Called by AbortServer(). The attempt is
861 * made to restore all original setting of the displays. Also all devices
866 AbortDDX(enum ExitCode error
)
868 ErrorF(" AbortDDX\n");