1706f2543Smrg/* Copyright (c) 2008 Apple Inc.
2706f2543Smrg *
3706f2543Smrg * Permission is hereby granted, free of charge, to any person
4706f2543Smrg * obtaining a copy of this software and associated documentation files
5706f2543Smrg * (the "Software"), to deal in the Software without restriction,
6706f2543Smrg * including without limitation the rights to use, copy, modify, merge,
7706f2543Smrg * publish, distribute, sublicense, and/or sell copies of the Software,
8706f2543Smrg * and to permit persons to whom the Software is furnished to do so,
9706f2543Smrg * subject to the following conditions:
10706f2543Smrg *
11706f2543Smrg * The above copyright notice and this permission notice shall be
12706f2543Smrg * included in all copies or substantial portions of the Software.
13706f2543Smrg *
14706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15706f2543Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16706f2543Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17706f2543Smrg * NONINFRINGEMENT.  IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
18706f2543Smrg * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19706f2543Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20706f2543Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21706f2543Smrg * DEALINGS IN THE SOFTWARE.
22706f2543Smrg *
23706f2543Smrg * Except as contained in this notice, the name(s) of the above
24706f2543Smrg * copyright holders shall not be used in advertising or otherwise to
25706f2543Smrg * promote the sale, use or other dealings in this Software without
26706f2543Smrg * prior written authorization.
27706f2543Smrg */
28706f2543Smrg
29706f2543Smrg#ifdef HAVE_DIX_CONFIG_H
30706f2543Smrg#include <dix-config.h>
31706f2543Smrg#endif
32706f2543Smrg
33706f2543Smrg#include "xpr.h"
34706f2543Smrg
35706f2543Smrg#include   <X11/X.h>
36706f2543Smrg#include   <X11/Xmd.h>
37706f2543Smrg#include   <X11/Xproto.h>
38706f2543Smrg#include   "misc.h"
39706f2543Smrg#include   "windowstr.h"
40706f2543Smrg#include   "pixmapstr.h"
41706f2543Smrg#include   "inputstr.h"
42706f2543Smrg#include   "eventstr.h"
43706f2543Smrg#include   "mi.h"
44706f2543Smrg#include   "scrnintstr.h"
45706f2543Smrg#include   "mipointer.h"
46706f2543Smrg
47706f2543Smrg#include "darwin.h"
48706f2543Smrg#include "quartz.h"
49706f2543Smrg#include "quartzKeyboard.h"
50706f2543Smrg#include "darwinEvents.h"
51706f2543Smrg
52706f2543Smrg#include <sys/types.h>
53706f2543Smrg#include <sys/uio.h>
54706f2543Smrg#include <unistd.h>
55706f2543Smrg
56706f2543Smrg#include "rootlessWindow.h"
57706f2543Smrg#include "xprEvent.h"
58706f2543Smrg
59706f2543SmrgBool QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) {
60706f2543Smrg    TA_SERVER();
61706f2543Smrg
62706f2543Smrg    switch(e->subtype) {
63706f2543Smrg        case kXquartzWindowState:
64706f2543Smrg            DEBUG_LOG("kXquartzWindowState\n");
65706f2543Smrg            RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]),
66706f2543Smrg                                             e->data[1]);
67706f2543Smrg            return TRUE;
68706f2543Smrg
69706f2543Smrg        case kXquartzWindowMoved:
70706f2543Smrg            DEBUG_LOG("kXquartzWindowMoved\n");
71706f2543Smrg            RootlessNativeWindowMoved(xprGetXWindow(e->data[0]));
72706f2543Smrg            return TRUE;
73706f2543Smrg
74706f2543Smrg        case kXquartzBringAllToFront:
75706f2543Smrg            DEBUG_LOG("kXquartzBringAllToFront\n");
76706f2543Smrg            RootlessOrderAllWindows(e->data[0]);
77706f2543Smrg            return TRUE;
78706f2543Smrg        default:
79706f2543Smrg            return FALSE;
80706f2543Smrg    }
81706f2543Smrg}
82