1*4882a593Smuzhiyun /* Copyright (c) 2008-2012 Apple Inc.
2*4882a593Smuzhiyun *
3*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person
4*4882a593Smuzhiyun * obtaining a copy of this software and associated documentation files
5*4882a593Smuzhiyun * (the "Software"), to deal in the Software without restriction,
6*4882a593Smuzhiyun * including without limitation the rights to use, copy, modify, merge,
7*4882a593Smuzhiyun * publish, distribute, sublicense, and/or sell copies of the Software,
8*4882a593Smuzhiyun * and to permit persons to whom the Software is furnished to do so,
9*4882a593Smuzhiyun * subject to the following conditions:
10*4882a593Smuzhiyun *
11*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be
12*4882a593Smuzhiyun * included in all copies or substantial portions of the Software.
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15*4882a593Smuzhiyun * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16*4882a593Smuzhiyun * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17*4882a593Smuzhiyun * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
18*4882a593Smuzhiyun * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19*4882a593Smuzhiyun * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20*4882a593Smuzhiyun * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21*4882a593Smuzhiyun * DEALINGS IN THE SOFTWARE.
22*4882a593Smuzhiyun *
23*4882a593Smuzhiyun * Except as contained in this notice, the name(s) of the above
24*4882a593Smuzhiyun * copyright holders shall not be used in advertising or otherwise to
25*4882a593Smuzhiyun * promote the sale, use or other dealings in this Software without
26*4882a593Smuzhiyun * prior written authorization.
27*4882a593Smuzhiyun */
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
30*4882a593Smuzhiyun #include <dix-config.h>
31*4882a593Smuzhiyun #endif
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun #include "xpr.h"
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun #include <X11/X.h>
36*4882a593Smuzhiyun #include <X11/Xmd.h>
37*4882a593Smuzhiyun #include <X11/Xproto.h>
38*4882a593Smuzhiyun #include "misc.h"
39*4882a593Smuzhiyun #include "windowstr.h"
40*4882a593Smuzhiyun #include "pixmapstr.h"
41*4882a593Smuzhiyun #include "inputstr.h"
42*4882a593Smuzhiyun #include "eventstr.h"
43*4882a593Smuzhiyun #include "mi.h"
44*4882a593Smuzhiyun #include "scrnintstr.h"
45*4882a593Smuzhiyun #include "mipointer.h"
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun #include "quartz.h"
48*4882a593Smuzhiyun #include "quartzKeyboard.h"
49*4882a593Smuzhiyun #include "darwinEvents.h"
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun #include <sys/types.h>
52*4882a593Smuzhiyun #include <sys/uio.h>
53*4882a593Smuzhiyun #include <unistd.h>
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun #include <dispatch/dispatch.h>
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun #include "rootlessWindow.h"
58*4882a593Smuzhiyun #include "xprEvent.h"
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun Bool
QuartzModeEventHandler(int screenNum,XQuartzEvent * e,DeviceIntPtr dev)61*4882a593Smuzhiyun QuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev)
62*4882a593Smuzhiyun {
63*4882a593Smuzhiyun switch (e->subtype) {
64*4882a593Smuzhiyun case kXquartzWindowState:
65*4882a593Smuzhiyun DEBUG_LOG("kXquartzWindowState\n");
66*4882a593Smuzhiyun RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]),
67*4882a593Smuzhiyun e->data[1]);
68*4882a593Smuzhiyun return TRUE;
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun case kXquartzWindowMoved:
71*4882a593Smuzhiyun DEBUG_LOG("kXquartzWindowMoved\n");
72*4882a593Smuzhiyun RootlessNativeWindowMoved(xprGetXWindow(e->data[0]));
73*4882a593Smuzhiyun return TRUE;
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun case kXquartzBringAllToFront:
76*4882a593Smuzhiyun DEBUG_LOG("kXquartzBringAllToFront\n");
77*4882a593Smuzhiyun dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
78*4882a593Smuzhiyun xp_window_bring_all_to_front();
79*4882a593Smuzhiyun });
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun return TRUE;
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun default:
84*4882a593Smuzhiyun return FALSE;
85*4882a593Smuzhiyun }
86*4882a593Smuzhiyun }
87