2 * Xplugin rootless implementation functions for AppleWM extension
4 * Copyright (c) 2002-2012 Apple Computer, Inc. All rights reserved.
5 * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
25 * Except as contained in this notice, the name(s) of the above copyright
26 * holders shall not be used in advertising or otherwise to promote the sale,
27 * use or other dealings in this Software without prior written authorization.
30 #ifdef HAVE_DIX_CONFIG_H
31 #include <dix-config.h>
36 #include <X11/extensions/applewmproto.h>
38 #include "applewmExt.h"
40 #include "rootlessCommon.h"
47 xprSetWindowLevel(WindowPtr pWin
, int level
)
51 RootlessWindowRec
*winRec
;
53 // AppleWMNumWindowLevels is allowed, but is only set by the server
54 // for the root window.
55 if (level
< 0 || level
>= AppleWMNumWindowLevels
) {
59 wid
= x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin
, TRUE
));
63 RootlessStopDrawing(pWin
, FALSE
);
64 winRec
= WINREC(pWin
);
69 if (XQuartzIsRootless
)
70 wc
.window_level
= normal_window_levels
[level
];
71 else if (XQuartzShieldingWindowLevel
)
72 wc
.window_level
= XQuartzShieldingWindowLevel
+ 1;
74 wc
.window_level
= rooted_window_levels
[level
];
76 if (xp_configure_window(wid
, XP_WINDOW_LEVEL
, &wc
) != Success
) {
80 winRec
->level
= level
;
85 #if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
87 xprAttachTransient(WindowPtr pWinChild
, WindowPtr pWinParent
)
89 xp_window_id child_wid
, parent_wid
;
92 child_wid
= x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinChild
, TRUE
));
98 x_cvt_vptr_to_uint(RootlessFrameForWindow(pWinParent
, TRUE
));
106 wc
.transient_for
= parent_wid
;
108 RootlessStopDrawing(pWinChild
, FALSE
);
110 if (xp_configure_window(child_wid
, XP_ATTACH_TRANSIENT
,
120 xprFrameDraw(WindowPtr pWin
,
121 xp_frame_class
class,
125 unsigned int title_len
,
126 const unsigned char *title_bytes
)
130 wid
= x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin
, FALSE
));
134 if (xp_frame_draw(wid
, class, attr
, outer
, inner
,
135 title_len
, title_bytes
) != Success
) {
142 static AppleWMProcsRec xprAppleWMProcs
= {
149 #if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 3
152 #elif defined(XPLUGIN_VERSION) && XPLUGIN_VERSION >= 2
164 AppleWMExtensionInit(&xprAppleWMProcs
);