1/*
2 * WindowsWM extension is based on AppleWM extension
3 * Authors:	Kensuke Matsuzaki
4 */
5/**************************************************************************
6
7Copyright (c) 2002 Apple Computer, Inc.
8All Rights Reserved.
9
10Permission is hereby granted, free of charge, to any person obtaining a
11copy of this software and associated documentation files (the
12"Software"), to deal in the Software without restriction, including
13without limitation the rights to use, copy, modify, merge, publish,
14distribute, sub license, and/or sell copies of the Software, and to
15permit persons to whom the Software is furnished to do so, subject to
16the following conditions:
17
18The above copyright notice and this permission notice (including the
19next paragraph) shall be included in all copies or substantial portions
20of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30**************************************************************************/
31
32#ifndef _WINDOWSWM_H_
33#define _WINDOWSWM_H_
34
35#include <X11/Xfuncproto.h>
36
37#define X_WindowsWMQueryVersion		0
38#define X_WindowsWMFrameGetRect		1
39#define X_WindowsWMFrameDraw		2
40#define X_WindowsWMFrameSetTitle	3
41#define X_WindowsWMDisableUpdate	4
42#define X_WindowsWMReenableUpdate	5
43#define X_WindowsWMSelectInput		6
44#define X_WindowsWMSetFrontProcess	7
45
46/* Events */
47#define WindowsWMControllerNotify	0
48#define WindowsWMActivationNotify	1
49#define WindowsWMNumberEvents		2
50
51#define WindowsWMControllerNotifyMask	(1L << 0)
52#define WindowsWMActivationNotifyMask	(1L << 1)
53
54/* "Kinds" of ControllerNotify events */
55#define WindowsWMMinimizeWindow		0
56#define WindowsWMMaximizeWindow		1
57#define WindowsWMRestoreWindow		2
58#define WindowsWMCloseWindow		3
59#define WindowsWMBringAllToFront	4
60#define WindowsWMHideWindow		5
61#define WindowsWMMoveWindow		6
62#define WindowsWMResizeWindow		7
63#define WindowsWMActivateWindow		8
64
65/* "Kinds" of ActivationNotify events */
66#define WindowsWMIsActive		0
67#define WindowsWMIsInactive		1
68
69/* Errors */
70#define WindowsWMClientNotLocal		0
71#define WindowsWMOperationNotSupported	1
72#define WindowsWMNumberErrors		(WindowsWMOperationNotSupported + 1)
73
74/* Possible value for frame_rect argument to XWindowsWMFrameGetRect() */
75#define WindowsWMFrameRectTitleBar	1
76#define WindowsWMFrameRectTracking	2
77#define WindowsWMFrameRectGrowBox	3
78
79/* Window frame styles */
80#define WindowsWMFrameStyleBorder		0x800000
81#define WindowsWMFrameStyleCaption		0xc00000
82#define WindowsWMFrameStyleChild		0x40000000
83#define WindowsWMFrameStyleChildWindow		0x40000000
84#define WindowsWMFrameStyleClipChildren		0x2000000
85#define WindowsWMFrameStyleClipSiblings		0x4000000
86#define WindowsWMFrameStyleDisabled		0x8000000
87#define WindowsWMFrameStyleDlgFrame		0x400000
88#define WindowsWMFrameStyleGroup		0x20000
89#define WindowsWMFrameStyleHScroll		0x100000
90#define WindowsWMFrameStyleIconic		0x20000000
91#define WindowsWMFrameStyleMaximize		0x1000000
92#define WindowsWMFrameStyleMaximizeBox		0x10000
93#define WindowsWMFrameStyleMinimize		0x20000000
94#define WindowsWMFrameStyleMinimizeBox		0x20000
95#define WindowsWMFrameStyleOverlapped		0
96#define WindowsWMFrameStyleOverlappedWindow	0xcf0000
97#define WindowsWMFrameStylePopup		0x80000000
98#define WindowsWMFrameStylePopupWindow		0x80880000
99#define WindowsWMFrameStyleSizeBox		0x40000
100#define WindowsWMFrameStyleSysMenu		0x80000
101#define WindowsWMFrameStyleTabStop		0x10000
102#define WindowsWMFrameStyleThickFrame		0x40000
103#define WindowsWMFrameStyleTiled		0
104#define WindowsWMFrameStyleTiledWindow		0xcf0000
105#define WindowsWMFrameStyleVisible		0x10000000
106#define WindowsWMFrameStyleVScroll		0x200000
107
108/* Window frame Ex-styles */
109#define WindowsWMFrameStyleExAcceptFiles	16
110#define WindowsWMFrameStyleExAppWindow		0x40000
111#define WindowsWMFrameStyleExClientEdge		512
112#define WindowsWMFrameStyleExComposited		0x2000000
113#define WindowsWMFrameStyleExContextHelp	0x400
114#define WindowsWMFrameStyleExControlParent	0x10000
115#define WindowsWMFrameStyleExDlgModalFrame	1
116#define WindowsWMFrameStyleExLayered		0x80000
117#define WindowsWMFrameStyleExLayoutRtl		0x400000
118#define WindowsWMFrameStyleExLeft		0
119#define WindowsWMFrameStyleExLeftScrollBar	0x4000
120#define WindowsWMFrameStyleExLtrReading		0
121#define WindowsWMFrameStyleExMDIChild		64
122#define WindowsWMFrameStyleExNoActivate		0x8000000
123#define WindowsWMFrameStyleExNoInheritLayout	0x100000
124#define WindowsWMFrameStyleExNoParentNotify	4
125#define WindowsWMFrameStyleExOverlappedWindow	0x300
126#define WindowsWMFrameStyleExPaletteWindow	0x188
127#define WindowsWMFrameStyleExRight		0x1000
128#define WindowsWMFrameStyleExRightScrollBar	0
129#define WindowsWMFrameStyleExRtlReading		0x2000
130#define WindowsWMFrameStyleExStaticEdge		0x20000
131#define WindowsWMFrameStyleExToolWindow		128
132#define WindowsWMFrameStyleExTopMost		8
133#define WindowsWMFrameStyleExTransparent	32
134#define WindowsWMFrameStyleExWindowEdge		256
135
136#define WINDOWSWM_RAISE_ON_CLICK	"_WINDOWSWM_RAISE_ON_CLICK"
137#define WINDOWSWM_MOUSE_ACTIVATE	"_WINDOWSWM_MOUSE_ACTIVATE"
138#define WINDOWSWM_CLIENT_WINDOW		"_WINDOWSWM_CLIENT_WINDOW"
139#define WINDOWSWM_NATIVE_HWND		"_WINDOWSWM_NATIVE_HWND"
140
141#ifndef _WINDOWSWM_SERVER_
142
143typedef struct {
144    int	type;		    /* of event */
145    unsigned long serial;   /* # of last request processed by server */
146    Bool send_event;	    /* true if this came from a SendEvent request */
147    Display *display;	    /* Display the event was read from */
148    Window window;	    /* window of event */
149    Time time;		    /* server timestamp when event happened */
150    int kind;		    /* subtype of event */
151    int arg;
152    int x;
153    int y;
154    int w;
155    int h;
156} XWindowsWMNotifyEvent;
157
158_XFUNCPROTOBEGIN
159
160Bool XWindowsWMQueryExtension (Display *dpy, int *event_base, int *error_base);
161
162Bool XWindowsWMQueryVersion (Display *dpy, int *majorVersion,
163			     int *minorVersion, int *patchVersion);
164
165Bool XWindowsWMDisableUpdate (Display *dpy, int screen);
166
167Bool XWindowsWMReenableUpdate (Display *dpy, int screen);
168
169Bool XWindowsWMSelectInput (Display *dpy, unsigned long mask);
170
171Bool XWindowsWMSetFrontProcess (Display *dpy);
172
173Bool XWindowsWMFrameGetRect (Display *dpy,
174			     unsigned int frame_style,
175			     unsigned int frame_style_ex,
176			     unsigned int frame_rect,
177			     short inner_x, short inner_y,
178			     short inner_w, short inner_h,
179			     short *ret_x, short *ret_y,
180			     short *ret_w, short *ret_h);
181
182Bool XWindowsWMFrameDraw (Display *dpy, int screen, Window window,
183			  unsigned int frame_style,
184			  unsigned int frame_style_ex,
185			  short inner_x, short inner_y,
186			  short inner_w, short inner_h);
187
188Bool XWindowsWMFrameSetTitle (Display *dpy, int screen, Window window,
189			      unsigned int title_length,
190			      const char * title_bytes);
191
192_XFUNCPROTOEND
193
194#endif /* _WINDOWSWM_SERVER_ */
195#endif /* _WINDOWSWM_H_ */
196