2 * Routines for debugging the window server and application drawing.
4 * Copyright (C) 2007-2008 Alacatia Labs
6 * This software is provided 'as-is', without any express or implied
7 * warranty. In no event will the authors be held liable for any damages
8 * arising from the use of this software.
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it
12 * freely, subject to the following restrictions:
14 * 1. The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 * 3. This notice may not be removed or altered from any source distribution.
22 * Joe Ranieri joe@alacatia.com
27 #include "CGSConnection.h"
30 /*! Clears all flags. */
31 kCGSDebugOptionNone = 0,
33 /*! All screen updates are flashed in yellow. Regions under a DisableUpdate are flashed in orange. Regions that are hardware accellerated are painted green. */
34 kCGSDebugOptionFlashScreenUpdates = 0x4,
36 /*! Colors windows green if they are accellerated, otherwise red. Doesn't cause things to refresh properly - leaves excess rects cluttering the screen. */
37 kCGSDebugOptionColorByAccelleration = 0x20,
39 /*! Disables shadows on all windows. */
40 kCGSDebugOptionNoShadows = 0x4000,
42 /*! Setting this disables the pause after a flash when using FlashScreenUpdates or FlashIdenticalUpdates. */
43 kCGSDebugOptionNoDelayAfterFlash = 0x20000,
45 /*! Flushes the contents to the screen after every drawing operation. */
46 kCGSDebugOptionAutoflushDrawing = 0x40000,
48 /*! Highlights mouse tracking areas. Doesn't cause things to refresh correctly - leaves excess rectangles cluttering the screen. */
49 kCGSDebugOptionShowMouseTrackingAreas = 0x100000,
51 /*! Flashes identical updates in red. */
52 kCGSDebugOptionFlashIdenticalUpdates = 0x4000000,
54 /*! Dumps a list of windows to /tmp/WindowServer.winfo.out. This is what Quartz Debug uses to get the window list. */
55 kCGSDebugOptionDumpWindowListToFile = 0x80000001,
57 /*! Dumps a list of connections to /tmp/WindowServer.cinfo.out. */
58 kCGSDebugOptionDumpConnectionListToFile = 0x80000002,
60 /*! Dumps a very verbose debug log of the WindowServer to /tmp/CGLog_WinServer_<PID>. */
61 kCGSDebugOptionVerboseLogging = 0x80000006,
63 /*! Dumps a very verbose debug log of all processes to /tmp/CGLog_<NAME>_<PID>. */
64 kCGSDebugOptionVerboseLoggingAllApps = 0x80000007,
66 /*! Dumps a list of hotkeys to /tmp/WindowServer.keyinfo.out. */
67 kCGSDebugOptionDumpHotKeyListToFile = 0x8000000E,
69 /*! Dumps information about OpenGL extensions, etc to /tmp/WindowServer.glinfo.out. */
70 kCGSDebugOptionDumpOpenGLInfoToFile = 0x80000013,
72 /*! Dumps a list of shadows to /tmp/WindowServer.shinfo.out. */
73 kCGSDebugOptionDumpShadowListToFile = 0x80000014,
75 /*! Leopard: Dumps information about caches to `/tmp/WindowServer.scinfo.out`. */
76 kCGSDebugOptionDumpCacheInformationToFile = 0x80000015,
78 /*! Leopard: Purges some sort of cache - most likely the same caches dummped with `kCGSDebugOptionDumpCacheInformationToFile`. */
79 kCGSDebugOptionPurgeCaches = 0x80000016,
81 /*! Leopard: Dumps a list of windows to `/tmp/WindowServer.winfo.plist`. This is what Quartz Debug on 10.5 uses to get the window list. */
82 kCGSDebugOptionDumpWindowListToPlist = 0x80000017,
84 /*! Leopard: DOCUMENTATION PENDING */
85 kCGSDebugOptionEnableSurfacePurging = 0x8000001B,
87 // Leopard: 0x8000001C - invalid
89 /*! Leopard: DOCUMENTATION PENDING */
90 kCGSDebugOptionDisableSurfacePurging = 0x8000001D,
92 /*! Leopard: Dumps information about an application's resource usage to `/tmp/CGResources_<NAME>_<PID>`. */
93 kCGSDebugOptionDumpResourceUsageToFiles = 0x80000020,
95 // Leopard: 0x80000022 - something about QuartzGL?
97 // Leopard: Returns the magic mirror to its normal mode. The magic mirror is what the Dock uses to draw the screen reflection. For more information, see `CGSSetMagicMirror`. */
98 kCGSDebugOptionSetMagicMirrorModeNormal = 0x80000023,
100 /*! Leopard: Disables the magic mirror. It still appears but draws black instead of a reflection. */
101 kCGSDebugOptionSetMagicMirrorModeDisabled = 0x80000024,
107 /*! Gets and sets the debug options. These options are global and are not reset when your application dies! */
108 CG_EXTERN CGError CGSGetDebugOptions(int *outCurrentOptions);
109 CG_EXTERN CGError CGSSetDebugOptions(int options);
111 /*! Queries the server about its performance. This is how Quartz Debug gets the FPS meter, but not the CPU meter (for that it uses host_processor_info). Quartz Debug subtracts 25 so that it is at zero with the minimum FPS. */
112 CG_EXTERN CGError CGSGetPerformanceData(CGSConnectionID cid, float *outFPS, float *unk, float *unk2, float *unk3);