2 * Cocoa rootless implementation functions for AppleWM extension
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.
29 /* $XFree86: xc/programs/Xserver/hw/darwin/quartz/xpr/xprFrame.c,v 1.2 2003/06/30 01:45:13 torrey Exp $ */
30 #ifdef HAVE_XORG_CONFIG_H
31 #include <xorg-config.h>
33 #include "quartz/quartzCommon.h"
34 #include "quartz/cr/cr.h"
40 #define _APPLEWM_SERVER_
41 #include "X11/extensions/applewm.h"
42 #include "quartz/applewmExt.h"
45 #define StdDocumentStyleMask (NSTitledWindowMask | \
46 NSClosableWindowMask | \
47 NSMiniaturizableWindowMask | \
48 NSResizableWindowMask)
64 static int CRSetWindowLevel(
70 crWinPtr = (CRWindowPtr) RootlessFrameForWindow(pWin, TRUE);
74 RootlessStopDrawing(pWin, FALSE);
76 [crWinPtr->window setLevel:level];
82 static int CRFrameGetRect(
93 static int CRFrameHitTest(
105 static int CRFrameDraw(
111 unsigned int title_len,
112 const unsigned char *title_bytes)
114 CRWindowPtr crWinPtr;
116 Bool hasResizeIndicator;
118 /* We assume the window has not yet been framed so
119 RootlessFrameForWindow() will cause it to be. Record the window
120 style so that the appropriate one will be used when it is framed.
121 If the window is already framed, we can't change the window
122 style and the following will have no effect. */
124 nextWindowToFrame = pWin;
125 if (class == AppleWMFrameClassDocument)
126 nextWindowStyle = StdDocumentStyleMask;
128 nextWindowStyle = NSBorderlessWindowMask;
130 crWinPtr = (CRWindowPtr) RootlessFrameForWindow(pWin, TRUE);
134 window = crWinPtr->window;
136 [window setTitle:[NSString stringWithCString:title_bytes
139 hasResizeIndicator = (attr & AppleWMFrameGrowBox) ? YES : NO;
140 [window setShowsResizeIndicator:hasResizeIndicator];
146 static AppleWMProcsRec crAppleWMProcs = {
156 void CRAppleWMInit(void)
158 AppleWMExtensionInit(&crAppleWMProcs);