First Revision (from Archive)
[~jspiros/WindowBlur.git] / CGSInternal / CGSNotifications.h
1 /*
2  * Copyright (C) 2007-2008 Alacatia Labs
3  * 
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  * 
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  * 
12  * 1. The origin of this software must not be misrepresented; you must not
13  *    claim that you wrote the original software. If you use this software
14  *    in a product, an acknowledgment in the product documentation would be
15  *    appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  *    misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  * 
20  * Joe Ranieri joe@alacatia.com
21  *
22  */
23
24 #pragma once
25 #include "CGSInternal.h"
26 #include "CGSTransitions.h"
27
28 typedef enum {
29         kCGSNotificationDebugOptionsChanged = 200,
30         
31         kCGSNotificationMouseMoved = 715,
32         
33         kCGSNotificationTrackingRegionEntered = 718,
34         kCGSNotificationTrackingRegionExited = 719,
35         
36         // 724 - keyboard preferences changed
37         
38         // 729, 730 seem to be process deactivated / activated - but only for this process
39         // 731 seems to be this process hidden or shown
40         
41         kCGSNotificationAppUnresponsive = 750,
42         kCGSNotificationAppResponsive = 751,
43         
44         // 761 - hotkey disabled
45         // 762 - hotkey enabled (do these two fire twice?)
46         
47         // 763 - hotkey begins editing
48         // 764 - hotkey ends editing
49         
50         // 765, 766 seem to be about the hotkey state (all disabled, etc)
51         
52         kCGSNotificationWorkspaceChanged = 1401,
53         
54         kCGSNotificationTransitionEnded = 1700,
55 } CGSNotificationType;
56
57 //! The data sent with kCGSNotificationAppUnresponsive and kCGSNotificationAppResponsive.
58 typedef struct {
59 #if __BIG_ENDIAN__
60         uint16_t majorVersion;
61         uint16_t minorVersion;
62 #else
63         uint16_t minorVersion;
64         uint16_t majorVersion;
65 #endif
66         
67         //! The length of the entire notification.
68         uint32_t length;        
69         
70         CGSConnectionID cid;
71         pid_t pid;
72         ProcessSerialNumber psn;
73 } CGSProcessNotificationData;
74
75 //! The data sent with kCGSNotificationDebugOptionsChanged.
76 typedef struct {
77         int newOptions;
78         int unknown[2]; // these two seem to be zero
79 } CGSDebugNotificationData;
80
81 //! The data sent with kCGSNotificationTransitionEnded
82 typedef struct {
83         CGSTransitionID transition;
84 } CGSTransitionNotificationData;
85
86
87 typedef void (*CGSNotifyProcPtr)(CGSNotificationType type, void *data, unsigned int dataLength, void *userData);
88
89 CG_EXTERN_C_BEGIN
90
91 //! Registers a function to receive notifications.
92 CG_EXTERN CGError CGSRegisterNotifyProc(CGSNotifyProcPtr proc, CGSNotificationType type, void *userData);
93
94 //! Unregisters a function that was registered to receive notifications.
95 CG_EXTERN CGError CGSRemoveNotifyProc(CGSNotifyProcPtr proc, CGSNotificationType type, void *userData);
96
97 CG_EXTERN_C_END