1 /*
2  *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
3  *Copyright (C) Colin Harrison 2005-2009
4  *
5  *Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  *"Software"), to deal in the Software without restriction, including
8  *without limitation the rights to use, copy, modify, merge, publish,
9  *distribute, sublicense, and/or sell copies of the Software, and to
10  *permit persons to whom the Software is furnished to do so, subject to
11  *the following conditions:
12  *
13  *The above copyright notice and this permission notice shall be
14  *included in all copies or substantial portions of the Software.
15  *
16  *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
20  *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21  *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  *Except as contained in this notice, the name of the XFree86 Project
25  *shall not be used in advertising or otherwise to promote the sale, use
26  *or other dealings in this Software without prior written authorization
27  *from the XFree86 Project.
28  *
29  * Authors:	Kensuke Matsuzaki
30  *              Colin Harrison
31  */
32 #if !defined(_WINWINDOW_H_)
33 #define _WINWINDOW_H_
34 
35 #ifndef NO
36 #define NO			0
37 #endif
38 #ifndef YES
39 #define YES			1
40 #endif
41 
42 /* Constant strings */
43 #ifndef PROJECT_NAME
44 #define PROJECT_NAME		"Cygwin/X"
45 #endif
46 #define EXECUTABLE_NAME         "XWin"
47 #define WINDOW_CLASS		"cygwin/x"
48 #define WINDOW_TITLE		PROJECT_NAME ":%s.%d"
49 #define WINDOW_TITLE_XDMCP	"%s:%s.%d"
50 #define WIN_SCR_PROP		"cyg_screen_prop rl"
51 #define WINDOW_CLASS_X		"cygwin/x X rl"
52 #define WINDOW_CLASS_X_MSG      "cygwin/x X msg"
53 #define WINDOW_TITLE_X		PROJECT_NAME " X"
54 #define WIN_WINDOW_PROP		"cyg_window_prop_rl"
55 #ifdef HAS_DEVWINDOWS
56 #define WIN_MSG_QUEUE_FNAME	"/dev/windows"
57 #endif
58 #define WIN_WID_PROP		"cyg_wid_prop_rl"
59 #define WIN_NEEDMANAGE_PROP	"cyg_override_redirect_prop_rl"
60 #ifndef CYGMULTIWINDOW_DEBUG
61 #define CYGMULTIWINDOW_DEBUG    NO
62 #endif
63 #ifndef CYGWINDOWING_DEBUG
64 #define CYGWINDOWING_DEBUG	NO
65 #endif
66 
67 #define XMING_SIGNATURE		0x12345678L
68 
69 typedef struct _winPrivScreenRec *winPrivScreenPtr;
70 
71 /*
72  * Window privates
73  */
74 
75 typedef struct {
76     DWORD dwDummy;
77     HRGN hRgn;
78     HWND hWnd;
79     winPrivScreenPtr pScreenPriv;
80     Bool fXKilled;
81     HDWP hDwp;
82 #ifdef XWIN_GLX_WINDOWS
83     Bool fWglUsed;
84 #endif
85 } winPrivWinRec, *winPrivWinPtr;
86 
87 typedef struct _winWMMessageRec {
88     DWORD dwID;
89     DWORD msg;
90     int iWindow;
91     HWND hwndWindow;
92     int iX, iY;
93     int iWidth, iHeight;
94 } winWMMessageRec, *winWMMessagePtr;
95 
96 /*
97  * winmultiwindowwm.c
98  */
99 
100 #define		WM_WM_MOVE		(WM_USER + 1)
101 #define		WM_WM_SIZE		(WM_USER + 2)
102 #define		WM_WM_RAISE		(WM_USER + 3)
103 #define		WM_WM_LOWER		(WM_USER + 4)
104 #define		WM_WM_UNMAP		(WM_USER + 6)
105 #define		WM_WM_KILL		(WM_USER + 7)
106 #define		WM_WM_ACTIVATE		(WM_USER + 8)
107 #define		WM_WM_NAME_EVENT	(WM_USER + 9)
108 #define		WM_WM_ICON_EVENT	(WM_USER + 10)
109 #define		WM_WM_CHANGE_STATE	(WM_USER + 11)
110 #define		WM_WM_MAP2		(WM_USER + 12)
111 #define		WM_WM_MAP3		(WM_USER + 13)
112 #define		WM_WM_HINTS_EVENT	(WM_USER + 14)
113 
114 #define		MwmHintsDecorations	(1L << 1)
115 
116 #define		MwmDecorAll		(1L << 0)
117 #define		MwmDecorBorder		(1L << 1)
118 #define		MwmDecorHandle		(1L << 2)
119 #define		MwmDecorTitle		(1L << 3)
120 #define		MwmDecorMenu		(1L << 4)
121 #define		MwmDecorMinimize	(1L << 5)
122 #define		MwmDecorMaximize	(1L << 6)
123 
124 /*
125   This structure only contains 3 elements.  The Motif 2.0 structure contains 5,
126   but we only need the first 3, so that is all we will define
127 
128   This structure represents xcb_get_property()'s view of the property as a
129   sequence of ints, rather than XGetWindowProperty()'s view of the property as a
130   sequence of arch-dependent longs.
131 */
132 typedef struct MwmHints {
133     unsigned int flags, functions, decorations;
134 } MwmHints;
135 
136 #define		PropMwmHintsElements	3
137 
138 void
139  winSendMessageToWM(void *pWMInfo, winWMMessagePtr msg);
140 
141 Bool
142 
143 winInitWM(void **ppWMInfo,
144           pthread_t * ptWMProc,
145           pthread_t * ptXMsgProc,
146           pthread_mutex_t * ppmServerStarted,
147           int dwScreen, HWND hwndScreen);
148 
149 void
150  winDeinitMultiWindowWM(void);
151 
152 void
153  winPropertyStoreInit(void);
154 
155 void
156  winPropertyStoreDestroy(void);
157 
158 void
159  winSetAppUserModelID(HWND hWnd, const char *AppID);
160 
161 void
162  winShowWindowOnTaskbar(HWND hWnd, Bool show);
163 
164 #endif
165