135c4bbdfSmrg/* Copyright (c) 2008-2012 Apple Inc. 24642e01fSmrg * 34642e01fSmrg * Permission is hereby granted, free of charge, to any person 44642e01fSmrg * obtaining a copy of this software and associated documentation files 54642e01fSmrg * (the "Software"), to deal in the Software without restriction, 64642e01fSmrg * including without limitation the rights to use, copy, modify, merge, 74642e01fSmrg * publish, distribute, sublicense, and/or sell copies of the Software, 84642e01fSmrg * and to permit persons to whom the Software is furnished to do so, 94642e01fSmrg * subject to the following conditions: 104642e01fSmrg * 114642e01fSmrg * The above copyright notice and this permission notice shall be 124642e01fSmrg * included in all copies or substantial portions of the Software. 134642e01fSmrg * 144642e01fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 154642e01fSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 164642e01fSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 174642e01fSmrg * NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT 184642e01fSmrg * HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 194642e01fSmrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 204642e01fSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 214642e01fSmrg * DEALINGS IN THE SOFTWARE. 224642e01fSmrg * 234642e01fSmrg * Except as contained in this notice, the name(s) of the above 244642e01fSmrg * copyright holders shall not be used in advertising or otherwise to 254642e01fSmrg * promote the sale, use or other dealings in this Software without 264642e01fSmrg * prior written authorization. 274642e01fSmrg */ 284642e01fSmrg 294642e01fSmrg#ifdef HAVE_DIX_CONFIG_H 304642e01fSmrg#include <dix-config.h> 314642e01fSmrg#endif 324642e01fSmrg 334642e01fSmrg#include "xpr.h" 344642e01fSmrg 354642e01fSmrg#include <X11/X.h> 364642e01fSmrg#include <X11/Xmd.h> 374642e01fSmrg#include <X11/Xproto.h> 384642e01fSmrg#include "misc.h" 394642e01fSmrg#include "windowstr.h" 404642e01fSmrg#include "pixmapstr.h" 414642e01fSmrg#include "inputstr.h" 426747b715Smrg#include "eventstr.h" 434642e01fSmrg#include "mi.h" 444642e01fSmrg#include "scrnintstr.h" 454642e01fSmrg#include "mipointer.h" 464642e01fSmrg 474642e01fSmrg#include "quartz.h" 484642e01fSmrg#include "quartzKeyboard.h" 494642e01fSmrg#include "darwinEvents.h" 504642e01fSmrg 514642e01fSmrg#include <sys/types.h> 524642e01fSmrg#include <sys/uio.h> 534642e01fSmrg#include <unistd.h> 544642e01fSmrg 5535c4bbdfSmrg#include <dispatch/dispatch.h> 5635c4bbdfSmrg 574642e01fSmrg#include "rootlessWindow.h" 584642e01fSmrg#include "xprEvent.h" 594642e01fSmrg 6035c4bbdfSmrgBool 6135c4bbdfSmrgQuartzModeEventHandler(int screenNum, XQuartzEvent *e, DeviceIntPtr dev) 6235c4bbdfSmrg{ 6335c4bbdfSmrg switch (e->subtype) { 6435c4bbdfSmrg case kXquartzWindowState: 6535c4bbdfSmrg DEBUG_LOG("kXquartzWindowState\n"); 6635c4bbdfSmrg RootlessNativeWindowStateChanged(xprGetXWindow(e->data[0]), 6735c4bbdfSmrg e->data[1]); 6835c4bbdfSmrg return TRUE; 6935c4bbdfSmrg 7035c4bbdfSmrg case kXquartzWindowMoved: 7135c4bbdfSmrg DEBUG_LOG("kXquartzWindowMoved\n"); 7235c4bbdfSmrg RootlessNativeWindowMoved(xprGetXWindow(e->data[0])); 7335c4bbdfSmrg return TRUE; 7435c4bbdfSmrg 7535c4bbdfSmrg case kXquartzBringAllToFront: 7635c4bbdfSmrg DEBUG_LOG("kXquartzBringAllToFront\n"); 77c8548ba8Smrg dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 78c8548ba8Smrg xp_window_bring_all_to_front(); 79c8548ba8Smrg }); 8035c4bbdfSmrg 8135c4bbdfSmrg return TRUE; 8235c4bbdfSmrg 8335c4bbdfSmrg default: 8435c4bbdfSmrg return FALSE; 854642e01fSmrg } 864642e01fSmrg} 87