2003-11-14 16:54:54 +01:00
|
|
|
/************************************************************
|
|
|
|
|
|
|
|
Copyright 1987, 1998 The Open Group
|
|
|
|
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
the above copyright notice appear in all copies and that both that
|
|
|
|
copyright notice and this permission notice appear in supporting
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of The Open Group shall not be
|
|
|
|
used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
in this Software without prior written authorization from The Open Group.
|
|
|
|
|
|
|
|
|
|
|
|
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
2003-11-14 16:54:54 +01:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
2007-11-13 07:28:23 +01:00
|
|
|
both that copyright notice and this permission notice appear in
|
2003-11-14 16:54:54 +01:00
|
|
|
supporting documentation, and that the name of Digital not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
2007-11-13 07:28:23 +01:00
|
|
|
software without specific, written prior permission.
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
|
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
|
|
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
|
|
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
|
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
SOFTWARE.
|
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/* The panoramix components contained the following notice */
|
2004-04-23 21:54:30 +02:00
|
|
|
/*****************************************************************
|
|
|
|
|
|
|
|
Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
|
|
|
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
|
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of Digital Equipment Corporation
|
|
|
|
shall not be used in advertising or otherwise to promote the sale, use or other
|
|
|
|
dealings in this Software without prior written authorization from Digital
|
|
|
|
Equipment Corporation.
|
|
|
|
|
|
|
|
******************************************************************/
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-12-16 00:54:22 +01:00
|
|
|
/*
|
2010-12-04 01:32:01 +01:00
|
|
|
* Copyright (c) 2003-2005, Oracle and/or its affiliates. All rights reserved.
|
2009-12-16 00:54:22 +01:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2005-05-22 03:12:49 +02:00
|
|
|
|
2009-02-12 06:05:57 +01:00
|
|
|
/** @file events.c
|
2007-04-13 05:38:44 +02:00
|
|
|
* This file handles event delivery and a big part of the server-side protocol
|
|
|
|
* handling (the parts for input devices).
|
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "resource.h"
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/Xproto.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "windowstr.h"
|
|
|
|
#include "inputstr.h"
|
2011-05-15 01:23:59 +02:00
|
|
|
#include "inpututils.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "cursorstr.h"
|
|
|
|
|
|
|
|
#include "dixstruct.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
#include "panoramiX.h"
|
|
|
|
#include "panoramiXsrv.h"
|
|
|
|
#endif
|
|
|
|
#include "globals.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-07-20 22:39:54 +02:00
|
|
|
#include <X11/extensions/XKBproto.h>
|
2008-03-18 09:05:57 +01:00
|
|
|
#include "xkbsrv.h"
|
2004-05-05 22:04:52 +02:00
|
|
|
#include "xace.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-11-03 21:54:43 +01:00
|
|
|
#ifdef XSERVER_DTRACE
|
|
|
|
#include <sys/types.h>
|
|
|
|
typedef const char *string;
|
|
|
|
#include "Xserver-dtrace.h"
|
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/extensions/XIproto.h>
|
2009-03-12 02:46:07 +01:00
|
|
|
#include <X11/extensions/XI2proto.h>
|
2007-05-14 03:12:03 +02:00
|
|
|
#include <X11/extensions/XI.h>
|
2009-03-06 13:27:54 +01:00
|
|
|
#include <X11/extensions/XI2.h>
|
2006-07-19 19:56:23 +02:00
|
|
|
#include "exglobals.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "exevents.h"
|
|
|
|
#include "extnsionst.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "dixevents.h"
|
|
|
|
#include "dixgrabs.h"
|
|
|
|
#include "dispatch.h"
|
2007-04-30 05:27:42 +02:00
|
|
|
|
|
|
|
#include <X11/extensions/ge.h>
|
|
|
|
#include "geext.h"
|
|
|
|
#include "geint.h"
|
|
|
|
|
2009-07-27 08:54:33 +02:00
|
|
|
#include "eventstr.h"
|
2008-11-14 06:18:56 +01:00
|
|
|
#include "enterleave.h"
|
2009-02-01 00:58:15 +01:00
|
|
|
#include "eventconvert.h"
|
2008-11-14 06:18:56 +01:00
|
|
|
|
2009-02-12 06:05:57 +01:00
|
|
|
/* Extension events type numbering starts at EXTENSION_EVENT_BASE. */
|
2003-11-14 16:54:54 +01:00
|
|
|
#define NoSuchEvent 0x80000000 /* so doesn't match NoEventMask */
|
|
|
|
#define StructureAndSubMask ( StructureNotifyMask | SubstructureNotifyMask )
|
|
|
|
#define AllButtonsMask ( \
|
|
|
|
Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
|
|
|
|
#define MotionMask ( \
|
|
|
|
PointerMotionMask | Button1MotionMask | \
|
|
|
|
Button2MotionMask | Button3MotionMask | Button4MotionMask | \
|
|
|
|
Button5MotionMask | ButtonMotionMask )
|
|
|
|
#define PropagateMask ( \
|
|
|
|
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
|
|
|
|
MotionMask )
|
|
|
|
#define PointerGrabMask ( \
|
|
|
|
ButtonPressMask | ButtonReleaseMask | \
|
|
|
|
EnterWindowMask | LeaveWindowMask | \
|
|
|
|
PointerMotionHintMask | KeymapStateMask | \
|
|
|
|
MotionMask )
|
|
|
|
#define AllModifiersMask ( \
|
|
|
|
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
|
|
|
Mod3Mask | Mod4Mask | Mod5Mask )
|
2009-02-12 05:29:23 +01:00
|
|
|
#define LastEventMask OwnerGrabButtonMask
|
|
|
|
#define AllEventMasks (LastEventMask|(LastEventMask-1))
|
2007-06-19 03:58:07 +02:00
|
|
|
|
2009-02-12 07:07:15 +01:00
|
|
|
|
2011-05-11 05:35:39 +02:00
|
|
|
/* @return the core event type or 0 if the event is not a core event */
|
|
|
|
static inline int
|
|
|
|
core_get_type(const xEvent *event)
|
|
|
|
{
|
|
|
|
int type = event->u.u.type;
|
|
|
|
|
|
|
|
return ((type & EXTENSION_EVENT_BASE) || type == GenericEvent) ? 0 : type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* @return the XI2 event type or 0 if the event is not a XI2 event */
|
|
|
|
static inline int
|
|
|
|
xi2_get_type(const xEvent *event)
|
|
|
|
{
|
2011-12-13 01:49:32 +01:00
|
|
|
const xGenericEvent* e = (const xGenericEvent*)event;
|
2011-05-11 05:35:39 +02:00
|
|
|
|
|
|
|
return (e->type != GenericEvent || e->extension != IReqCode) ? 0 : e->evtype;
|
|
|
|
}
|
2009-03-12 02:46:07 +01:00
|
|
|
|
2007-06-19 03:58:07 +02:00
|
|
|
/**
|
|
|
|
* Used to indicate a implicit passive grab created by a ButtonPress event.
|
|
|
|
* See DeliverEventsToWindow().
|
|
|
|
*/
|
|
|
|
#define ImplicitGrabMask (1 << 7)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#define XE_KBPTR (xE->u.keyButtonPointer)
|
|
|
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
CallbackListPtr EventCallback;
|
|
|
|
CallbackListPtr DeviceEventCallback;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
#define DNPMCOUNT 8
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Mask DontPropagateMasks[DNPMCOUNT];
|
2003-11-14 16:54:54 +01:00
|
|
|
static int DontPropagateRefCnts[DNPMCOUNT];
|
|
|
|
|
2009-01-30 07:09:23 +01:00
|
|
|
static void CheckVirtualMotion( DeviceIntPtr pDev, QdEventPtr qe, WindowPtr pWin);
|
2009-01-30 07:25:22 +01:00
|
|
|
static void CheckPhysLimits(DeviceIntPtr pDev,
|
|
|
|
CursorPtr cursor,
|
|
|
|
Bool generateEvents,
|
|
|
|
Bool confineToScreen,
|
|
|
|
ScreenPtr pScreen);
|
2007-11-09 02:03:27 +01:00
|
|
|
|
2009-08-21 08:38:53 +02:00
|
|
|
/** Key repeat hack. Do not use but in TryClientEvents */
|
|
|
|
extern BOOL EventIsKeyRepeat(xEvent *event);
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2007-11-13 07:28:23 +01:00
|
|
|
* Main input device struct.
|
|
|
|
* inputInfo.pointer
|
2007-04-13 05:38:44 +02:00
|
|
|
* is the core pointer. Referred to as "virtual core pointer", "VCP",
|
2008-11-28 02:29:06 +01:00
|
|
|
* "core pointer" or inputInfo.pointer. The VCP is the first master
|
2007-12-04 09:39:37 +01:00
|
|
|
* pointer device and cannot be deleted.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* inputInfo.keyboard
|
|
|
|
* is the core keyboard ("virtual core keyboard", "VCK", "core keyboard").
|
|
|
|
* See inputInfo.pointer.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* inputInfo.devices
|
2007-12-04 09:39:37 +01:00
|
|
|
* linked list containing all devices including VCP and VCK.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* inputInfo.off_devices
|
|
|
|
* Devices that have not been initialized and are thus turned off.
|
|
|
|
*
|
|
|
|
* inputInfo.numDevices
|
2007-12-04 09:39:37 +01:00
|
|
|
* Total number of devices.
|
2009-06-01 07:37:53 +02:00
|
|
|
*
|
|
|
|
* inputInfo.all_devices
|
|
|
|
* Virtual device used for XIAllDevices passive grabs. This device is
|
|
|
|
* not part of the inputInfo.devices list and mostly unset except for
|
|
|
|
* the deviceid. It exists because passivegrabs need a valid device
|
|
|
|
* reference.
|
|
|
|
*
|
|
|
|
* inputInfo.all_master_devices
|
|
|
|
* Virtual device used for XIAllMasterDevices passive grabs. This device
|
|
|
|
* is not part of the inputInfo.devices list and mostly unset except for
|
|
|
|
* the deviceid. It exists because passivegrabs need a valid device
|
|
|
|
* reference.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
InputInfo inputInfo;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-03-11 13:19:04 +01:00
|
|
|
EventSyncInfoRec syncEvents;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-02-12 06:05:57 +01:00
|
|
|
/**
|
|
|
|
* The root window the given device is currently on.
|
|
|
|
*/
|
2010-12-27 14:06:03 +01:00
|
|
|
#define RootWindow(sprite) sprite->spriteTrace[0]
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-04-30 05:27:42 +02:00
|
|
|
static xEvent* swapEvent = NULL;
|
|
|
|
static int swapEventLen = 0;
|
|
|
|
|
2009-04-22 05:26:40 +02:00
|
|
|
void
|
|
|
|
NotImplemented(xEvent *from, xEvent *to)
|
|
|
|
{
|
|
|
|
FatalError("Not implemented");
|
|
|
|
}
|
|
|
|
|
2007-09-28 11:16:41 +02:00
|
|
|
/**
|
|
|
|
* Convert the given event type from an XI event to a core event.
|
2009-02-12 06:05:57 +01:00
|
|
|
* @param[in] The XI 1.x event type.
|
2007-09-28 11:16:41 +02:00
|
|
|
* @return The matching core event type or 0 if there is none.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-09-28 11:16:41 +02:00
|
|
|
XItoCoreType(int xitype)
|
|
|
|
{
|
|
|
|
int coretype = 0;
|
|
|
|
if (xitype == DeviceMotionNotify)
|
|
|
|
coretype = MotionNotify;
|
|
|
|
else if (xitype == DeviceButtonPress)
|
|
|
|
coretype = ButtonPress;
|
|
|
|
else if (xitype == DeviceButtonRelease)
|
|
|
|
coretype = ButtonRelease;
|
|
|
|
else if (xitype == DeviceKeyPress)
|
|
|
|
coretype = KeyPress;
|
|
|
|
else if (xitype == DeviceKeyRelease)
|
|
|
|
coretype = KeyRelease;
|
2008-01-15 09:45:09 +01:00
|
|
|
|
2007-09-28 11:16:41 +02:00
|
|
|
return coretype;
|
|
|
|
}
|
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
/**
|
2009-02-12 06:05:57 +01:00
|
|
|
* @return true if the device owns a cursor, false if device shares a cursor
|
|
|
|
* sprite with another device.
|
2006-11-23 07:45:14 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2007-11-13 07:28:23 +01:00
|
|
|
DevHasCursor(DeviceIntPtr pDev)
|
2006-11-23 07:45:14 +01:00
|
|
|
{
|
2007-10-16 07:37:31 +02:00
|
|
|
return pDev->spriteInfo->spriteOwner;
|
2006-11-23 07:45:14 +01:00
|
|
|
}
|
|
|
|
|
2007-03-16 06:22:24 +01:00
|
|
|
/*
|
2009-02-12 06:05:57 +01:00
|
|
|
* @return true if a device is a pointer, check is the same as used by XI to
|
2007-03-16 06:22:24 +01:00
|
|
|
* fill the 'use' field.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2007-03-16 06:22:24 +01:00
|
|
|
IsPointerDevice(DeviceIntPtr dev)
|
|
|
|
{
|
2009-10-13 05:15:05 +02:00
|
|
|
return (dev->type == MASTER_POINTER) ||
|
|
|
|
(dev->valuator && dev->button) ||
|
|
|
|
(dev->valuator && !dev->key);
|
2007-03-16 06:22:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2009-02-12 06:05:57 +01:00
|
|
|
* @return true if a device is a keyboard, check is the same as used by XI to
|
2007-03-16 06:22:24 +01:00
|
|
|
* fill the 'use' field.
|
2008-04-10 02:29:45 +02:00
|
|
|
*
|
|
|
|
* Some pointer devices have keys as well (e.g. multimedia keys). Try to not
|
|
|
|
* count them as keyboard devices.
|
2007-03-16 06:22:24 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2007-03-16 06:22:24 +01:00
|
|
|
IsKeyboardDevice(DeviceIntPtr dev)
|
|
|
|
{
|
2009-05-20 07:28:16 +02:00
|
|
|
return (dev->type == MASTER_KEYBOARD) ||
|
|
|
|
((dev->key && dev->kbdfeed) && !IsPointerDevice(dev));
|
|
|
|
}
|
|
|
|
|
|
|
|
Bool
|
|
|
|
IsMaster(DeviceIntPtr dev)
|
|
|
|
{
|
2010-06-06 16:18:40 +02:00
|
|
|
return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
|
2007-03-16 06:22:24 +01:00
|
|
|
}
|
|
|
|
|
2011-02-11 03:19:26 +01:00
|
|
|
Bool
|
|
|
|
IsFloating(DeviceIntPtr dev)
|
|
|
|
{
|
|
|
|
return GetMaster(dev, MASTER_KEYBOARD) == NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Max event opcode.
|
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
extern int lastEvent;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
extern int DeviceMotionNotify;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-02-11 07:06:36 +01:00
|
|
|
#define CantBeFiltered NoEventMask
|
2007-12-04 09:37:46 +01:00
|
|
|
/**
|
2009-02-11 07:06:36 +01:00
|
|
|
* Event masks for each event type.
|
|
|
|
*
|
2011-04-23 07:19:39 +02:00
|
|
|
* One set of filters for each device, initialized by memcpy of
|
|
|
|
* default_filter in InitEvents.
|
2009-02-11 07:06:36 +01:00
|
|
|
*
|
|
|
|
* Filters are used whether a given event may be delivered to a client,
|
|
|
|
* usually in the form of if (window-event-mask & filter); then deliver event.
|
|
|
|
*
|
|
|
|
* One notable filter is for PointerMotion/DevicePointerMotion events. Each
|
|
|
|
* time a button is pressed, the filter is modified to also contain the
|
|
|
|
* matching ButtonXMotion mask.
|
2007-12-04 09:37:46 +01:00
|
|
|
*/
|
2011-12-10 22:31:43 +01:00
|
|
|
Mask event_filters[MAXDEVICES][MAXEVENTS];
|
2011-04-23 07:19:39 +02:00
|
|
|
|
2011-12-10 22:31:43 +01:00
|
|
|
static const Mask default_filter[MAXEVENTS] =
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
NoSuchEvent, /* 0 */
|
|
|
|
NoSuchEvent, /* 1 */
|
|
|
|
KeyPressMask, /* KeyPress */
|
|
|
|
KeyReleaseMask, /* KeyRelease */
|
|
|
|
ButtonPressMask, /* ButtonPress */
|
|
|
|
ButtonReleaseMask, /* ButtonRelease */
|
|
|
|
PointerMotionMask, /* MotionNotify (initial state) */
|
|
|
|
EnterWindowMask, /* EnterNotify */
|
|
|
|
LeaveWindowMask, /* LeaveNotify */
|
|
|
|
FocusChangeMask, /* FocusIn */
|
|
|
|
FocusChangeMask, /* FocusOut */
|
|
|
|
KeymapStateMask, /* KeymapNotify */
|
|
|
|
ExposureMask, /* Expose */
|
|
|
|
CantBeFiltered, /* GraphicsExpose */
|
|
|
|
CantBeFiltered, /* NoExpose */
|
|
|
|
VisibilityChangeMask, /* VisibilityNotify */
|
|
|
|
SubstructureNotifyMask, /* CreateNotify */
|
|
|
|
StructureAndSubMask, /* DestroyNotify */
|
|
|
|
StructureAndSubMask, /* UnmapNotify */
|
|
|
|
StructureAndSubMask, /* MapNotify */
|
|
|
|
SubstructureRedirectMask, /* MapRequest */
|
|
|
|
StructureAndSubMask, /* ReparentNotify */
|
|
|
|
StructureAndSubMask, /* ConfigureNotify */
|
|
|
|
SubstructureRedirectMask, /* ConfigureRequest */
|
|
|
|
StructureAndSubMask, /* GravityNotify */
|
|
|
|
ResizeRedirectMask, /* ResizeRequest */
|
|
|
|
StructureAndSubMask, /* CirculateNotify */
|
|
|
|
SubstructureRedirectMask, /* CirculateRequest */
|
|
|
|
PropertyChangeMask, /* PropertyNotify */
|
|
|
|
CantBeFiltered, /* SelectionClear */
|
|
|
|
CantBeFiltered, /* SelectionRequest */
|
|
|
|
CantBeFiltered, /* SelectionNotify */
|
|
|
|
ColormapChangeMask, /* ColormapNotify */
|
|
|
|
CantBeFiltered, /* ClientMessage */
|
|
|
|
CantBeFiltered /* MappingNotify */
|
2011-04-23 07:19:39 +02:00
|
|
|
};
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-02-13 07:42:02 +01:00
|
|
|
/**
|
|
|
|
* For the given event, return the matching event filter. This filter may then
|
|
|
|
* be AND'ed with the selected event mask.
|
|
|
|
*
|
2009-03-06 05:45:26 +01:00
|
|
|
* For XI2 events, the returned filter is simply the byte containing the event
|
|
|
|
* mask we're interested in. E.g. for a mask of (1 << 13), this would be
|
|
|
|
* byte[1].
|
|
|
|
*
|
2009-02-13 07:42:02 +01:00
|
|
|
* @param[in] dev The device the event belongs to, may be NULL.
|
|
|
|
* @param[in] event The event to get the filter for. Only the type of the
|
|
|
|
* event matters, or the extension + evtype for GenericEvents.
|
|
|
|
* @return The filter mask for the given event.
|
2009-03-06 05:45:26 +01:00
|
|
|
*
|
|
|
|
* @see GetEventMask
|
2009-02-13 07:42:02 +01:00
|
|
|
*/
|
2009-03-10 07:08:14 +01:00
|
|
|
Mask
|
2009-02-13 07:42:02 +01:00
|
|
|
GetEventFilter(DeviceIntPtr dev, xEvent *event)
|
|
|
|
{
|
2011-05-11 05:35:39 +02:00
|
|
|
int evtype = 0;
|
|
|
|
|
2009-02-13 07:42:02 +01:00
|
|
|
if (event->u.u.type != GenericEvent)
|
2011-12-09 09:38:53 +01:00
|
|
|
return event_get_filter_from_type(dev, event->u.u.type);
|
2011-05-11 05:35:39 +02:00
|
|
|
else if ((evtype = xi2_get_type(event)))
|
2011-12-09 09:38:53 +01:00
|
|
|
return event_get_filter_from_xi2type(evtype);
|
2011-05-31 06:48:33 +02:00
|
|
|
ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type);
|
2009-02-13 07:42:02 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-08-11 02:57:05 +02:00
|
|
|
/**
|
|
|
|
* Return the single byte of the device's XI2 mask that contains the mask
|
|
|
|
* for the event_type.
|
|
|
|
*/
|
2011-10-28 04:55:55 +02:00
|
|
|
int
|
2011-11-04 02:29:01 +01:00
|
|
|
GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type)
|
2011-08-11 02:57:05 +02:00
|
|
|
{
|
2011-11-04 02:29:01 +01:00
|
|
|
/* we just return the matching filter because that's the only use
|
|
|
|
* for this mask anyway.
|
|
|
|
*/
|
|
|
|
if (xi2mask_isset(mask, dev, event_type))
|
2011-12-09 09:38:53 +01:00
|
|
|
return event_get_filter_from_xi2type(event_type);
|
2011-11-04 02:29:01 +01:00
|
|
|
else
|
|
|
|
return 0;
|
2011-08-11 02:57:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-11 00:01:12 +01:00
|
|
|
/**
|
2011-11-03 05:54:06 +01:00
|
|
|
* @return TRUE if the mask is set for this event from this device on the
|
|
|
|
* window, or FALSE otherwise.
|
2009-03-11 00:01:12 +01:00
|
|
|
*/
|
2011-11-03 05:54:06 +01:00
|
|
|
Bool
|
|
|
|
WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev)
|
2009-03-11 00:01:12 +01:00
|
|
|
{
|
|
|
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
|
|
|
int evtype;
|
|
|
|
|
2011-05-11 05:35:39 +02:00
|
|
|
if (!inputMasks || xi2_get_type(ev) == 0)
|
2009-03-11 00:01:12 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
evtype = ((xGenericEvent*)ev)->evtype;
|
|
|
|
|
2011-11-04 02:29:01 +01:00
|
|
|
return xi2mask_isset(inputMasks->xi2mask, dev, evtype);
|
2009-03-11 00:01:12 +01:00
|
|
|
}
|
2007-05-02 06:20:09 +02:00
|
|
|
|
2010-12-28 13:15:28 +01:00
|
|
|
Mask
|
2009-03-06 05:45:26 +01:00
|
|
|
GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other)
|
|
|
|
{
|
2011-05-11 05:35:39 +02:00
|
|
|
int evtype;
|
|
|
|
|
2009-03-06 05:45:26 +01:00
|
|
|
/* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */
|
2011-05-11 05:35:39 +02:00
|
|
|
if ((evtype = xi2_get_type(event)))
|
2009-03-06 05:45:26 +01:00
|
|
|
{
|
2011-08-11 02:57:05 +02:00
|
|
|
return GetXI2MaskByte(other->xi2mask, dev, evtype);
|
2011-05-11 05:35:39 +02:00
|
|
|
} else if (core_get_type(event) != 0)
|
2009-05-07 08:52:31 +02:00
|
|
|
return other->mask[XIAllDevices];
|
2009-03-06 05:45:26 +01:00
|
|
|
else
|
|
|
|
return other->mask[dev->id];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
static CARD8 criticalEvents[32] =
|
|
|
|
{
|
2008-07-18 05:10:11 +02:00
|
|
|
0x7c, 0x30, 0x40 /* key, button, expose, and configure events */
|
2003-11-14 16:54:54 +01:00
|
|
|
};
|
|
|
|
|
2009-01-30 07:46:27 +01:00
|
|
|
static void
|
|
|
|
SyntheticMotion(DeviceIntPtr dev, int x, int y) {
|
|
|
|
int screenno = 0;
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
2009-01-30 07:46:27 +01:00
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
screenno = dev->spriteInfo->sprite->screen->myNum;
|
|
|
|
#endif
|
|
|
|
PostSyntheticMotion(dev, x, y, screenno,
|
|
|
|
(syncEvents.playingEvents) ? syncEvents.time.milliseconds : currentTime.milliseconds);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:46:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static void PostNewCursor(DeviceIntPtr pDev);
|
2006-10-23 01:48:30 +02:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static Bool
|
|
|
|
XineramaSetCursorPosition(
|
2006-11-23 07:45:14 +01:00
|
|
|
DeviceIntPtr pDev,
|
2007-11-13 07:28:23 +01:00
|
|
|
int x,
|
|
|
|
int y,
|
2003-11-14 17:49:22 +01:00
|
|
|
Bool generateEvent
|
|
|
|
){
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
int i;
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
/* x,y are in Screen 0 coordinates. We need to decide what Screen
|
2007-11-13 07:28:23 +01:00
|
|
|
to send the message too and what the coordinates relative to
|
2003-11-14 17:49:22 +01:00
|
|
|
that screen are. */
|
|
|
|
|
2006-11-23 07:45:14 +01:00
|
|
|
pScreen = pSprite->screen;
|
2010-05-23 19:11:47 +02:00
|
|
|
x += screenInfo.screens[0]->x;
|
|
|
|
y += screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2011-08-30 22:58:04 +02:00
|
|
|
if(!point_on_screen(pScreen, x, y))
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
FOR_NSCREENS(i)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
if(i == pScreen->myNum)
|
2003-11-14 17:49:22 +01:00
|
|
|
continue;
|
2011-08-30 22:58:04 +02:00
|
|
|
if(point_on_screen(screenInfo.screens[i], x, y))
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
pScreen = screenInfo.screens[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-23 07:45:14 +01:00
|
|
|
pSprite->screen = pScreen;
|
2010-05-23 19:11:47 +02:00
|
|
|
pSprite->hotPhys.x = x - screenInfo.screens[0]->x;
|
|
|
|
pSprite->hotPhys.y = y - screenInfo.screens[0]->y;
|
|
|
|
x -= pScreen->x;
|
|
|
|
y -= pScreen->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2006-11-23 07:45:14 +01:00
|
|
|
return (*pScreen->SetCursorPosition)(pDev, pScreen, x, y, generateEvent);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2006-11-22 05:57:16 +01:00
|
|
|
XineramaConstrainCursor(DeviceIntPtr pDev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2006-11-22 05:57:16 +01:00
|
|
|
ScreenPtr pScreen;
|
|
|
|
BoxRec newBox;
|
|
|
|
|
|
|
|
pScreen = pSprite->screen;
|
|
|
|
newBox = pSprite->physLimits;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
/* Translate the constraining box to the screen
|
|
|
|
the sprite is actually on */
|
2010-05-23 19:11:47 +02:00
|
|
|
newBox.x1 += screenInfo.screens[0]->x - pScreen->x;
|
|
|
|
newBox.x2 += screenInfo.screens[0]->x - pScreen->x;
|
|
|
|
newBox.y1 += screenInfo.screens[0]->y - pScreen->y;
|
|
|
|
newBox.y2 += screenInfo.screens[0]->y - pScreen->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2006-11-22 05:57:16 +01:00
|
|
|
(* pScreen->ConstrainCursor)(pDev, pScreen, &newBox);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
static Bool
|
2006-12-11 08:39:59 +01:00
|
|
|
XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2006-12-11 08:39:59 +01:00
|
|
|
|
2010-05-22 09:26:28 +02:00
|
|
|
if(pWin == screenInfo.screens[0]->root) {
|
|
|
|
int i;
|
2011-03-09 06:01:20 +01:00
|
|
|
FOR_NSCREENS(i)
|
2010-05-22 09:26:28 +02:00
|
|
|
pSprite->windows[i] = screenInfo.screens[i]->root;
|
2003-11-14 17:49:22 +01:00
|
|
|
} else {
|
|
|
|
PanoramiXRes *win;
|
2009-04-29 07:04:37 +02:00
|
|
|
int rc, i;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&win, pWin->drawable.id,
|
|
|
|
XRT_WINDOW, serverClient, DixReadAccess);
|
|
|
|
if (rc != Success)
|
2003-11-14 17:49:22 +01:00
|
|
|
return FALSE;
|
|
|
|
|
2011-03-09 06:01:20 +01:00
|
|
|
FOR_NSCREENS(i) {
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupWindow(pSprite->windows + i, win->info[i].id,
|
|
|
|
serverClient, DixReadAccess);
|
|
|
|
if (rc != Success) /* window is being unmapped */
|
2003-11-14 17:49:22 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-11-13 07:28:23 +01:00
|
|
|
XineramaConfineCursorToWindow(DeviceIntPtr pDev,
|
|
|
|
WindowPtr pWin,
|
2006-12-11 08:39:59 +01:00
|
|
|
Bool generateEvents)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:14:54 +01:00
|
|
|
int x, y, off_x, off_y, i;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:14:54 +01:00
|
|
|
if(!XineramaSetWindowPntrs(pDev, pWin))
|
|
|
|
return;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:14:54 +01:00
|
|
|
i = PanoramiXNumScreens - 1;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionCopy(&pSprite->Reg1,
|
2009-01-30 07:14:54 +01:00
|
|
|
&pSprite->windows[i]->borderSize);
|
2010-05-23 19:11:47 +02:00
|
|
|
off_x = screenInfo.screens[i]->x;
|
|
|
|
off_y = screenInfo.screens[i]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:14:54 +01:00
|
|
|
while(i--) {
|
2010-05-23 19:11:47 +02:00
|
|
|
x = off_x - screenInfo.screens[i]->x;
|
|
|
|
y = off_y - screenInfo.screens[i]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:14:54 +01:00
|
|
|
if(x || y)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionTranslate(&pSprite->Reg1, x, y);
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUnion(&pSprite->Reg1, &pSprite->Reg1,
|
2009-01-30 07:14:54 +01:00
|
|
|
&pSprite->windows[i]->borderSize);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-23 19:11:47 +02:00
|
|
|
off_x = screenInfo.screens[i]->x;
|
|
|
|
off_y = screenInfo.screens[i]->y;
|
2009-01-30 07:14:54 +01:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
pSprite->hotLimits = *RegionExtents(&pSprite->Reg1);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if(RegionNumRects(&pSprite->Reg1) > 1)
|
2009-01-30 07:14:54 +01:00
|
|
|
pSprite->hotShape = &pSprite->Reg1;
|
|
|
|
else
|
|
|
|
pSprite->hotShape = NullRegion;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2009-01-30 07:14:54 +01:00
|
|
|
pSprite->confined = FALSE;
|
2010-05-22 09:26:28 +02:00
|
|
|
pSprite->confineWin = (pWin == screenInfo.screens[0]->root) ? NullWindow : pWin;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-01-30 07:25:22 +01:00
|
|
|
CheckPhysLimits(pDev, pSprite->current, generateEvents, FALSE, NULL);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* PANORAMIX */
|
|
|
|
|
2009-02-12 04:38:34 +01:00
|
|
|
/**
|
|
|
|
* Modifies the filter for the given protocol event type to the given masks.
|
|
|
|
*
|
|
|
|
* There's only two callers: UpdateDeviceState() and XI's SetMaskForExtEvent().
|
|
|
|
* The latter initialises masks for the matching XI events, it's a once-off
|
|
|
|
* setting.
|
|
|
|
* UDS however changes the mask for MotionNotify and DeviceMotionNotify each
|
|
|
|
* time a button is pressed to include the matching ButtonXMotion mask in the
|
|
|
|
* filter.
|
|
|
|
*
|
|
|
|
* @param[in] deviceid The device to modify the filter for.
|
|
|
|
* @param[in] mask The new filter mask.
|
|
|
|
* @param[in] event Protocol event type.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-12-04 09:37:46 +01:00
|
|
|
SetMaskForEvent(int deviceid, Mask mask, int event)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-05-01 03:49:06 +02:00
|
|
|
if (deviceid < 0 || deviceid >= MAXDEVICES)
|
2007-12-04 09:37:46 +01:00
|
|
|
FatalError("SetMaskForEvent: bogus device id");
|
2011-12-09 09:38:53 +01:00
|
|
|
event_filters[deviceid][event] = mask;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
SetCriticalEvent(int event)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-12-10 22:31:43 +01:00
|
|
|
if (event >= MAXEVENTS)
|
2003-11-14 16:54:54 +01:00
|
|
|
FatalError("SetCriticalEvent: bogus event number");
|
|
|
|
criticalEvents[event >> 3] |= 1 << (event & 7);
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-11-21 08:45:04 +01:00
|
|
|
ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
BoxRec box;
|
|
|
|
int x = *px, y = *py;
|
|
|
|
int incx = 1, incy = 1;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if (RegionContainsPoint(shape, x, y, &box))
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
2010-05-22 00:05:48 +02:00
|
|
|
box = *RegionExtents(shape);
|
2003-11-14 16:54:54 +01:00
|
|
|
/* this is rather crude */
|
|
|
|
do {
|
|
|
|
x += incx;
|
|
|
|
if (x >= box.x2)
|
|
|
|
{
|
|
|
|
incx = -1;
|
|
|
|
x = *px - 1;
|
|
|
|
}
|
|
|
|
else if (x < box.x1)
|
|
|
|
{
|
|
|
|
incx = 1;
|
|
|
|
x = *px;
|
|
|
|
y += incy;
|
|
|
|
if (y >= box.y2)
|
|
|
|
{
|
|
|
|
incy = -1;
|
|
|
|
y = *py - 1;
|
|
|
|
}
|
|
|
|
else if (y < box.y1)
|
|
|
|
return; /* should never get here! */
|
|
|
|
}
|
2010-05-22 00:05:48 +02:00
|
|
|
} while (!RegionContainsPoint(shape, x, y, &box));
|
2003-11-14 16:54:54 +01:00
|
|
|
*px = x;
|
|
|
|
*py = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-14 17:49:22 +01:00
|
|
|
CheckPhysLimits(
|
2007-11-13 07:28:23 +01:00
|
|
|
DeviceIntPtr pDev,
|
2003-11-14 17:49:22 +01:00
|
|
|
CursorPtr cursor,
|
|
|
|
Bool generateEvents,
|
2009-01-30 07:25:22 +01:00
|
|
|
Bool confineToScreen, /* unused if PanoramiX on */
|
|
|
|
ScreenPtr pScreen) /* unused if PanoramiX on */
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
HotSpot new;
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (!cursor)
|
|
|
|
return;
|
2006-11-21 08:45:04 +01:00
|
|
|
new = pSprite->hotPhys;
|
2009-01-30 07:25:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
/* I don't care what the DDX has to say about it */
|
|
|
|
pSprite->physLimits = pSprite->hotLimits;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2009-01-30 07:25:22 +01:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (pScreen)
|
|
|
|
new.pScreen = pScreen;
|
|
|
|
else
|
|
|
|
pScreen = new.pScreen;
|
|
|
|
(*pScreen->CursorLimits) (pDev, pScreen, cursor, &pSprite->hotLimits,
|
|
|
|
&pSprite->physLimits);
|
|
|
|
pSprite->confined = confineToScreen;
|
|
|
|
(* pScreen->ConstrainCursor)(pDev, pScreen, &pSprite->physLimits);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* constrain the pointer to those limits */
|
2006-11-21 08:45:04 +01:00
|
|
|
if (new.x < pSprite->physLimits.x1)
|
|
|
|
new.x = pSprite->physLimits.x1;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2006-11-21 08:45:04 +01:00
|
|
|
if (new.x >= pSprite->physLimits.x2)
|
|
|
|
new.x = pSprite->physLimits.x2 - 1;
|
|
|
|
if (new.y < pSprite->physLimits.y1)
|
|
|
|
new.y = pSprite->physLimits.y1;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2006-11-21 08:45:04 +01:00
|
|
|
if (new.y >= pSprite->physLimits.y2)
|
|
|
|
new.y = pSprite->physLimits.y2 - 1;
|
|
|
|
if (pSprite->hotShape)
|
2007-11-13 07:28:23 +01:00
|
|
|
ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y);
|
2010-03-08 03:45:15 +01:00
|
|
|
if ((
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
noPanoramiXExtension &&
|
|
|
|
#endif
|
|
|
|
(pScreen != pSprite->hotPhys.pScreen)) ||
|
2006-11-21 08:45:04 +01:00
|
|
|
(new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-01-30 07:25:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
XineramaSetCursorPosition (pDev, new.x, new.y, generateEvents);
|
|
|
|
else
|
2009-02-10 06:44:18 +01:00
|
|
|
#endif
|
2009-01-30 07:25:22 +01:00
|
|
|
{
|
|
|
|
if (pScreen != pSprite->hotPhys.pScreen)
|
|
|
|
pSprite->hotPhys = new;
|
|
|
|
(*pScreen->SetCursorPosition)
|
|
|
|
(pDev, pScreen, new.x, new.y, generateEvents);
|
|
|
|
}
|
2006-11-23 07:45:14 +01:00
|
|
|
if (!generateEvents)
|
2009-01-30 07:25:22 +01:00
|
|
|
SyntheticMotion(pDev, new.x, new.y);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-01-30 07:25:22 +01:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
/* Tell DDX what the limits are */
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
XineramaConstrainCursor(pDev);
|
|
|
|
#endif
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-14 17:49:22 +01:00
|
|
|
CheckVirtualMotion(
|
2007-03-19 00:12:56 +01:00
|
|
|
DeviceIntPtr pDev,
|
2007-03-08 08:20:19 +01:00
|
|
|
QdEventPtr qe,
|
|
|
|
WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2009-01-30 07:09:23 +01:00
|
|
|
RegionPtr reg = NULL;
|
2009-01-30 23:46:43 +01:00
|
|
|
DeviceEvent *ev = NULL;
|
2006-12-11 08:39:59 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (qe)
|
|
|
|
{
|
2009-09-18 02:03:02 +02:00
|
|
|
ev = &qe->event->device_event;
|
2009-01-30 23:46:43 +01:00
|
|
|
switch(ev->type)
|
|
|
|
{
|
|
|
|
case ET_Motion:
|
|
|
|
case ET_ButtonPress:
|
|
|
|
case ET_ButtonRelease:
|
|
|
|
case ET_KeyPress:
|
|
|
|
case ET_KeyRelease:
|
|
|
|
case ET_ProximityIn:
|
|
|
|
case ET_ProximityOut:
|
|
|
|
pSprite->hot.pScreen = qe->pScreen;
|
|
|
|
pSprite->hot.x = ev->root_x;
|
|
|
|
pSprite->hot.y = ev->root_y;
|
|
|
|
pWin = pDev->deviceGrab.grab ? pDev->deviceGrab.grab->confineTo : NullWindow;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
if (pWin)
|
|
|
|
{
|
|
|
|
BoxRec lims;
|
|
|
|
|
2009-01-30 07:09:23 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (!noPanoramiXExtension) {
|
|
|
|
int x, y, off_x, off_y, i;
|
|
|
|
|
|
|
|
if(!XineramaSetWindowPntrs(pDev, pWin))
|
|
|
|
return;
|
|
|
|
|
|
|
|
i = PanoramiXNumScreens - 1;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionCopy(&pSprite->Reg2,
|
2009-01-30 07:09:23 +01:00
|
|
|
&pSprite->windows[i]->borderSize);
|
2010-05-23 19:11:47 +02:00
|
|
|
off_x = screenInfo.screens[i]->x;
|
|
|
|
off_y = screenInfo.screens[i]->y;
|
2009-01-30 07:09:23 +01:00
|
|
|
|
|
|
|
while(i--) {
|
2010-05-23 19:11:47 +02:00
|
|
|
x = off_x - screenInfo.screens[i]->x;
|
|
|
|
y = off_y - screenInfo.screens[i]->y;
|
2009-01-30 07:09:23 +01:00
|
|
|
|
|
|
|
if(x || y)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionTranslate(&pSprite->Reg2, x, y);
|
2009-01-30 07:09:23 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUnion(&pSprite->Reg2, &pSprite->Reg2,
|
2009-01-30 07:09:23 +01:00
|
|
|
&pSprite->windows[i]->borderSize);
|
|
|
|
|
2010-05-23 19:11:47 +02:00
|
|
|
off_x = screenInfo.screens[i]->x;
|
|
|
|
off_y = screenInfo.screens[i]->y;
|
2009-01-30 07:09:23 +01:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (pSprite->hot.pScreen != pWin->drawable.pScreen)
|
|
|
|
{
|
|
|
|
pSprite->hot.pScreen = pWin->drawable.pScreen;
|
|
|
|
pSprite->hot.x = pSprite->hot.y = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
lims = *RegionExtents(&pWin->borderSize);
|
2006-12-11 08:39:59 +01:00
|
|
|
if (pSprite->hot.x < lims.x1)
|
|
|
|
pSprite->hot.x = lims.x1;
|
|
|
|
else if (pSprite->hot.x >= lims.x2)
|
|
|
|
pSprite->hot.x = lims.x2 - 1;
|
|
|
|
if (pSprite->hot.y < lims.y1)
|
|
|
|
pSprite->hot.y = lims.y1;
|
|
|
|
else if (pSprite->hot.y >= lims.y2)
|
|
|
|
pSprite->hot.y = lims.y2 - 1;
|
2009-01-30 07:09:23 +01:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
{
|
2010-05-22 00:05:48 +02:00
|
|
|
if (RegionNumRects(&pSprite->Reg2) > 1)
|
2009-01-30 07:09:23 +01:00
|
|
|
reg = &pSprite->Reg2;
|
|
|
|
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (wBoundingShape(pWin))
|
|
|
|
reg = &pWin->borderSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reg)
|
|
|
|
ConfineToShape(pDev, reg, &pSprite->hot.x, &pSprite->hot.y);
|
|
|
|
|
2009-01-30 23:46:43 +01:00
|
|
|
if (qe && ev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-11 08:39:59 +01:00
|
|
|
qe->pScreen = pSprite->hot.pScreen;
|
2009-01-30 23:46:43 +01:00
|
|
|
ev->root_x = pSprite->hot.x;
|
|
|
|
ev->root_y = pSprite->hot.y;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
2009-01-30 07:09:23 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */
|
|
|
|
#endif
|
2010-12-27 14:06:03 +01:00
|
|
|
RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static void
|
2006-12-11 08:39:59 +01:00
|
|
|
ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bool confineToScreen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (syncEvents.playingEvents)
|
|
|
|
{
|
2006-12-11 08:39:59 +01:00
|
|
|
CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
|
|
|
|
SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-01-30 07:14:54 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension) {
|
|
|
|
XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
2010-05-22 00:05:48 +02:00
|
|
|
pSprite->hotLimits = *RegionExtents(&pWin->borderSize);
|
2006-12-11 08:39:59 +01:00
|
|
|
pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
|
2003-11-14 16:54:54 +01:00
|
|
|
: NullRegion;
|
2006-12-11 08:39:59 +01:00
|
|
|
CheckPhysLimits(pDev, pSprite->current, generateEvents,
|
2010-06-06 05:55:29 +02:00
|
|
|
confineToScreen, pWin->drawable.pScreen);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2006-11-21 08:45:04 +01:00
|
|
|
PointerConfinedToScreen(DeviceIntPtr pDev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
return pDev->spriteInfo->sprite->confined;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Update the sprite cursor to the given cursor.
|
|
|
|
*
|
|
|
|
* ChangeToCursor() will display the new cursor and free the old cursor (if
|
|
|
|
* applicable). If the provided cursor is already the updated cursor, nothing
|
|
|
|
* happens.
|
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
static void
|
2006-11-21 08:45:04 +01:00
|
|
|
ChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2009-01-30 07:37:19 +01:00
|
|
|
ScreenPtr pScreen;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2006-11-21 08:45:04 +01:00
|
|
|
if (cursor != pSprite->current)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-11-21 08:45:04 +01:00
|
|
|
if ((pSprite->current->bits->xhot != cursor->bits->xhot) ||
|
|
|
|
(pSprite->current->bits->yhot != cursor->bits->yhot))
|
|
|
|
CheckPhysLimits(pDev, cursor, FALSE, pSprite->confined,
|
2003-11-14 16:54:54 +01:00
|
|
|
(ScreenPtr)NULL);
|
2009-01-30 07:37:19 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
/* XXX: is this really necessary?? (whot) */
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
pScreen = pSprite->screen;
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
pScreen = pSprite->hotPhys.pScreen;
|
|
|
|
|
|
|
|
(*pScreen->DisplayCursor)(pDev, pScreen, cursor);
|
2006-11-21 08:45:04 +01:00
|
|
|
FreeCursor(pSprite->current, (Cursor)0);
|
|
|
|
pSprite->current = cursor;
|
|
|
|
pSprite->current->refcnt++;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2007-11-13 07:28:23 +01:00
|
|
|
* @returns true if b is a descendent of a
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2007-03-08 08:20:19 +01:00
|
|
|
IsParent(WindowPtr a, WindowPtr b)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
for (b = b->parent; b; b = b->parent)
|
|
|
|
if (b == a) return TRUE;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Update the cursor displayed on the screen.
|
|
|
|
*
|
2007-11-13 07:28:23 +01:00
|
|
|
* Called whenever a cursor may have changed shape or position.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
static void
|
2006-11-21 08:45:04 +01:00
|
|
|
PostNewCursor(DeviceIntPtr pDev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
WindowPtr win;
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabPtr grab = pDev->deviceGrab.grab;
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2007-01-08 03:01:18 +01:00
|
|
|
CursorPtr pCursor;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (syncEvents.playingEvents)
|
|
|
|
return;
|
|
|
|
if (grab)
|
|
|
|
{
|
|
|
|
if (grab->cursor)
|
|
|
|
{
|
2006-11-21 08:45:04 +01:00
|
|
|
ChangeToCursor(pDev, grab->cursor);
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
|
|
|
}
|
2006-11-21 08:45:04 +01:00
|
|
|
if (IsParent(grab->window, pSprite->win))
|
|
|
|
win = pSprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
|
|
|
win = grab->window;
|
|
|
|
}
|
|
|
|
else
|
2006-11-21 08:45:04 +01:00
|
|
|
win = pSprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
for (; win; win = win->parent)
|
2007-01-08 03:01:18 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
if (win->optional)
|
2007-01-08 03:01:18 +01:00
|
|
|
{
|
|
|
|
pCursor = WindowGetDeviceCursor(win, pDev);
|
|
|
|
if (!pCursor && win->optional->cursor != NullCursor)
|
|
|
|
pCursor = win->optional->cursor;
|
|
|
|
if (pCursor)
|
|
|
|
{
|
|
|
|
ChangeToCursor(pDev, pCursor);
|
|
|
|
return;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-01-08 03:01:18 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-26 08:28:50 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param dev device which you want to know its current root window
|
|
|
|
* @return root window where dev's sprite is located
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
WindowPtr
|
2007-04-26 08:28:50 +02:00
|
|
|
GetCurrentRootWindow(DeviceIntPtr dev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2010-12-27 14:06:03 +01:00
|
|
|
return RootWindow(dev->spriteInfo->sprite);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* @return window underneath the cursor sprite.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
WindowPtr
|
2006-11-22 07:36:47 +01:00
|
|
|
GetSpriteWindow(DeviceIntPtr pDev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
return pDev->spriteInfo->sprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* @return current sprite cursor.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
CursorPtr
|
2006-12-11 08:39:59 +01:00
|
|
|
GetSpriteCursor(DeviceIntPtr pDev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
return pDev->spriteInfo->sprite->current;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Set x/y current sprite position in screen coordinates.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-11-21 08:45:04 +01:00
|
|
|
GetSpritePosition(DeviceIntPtr pDev, int *px, int *py)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2006-11-21 08:45:04 +01:00
|
|
|
*px = pSprite->hotPhys.x;
|
|
|
|
*py = pSprite->hotPhys.y;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2006-12-11 08:39:59 +01:00
|
|
|
XineramaGetCursorScreen(DeviceIntPtr pDev)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
if(!noPanoramiXExtension) {
|
2007-03-25 07:30:03 +02:00
|
|
|
return pDev->spriteInfo->sprite->screen->myNum;
|
2003-11-14 17:49:22 +01:00
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* PANORAMIX */
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#define TIMESLOP (5 * 60 * 1000) /* 5 minutes */
|
|
|
|
|
|
|
|
static void
|
2009-01-30 06:14:46 +01:00
|
|
|
MonthChangedOrBadTime(InternalEvent *ev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
/* If the ddx/OS is careless about not processing timestamped events from
|
|
|
|
* different sources in sorted order, then it's possible for time to go
|
|
|
|
* backwards when it should not. Here we ensure a decent time.
|
|
|
|
*/
|
2009-05-20 09:02:50 +02:00
|
|
|
if ((currentTime.milliseconds - ev->any.time) > TIMESLOP)
|
2003-11-14 16:54:54 +01:00
|
|
|
currentTime.months++;
|
|
|
|
else
|
2009-05-20 09:02:50 +02:00
|
|
|
ev->any.time = currentTime.milliseconds;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2009-01-30 06:14:46 +01:00
|
|
|
static void
|
|
|
|
NoticeTime(InternalEvent *ev)
|
|
|
|
{
|
2009-05-20 09:02:50 +02:00
|
|
|
if (ev->any.time < currentTime.milliseconds)
|
2009-01-30 06:14:46 +01:00
|
|
|
MonthChangedOrBadTime(ev);
|
2009-05-20 09:02:50 +02:00
|
|
|
currentTime.milliseconds = ev->any.time;
|
2009-01-30 06:14:46 +01:00
|
|
|
lastDeviceEventTime = currentTime;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-30 06:14:46 +01:00
|
|
|
NoticeEventTime(InternalEvent *ev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
if (!syncEvents.playingEvents)
|
2009-01-30 06:14:46 +01:00
|
|
|
NoticeTime(ev);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* The following procedures deal with synchronous events *
|
|
|
|
**************************************************************************/
|
|
|
|
|
2007-09-12 10:30:03 +02:00
|
|
|
/**
|
2007-11-13 07:28:23 +01:00
|
|
|
* EnqueueEvent is a device's processInputProc if a device is frozen.
|
2007-09-12 10:30:03 +02:00
|
|
|
* Instead of delivering the events to the client, the event is tacked onto a
|
|
|
|
* linked list for later delivery.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-02-02 08:20:17 +01:00
|
|
|
EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-11-21 20:41:12 +01:00
|
|
|
QdEventPtr tail;
|
2007-11-13 07:28:23 +01:00
|
|
|
QdEventPtr qe;
|
|
|
|
SpritePtr pSprite = device->spriteInfo->sprite;
|
2007-09-12 10:30:03 +02:00
|
|
|
int eventlen;
|
2009-09-18 02:03:02 +02:00
|
|
|
DeviceEvent *event = &ev->device_event;
|
2007-09-12 10:30:03 +02:00
|
|
|
|
2011-11-21 20:41:12 +01:00
|
|
|
tail = list_last_entry(&syncEvents.pending, QdEventRec, next);
|
|
|
|
|
2009-01-30 06:14:46 +01:00
|
|
|
NoticeTime((InternalEvent*)event);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
/* Fix for key repeating bug. */
|
2007-11-13 07:28:23 +01:00
|
|
|
if (device->key != NULL && device->key->xkbInfo != NULL &&
|
2009-01-30 23:46:43 +01:00
|
|
|
event->type == ET_KeyRelease)
|
|
|
|
AccessXCancelRepeatKey(device->key->xkbInfo, event->detail.key);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (DeviceEventCallback)
|
|
|
|
{
|
|
|
|
DeviceEventInfoRec eventinfo;
|
2010-02-11 07:34:09 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* The RECORD spec says that the root window field of motion events
|
|
|
|
* must be valid. At this point, it hasn't been filled in yet, so
|
|
|
|
* we do it here. The long expression below is necessary to get
|
|
|
|
* the current root window; the apparently reasonable alternative
|
|
|
|
* GetCurrentRootWindow()->drawable.id doesn't give you the right
|
|
|
|
* answer on the first motion event after a screen change because
|
|
|
|
* the data that GetCurrentRootWindow relies on hasn't been
|
|
|
|
* updated yet.
|
|
|
|
*/
|
2010-02-11 07:34:09 +01:00
|
|
|
if (ev->any.type == ET_Motion)
|
2010-05-22 09:26:28 +02:00
|
|
|
ev->device_event.root = pSprite->hotPhys.pScreen->root->drawable.id;
|
2010-02-11 07:34:09 +01:00
|
|
|
|
|
|
|
eventinfo.event = ev;
|
|
|
|
eventinfo.device = device;
|
2003-11-14 16:54:54 +01:00
|
|
|
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
|
|
|
|
}
|
2010-02-11 07:34:09 +01:00
|
|
|
|
2009-01-30 23:46:43 +01:00
|
|
|
if (event->type == ET_Motion)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension) {
|
2010-05-23 19:11:47 +02:00
|
|
|
event->root_x += pSprite->screen->x - screenInfo.screens[0]->x;
|
|
|
|
event->root_y += pSprite->screen->y - screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
#endif
|
2009-01-30 23:46:43 +01:00
|
|
|
pSprite->hotPhys.x = event->root_x;
|
|
|
|
pSprite->hotPhys.y = event->root_y;
|
2007-09-12 10:10:11 +02:00
|
|
|
/* do motion compression, but not if from different devices */
|
2003-11-14 16:54:54 +01:00
|
|
|
if (tail &&
|
2009-05-20 09:02:50 +02:00
|
|
|
(tail->event->any.type == ET_Motion) &&
|
2007-09-12 10:10:11 +02:00
|
|
|
(tail->device == device) &&
|
2006-12-11 08:39:59 +01:00
|
|
|
(tail->pScreen == pSprite->hotPhys.pScreen))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-09-18 02:03:02 +02:00
|
|
|
DeviceEvent *tailev = &tail->event->device_event;
|
2009-01-30 23:46:43 +01:00
|
|
|
tailev->root_x = pSprite->hotPhys.x;
|
|
|
|
tailev->root_y = pSprite->hotPhys.y;
|
|
|
|
tailev->time = event->time;
|
2003-11-14 16:54:54 +01:00
|
|
|
tail->months = currentTime.months;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2007-09-12 10:30:03 +02:00
|
|
|
|
2009-01-30 23:46:43 +01:00
|
|
|
eventlen = event->length;
|
2007-09-12 10:30:03 +02:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
qe = malloc(sizeof(QdEventRec) + eventlen);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!qe)
|
|
|
|
return;
|
2011-11-21 20:41:12 +01:00
|
|
|
list_init(&qe->next);
|
2003-11-14 16:54:54 +01:00
|
|
|
qe->device = device;
|
2006-12-11 08:39:59 +01:00
|
|
|
qe->pScreen = pSprite->hotPhys.pScreen;
|
2003-11-14 16:54:54 +01:00
|
|
|
qe->months = currentTime.months;
|
2009-01-30 23:46:43 +01:00
|
|
|
qe->event = (InternalEvent *)(qe + 1);
|
|
|
|
memcpy(qe->event, event, eventlen);
|
2011-11-21 20:41:12 +01:00
|
|
|
list_append(&qe->next, &syncEvents.pending);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-09-26 01:50:11 +02:00
|
|
|
/**
|
|
|
|
* Run through the list of events queued up in syncEvents.
|
2007-11-13 07:28:23 +01:00
|
|
|
* For each event do:
|
2007-09-26 01:50:11 +02:00
|
|
|
* If the device for this event is not frozen anymore, take it and process it
|
2007-11-13 07:28:23 +01:00
|
|
|
* as usually.
|
2007-09-26 01:50:11 +02:00
|
|
|
* After that, check if there's any devices in the list that are not frozen.
|
|
|
|
* If there is none, we're done. If there is at least one device that is not
|
|
|
|
* frozen, then re-run from the beginning of the event queue.
|
|
|
|
*/
|
2011-11-21 20:41:12 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
PlayReleasedEvents(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-11-21 20:41:12 +01:00
|
|
|
QdEventPtr tmp;
|
|
|
|
QdEventPtr qe;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2006-12-11 08:39:59 +01:00
|
|
|
DeviceIntPtr pDev;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2011-11-21 20:41:12 +01:00
|
|
|
restart:
|
|
|
|
list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) {
|
2007-05-14 05:04:53 +02:00
|
|
|
if (!qe->device->deviceGrab.sync.frozen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-11-21 20:41:12 +01:00
|
|
|
list_del(&qe->next);
|
|
|
|
pDev = qe->device;
|
2009-05-20 09:02:50 +02:00
|
|
|
if (qe->event->any.type == ET_Motion)
|
2006-12-11 08:39:59 +01:00
|
|
|
CheckVirtualMotion(pDev, qe, NullWindow);
|
2003-11-14 16:54:54 +01:00
|
|
|
syncEvents.time.months = qe->months;
|
2009-05-20 09:02:50 +02:00
|
|
|
syncEvents.time.milliseconds = qe->event->any.time;
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
/* Translate back to the sprite screen since processInputProc
|
|
|
|
will translate from sprite screen to screen 0 upon reentry
|
|
|
|
to the DIX layer */
|
|
|
|
if(!noPanoramiXExtension) {
|
2009-09-18 02:03:02 +02:00
|
|
|
DeviceEvent *ev = &qe->event->device_event;
|
2009-01-30 23:46:43 +01:00
|
|
|
switch(ev->type)
|
|
|
|
{
|
|
|
|
case ET_Motion:
|
|
|
|
case ET_ButtonPress:
|
|
|
|
case ET_ButtonRelease:
|
|
|
|
case ET_KeyPress:
|
|
|
|
case ET_KeyRelease:
|
|
|
|
case ET_ProximityIn:
|
|
|
|
case ET_ProximityOut:
|
2010-05-23 19:11:47 +02:00
|
|
|
ev->root_x += screenInfo.screens[0]->x -
|
|
|
|
pDev->spriteInfo->sprite->screen->x;
|
|
|
|
ev->root_y += screenInfo.screens[0]->y -
|
|
|
|
pDev->spriteInfo->sprite->screen->y;
|
2009-01-30 23:46:43 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
#endif
|
2009-02-02 08:20:17 +01:00
|
|
|
(*qe->device->public.processInputProc)(qe->event, qe->device);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(qe);
|
2007-05-14 05:04:53 +02:00
|
|
|
for (dev = inputInfo.devices; dev && dev->deviceGrab.sync.frozen; dev = dev->next)
|
2003-11-14 16:54:54 +01:00
|
|
|
;
|
|
|
|
if (!dev)
|
|
|
|
break;
|
2011-11-21 20:41:12 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* Playing the event may have unfrozen another device. */
|
|
|
|
/* So to play it safe, restart at the head of the queue */
|
2011-11-21 20:41:12 +01:00
|
|
|
goto restart;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-06-19 03:58:07 +02:00
|
|
|
/**
|
|
|
|
* Freeze or thaw the given devices. The device's processing proc is
|
|
|
|
* switched to either the real processing proc (in case of thawing) or an
|
|
|
|
* enqueuing processing proc (usually EnqueueEvent()).
|
|
|
|
*
|
|
|
|
* @param dev The device to freeze/thaw
|
|
|
|
* @param frozen True to freeze or false to thaw.
|
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
static void
|
2007-03-08 08:20:19 +01:00
|
|
|
FreezeThaw(DeviceIntPtr dev, Bool frozen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
dev->deviceGrab.sync.frozen = frozen;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (frozen)
|
|
|
|
dev->public.processInputProc = dev->public.enqueueInputProc;
|
|
|
|
else
|
|
|
|
dev->public.processInputProc = dev->public.realInputProc;
|
|
|
|
}
|
|
|
|
|
2007-06-19 03:58:07 +02:00
|
|
|
/**
|
|
|
|
* Unfreeze devices and replay all events to the respective clients.
|
|
|
|
*
|
|
|
|
* ComputeFreezes takes the first event in the device's frozen event queue. It
|
|
|
|
* runs up the sprite tree (spriteTrace) and searches for the window to replay
|
|
|
|
* the events from. If it is found, it checks for passive grabs one down from
|
|
|
|
* the window or delivers the events.
|
|
|
|
*/
|
2007-11-15 23:01:33 +01:00
|
|
|
static void
|
2007-04-09 23:33:15 +02:00
|
|
|
ComputeFreezes(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr replayDev = syncEvents.replayDev;
|
2003-11-14 16:54:54 +01:00
|
|
|
WindowPtr w;
|
|
|
|
GrabPtr grab;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
2007-11-13 07:28:23 +01:00
|
|
|
FreezeThaw(dev, dev->deviceGrab.sync.other ||
|
2007-05-14 05:04:53 +02:00
|
|
|
(dev->deviceGrab.sync.state >= FROZEN));
|
2011-11-21 20:41:12 +01:00
|
|
|
if (syncEvents.playingEvents ||
|
|
|
|
(!replayDev && list_is_empty(&syncEvents.pending)))
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
|
|
|
syncEvents.playingEvents = TRUE;
|
|
|
|
if (replayDev)
|
|
|
|
{
|
2009-02-01 00:58:15 +01:00
|
|
|
DeviceEvent* event = replayDev->deviceGrab.sync.event;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
syncEvents.replayDev = (DeviceIntPtr)NULL;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-09-20 07:03:05 +02:00
|
|
|
w = XYToWindow(replayDev->spriteInfo->sprite,
|
|
|
|
event->root_x, event->root_y);
|
2010-08-04 20:44:05 +02:00
|
|
|
if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin))
|
|
|
|
{
|
|
|
|
if (replayDev->focus && !IsPointerEvent((InternalEvent*)event))
|
|
|
|
DeliverFocusedEvent(replayDev, (InternalEvent*)event, w);
|
|
|
|
else
|
|
|
|
DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab,
|
|
|
|
NullWindow, replayDev);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
if (!dev->deviceGrab.sync.frozen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
PlayReleasedEvents();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
syncEvents.playingEvents = FALSE;
|
2006-12-11 08:39:59 +01:00
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-18 06:03:54 +01:00
|
|
|
if (DevHasCursor(dev))
|
2006-12-11 08:39:59 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
/* the following may have been skipped during replay,
|
2006-12-11 08:39:59 +01:00
|
|
|
so do it now */
|
2007-05-14 05:04:53 +02:00
|
|
|
if ((grab = dev->deviceGrab.grab) && grab->confineTo)
|
2006-12-11 08:39:59 +01:00
|
|
|
{
|
|
|
|
if (grab->confineTo->drawable.pScreen !=
|
2007-11-13 07:28:23 +01:00
|
|
|
dev->spriteInfo->sprite->hotPhys.pScreen)
|
2007-03-25 07:30:03 +02:00
|
|
|
dev->spriteInfo->sprite->hotPhys.x =
|
|
|
|
dev->spriteInfo->sprite->hotPhys.y = 0;
|
2006-12-11 08:39:59 +01:00
|
|
|
ConfineCursorToWindow(dev, grab->confineTo, TRUE, TRUE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ConfineCursorToWindow(dev,
|
2010-05-22 09:26:28 +02:00
|
|
|
dev->spriteInfo->sprite->hotPhys.pScreen->root,
|
2006-12-11 08:39:59 +01:00
|
|
|
TRUE, FALSE);
|
|
|
|
PostNewCursor(dev);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef RANDR
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
ScreenRestructured (ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
GrabPtr grab;
|
2006-12-11 08:39:59 +01:00
|
|
|
DeviceIntPtr pDev;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2006-12-11 08:39:59 +01:00
|
|
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2008-01-07 10:38:56 +01:00
|
|
|
if (!DevHasCursor(pDev))
|
|
|
|
continue;
|
2006-12-11 08:39:59 +01:00
|
|
|
|
2007-03-08 07:47:23 +01:00
|
|
|
/* GrabDevice doesn't have a confineTo field, so we don't need to
|
|
|
|
* worry about it. */
|
2007-05-14 05:04:53 +02:00
|
|
|
if ((grab = pDev->deviceGrab.grab) && grab->confineTo)
|
2006-12-11 08:39:59 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
if (grab->confineTo->drawable.pScreen
|
2007-03-25 07:30:03 +02:00
|
|
|
!= pDev->spriteInfo->sprite->hotPhys.pScreen)
|
|
|
|
pDev->spriteInfo->sprite->hotPhys.x = pDev->spriteInfo->sprite->hotPhys.y = 0;
|
2006-12-11 08:39:59 +01:00
|
|
|
ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE);
|
|
|
|
}
|
|
|
|
else
|
2007-11-13 07:28:23 +01:00
|
|
|
ConfineCursorToWindow(pDev,
|
2010-05-22 09:26:28 +02:00
|
|
|
pDev->spriteInfo->sprite->hotPhys.pScreen->root,
|
2006-12-11 08:39:59 +01:00
|
|
|
TRUE, FALSE);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-11-15 23:01:33 +01:00
|
|
|
static void
|
2007-03-08 08:20:19 +01:00
|
|
|
CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabPtr grab = thisDev->deviceGrab.grab;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (thisMode == GrabModeSync)
|
2007-05-14 05:04:53 +02:00
|
|
|
thisDev->deviceGrab.sync.state = FROZEN_NO_EVENT;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
|
|
|
{ /* free both if same client owns both */
|
2007-05-14 05:04:53 +02:00
|
|
|
thisDev->deviceGrab.sync.state = THAWED;
|
|
|
|
if (thisDev->deviceGrab.sync.other &&
|
|
|
|
(CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) ==
|
2003-11-14 16:54:54 +01:00
|
|
|
CLIENT_BITS(grab->resource)))
|
2007-05-14 05:04:53 +02:00
|
|
|
thisDev->deviceGrab.sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-11-30 02:02:59 +01:00
|
|
|
|
2009-05-20 07:28:16 +02:00
|
|
|
if (IsMaster(thisDev))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-30 02:02:59 +01:00
|
|
|
dev = GetPairedDevice(thisDev);
|
|
|
|
if (otherMode == GrabModeSync)
|
|
|
|
dev->deviceGrab.sync.other = grab;
|
|
|
|
else
|
|
|
|
{ /* free both if same client owns both */
|
|
|
|
if (dev->deviceGrab.sync.other &&
|
|
|
|
(CLIENT_BITS(dev->deviceGrab.sync.other->resource) ==
|
|
|
|
CLIENT_BITS(grab->resource)))
|
|
|
|
dev->deviceGrab.sync.other = NullGrab;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
|
2009-08-05 07:33:07 +02:00
|
|
|
/**
|
2010-04-29 21:24:49 +02:00
|
|
|
* Save the device's master device id. This needs to be done
|
2009-08-05 07:33:07 +02:00
|
|
|
* if a client directly grabs a slave device that is attached to a master. For
|
|
|
|
* the duration of the grab, the device is detached, ungrabbing re-attaches it
|
|
|
|
* though.
|
|
|
|
*
|
|
|
|
* We store the ID of the master device only in case the master disappears
|
|
|
|
* while the device has a grab.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
DetachFromMaster(DeviceIntPtr dev)
|
|
|
|
{
|
2011-06-07 02:42:50 +02:00
|
|
|
if (IsFloating(dev))
|
2009-08-05 07:33:07 +02:00
|
|
|
return;
|
|
|
|
|
2011-02-18 02:45:29 +01:00
|
|
|
dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
|
2009-08-05 07:33:07 +02:00
|
|
|
|
|
|
|
AttachDevice(NULL, dev, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ReattachToOldMaster(DeviceIntPtr dev)
|
|
|
|
{
|
|
|
|
DeviceIntPtr master = NULL;
|
|
|
|
|
|
|
|
if (IsMaster(dev))
|
|
|
|
return;
|
|
|
|
|
2010-04-29 21:24:49 +02:00
|
|
|
dixLookupDevice(&master, dev->saved_master_id, serverClient, DixUseAccess);
|
2009-08-05 07:33:07 +02:00
|
|
|
|
|
|
|
if (master)
|
|
|
|
{
|
|
|
|
AttachDevice(serverClient, dev, master);
|
2010-04-29 21:24:49 +02:00
|
|
|
dev->saved_master_id = 0;
|
2009-08-05 07:33:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Activate a pointer grab on the given device. A pointer grab will cause all
|
2007-11-13 07:28:23 +01:00
|
|
|
* core pointer events of this device to be delivered to the grabbing client only.
|
2007-05-30 10:14:31 +02:00
|
|
|
* No other device will send core events to the grab client while the grab is
|
|
|
|
* on, but core events will be sent to other clients.
|
|
|
|
* Can cause the cursor to change if a grab cursor is set.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-06-19 03:58:07 +02:00
|
|
|
* Note that parameter autoGrab may be (True & ImplicitGrabMask) if the grab
|
|
|
|
* is an implicit grab caused by a ButtonPress event.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param mouse The device to grab.
|
|
|
|
* @param grab The grab structure, needs to be setup.
|
|
|
|
* @param autoGrab True if the grab was caused by a button down event and not
|
2007-11-13 07:28:23 +01:00
|
|
|
* explicitely by a client.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-11-13 07:28:23 +01:00
|
|
|
ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
|
2005-03-08 00:02:59 +01:00
|
|
|
TimeStamp time, Bool autoGrab)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabInfoPtr grabinfo = &mouse->deviceGrab;
|
2007-11-13 07:28:23 +01:00
|
|
|
WindowPtr oldWin = (grabinfo->grab) ?
|
2007-05-14 03:12:03 +02:00
|
|
|
grabinfo->grab->window
|
2007-03-25 07:30:03 +02:00
|
|
|
: mouse->spriteInfo->sprite->win;
|
2007-11-09 02:03:27 +01:00
|
|
|
Bool isPassive = autoGrab & ~ImplicitGrabMask;
|
|
|
|
|
2009-08-05 07:33:07 +02:00
|
|
|
/* slave devices need to float for the duration of the grab. */
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == XI2 &&
|
2009-08-05 07:47:46 +02:00
|
|
|
!(autoGrab & ImplicitGrabMask) && !IsMaster(mouse))
|
2009-08-05 07:33:07 +02:00
|
|
|
DetachFromMaster(mouse);
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (grab->confineTo)
|
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
if (grab->confineTo->drawable.pScreen
|
2007-03-25 07:30:03 +02:00
|
|
|
!= mouse->spriteInfo->sprite->hotPhys.pScreen)
|
2007-11-13 07:28:23 +01:00
|
|
|
mouse->spriteInfo->sprite->hotPhys.x =
|
2007-03-25 07:30:03 +02:00
|
|
|
mouse->spriteInfo->sprite->hotPhys.y = 0;
|
2006-12-11 08:39:59 +01:00
|
|
|
ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
mouse->valuator->motionHintWindow = NullWindow;
|
|
|
|
if (syncEvents.playingEvents)
|
2007-05-14 03:12:03 +02:00
|
|
|
grabinfo->grabTime = syncEvents.time;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2007-05-14 03:12:03 +02:00
|
|
|
grabinfo->grabTime = time;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (grab->cursor)
|
|
|
|
grab->cursor->refcnt++;
|
2011-11-04 05:16:37 +01:00
|
|
|
CopyGrab(grabinfo->activeGrab, grab);
|
|
|
|
grabinfo->grab = grabinfo->activeGrab;
|
2007-11-09 02:03:27 +01:00
|
|
|
grabinfo->fromPassiveGrab = isPassive;
|
2007-06-19 03:58:07 +02:00
|
|
|
grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
|
2006-12-18 06:03:54 +01:00
|
|
|
PostNewCursor(mouse);
|
2003-11-14 17:49:22 +01:00
|
|
|
CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Delete grab on given device, update the sprite.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Extension devices are set up for ActivateKeyboardGrab().
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-03-08 08:20:19 +01:00
|
|
|
DeactivatePointerGrab(DeviceIntPtr mouse)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabPtr grab = mouse->deviceGrab.grab;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2009-08-05 07:33:07 +02:00
|
|
|
Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
|
|
|
|
mouse->deviceGrab.implicitGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
mouse->valuator->motionHintWindow = NullWindow;
|
2007-05-14 05:04:53 +02:00
|
|
|
mouse->deviceGrab.grab = NullGrab;
|
|
|
|
mouse->deviceGrab.sync.state = NOT_GRABBED;
|
|
|
|
mouse->deviceGrab.fromPassiveGrab = FALSE;
|
2008-01-18 10:36:29 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
if (dev->deviceGrab.sync.other == grab)
|
|
|
|
dev->deviceGrab.sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(mouse, mouse->id, grab->window,
|
2007-03-25 07:30:03 +02:00
|
|
|
mouse->spriteInfo->sprite->win, NotifyUngrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (grab->confineTo)
|
2010-12-27 14:06:03 +01:00
|
|
|
ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
|
2006-12-11 08:39:59 +01:00
|
|
|
PostNewCursor(mouse);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (grab->cursor)
|
|
|
|
FreeCursor(grab->cursor, (Cursor)0);
|
2007-11-09 02:03:27 +01:00
|
|
|
|
2011-12-08 05:27:01 +01:00
|
|
|
if (!wasImplicit && grab->grabtype == XI2)
|
2009-08-05 07:33:07 +02:00
|
|
|
ReattachToOldMaster(mouse);
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2007-11-13 07:28:23 +01:00
|
|
|
* Activate a keyboard grab on the given device.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* Extension devices have ActivateKeyboardGrab() set as their grabbing proc.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-03-08 08:20:19 +01:00
|
|
|
ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabInfoPtr grabinfo = &keybd->deviceGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
WindowPtr oldWin;
|
|
|
|
|
2009-08-05 07:33:07 +02:00
|
|
|
/* slave devices need to float for the duration of the grab. */
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == XI2 &&
|
2009-08-05 07:47:46 +02:00
|
|
|
!(passive & ImplicitGrabMask) &&
|
|
|
|
!IsMaster(keybd))
|
2009-08-05 07:33:07 +02:00
|
|
|
DetachFromMaster(keybd);
|
|
|
|
|
2007-05-14 03:12:03 +02:00
|
|
|
if (grabinfo->grab)
|
|
|
|
oldWin = grabinfo->grab->window;
|
2003-11-14 16:54:54 +01:00
|
|
|
else if (keybd->focus)
|
|
|
|
oldWin = keybd->focus->win;
|
|
|
|
else
|
2007-03-25 07:30:03 +02:00
|
|
|
oldWin = keybd->spriteInfo->sprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (oldWin == FollowKeyboardWin)
|
2009-03-13 06:22:23 +01:00
|
|
|
oldWin = keybd->focus->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (keybd->valuator)
|
|
|
|
keybd->valuator->motionHintWindow = NullWindow;
|
|
|
|
DoFocusEvents(keybd, oldWin, grab->window, NotifyGrab);
|
|
|
|
if (syncEvents.playingEvents)
|
2007-05-14 03:12:03 +02:00
|
|
|
grabinfo->grabTime = syncEvents.time;
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2007-05-14 03:12:03 +02:00
|
|
|
grabinfo->grabTime = time;
|
2011-11-04 05:16:37 +01:00
|
|
|
CopyGrab(grabinfo->activeGrab, grab);
|
|
|
|
grabinfo->grab = grabinfo->activeGrab;
|
2007-05-14 03:12:03 +02:00
|
|
|
grabinfo->fromPassiveGrab = passive;
|
2009-05-29 06:18:37 +02:00
|
|
|
grabinfo->implicitGrab = passive & ImplicitGrabMask;
|
2003-11-14 17:49:22 +01:00
|
|
|
CheckGrabForSyncs(keybd, (Bool)grab->keyboardMode, (Bool)grab->pointerMode);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2007-11-13 07:28:23 +01:00
|
|
|
* Delete keyboard grab for the given device.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-03-08 08:20:19 +01:00
|
|
|
DeactivateKeyboardGrab(DeviceIntPtr keybd)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabPtr grab = keybd->deviceGrab.grab;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
|
|
|
WindowPtr focusWin = keybd->focus ? keybd->focus->win
|
2007-03-25 07:30:03 +02:00
|
|
|
: keybd->spriteInfo->sprite->win;
|
2009-08-05 07:33:07 +02:00
|
|
|
Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
|
|
|
|
keybd->deviceGrab.implicitGrab);
|
2007-05-14 03:12:03 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (focusWin == FollowKeyboardWin)
|
|
|
|
focusWin = inputInfo.keyboard->focus->win;
|
|
|
|
if (keybd->valuator)
|
|
|
|
keybd->valuator->motionHintWindow = NullWindow;
|
2007-05-14 05:04:53 +02:00
|
|
|
keybd->deviceGrab.grab = NullGrab;
|
|
|
|
keybd->deviceGrab.sync.state = NOT_GRABBED;
|
|
|
|
keybd->deviceGrab.fromPassiveGrab = FALSE;
|
2008-01-18 10:36:29 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
if (dev->deviceGrab.sync.other == grab)
|
|
|
|
dev->deviceGrab.sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
|
2007-11-09 02:03:27 +01:00
|
|
|
|
2011-12-08 05:27:01 +01:00
|
|
|
if (!wasImplicit && grab->grabtype == XI2)
|
2009-08-05 07:33:07 +02:00
|
|
|
ReattachToOldMaster(keybd);
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-11-13 07:28:23 +01:00
|
|
|
AllowSome(ClientPtr client,
|
|
|
|
TimeStamp time,
|
|
|
|
DeviceIntPtr thisDev,
|
2009-04-15 14:16:49 +02:00
|
|
|
int newState)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
Bool thisGrabbed, otherGrabbed, othersFrozen, thisSynced;
|
|
|
|
TimeStamp grabTime;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2007-11-13 07:28:23 +01:00
|
|
|
GrabInfoPtr devgrabinfo,
|
2007-05-17 10:29:02 +02:00
|
|
|
grabinfo = &thisDev->deviceGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-03-08 07:47:23 +01:00
|
|
|
thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
|
2003-11-14 16:54:54 +01:00
|
|
|
thisSynced = FALSE;
|
|
|
|
otherGrabbed = FALSE;
|
2009-10-28 02:00:48 +01:00
|
|
|
othersFrozen = FALSE;
|
2007-03-08 07:47:23 +01:00
|
|
|
grabTime = grabinfo->grabTime;
|
2003-11-14 16:54:54 +01:00
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-17 10:29:02 +02:00
|
|
|
devgrabinfo = &dev->deviceGrab;
|
2007-03-08 07:47:23 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (dev == thisDev)
|
|
|
|
continue;
|
2007-03-08 07:47:23 +01:00
|
|
|
if (devgrabinfo->grab && SameClient(devgrabinfo->grab, client))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
if (!(thisGrabbed || otherGrabbed) ||
|
2007-03-08 07:47:23 +01:00
|
|
|
(CompareTimeStamps(devgrabinfo->grabTime, grabTime) == LATER))
|
|
|
|
grabTime = devgrabinfo->grabTime;
|
2003-11-14 16:54:54 +01:00
|
|
|
otherGrabbed = TRUE;
|
2007-03-08 07:47:23 +01:00
|
|
|
if (grabinfo->sync.other == devgrabinfo->grab)
|
2003-11-14 16:54:54 +01:00
|
|
|
thisSynced = TRUE;
|
2009-10-28 02:00:48 +01:00
|
|
|
if (devgrabinfo->sync.state >= FROZEN)
|
|
|
|
othersFrozen = TRUE;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
2007-03-08 07:47:23 +01:00
|
|
|
if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced))
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
|
|
|
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
|
|
|
(CompareTimeStamps(time, grabTime) == EARLIER))
|
|
|
|
return;
|
|
|
|
switch (newState)
|
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
case THAWED: /* Async */
|
2003-11-14 16:54:54 +01:00
|
|
|
if (thisGrabbed)
|
2007-03-08 07:47:23 +01:00
|
|
|
grabinfo->sync.state = THAWED;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (thisSynced)
|
2007-03-08 07:47:23 +01:00
|
|
|
grabinfo->sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
ComputeFreezes();
|
|
|
|
break;
|
|
|
|
case FREEZE_NEXT_EVENT: /* Sync */
|
|
|
|
if (thisGrabbed)
|
|
|
|
{
|
2007-03-08 07:47:23 +01:00
|
|
|
grabinfo->sync.state = FREEZE_NEXT_EVENT;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (thisSynced)
|
2007-03-08 07:47:23 +01:00
|
|
|
grabinfo->sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case THAWED_BOTH: /* AsyncBoth */
|
|
|
|
if (othersFrozen)
|
|
|
|
{
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-17 10:29:02 +02:00
|
|
|
devgrabinfo = &dev->deviceGrab;
|
2007-11-13 07:28:23 +01:00
|
|
|
if (devgrabinfo->grab
|
2007-03-08 07:47:23 +01:00
|
|
|
&& SameClient(devgrabinfo->grab, client))
|
|
|
|
devgrabinfo->sync.state = THAWED;
|
2007-11-13 07:28:23 +01:00
|
|
|
if (devgrabinfo->sync.other &&
|
2007-03-08 07:47:23 +01:00
|
|
|
SameClient(devgrabinfo->sync.other, client))
|
|
|
|
devgrabinfo->sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case FREEZE_BOTH_NEXT_EVENT: /* SyncBoth */
|
|
|
|
if (othersFrozen)
|
|
|
|
{
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-17 10:29:02 +02:00
|
|
|
devgrabinfo = &dev->deviceGrab;
|
2007-11-13 07:28:23 +01:00
|
|
|
if (devgrabinfo->grab
|
2007-03-08 07:47:23 +01:00
|
|
|
&& SameClient(devgrabinfo->grab, client))
|
|
|
|
devgrabinfo->sync.state = FREEZE_BOTH_NEXT_EVENT;
|
2007-11-13 07:28:23 +01:00
|
|
|
if (devgrabinfo->sync.other
|
2007-03-08 07:47:23 +01:00
|
|
|
&& SameClient(devgrabinfo->sync.other, client))
|
|
|
|
devgrabinfo->sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NOT_GRABBED: /* Replay */
|
2007-03-08 07:47:23 +01:00
|
|
|
if (thisGrabbed && grabinfo->sync.state == FROZEN_WITH_EVENT)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
if (thisSynced)
|
2007-03-08 07:47:23 +01:00
|
|
|
grabinfo->sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
syncEvents.replayDev = thisDev;
|
2007-03-08 07:47:23 +01:00
|
|
|
syncEvents.replayWin = grabinfo->grab->window;
|
|
|
|
(*grabinfo->DeactivateGrab)(thisDev);
|
2003-11-14 16:54:54 +01:00
|
|
|
syncEvents.replayDev = (DeviceIntPtr)NULL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case THAW_OTHERS: /* AsyncOthers */
|
|
|
|
if (othersFrozen)
|
|
|
|
{
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
|
|
|
if (dev == thisDev)
|
|
|
|
continue;
|
2009-03-19 06:44:34 +01:00
|
|
|
devgrabinfo = &dev->deviceGrab;
|
2007-11-13 07:28:23 +01:00
|
|
|
if (devgrabinfo->grab
|
2007-03-08 07:47:23 +01:00
|
|
|
&& SameClient(devgrabinfo->grab, client))
|
|
|
|
devgrabinfo->sync.state = THAWED;
|
2007-11-13 07:28:23 +01:00
|
|
|
if (devgrabinfo->sync.other
|
2007-03-08 07:47:23 +01:00
|
|
|
&& SameClient(devgrabinfo->sync.other, client))
|
|
|
|
devgrabinfo->sync.other = NullGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
ComputeFreezes();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for AllowEvents request.
|
|
|
|
*
|
2007-11-13 07:28:23 +01:00
|
|
|
* Release some events from a frozen device.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-08 08:20:19 +01:00
|
|
|
ProcAllowEvents(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
TimeStamp time;
|
2008-04-25 07:45:31 +02:00
|
|
|
DeviceIntPtr mouse = NULL;
|
2007-08-08 05:40:00 +02:00
|
|
|
DeviceIntPtr keybd = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST(xAllowEventsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xAllowEventsReq);
|
|
|
|
time = ClientTimeToServerTime(stuff->time);
|
2007-08-08 05:40:00 +02:00
|
|
|
|
2008-04-25 07:45:31 +02:00
|
|
|
mouse = PickPointer(client);
|
|
|
|
keybd = PickKeyboard(client);
|
2007-08-08 05:40:00 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
switch (stuff->mode)
|
|
|
|
{
|
|
|
|
case ReplayPointer:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, mouse, NOT_GRABBED);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
2007-11-13 07:28:23 +01:00
|
|
|
case SyncPointer:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, mouse, FREEZE_NEXT_EVENT);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
2007-11-13 07:28:23 +01:00
|
|
|
case AsyncPointer:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, mouse, THAWED);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
2007-11-13 07:28:23 +01:00
|
|
|
case ReplayKeyboard:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, keybd, NOT_GRABBED);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
2007-11-13 07:28:23 +01:00
|
|
|
case SyncKeyboard:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, keybd, FREEZE_NEXT_EVENT);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
2007-11-13 07:28:23 +01:00
|
|
|
case AsyncKeyboard:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, keybd, THAWED);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
case SyncBoth:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
case AsyncBoth:
|
2009-04-15 14:16:49 +02:00
|
|
|
AllowSome(client, time, keybd, THAWED_BOTH);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
2007-11-13 07:28:23 +01:00
|
|
|
default:
|
2003-11-14 16:54:54 +01:00
|
|
|
client->errorValue = stuff->mode;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Deactivate grabs from any device that has been grabbed by the client.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
ReleaseActiveGrabs(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2003-11-14 16:54:54 +01:00
|
|
|
Bool done;
|
|
|
|
|
|
|
|
/* XXX CloseDownClient should remove passive grabs before
|
|
|
|
* releasing active grabs.
|
|
|
|
*/
|
|
|
|
do {
|
2007-11-13 07:28:23 +01:00
|
|
|
done = TRUE;
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
|
2007-03-08 07:47:23 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
(*dev->deviceGrab.DeactivateGrab)(dev);
|
|
|
|
done = FALSE;
|
2007-03-08 07:47:23 +01:00
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
} while (!done);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* The following procedures deal with delivering events *
|
|
|
|
**************************************************************************/
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Deliver the given events to the given client.
|
|
|
|
*
|
|
|
|
* More than one event may be delivered at a time. This is the case with
|
|
|
|
* DeviceMotionNotifies which may be followed by DeviceValuator events.
|
|
|
|
*
|
|
|
|
* TryClientEvents() is the last station before actually writing the events to
|
|
|
|
* the socket. Anything that is not filtered here, will get delivered to the
|
2007-11-13 07:28:23 +01:00
|
|
|
* client.
|
|
|
|
* An event is only delivered if
|
2007-04-13 05:38:44 +02:00
|
|
|
* - mask and filter match up.
|
|
|
|
* - no other client has a grab on the device that caused the event.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* @param client The target client to deliver to.
|
2008-01-18 09:18:46 +01:00
|
|
|
* @param dev The device the event came from. May be NULL.
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param pEvents The events to be delivered.
|
|
|
|
* @param count Number of elements in pEvents.
|
|
|
|
* @param mask Event mask as set by the window.
|
|
|
|
* @param filter Mask based on event type.
|
2007-11-13 07:28:23 +01:00
|
|
|
* @param grab Possible grab on the device that caused the event.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* @return 1 if event was delivered, 0 if not or -1 if grab was not set by the
|
|
|
|
* client.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2008-01-18 09:18:46 +01:00
|
|
|
TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
|
|
|
|
int count, Mask mask, Mask filter, GrabPtr grab)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
int type;
|
|
|
|
|
2006-09-30 16:05:46 +02:00
|
|
|
#ifdef DEBUG_EVENTS
|
2009-08-21 07:15:41 +02:00
|
|
|
ErrorF("[dix] Event([%d, %d], mask=0x%lx), client=%d%s",
|
|
|
|
pEvents->u.u.type, pEvents->u.u.detail, mask,
|
|
|
|
client ? client->index : -1,
|
|
|
|
(client && client->clientGone) ? " (gone)" : "");
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2009-08-21 07:15:41 +02:00
|
|
|
|
|
|
|
if (!client || client == serverClient || client->clientGone) {
|
2006-09-30 16:05:46 +02:00
|
|
|
#ifdef DEBUG_EVENTS
|
2009-08-21 07:15:41 +02:00
|
|
|
ErrorF(" not delivered to fake/dead client\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2009-08-21 07:15:41 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-08-21 07:15:41 +02:00
|
|
|
if (filter != CantBeFiltered && !(mask & filter))
|
|
|
|
{
|
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
ErrorF(" filtered\n");
|
|
|
|
#endif
|
|
|
|
return 0;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-08-21 07:15:41 +02:00
|
|
|
if (grab && !SameClient(grab, client))
|
|
|
|
{
|
2006-09-30 16:05:46 +02:00
|
|
|
#ifdef DEBUG_EVENTS
|
2009-08-21 07:15:41 +02:00
|
|
|
ErrorF(" not delivered due to grab\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2009-08-21 07:15:41 +02:00
|
|
|
return -1; /* don't send, but notify caller */
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-08-21 07:15:41 +02:00
|
|
|
|
|
|
|
type = pEvents->u.u.type;
|
|
|
|
if (type == MotionNotify)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-08-21 07:15:41 +02:00
|
|
|
if (mask & PointerMotionHintMask)
|
|
|
|
{
|
|
|
|
if (WID(dev->valuator->motionHintWindow) ==
|
|
|
|
pEvents->u.keyButtonPointer.event)
|
|
|
|
{
|
2006-09-30 16:05:46 +02:00
|
|
|
#ifdef DEBUG_EVENTS
|
2009-08-21 07:15:41 +02:00
|
|
|
ErrorF("[dix] \n");
|
|
|
|
ErrorF("[dix] motionHintWindow == keyButtonPointer.event\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2009-08-21 07:15:41 +02:00
|
|
|
return 1; /* don't send, but pretend we did */
|
|
|
|
}
|
|
|
|
pEvents->u.u.detail = NotifyHint;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pEvents->u.u.detail = NotifyNormal;
|
|
|
|
}
|
|
|
|
}
|
2009-08-21 08:03:36 +02:00
|
|
|
else if (type == DeviceMotionNotify)
|
2009-08-21 07:15:41 +02:00
|
|
|
{
|
2009-08-21 08:03:36 +02:00
|
|
|
if (MaybeSendDeviceMotionNotifyHint((deviceKeyButtonPointer*)pEvents,
|
|
|
|
mask) != 0)
|
2009-08-21 07:15:41 +02:00
|
|
|
return 1;
|
2009-08-21 08:03:36 +02:00
|
|
|
} else if (type == KeyPress)
|
|
|
|
{
|
2009-08-21 08:38:53 +02:00
|
|
|
if (EventIsKeyRepeat(pEvents))
|
2009-08-21 08:03:36 +02:00
|
|
|
{
|
|
|
|
if (!_XkbWantsDetectableAutoRepeat(client))
|
|
|
|
{
|
|
|
|
xEvent release = *pEvents;
|
|
|
|
release.u.u.type = KeyRelease;
|
|
|
|
WriteEventsToClient(client, 1, &release);
|
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
ErrorF(" (plus fake core release for repeat)");
|
|
|
|
#endif
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
ErrorF(" (detectable autorepeat for core)");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (type == DeviceKeyPress)
|
|
|
|
{
|
2009-08-21 08:38:53 +02:00
|
|
|
if (EventIsKeyRepeat(pEvents))
|
2009-08-21 08:03:36 +02:00
|
|
|
{
|
|
|
|
if (!_XkbWantsDetectableAutoRepeat(client))
|
|
|
|
{
|
|
|
|
deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents;
|
|
|
|
release.type = DeviceKeyRelease;
|
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
ErrorF(" (plus fake xi1 release for repeat)");
|
|
|
|
#endif
|
|
|
|
WriteEventsToClient(client, 1, (xEvent *) &release);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
ErrorF(" (detectable autorepeat for core)");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2009-08-21 07:15:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (BitIsOn(criticalEvents, type))
|
|
|
|
{
|
|
|
|
if (client->smart_priority < SMART_MAX_PRIORITY)
|
|
|
|
client->smart_priority++;
|
|
|
|
SetCriticalOutputPending();
|
|
|
|
}
|
|
|
|
|
|
|
|
WriteEventsToClient(client, count, pEvents);
|
|
|
|
#ifdef DEBUG_EVENTS
|
|
|
|
ErrorF("[dix] delivered\n");
|
|
|
|
#endif
|
|
|
|
return 1;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2011-05-11 23:08:28 +02:00
|
|
|
static BOOL
|
|
|
|
ActivateImplicitGrab(DeviceIntPtr dev, ClientPtr client, WindowPtr win,
|
|
|
|
xEvent *event, Mask deliveryMask)
|
|
|
|
{
|
2011-11-04 01:47:27 +01:00
|
|
|
GrabPtr tempGrab;
|
2011-05-11 23:08:28 +02:00
|
|
|
OtherInputMasks *inputMasks;
|
|
|
|
CARD8 type = event->u.u.type;
|
2011-12-08 05:27:01 +01:00
|
|
|
enum InputLevel grabtype;
|
2011-05-11 23:08:28 +02:00
|
|
|
|
|
|
|
if (type == ButtonPress)
|
2011-12-08 05:27:01 +01:00
|
|
|
grabtype = CORE;
|
2011-05-11 23:08:28 +02:00
|
|
|
else if (type == DeviceButtonPress)
|
2011-12-08 05:27:01 +01:00
|
|
|
grabtype = XI;
|
2011-05-11 05:35:39 +02:00
|
|
|
else if ((type = xi2_get_type(event)) == XI_ButtonPress)
|
2011-12-08 05:27:01 +01:00
|
|
|
grabtype = XI2;
|
2011-05-11 23:08:28 +02:00
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab = AllocGrab();
|
|
|
|
if (!tempGrab)
|
|
|
|
return FALSE;
|
|
|
|
tempGrab->next = NULL;
|
|
|
|
tempGrab->device = dev;
|
|
|
|
tempGrab->resource = client->clientAsMask;
|
|
|
|
tempGrab->window = win;
|
|
|
|
tempGrab->ownerEvents = (deliveryMask & OwnerGrabButtonMask) ? TRUE : FALSE;
|
|
|
|
tempGrab->eventMask = deliveryMask;
|
|
|
|
tempGrab->keyboardMode = GrabModeAsync;
|
|
|
|
tempGrab->pointerMode = GrabModeAsync;
|
|
|
|
tempGrab->confineTo = NullWindow;
|
|
|
|
tempGrab->cursor = NullCursor;
|
|
|
|
tempGrab->type = type;
|
|
|
|
tempGrab->grabtype = grabtype;
|
2011-05-11 23:08:28 +02:00
|
|
|
|
|
|
|
/* get the XI and XI2 device mask */
|
|
|
|
inputMasks = wOtherInputMasks(win);
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->deviceMask = (inputMasks) ? inputMasks->inputEvents[dev->id]: 0;
|
2011-05-11 23:08:28 +02:00
|
|
|
|
|
|
|
if (inputMasks)
|
2011-11-04 02:29:01 +01:00
|
|
|
xi2mask_merge(tempGrab->xi2mask, inputMasks->xi2mask);
|
2011-05-11 23:08:28 +02:00
|
|
|
|
2011-11-04 01:47:27 +01:00
|
|
|
(*dev->deviceGrab.ActivateGrab)(dev, tempGrab,
|
2011-05-11 23:08:28 +02:00
|
|
|
currentTime, TRUE | ImplicitGrabMask);
|
2011-11-04 01:47:27 +01:00
|
|
|
FreeGrab(tempGrab);
|
2011-05-11 23:08:28 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-04-12 05:44:30 +02:00
|
|
|
/**
|
|
|
|
* Attempt event delivery to the client owning the window.
|
|
|
|
*/
|
|
|
|
static enum EventDeliveryState
|
|
|
|
DeliverToWindowOwner(DeviceIntPtr dev, WindowPtr win,
|
|
|
|
xEvent *events, int count, Mask filter,
|
|
|
|
GrabPtr grab)
|
|
|
|
{
|
|
|
|
/* if nobody ever wants to see this event, skip some work */
|
|
|
|
if (filter != CantBeFiltered &&
|
|
|
|
!((wOtherEventMasks(win)|win->eventMask) & filter))
|
|
|
|
return EVENT_SKIP;
|
|
|
|
|
|
|
|
if (IsInterferingGrab(wClient(win), dev, events))
|
|
|
|
return EVENT_SKIP;
|
|
|
|
|
|
|
|
if (!XaceHook(XACE_RECEIVE_ACCESS, wClient(win), win, events, count))
|
|
|
|
{
|
|
|
|
int attempt = TryClientEvents(wClient(win), dev, events,
|
|
|
|
count, win->eventMask,
|
|
|
|
filter, grab);
|
|
|
|
if (attempt > 0)
|
|
|
|
return EVENT_DELIVERED;
|
|
|
|
if (attempt < 0)
|
|
|
|
return EVENT_REJECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EVENT_NOT_DELIVERED;
|
|
|
|
}
|
|
|
|
|
2011-05-27 03:40:56 +02:00
|
|
|
|
2011-04-12 06:04:37 +02:00
|
|
|
/**
|
2011-05-27 03:40:56 +02:00
|
|
|
* Get the list of clients that should be tried for event delivery on the
|
|
|
|
* given window.
|
2011-04-12 06:04:37 +02:00
|
|
|
*
|
2011-05-27 03:40:56 +02:00
|
|
|
* @return 1 if the client list should be traversed, zero if the event
|
|
|
|
* should be skipped.
|
2011-04-12 06:04:37 +02:00
|
|
|
*/
|
2011-05-27 03:40:56 +02:00
|
|
|
static Bool
|
|
|
|
GetClientsForDelivery(DeviceIntPtr dev, WindowPtr win,
|
|
|
|
xEvent *events, Mask filter, InputClients **clients)
|
2011-04-12 06:04:37 +02:00
|
|
|
{
|
2011-05-27 03:40:56 +02:00
|
|
|
int rc = 0;
|
2011-04-12 06:04:37 +02:00
|
|
|
|
2011-05-11 05:35:39 +02:00
|
|
|
if (core_get_type(events) != 0)
|
2011-05-27 03:40:56 +02:00
|
|
|
*clients = (InputClients *)wOtherClients(win);
|
2011-05-11 05:35:39 +02:00
|
|
|
else if (xi2_get_type(events) != 0)
|
2011-04-12 06:04:37 +02:00
|
|
|
{
|
|
|
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
|
|
|
/* Has any client selected for the event? */
|
2011-11-03 05:54:06 +01:00
|
|
|
if (!WindowXI2MaskIsset(dev, win, events))
|
2011-04-12 06:04:37 +02:00
|
|
|
goto out;
|
2011-05-27 03:40:56 +02:00
|
|
|
*clients = inputMasks->inputClients;
|
2011-04-12 06:04:37 +02:00
|
|
|
} else {
|
|
|
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
|
|
|
/* Has any client selected for the event? */
|
|
|
|
if (!inputMasks ||
|
|
|
|
!(inputMasks->inputEvents[dev->id] & filter))
|
|
|
|
goto out;
|
|
|
|
|
2011-05-27 03:40:56 +02:00
|
|
|
*clients = inputMasks->inputClients;
|
2011-04-12 06:04:37 +02:00
|
|
|
}
|
|
|
|
|
2011-05-27 03:40:56 +02:00
|
|
|
rc = 1;
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-05-27 04:14:32 +02:00
|
|
|
* Try delivery on each client in inputclients, provided the event mask
|
|
|
|
* accepts it and there is no interfering core grab..
|
2011-05-27 03:40:56 +02:00
|
|
|
*/
|
|
|
|
static enum EventDeliveryState
|
2011-05-27 04:14:32 +02:00
|
|
|
DeliverEventToInputClients(DeviceIntPtr dev, InputClients *inputclients,
|
|
|
|
WindowPtr win, xEvent *events,
|
|
|
|
int count, Mask filter, GrabPtr grab,
|
|
|
|
ClientPtr *client_return, Mask *mask_return)
|
2011-05-27 03:40:56 +02:00
|
|
|
{
|
|
|
|
int attempt;
|
2011-05-27 04:14:32 +02:00
|
|
|
enum EventDeliveryState rc = EVENT_NOT_DELIVERED;
|
2011-05-27 03:40:56 +02:00
|
|
|
|
2011-05-27 04:14:32 +02:00
|
|
|
for (; inputclients; inputclients = inputclients->next)
|
2011-04-12 06:04:37 +02:00
|
|
|
{
|
|
|
|
Mask mask;
|
2011-05-27 04:14:32 +02:00
|
|
|
ClientPtr client = rClient(inputclients);
|
2011-04-12 06:04:37 +02:00
|
|
|
|
2011-05-11 03:43:16 +02:00
|
|
|
if (IsInterferingGrab(client, dev, events))
|
2011-04-12 06:04:37 +02:00
|
|
|
continue;
|
|
|
|
|
2011-05-27 04:14:32 +02:00
|
|
|
mask = GetEventMask(dev, events, inputclients);
|
2011-04-12 06:04:37 +02:00
|
|
|
|
2011-05-11 03:43:16 +02:00
|
|
|
if (XaceHook(XACE_RECEIVE_ACCESS, client, win,
|
2011-04-12 06:04:37 +02:00
|
|
|
events, count))
|
|
|
|
/* do nothing */;
|
2011-05-11 03:43:16 +02:00
|
|
|
else if ( (attempt = TryClientEvents(client, dev,
|
2011-04-12 06:04:37 +02:00
|
|
|
events, count,
|
|
|
|
mask, filter, grab)) )
|
|
|
|
{
|
|
|
|
if (attempt > 0)
|
|
|
|
{
|
|
|
|
rc = EVENT_DELIVERED;
|
2011-05-11 03:43:16 +02:00
|
|
|
*client_return = client;
|
2011-04-12 06:04:37 +02:00
|
|
|
*mask_return = mask;
|
|
|
|
/* Success overrides non-success, so if we've been
|
|
|
|
* successful on one client, return that */
|
|
|
|
} else if (rc == EVENT_NOT_DELIVERED)
|
|
|
|
rc = EVENT_REJECTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2011-05-11 05:35:39 +02:00
|
|
|
|
2011-05-27 04:14:32 +02:00
|
|
|
/**
|
|
|
|
* Deliver events to clients registered on the window.
|
|
|
|
*
|
|
|
|
* @param client_return On successful delivery, set to the recipient.
|
|
|
|
* @param mask_return On successful delivery, set to the recipient's event
|
|
|
|
* mask for this event.
|
|
|
|
*/
|
|
|
|
static enum EventDeliveryState
|
|
|
|
DeliverEventToWindowMask(DeviceIntPtr dev, WindowPtr win, xEvent *events,
|
|
|
|
int count, Mask filter, GrabPtr grab,
|
|
|
|
ClientPtr *client_return, Mask *mask_return)
|
|
|
|
{
|
|
|
|
InputClients *clients;
|
|
|
|
|
|
|
|
if (!GetClientsForDelivery(dev, win, events, filter, &clients))
|
|
|
|
return EVENT_SKIP;
|
|
|
|
|
|
|
|
return DeliverEventToInputClients(dev, clients, win, events, count, filter,
|
|
|
|
grab, client_return, mask_return);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Deliver events to a window. At this point, we do not yet know if the event
|
|
|
|
* actually needs to be delivered. May activate a grab if the event is a
|
|
|
|
* button press.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-05-31 09:35:14 +02:00
|
|
|
* Core events are always delivered to the window owner. If the filter is
|
|
|
|
* something other than CantBeFiltered, the event is also delivered to other
|
|
|
|
* clients with the matching mask on the window.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* More than one event may be delivered at a time. This is the case with
|
|
|
|
* DeviceMotionNotifies which may be followed by DeviceValuator events.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param pWin The window that would get the event.
|
|
|
|
* @param pEvents The events to be delivered.
|
|
|
|
* @param count Number of elements in pEvents.
|
|
|
|
* @param filter Mask based on event type.
|
2007-11-13 07:28:23 +01:00
|
|
|
* @param grab Possible grab on the device that caused the event.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
2011-04-12 06:04:37 +02:00
|
|
|
* @return a positive number if at least one successful delivery has been
|
|
|
|
* made, 0 if no events were delivered, or a negative number if the event
|
|
|
|
* has not been delivered _and_ rejected by at least one client.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-19 00:12:56 +01:00
|
|
|
DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
|
2009-03-18 01:21:59 +01:00
|
|
|
*pEvents, int count, Mask filter, GrabPtr grab)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
int deliveries = 0, nondeliveries = 0;
|
|
|
|
ClientPtr client = NullClient;
|
2003-11-14 17:49:22 +01:00
|
|
|
Mask deliveryMask = 0; /* If a grab occurs due to a button press, then
|
2003-11-14 16:54:54 +01:00
|
|
|
this mask is the mask of the grab. */
|
|
|
|
int type = pEvents->u.u.type;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2009-02-12 07:07:15 +01:00
|
|
|
/* Deliver to window owner */
|
2011-05-11 05:35:39 +02:00
|
|
|
if ((filter == CantBeFiltered) || core_get_type(pEvents) != 0)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-04-12 05:44:30 +02:00
|
|
|
enum EventDeliveryState rc;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2011-04-12 05:44:30 +02:00
|
|
|
rc = DeliverToWindowOwner(pDev, pWin, pEvents, count, filter, grab);
|
2007-03-09 07:43:05 +01:00
|
|
|
|
2011-04-12 05:44:30 +02:00
|
|
|
switch(rc)
|
|
|
|
{
|
|
|
|
case EVENT_SKIP:
|
|
|
|
return 0;
|
|
|
|
case EVENT_REJECTED:
|
|
|
|
nondeliveries--;
|
|
|
|
break;
|
|
|
|
case EVENT_DELIVERED:
|
|
|
|
/* We delivered to the owner, with our event mask */
|
|
|
|
deliveries++;
|
|
|
|
client = wClient(pWin);
|
|
|
|
deliveryMask = pWin->eventMask;
|
|
|
|
break;
|
|
|
|
case EVENT_NOT_DELIVERED:
|
|
|
|
break;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-02-12 07:07:15 +01:00
|
|
|
|
|
|
|
/* CantBeFiltered means only window owner gets the event */
|
2003-11-14 16:54:54 +01:00
|
|
|
if (filter != CantBeFiltered)
|
|
|
|
{
|
2011-04-12 06:04:37 +02:00
|
|
|
enum EventDeliveryState rc;
|
2007-04-30 05:27:42 +02:00
|
|
|
|
2011-05-27 03:43:50 +02:00
|
|
|
rc = DeliverEventToWindowMask(pDev, pWin, pEvents, count, filter,
|
|
|
|
grab, &client, &deliveryMask);
|
2007-04-30 05:27:42 +02:00
|
|
|
|
2011-04-12 06:04:37 +02:00
|
|
|
switch(rc)
|
2009-02-12 07:07:15 +01:00
|
|
|
{
|
2011-04-12 06:04:37 +02:00
|
|
|
case EVENT_SKIP:
|
|
|
|
return 0;
|
|
|
|
case EVENT_REJECTED:
|
|
|
|
nondeliveries--;
|
|
|
|
break;
|
|
|
|
case EVENT_DELIVERED:
|
|
|
|
deliveries++;
|
|
|
|
break;
|
|
|
|
case EVENT_NOT_DELIVERED:
|
|
|
|
break;
|
2009-02-12 07:07:15 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2011-04-12 06:04:37 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (deliveries)
|
2011-04-14 07:09:39 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Note that since core events are delivered first, an implicit grab may
|
|
|
|
* be activated on a core grab, stopping the XI events.
|
|
|
|
*/
|
|
|
|
if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask))
|
|
|
|
/* grab activated */;
|
2011-05-15 01:23:59 +02:00
|
|
|
else if (type == MotionNotify)
|
2011-04-14 07:09:39 +02:00
|
|
|
pDev->valuator->motionHintWindow = pWin;
|
|
|
|
else if (type == DeviceMotionNotify || type == DeviceButtonPress)
|
|
|
|
CheckDeviceGrabAndHintWindow (pWin, type,
|
|
|
|
(deviceKeyButtonPointer*) pEvents,
|
|
|
|
grab, client, deliveryMask);
|
2003-11-14 16:54:54 +01:00
|
|
|
return deliveries;
|
2011-04-14 07:09:39 +02:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
return nondeliveries;
|
|
|
|
}
|
|
|
|
|
2011-05-11 05:56:08 +02:00
|
|
|
/**
|
|
|
|
* Filter out raw events for XI 2.0 and XI 2.1 clients.
|
|
|
|
*
|
|
|
|
* If there is a grab on the device, 2.0 clients only get raw events if they
|
|
|
|
* have the grab. 2.1+ clients get raw events in all cases.
|
|
|
|
*
|
|
|
|
* @return TRUE if the event should be discarded, FALSE otherwise.
|
|
|
|
*/
|
|
|
|
static BOOL
|
|
|
|
FilterRawEvents(const ClientPtr client, const GrabPtr grab)
|
|
|
|
{
|
|
|
|
XIClientPtr client_xi_version;
|
|
|
|
int cmp;
|
|
|
|
|
|
|
|
/* device not grabbed -> don't filter */
|
|
|
|
if (!grab)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
client_xi_version = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
|
|
|
|
|
|
|
cmp = version_compare(client_xi_version->major_version,
|
|
|
|
client_xi_version->minor_version, 2, 0);
|
|
|
|
/* XI 2.0: if device is grabbed, skip
|
|
|
|
XI 2.1: if device is grabbed by us, skip, we've already delivered */
|
|
|
|
return (cmp == 0) ? TRUE : SameClient(grab, client);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deliver a raw event to the grab owner (if any) and to all root windows.
|
|
|
|
*
|
|
|
|
* Raw event delivery differs between XI 2.0 and XI 2.1.
|
|
|
|
* XI 2.0: events delivered to the grabbing client (if any) OR to all root
|
|
|
|
* windows
|
|
|
|
* XI 2.1: events delivered to all root windows, regardless of grabbing
|
|
|
|
* state.
|
|
|
|
*/
|
2011-05-27 06:21:39 +02:00
|
|
|
void
|
|
|
|
DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
|
|
|
|
{
|
|
|
|
GrabPtr grab = device->deviceGrab.grab;
|
2011-05-11 05:56:08 +02:00
|
|
|
xEvent *xi;
|
2011-05-30 01:47:06 +02:00
|
|
|
int i, rc;
|
2011-05-11 05:56:08 +02:00
|
|
|
int filter;
|
|
|
|
|
2011-05-30 01:47:06 +02:00
|
|
|
rc = EventToXI2((InternalEvent*)ev, (xEvent**)&xi);
|
|
|
|
if (rc != Success)
|
2011-05-11 05:56:08 +02:00
|
|
|
{
|
|
|
|
ErrorF("[Xi] %s: XI2 conversion failed in %s (%d)\n",
|
2011-05-30 01:47:06 +02:00
|
|
|
__func__, device->name, rc);
|
2011-05-11 05:56:08 +02:00
|
|
|
return;
|
|
|
|
}
|
2011-05-27 06:21:39 +02:00
|
|
|
|
|
|
|
if (grab)
|
|
|
|
DeliverGrabbedEvent((InternalEvent*)ev, device, FALSE);
|
|
|
|
|
2011-05-11 05:56:08 +02:00
|
|
|
filter = GetEventFilter(device, xi);
|
2011-05-27 06:21:39 +02:00
|
|
|
|
2011-05-11 05:56:08 +02:00
|
|
|
for (i = 0; i < screenInfo.numScreens; i++)
|
|
|
|
{
|
|
|
|
WindowPtr root;
|
|
|
|
InputClients *inputclients;
|
2011-05-27 06:21:39 +02:00
|
|
|
|
2011-05-11 05:56:08 +02:00
|
|
|
root = screenInfo.screens[i]->root;
|
|
|
|
if (!GetClientsForDelivery(device, root, xi, filter, &inputclients))
|
|
|
|
continue;
|
2011-05-27 06:21:39 +02:00
|
|
|
|
2011-05-11 05:56:08 +02:00
|
|
|
for (; inputclients; inputclients = inputclients->next)
|
|
|
|
{
|
|
|
|
ClientPtr c; /* unused */
|
|
|
|
Mask m; /* unused */
|
|
|
|
InputClients ic = *inputclients;
|
|
|
|
|
|
|
|
/* Because we run through the list manually, copy the actual
|
|
|
|
* list, shorten the copy to only have one client and then pass
|
|
|
|
* that down to DeliverEventToInputClients. This way we avoid
|
|
|
|
* double events on XI 2.1 clients that have a grab on the
|
|
|
|
* device.
|
|
|
|
*/
|
|
|
|
ic.next = NULL;
|
|
|
|
|
|
|
|
if (!FilterRawEvents(rClient(&ic), grab))
|
|
|
|
DeliverEventToInputClients(device, &ic, root, xi, 1,
|
|
|
|
filter, NULL, &c, &m);
|
|
|
|
}
|
2011-05-27 06:21:39 +02:00
|
|
|
}
|
2011-05-11 05:56:08 +02:00
|
|
|
|
|
|
|
free(xi);
|
2011-05-27 06:21:39 +02:00
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* If the event goes to dontClient, don't send it and return 0. if
|
|
|
|
send works, return 1 or if send didn't work, return 2.
|
|
|
|
Only works for core events.
|
|
|
|
*/
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
2007-11-13 07:28:23 +01:00
|
|
|
static int
|
2003-11-14 17:49:22 +01:00
|
|
|
XineramaTryClientEventsResult(
|
|
|
|
ClientPtr client,
|
|
|
|
GrabPtr grab,
|
2007-11-13 07:28:23 +01:00
|
|
|
Mask mask,
|
2003-11-14 17:49:22 +01:00
|
|
|
Mask filter
|
|
|
|
){
|
|
|
|
if ((client) && (client != serverClient) && (!client->clientGone) &&
|
|
|
|
((filter == CantBeFiltered) || (mask & filter)))
|
|
|
|
{
|
|
|
|
if (grab && !SameClient(grab, client)) return -1;
|
|
|
|
else return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Try to deliver events to the interested parties.
|
|
|
|
*
|
|
|
|
* @param pWin The window that would get the event.
|
|
|
|
* @param pEvents The events to be delivered.
|
|
|
|
* @param count Number of elements in pEvents.
|
|
|
|
* @param filter Mask based on event type.
|
|
|
|
* @param dontClient Don't deliver to the dontClient.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-11-13 07:28:23 +01:00
|
|
|
MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents,
|
2005-03-08 00:02:59 +01:00
|
|
|
int count, Mask filter, ClientPtr dontClient)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
OtherClients *other;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (pWin->eventMask & filter)
|
|
|
|
{
|
|
|
|
if (wClient(pWin) == dontClient)
|
|
|
|
return 0;
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
2007-11-13 07:28:23 +01:00
|
|
|
if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
|
2003-11-14 17:49:22 +01:00
|
|
|
return XineramaTryClientEventsResult(
|
|
|
|
wClient(pWin), NullGrab, pWin->eventMask, filter);
|
|
|
|
#endif
|
2007-08-29 20:16:46 +02:00
|
|
|
if (XaceHook(XACE_RECEIVE_ACCESS, wClient(pWin), pWin, pEvents, count))
|
2007-10-23 19:35:30 +02:00
|
|
|
return 1; /* don't send, but pretend we did */
|
2008-01-18 09:18:46 +01:00
|
|
|
return TryClientEvents(wClient(pWin), NULL, pEvents, count,
|
2003-11-14 16:54:54 +01:00
|
|
|
pWin->eventMask, filter, NullGrab);
|
|
|
|
}
|
|
|
|
for (other = wOtherClients(pWin); other; other = other->next)
|
|
|
|
{
|
|
|
|
if (other->mask & filter)
|
|
|
|
{
|
|
|
|
if (SameClient(other, dontClient))
|
|
|
|
return 0;
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
2007-11-13 07:28:23 +01:00
|
|
|
if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
|
2003-11-14 17:49:22 +01:00
|
|
|
return XineramaTryClientEventsResult(
|
|
|
|
rClient(other), NullGrab, other->mask, filter);
|
|
|
|
#endif
|
2007-08-29 20:16:46 +02:00
|
|
|
if (XaceHook(XACE_RECEIVE_ACCESS, rClient(other), pWin, pEvents,
|
|
|
|
count))
|
2007-10-23 19:35:30 +02:00
|
|
|
return 1; /* don't send, but pretend we did */
|
2008-01-18 09:18:46 +01:00
|
|
|
return TryClientEvents(rClient(other), NULL, pEvents, count,
|
2003-11-14 16:54:54 +01:00
|
|
|
other->mask, filter, NullGrab);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2010-09-20 07:03:04 +02:00
|
|
|
static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event)
|
2009-03-08 02:47:26 +01:00
|
|
|
{
|
2011-01-18 21:16:36 +01:00
|
|
|
WindowPtr w = DeepestSpriteWin(pSprite);
|
2009-09-14 00:03:17 +02:00
|
|
|
Window child = None;
|
2009-03-08 02:47:26 +01:00
|
|
|
|
|
|
|
/* If the search ends up past the root should the child field be
|
|
|
|
set to none or should the value in the argument be passed
|
|
|
|
through. It probably doesn't matter since everyone calls
|
|
|
|
this function with child == None anyway. */
|
|
|
|
while (w)
|
|
|
|
{
|
|
|
|
/* If the source window is same as event window, child should be
|
|
|
|
none. Don't bother going all all the way back to the root. */
|
|
|
|
|
|
|
|
if (w == event)
|
|
|
|
{
|
|
|
|
child = None;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (w->parent == event)
|
|
|
|
{
|
|
|
|
child = w->drawable.id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
w = w->parent;
|
|
|
|
}
|
|
|
|
return child;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Adjust event fields to comply with the window properties.
|
|
|
|
*
|
|
|
|
* @param xE Event to be modified in place
|
|
|
|
* @param pWin The window to get the information from.
|
|
|
|
* @param child Child window setting for event (if applicable)
|
|
|
|
* @param calcChild If True, calculate the child window.
|
|
|
|
*/
|
2009-02-23 07:12:25 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
FixUpEventFromWindow(
|
2010-09-20 07:03:04 +02:00
|
|
|
SpritePtr pSprite,
|
2003-11-14 17:49:22 +01:00
|
|
|
xEvent *xE,
|
|
|
|
WindowPtr pWin,
|
|
|
|
Window child,
|
|
|
|
Bool calcChild)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-05-11 05:35:39 +02:00
|
|
|
int evtype;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (calcChild)
|
2010-09-20 07:03:04 +02:00
|
|
|
child = FindChildForEvent(pSprite, pWin);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2011-05-11 05:35:39 +02:00
|
|
|
if ((evtype = xi2_get_type(xE)))
|
2009-03-08 02:47:26 +01:00
|
|
|
{
|
|
|
|
xXIDeviceEvent* event = (xXIDeviceEvent*)xE;
|
2009-03-10 07:08:14 +01:00
|
|
|
|
2011-05-11 05:35:39 +02:00
|
|
|
switch (evtype)
|
|
|
|
{
|
|
|
|
case XI_RawKeyPress:
|
|
|
|
case XI_RawKeyRelease:
|
|
|
|
case XI_RawButtonPress:
|
|
|
|
case XI_RawButtonRelease:
|
|
|
|
case XI_RawMotion:
|
|
|
|
case XI_DeviceChanged:
|
|
|
|
case XI_HierarchyChanged:
|
|
|
|
case XI_PropertyEvent:
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-03-10 07:08:14 +01:00
|
|
|
|
2010-09-20 07:03:04 +02:00
|
|
|
event->root = RootWindow(pSprite)->drawable.id;
|
2009-03-08 02:47:26 +01:00
|
|
|
event->event = pWin->drawable.id;
|
|
|
|
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
|
|
|
{
|
2009-05-26 05:58:04 +02:00
|
|
|
event->event_x = event->root_x - FP1616(pWin->drawable.x, 0);
|
|
|
|
event->event_y = event->root_y - FP1616(pWin->drawable.y, 0);
|
2009-03-08 02:47:26 +01:00
|
|
|
event->child = child;
|
|
|
|
} else
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-04-19 14:12:11 +02:00
|
|
|
event->event_x = 0;
|
|
|
|
event->event_y = 0;
|
2009-03-08 02:47:26 +01:00
|
|
|
event->child = None;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-03-11 07:08:24 +01:00
|
|
|
if (event->evtype == XI_Enter || event->evtype == XI_Leave ||
|
|
|
|
event->evtype == XI_FocusIn || event->evtype == XI_FocusOut)
|
2009-03-08 02:47:26 +01:00
|
|
|
((xXIEnterEvent*)event)->same_screen =
|
|
|
|
(pSprite->hot.pScreen == pWin->drawable.pScreen);
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2009-03-08 02:47:26 +01:00
|
|
|
} else
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2010-09-20 07:03:04 +02:00
|
|
|
XE_KBPTR.root = RootWindow(pSprite)->drawable.id;
|
2009-03-08 02:47:26 +01:00
|
|
|
XE_KBPTR.event = pWin->drawable.id;
|
|
|
|
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
|
|
|
{
|
|
|
|
XE_KBPTR.sameScreen = xTrue;
|
|
|
|
XE_KBPTR.child = child;
|
|
|
|
XE_KBPTR.eventX =
|
|
|
|
XE_KBPTR.rootX - pWin->drawable.x;
|
|
|
|
XE_KBPTR.eventY =
|
|
|
|
XE_KBPTR.rootY - pWin->drawable.y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XE_KBPTR.sameScreen = xFalse;
|
|
|
|
XE_KBPTR.child = None;
|
|
|
|
XE_KBPTR.eventX = 0;
|
|
|
|
XE_KBPTR.eventY = 0;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-12 01:12:45 +01:00
|
|
|
/**
|
|
|
|
* Check if a given event is deliverable at all on a given window.
|
|
|
|
*
|
|
|
|
* This function only checks if any client wants it, not for a specific
|
|
|
|
* client.
|
|
|
|
*
|
|
|
|
* @param[in] dev The device this event is being sent for.
|
2011-12-09 09:02:49 +01:00
|
|
|
* @param[in] evtype The event type of the event that is to be sent.
|
2009-02-12 01:12:45 +01:00
|
|
|
* @param[in] win The current event window.
|
|
|
|
*
|
2011-02-15 12:28:00 +01:00
|
|
|
* @return Bitmask of ::EVENT_XI2_MASK, ::EVENT_XI1_MASK, ::EVENT_CORE_MASK, and
|
|
|
|
* ::EVENT_DONT_PROPAGATE_MASK.
|
2009-02-12 01:12:45 +01:00
|
|
|
*/
|
2010-12-17 18:13:30 +01:00
|
|
|
int
|
2011-12-09 09:02:49 +01:00
|
|
|
EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
|
2009-02-12 01:12:45 +01:00
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
int filter = 0;
|
|
|
|
int type;
|
2009-06-02 08:53:41 +02:00
|
|
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
2011-08-11 02:59:07 +02:00
|
|
|
|
2011-12-09 09:02:49 +01:00
|
|
|
if ((type = GetXI2Type(evtype)) != 0)
|
2011-08-11 02:59:07 +02:00
|
|
|
{
|
2011-11-04 02:29:01 +01:00
|
|
|
if (inputMasks && xi2mask_isset(inputMasks->xi2mask, dev, type))
|
2011-08-11 02:59:07 +02:00
|
|
|
rc |= EVENT_XI2_MASK;
|
|
|
|
}
|
|
|
|
|
2011-12-09 09:02:49 +01:00
|
|
|
if ((type = GetXIType(evtype)) != 0)
|
2011-08-11 02:59:07 +02:00
|
|
|
{
|
2011-12-09 09:38:53 +01:00
|
|
|
filter = event_get_filter_from_type(dev, type);
|
2011-08-11 02:59:07 +02:00
|
|
|
|
|
|
|
/* Check for XI mask */
|
|
|
|
if (inputMasks &&
|
|
|
|
(inputMasks->deliverableEvents[dev->id] & filter) &&
|
|
|
|
(inputMasks->inputEvents[dev->id] & filter))
|
|
|
|
rc |= EVENT_XI1_MASK;
|
|
|
|
|
|
|
|
/* Check for XI DontPropagate mask */
|
|
|
|
if (inputMasks && (inputMasks->dontPropagateMask[dev->id] & filter))
|
|
|
|
rc |= EVENT_DONT_PROPAGATE_MASK;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-12-09 09:02:49 +01:00
|
|
|
if ((type = GetCoreType(evtype)) != 0)
|
2011-08-11 02:59:07 +02:00
|
|
|
{
|
2011-12-09 09:38:53 +01:00
|
|
|
filter = event_get_filter_from_type(dev, type);
|
2011-08-11 02:59:07 +02:00
|
|
|
|
|
|
|
/* Check for core mask */
|
|
|
|
if ((win->deliverableEvents & filter) &&
|
|
|
|
((wOtherEventMasks(win) | win->eventMask) & filter))
|
|
|
|
rc |= EVENT_CORE_MASK;
|
|
|
|
|
|
|
|
/* Check for core DontPropagate mask */
|
|
|
|
if (filter & wDontPropagateMask(win))
|
|
|
|
rc |= EVENT_DONT_PROPAGATE_MASK;
|
|
|
|
}
|
2009-02-12 01:12:45 +01:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2011-12-05 07:46:18 +01:00
|
|
|
static int
|
|
|
|
DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count,
|
|
|
|
WindowPtr win, Window child, GrabPtr grab)
|
|
|
|
{
|
|
|
|
SpritePtr pSprite = dev->spriteInfo->sprite;
|
|
|
|
Mask filter;
|
|
|
|
int deliveries = 0;
|
|
|
|
|
|
|
|
if (XaceHook(XACE_SEND_ACCESS, NULL, dev, win, xE, count) == Success) {
|
|
|
|
filter = GetEventFilter(dev, xE);
|
|
|
|
FixUpEventFromWindow(pSprite, xE, win, child, FALSE);
|
|
|
|
deliveries = DeliverEventsToWindow(dev, win, xE, count,
|
|
|
|
filter, grab);
|
|
|
|
}
|
|
|
|
|
|
|
|
return deliveries;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
DeliverOneEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level,
|
|
|
|
WindowPtr win, Window child, GrabPtr grab)
|
|
|
|
{
|
|
|
|
xEvent *xE = NULL;
|
|
|
|
int count = 0;
|
|
|
|
int deliveries = 0;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
switch(level)
|
|
|
|
{
|
|
|
|
case XI2:
|
|
|
|
rc = EventToXI2(event, &xE);
|
|
|
|
count = 1;
|
|
|
|
break;
|
|
|
|
case XI:
|
|
|
|
rc = EventToXI(event, &xE, &count);
|
|
|
|
break;
|
|
|
|
case CORE:
|
|
|
|
rc = EventToCore(event, &xE, &count);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rc == Success)
|
|
|
|
{
|
|
|
|
deliveries = DeliverEvent(dev, xE, count, win, child, grab);
|
|
|
|
free(xE);
|
|
|
|
} else
|
|
|
|
BUG_WARN_MSG(rc != BadMatch, "%s: conversion to level %d failed with rc %d\n",
|
|
|
|
dev->name, level, rc);
|
|
|
|
return deliveries;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2009-02-02 05:44:13 +01:00
|
|
|
* Deliver events caused by input devices.
|
|
|
|
*
|
2007-09-12 10:39:57 +02:00
|
|
|
* For events from a non-grabbed, non-focus device, DeliverDeviceEvents is
|
|
|
|
* called directly from the processInputProc.
|
|
|
|
* For grabbed devices, DeliverGrabbedEvent is called first, and _may_ call
|
|
|
|
* DeliverDeviceEvents.
|
|
|
|
* For focused events, DeliverFocusedEvent is called first, and _may_ call
|
|
|
|
* DeliverDeviceEvents.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* @param pWin Window to deliver event to.
|
2009-02-02 05:44:13 +01:00
|
|
|
* @param event The events to deliver, not yet in wire format.
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param grab Possible grab on a device.
|
|
|
|
* @param stopAt Don't recurse up to the root window.
|
|
|
|
* @param dev The device that is responsible for the event.
|
|
|
|
*
|
2007-09-12 10:39:57 +02:00
|
|
|
* @see DeliverGrabbedEvent
|
|
|
|
* @see DeliverFocusedEvent
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2009-02-01 11:18:33 +01:00
|
|
|
DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
|
|
|
WindowPtr stopAt, DeviceIntPtr dev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
Window child = None;
|
|
|
|
int deliveries = 0;
|
2011-12-05 07:46:18 +01:00
|
|
|
int mask;
|
2009-02-01 11:18:33 +01:00
|
|
|
|
2011-05-05 00:48:19 +02:00
|
|
|
verify_internal_event(event);
|
2009-02-16 07:34:05 +01:00
|
|
|
|
2009-02-12 01:12:45 +01:00
|
|
|
while (pWin)
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
{
|
2011-12-09 09:02:49 +01:00
|
|
|
if ((mask = EventIsDeliverable(dev, event->any.type, pWin)))
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
{
|
2009-06-03 02:45:28 +02:00
|
|
|
/* XI2 events first */
|
2011-02-15 12:28:00 +01:00
|
|
|
if (mask & EVENT_XI2_MASK)
|
2009-03-06 05:45:26 +01:00
|
|
|
{
|
2011-12-05 07:46:18 +01:00
|
|
|
deliveries = DeliverOneEvent(event, dev, XI2, pWin, child, grab);
|
|
|
|
if (deliveries > 0)
|
|
|
|
break;
|
2009-03-06 05:45:26 +01:00
|
|
|
}
|
|
|
|
|
2009-06-03 02:45:28 +02:00
|
|
|
/* XI events */
|
2011-02-15 12:28:00 +01:00
|
|
|
if (mask & EVENT_XI1_MASK)
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
{
|
2011-12-05 07:46:18 +01:00
|
|
|
deliveries = DeliverOneEvent(event, dev, XI, pWin, child, grab);
|
|
|
|
if (deliveries > 0)
|
|
|
|
break;
|
2007-05-02 06:20:09 +02:00
|
|
|
}
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
|
2009-02-12 01:12:45 +01:00
|
|
|
/* Core event */
|
2011-02-15 12:28:00 +01:00
|
|
|
if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents)
|
2009-02-02 05:44:13 +01:00
|
|
|
{
|
2011-12-05 07:46:18 +01:00
|
|
|
deliveries = DeliverOneEvent(event, dev, CORE, pWin, child, grab);
|
|
|
|
if (deliveries > 0)
|
|
|
|
break;
|
2007-05-02 06:20:09 +02:00
|
|
|
}
|
2009-01-05 19:35:18 +01:00
|
|
|
|
2011-12-08 03:00:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((deliveries < 0) || (pWin == stopAt) ||
|
|
|
|
(mask & EVENT_DONT_PROPAGATE_MASK))
|
|
|
|
{
|
|
|
|
deliveries = 0;
|
|
|
|
break;
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
child = pWin->drawable.id;
|
|
|
|
pWin = pWin->parent;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
|
2009-02-02 05:44:13 +01:00
|
|
|
return deliveries;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Deliver event to a window and it's immediate parent. Used for most window
|
|
|
|
* events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
|
2007-11-13 07:28:23 +01:00
|
|
|
* propagate up the tree or extension events
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* In case of a ReparentNotify event, the event will be delivered to the
|
|
|
|
* otherParent as well.
|
|
|
|
*
|
|
|
|
* @param pWin Window to deliver events to.
|
|
|
|
* @param xE Events to deliver.
|
|
|
|
* @param count number of events in xE.
|
|
|
|
* @param otherParent Used for ReparentNotify events.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-11-13 07:28:23 +01:00
|
|
|
DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
|
2007-03-08 08:20:19 +01:00
|
|
|
WindowPtr otherParent)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-03-06 13:27:54 +01:00
|
|
|
DeviceIntRec dummy;
|
2011-02-15 12:28:01 +01:00
|
|
|
int deliveries;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
|
|
|
|
return count;
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!count)
|
|
|
|
return 0;
|
2009-03-06 13:27:54 +01:00
|
|
|
|
2009-05-07 08:52:31 +02:00
|
|
|
dummy.id = XIAllDevices;
|
2011-02-15 12:28:01 +01:00
|
|
|
|
|
|
|
switch (xE->u.u.type)
|
|
|
|
{
|
|
|
|
case DestroyNotify:
|
|
|
|
case UnmapNotify:
|
|
|
|
case MapNotify:
|
|
|
|
case MapRequest:
|
|
|
|
case ReparentNotify:
|
|
|
|
case ConfigureNotify:
|
|
|
|
case ConfigureRequest:
|
|
|
|
case GravityNotify:
|
|
|
|
case CirculateNotify:
|
|
|
|
case CirculateRequest:
|
|
|
|
xE->u.destroyNotify.event = pWin->drawable.id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (xE->u.u.type)
|
|
|
|
{
|
|
|
|
case DestroyNotify:
|
|
|
|
case UnmapNotify:
|
|
|
|
case MapNotify:
|
|
|
|
case ReparentNotify:
|
|
|
|
case ConfigureNotify:
|
|
|
|
case GravityNotify:
|
|
|
|
case CirculateNotify:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
Mask filter;
|
|
|
|
filter = GetEventFilter(&dummy, xE);
|
|
|
|
return DeliverEventsToWindow(&dummy, pWin, xE, count, filter,
|
|
|
|
NullGrab);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-18 01:21:59 +01:00
|
|
|
deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count,
|
|
|
|
StructureNotifyMask, NullGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (pWin->parent)
|
|
|
|
{
|
|
|
|
xE->u.destroyNotify.event = pWin->parent->drawable.id;
|
2009-03-06 13:27:54 +01:00
|
|
|
deliveries += DeliverEventsToWindow(&dummy, pWin->parent, xE, count,
|
2009-03-18 01:21:59 +01:00
|
|
|
SubstructureNotifyMask, NullGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (xE->u.u.type == ReparentNotify)
|
|
|
|
{
|
|
|
|
xE->u.destroyNotify.event = otherParent->drawable.id;
|
2009-03-06 13:27:54 +01:00
|
|
|
deliveries += DeliverEventsToWindow(&dummy,
|
2006-11-22 08:28:57 +01:00
|
|
|
otherParent, xE, count, SubstructureNotifyMask,
|
2009-03-18 01:21:59 +01:00
|
|
|
NullGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return deliveries;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
static Bool
|
2003-11-14 17:49:22 +01:00
|
|
|
PointInBorderSize(WindowPtr pWin, int x, int y)
|
|
|
|
{
|
|
|
|
BoxRec box;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if(RegionContainsPoint(&pWin->borderSize, x, y, &box))
|
2003-11-14 17:49:22 +01:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
2007-11-13 07:28:23 +01:00
|
|
|
if(!noPanoramiXExtension &&
|
2006-12-11 08:39:59 +01:00
|
|
|
XineramaSetWindowPntrs(inputInfo.pointer, pWin)) {
|
2010-05-02 18:14:39 +02:00
|
|
|
SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite;
|
2003-11-14 17:49:22 +01:00
|
|
|
int i;
|
|
|
|
|
2011-03-09 06:05:26 +01:00
|
|
|
FOR_NSCREENS_FORWARD_SKIP(i) {
|
2010-06-06 05:55:29 +02:00
|
|
|
if(RegionContainsPoint(&pSprite->windows[i]->borderSize,
|
|
|
|
x + screenInfo.screens[0]->x - screenInfo.screens[i]->x,
|
|
|
|
y + screenInfo.screens[0]->y - screenInfo.screens[i]->y,
|
|
|
|
&box))
|
2003-11-14 17:49:22 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Traversed from the root window to the window at the position x/y. While
|
|
|
|
* traversing, it sets up the traversal history in the spriteTrace array.
|
|
|
|
* After completing, the spriteTrace history is set in the following way:
|
|
|
|
* spriteTrace[0] ... root window
|
|
|
|
* spriteTrace[1] ... top level window that encloses x/y
|
|
|
|
* ...
|
|
|
|
* spriteTrace[spriteTraceGood - 1] ... window at x/y
|
|
|
|
*
|
|
|
|
* @returns the window at the given coordinates.
|
|
|
|
*/
|
2010-09-20 07:03:05 +02:00
|
|
|
WindowPtr
|
|
|
|
XYToWindow(SpritePtr pSprite, int x, int y)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
WindowPtr pWin;
|
2005-06-10 06:01:14 +02:00
|
|
|
BoxRec box;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-04-26 08:28:50 +02:00
|
|
|
pSprite->spriteTraceGood = 1; /* root window still there */
|
2010-09-20 07:03:05 +02:00
|
|
|
pWin = RootWindow(pSprite)->firstChild;
|
2003-11-14 16:54:54 +01:00
|
|
|
while (pWin)
|
|
|
|
{
|
|
|
|
if ((pWin->mapped) &&
|
2005-06-10 06:01:14 +02:00
|
|
|
(x >= pWin->drawable.x - wBorderWidth (pWin)) &&
|
|
|
|
(x < pWin->drawable.x + (int)pWin->drawable.width +
|
|
|
|
wBorderWidth(pWin)) &&
|
|
|
|
(y >= pWin->drawable.y - wBorderWidth (pWin)) &&
|
|
|
|
(y < pWin->drawable.y + (int)pWin->drawable.height +
|
|
|
|
wBorderWidth (pWin))
|
|
|
|
/* When a window is shaped, a further check
|
|
|
|
* is made to see if the point is inside
|
|
|
|
* borderSize
|
|
|
|
*/
|
|
|
|
&& (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y))
|
|
|
|
&& (!wInputShape(pWin) ||
|
2010-06-06 05:55:29 +02:00
|
|
|
RegionContainsPoint(wInputShape(pWin),
|
|
|
|
x - pWin->drawable.x,
|
|
|
|
y - pWin->drawable.y, &box))
|
2008-04-09 02:02:56 +02:00
|
|
|
#ifdef ROOTLESS
|
|
|
|
/* In rootless mode windows may be offscreen, even when
|
|
|
|
* they're in X's stack. (E.g. if the native window system
|
|
|
|
* implements some form of virtual desktop system).
|
|
|
|
*/
|
|
|
|
&& !pWin->rootlessUnhittable
|
2005-06-10 06:01:14 +02:00
|
|
|
#endif
|
|
|
|
)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-04-26 08:28:50 +02:00
|
|
|
if (pSprite->spriteTraceGood >= pSprite->spriteTraceSize)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-04-26 08:28:50 +02:00
|
|
|
pSprite->spriteTraceSize += 10;
|
2010-05-05 20:44:06 +02:00
|
|
|
pSprite->spriteTrace = realloc(pSprite->spriteTrace,
|
2007-04-26 08:28:50 +02:00
|
|
|
pSprite->spriteTraceSize*sizeof(WindowPtr));
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-04-26 08:28:50 +02:00
|
|
|
pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin;
|
2003-11-14 16:54:54 +01:00
|
|
|
pWin = pWin->firstChild;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pWin = pWin->nextSib;
|
|
|
|
}
|
2011-01-18 21:16:36 +01:00
|
|
|
return DeepestSpriteWin(pSprite);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2009-05-26 06:42:25 +02:00
|
|
|
/**
|
|
|
|
* Ungrab a currently FocusIn grabbed device and grab the device on the
|
|
|
|
* given window. If the win given is the NoneWin, the device is ungrabbed if
|
|
|
|
* applicable and FALSE is returned.
|
|
|
|
*
|
|
|
|
* @returns TRUE if the device has been grabbed, or FALSE otherwise.
|
|
|
|
*/
|
|
|
|
BOOL
|
2009-05-27 07:47:12 +02:00
|
|
|
ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
|
2009-05-26 06:42:25 +02:00
|
|
|
{
|
2009-05-27 07:47:12 +02:00
|
|
|
BOOL rc = FALSE;
|
2009-05-26 06:42:25 +02:00
|
|
|
DeviceEvent event;
|
|
|
|
|
2010-08-04 04:40:26 +02:00
|
|
|
if (dev->deviceGrab.grab)
|
2009-05-26 06:42:25 +02:00
|
|
|
{
|
2010-08-04 04:40:26 +02:00
|
|
|
if (!dev->deviceGrab.fromPassiveGrab ||
|
|
|
|
dev->deviceGrab.grab->type != XI_Enter ||
|
|
|
|
dev->deviceGrab.grab->window == win ||
|
2009-05-26 06:42:25 +02:00
|
|
|
IsParent(dev->deviceGrab.grab->window, win))
|
|
|
|
return FALSE;
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
|
2009-05-26 06:42:25 +02:00
|
|
|
(*dev->deviceGrab.DeactivateGrab)(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (win == NoneWin || win == PointerRootWin)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
memset(&event, 0, sizeof(DeviceEvent));
|
|
|
|
event.header = ET_Internal;
|
|
|
|
event.type = ET_FocusIn;
|
|
|
|
event.length = sizeof(DeviceEvent);
|
|
|
|
event.time = GetTimeInMillis();
|
|
|
|
event.deviceid = dev->id;
|
|
|
|
event.sourceid = dev->id;
|
|
|
|
event.detail.button = 0;
|
2011-01-19 21:38:44 +01:00
|
|
|
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
|
|
|
|
TRUE) != NULL);
|
2009-05-27 07:47:12 +02:00
|
|
|
if (rc)
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
|
2009-05-27 07:47:12 +02:00
|
|
|
return rc;
|
2009-05-26 06:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-05-27 07:47:12 +02:00
|
|
|
* Ungrab a currently Enter grabbed device and grab the device for the given
|
2009-05-26 06:42:25 +02:00
|
|
|
* window.
|
|
|
|
*
|
|
|
|
* @returns TRUE if the device has been grabbed, or FALSE otherwise.
|
|
|
|
*/
|
|
|
|
static BOOL
|
2009-05-27 07:47:12 +02:00
|
|
|
ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
|
2009-05-26 06:42:25 +02:00
|
|
|
{
|
2009-05-27 07:47:12 +02:00
|
|
|
BOOL rc = FALSE;
|
2009-05-26 06:42:25 +02:00
|
|
|
DeviceEvent event;
|
|
|
|
|
2010-08-04 04:40:26 +02:00
|
|
|
if (dev->deviceGrab.grab)
|
2009-05-26 06:42:25 +02:00
|
|
|
{
|
2010-08-04 04:40:26 +02:00
|
|
|
if (!dev->deviceGrab.fromPassiveGrab ||
|
|
|
|
dev->deviceGrab.grab->type != XI_Enter ||
|
|
|
|
dev->deviceGrab.grab->window == win ||
|
2009-05-26 06:42:25 +02:00
|
|
|
IsParent(dev->deviceGrab.grab->window, win))
|
|
|
|
return FALSE;
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
|
2009-05-26 06:42:25 +02:00
|
|
|
(*dev->deviceGrab.DeactivateGrab)(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&event, 0, sizeof(DeviceEvent));
|
|
|
|
event.header = ET_Internal;
|
|
|
|
event.type = ET_Enter;
|
|
|
|
event.length = sizeof(DeviceEvent);
|
|
|
|
event.time = GetTimeInMillis();
|
|
|
|
event.deviceid = dev->id;
|
|
|
|
event.sourceid = dev->id;
|
|
|
|
event.detail.button = 0;
|
2011-01-19 21:38:44 +01:00
|
|
|
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
|
|
|
|
TRUE) != NULL);
|
2009-05-27 07:47:12 +02:00
|
|
|
if (rc)
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab);
|
2009-05-27 07:47:12 +02:00
|
|
|
return rc;
|
2009-05-26 06:42:25 +02:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Update the sprite coordinates based on the event. Update the cursor
|
|
|
|
* position, then update the event with the new coordinates that may have been
|
|
|
|
* changed. If the window underneath the sprite has changed, change to new
|
|
|
|
* cursor and send enter/leave events.
|
2007-07-09 03:12:03 +02:00
|
|
|
*
|
|
|
|
* CheckMotion() will not do anything and return FALSE if the event is not a
|
|
|
|
* pointer event.
|
|
|
|
*
|
2007-11-13 07:28:23 +01:00
|
|
|
* @return TRUE if the sprite has moved or FALSE otherwise.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2009-01-30 05:59:22 +01:00
|
|
|
CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-05-26 06:42:25 +02:00
|
|
|
WindowPtr prevSpriteWin, newSpriteWin;
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = pDev->spriteInfo->sprite;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2011-05-15 01:23:59 +02:00
|
|
|
verify_internal_event((InternalEvent *)ev);
|
2009-02-16 07:34:05 +01:00
|
|
|
|
2006-11-21 08:45:04 +01:00
|
|
|
prevSpriteWin = pSprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-01-30 05:59:22 +01:00
|
|
|
if (ev && !syncEvents.playingEvents)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-07-09 03:12:03 +02:00
|
|
|
/* GetPointerEvents() guarantees that pointer events have the correct
|
|
|
|
rootX/Y set already. */
|
2009-01-30 05:59:22 +01:00
|
|
|
switch (ev->type)
|
2007-07-09 03:12:03 +02:00
|
|
|
{
|
2009-01-30 05:59:22 +01:00
|
|
|
case ET_ButtonPress:
|
|
|
|
case ET_ButtonRelease:
|
|
|
|
case ET_Motion:
|
2007-07-09 03:12:03 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* all other events return FALSE */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-01-16 07:04:07 +01:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
{
|
|
|
|
/* Motion events entering DIX get translated to Screen 0
|
|
|
|
coordinates. Replayed events have already been
|
|
|
|
translated since they've entered DIX before */
|
2010-05-23 19:11:47 +02:00
|
|
|
ev->root_x += pSprite->screen->x - screenInfo.screens[0]->x;
|
|
|
|
ev->root_y += pSprite->screen->y - screenInfo.screens[0]->y;
|
2009-01-16 07:04:07 +01:00
|
|
|
} else
|
|
|
|
#endif
|
2007-07-09 03:12:03 +02:00
|
|
|
{
|
2009-01-16 07:04:07 +01:00
|
|
|
if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen)
|
|
|
|
{
|
|
|
|
pSprite->hot.pScreen = pSprite->hotPhys.pScreen;
|
2010-12-27 14:06:03 +01:00
|
|
|
RootWindow(pDev->spriteInfo->sprite) =
|
|
|
|
pSprite->hot.pScreen->root;
|
2009-01-16 07:04:07 +01:00
|
|
|
}
|
2007-07-09 03:12:03 +02:00
|
|
|
}
|
2009-01-16 07:04:07 +01:00
|
|
|
|
2009-01-30 05:59:22 +01:00
|
|
|
pSprite->hot.x = ev->root_x;
|
|
|
|
pSprite->hot.y = ev->root_y;
|
2007-07-09 03:12:03 +02:00
|
|
|
if (pSprite->hot.x < pSprite->physLimits.x1)
|
|
|
|
pSprite->hot.x = pSprite->physLimits.x1;
|
|
|
|
else if (pSprite->hot.x >= pSprite->physLimits.x2)
|
|
|
|
pSprite->hot.x = pSprite->physLimits.x2 - 1;
|
|
|
|
if (pSprite->hot.y < pSprite->physLimits.y1)
|
|
|
|
pSprite->hot.y = pSprite->physLimits.y1;
|
|
|
|
else if (pSprite->hot.y >= pSprite->physLimits.y2)
|
|
|
|
pSprite->hot.y = pSprite->physLimits.y2 - 1;
|
2006-11-21 08:45:04 +01:00
|
|
|
if (pSprite->hotShape)
|
|
|
|
ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y);
|
|
|
|
pSprite->hotPhys = pSprite->hot;
|
2006-12-18 06:03:54 +01:00
|
|
|
|
2009-01-30 05:59:22 +01:00
|
|
|
if ((pSprite->hotPhys.x != ev->root_x) ||
|
|
|
|
(pSprite->hotPhys.y != ev->root_y))
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2009-01-16 07:04:07 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
{
|
|
|
|
XineramaSetCursorPosition(
|
|
|
|
pDev, pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE);
|
|
|
|
} else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
(*pSprite->hotPhys.pScreen->SetCursorPosition)(
|
|
|
|
pDev, pSprite->hotPhys.pScreen,
|
|
|
|
pSprite->hotPhys.x, pSprite->hotPhys.y, FALSE);
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2006-12-18 06:03:54 +01:00
|
|
|
|
2009-01-30 05:59:22 +01:00
|
|
|
ev->root_x = pSprite->hot.x;
|
|
|
|
ev->root_y = pSprite->hot.y;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2010-09-20 07:03:05 +02:00
|
|
|
newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y);
|
2009-01-16 06:53:50 +01:00
|
|
|
|
2009-05-26 06:42:25 +02:00
|
|
|
if (newSpriteWin != prevSpriteWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-07-29 08:34:28 +02:00
|
|
|
int sourceid;
|
|
|
|
if (!ev) {
|
2009-05-26 06:42:25 +02:00
|
|
|
UpdateCurrentTimeIf();
|
2009-07-29 08:34:28 +02:00
|
|
|
sourceid = pDev->id; /* when from WindowsRestructured */
|
|
|
|
} else
|
|
|
|
sourceid = ev->sourceid;
|
2009-05-26 06:42:25 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (prevSpriteWin != NullWindow) {
|
2009-05-27 07:47:12 +02:00
|
|
|
if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin))
|
2009-07-29 08:34:28 +02:00
|
|
|
DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin,
|
2009-05-26 06:42:25 +02:00
|
|
|
newSpriteWin, NotifyNormal);
|
2006-11-22 07:36:47 +01:00
|
|
|
}
|
2009-05-26 06:42:25 +02:00
|
|
|
/* set pSprite->win after ActivateEnterGrab, otherwise
|
|
|
|
sprite window == grab_window and no enter/leave events are
|
|
|
|
sent. */
|
|
|
|
pSprite->win = newSpriteWin;
|
|
|
|
PostNewCursor(pDev);
|
2003-11-14 16:54:54 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Windows have restructured, we need to update the sprite position and the
|
|
|
|
* sprite's cursor.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-04-09 23:33:15 +02:00
|
|
|
WindowsRestructured(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-11-21 11:01:30 +01:00
|
|
|
DeviceIntPtr pDev = inputInfo.devices;
|
|
|
|
while(pDev)
|
|
|
|
{
|
2011-02-11 03:47:37 +01:00
|
|
|
if (IsMaster(pDev) || IsFloating(pDev))
|
2009-01-30 05:59:22 +01:00
|
|
|
CheckMotion(NULL, pDev);
|
2006-11-21 11:01:30 +01:00
|
|
|
pDev = pDev->next;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
/* This was added to support reconfiguration under Xdmx. The problem is
|
2010-05-22 09:26:28 +02:00
|
|
|
* that if the 0th screen (i.e., screenInfo.screens[0]) is moved to an origin
|
2004-06-30 22:06:56 +02:00
|
|
|
* other than 0,0, the information in the private sprite structure must
|
|
|
|
* be updated accordingly, or XYToWindow (and other routines) will not
|
|
|
|
* compute correctly. */
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
GrabPtr grab;
|
2006-12-11 08:39:59 +01:00
|
|
|
DeviceIntPtr pDev;
|
|
|
|
SpritePtr pSprite;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
if (noPanoramiXExtension) return;
|
2006-12-11 08:39:59 +01:00
|
|
|
|
|
|
|
pDev = inputInfo.devices;
|
|
|
|
while(pDev)
|
|
|
|
{
|
2006-12-18 06:03:54 +01:00
|
|
|
if (DevHasCursor(pDev))
|
2006-12-11 08:39:59 +01:00
|
|
|
{
|
2007-03-25 07:30:03 +02:00
|
|
|
pSprite = pDev->spriteInfo->sprite;
|
2006-12-11 08:39:59 +01:00
|
|
|
pSprite->hot.x -= xoff;
|
|
|
|
pSprite->hot.y -= yoff;
|
|
|
|
|
|
|
|
pSprite->hotPhys.x -= xoff;
|
|
|
|
pSprite->hotPhys.y -= yoff;
|
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
pSprite->hotLimits.x1 -= xoff;
|
2006-12-11 08:39:59 +01:00
|
|
|
pSprite->hotLimits.y1 -= yoff;
|
|
|
|
pSprite->hotLimits.x2 -= xoff;
|
|
|
|
pSprite->hotLimits.y2 -= yoff;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if (RegionNotEmpty(&pSprite->Reg1))
|
2010-06-06 05:55:29 +02:00
|
|
|
RegionTranslate(&pSprite->Reg1, xoff, yoff);
|
2010-05-22 00:05:48 +02:00
|
|
|
if (RegionNotEmpty(&pSprite->Reg2))
|
2010-06-06 05:55:29 +02:00
|
|
|
RegionTranslate(&pSprite->Reg2, xoff, yoff);
|
2006-12-11 08:39:59 +01:00
|
|
|
|
|
|
|
/* FIXME: if we call ConfineCursorToWindow, must we do anything else? */
|
2007-05-14 05:04:53 +02:00
|
|
|
if ((grab = pDev->deviceGrab.grab) && grab->confineTo) {
|
2007-11-13 07:28:23 +01:00
|
|
|
if (grab->confineTo->drawable.pScreen
|
2006-12-11 08:39:59 +01:00
|
|
|
!= pSprite->hotPhys.pScreen)
|
|
|
|
pSprite->hotPhys.x = pSprite->hotPhys.y = 0;
|
|
|
|
ConfineCursorToWindow(pDev, grab->confineTo, TRUE, TRUE);
|
|
|
|
} else
|
|
|
|
ConfineCursorToWindow(
|
|
|
|
pDev,
|
2010-05-22 09:26:28 +02:00
|
|
|
pSprite->hotPhys.pScreen->root,
|
2006-12-11 08:39:59 +01:00
|
|
|
TRUE, FALSE);
|
|
|
|
|
|
|
|
}
|
|
|
|
pDev = pDev->next;
|
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-05-30 10:14:31 +02:00
|
|
|
/**
|
|
|
|
* Initialize a sprite for the given device and set it to some sane values. If
|
|
|
|
* the device already has a sprite alloc'd, don't realloc but just reset to
|
|
|
|
* default values.
|
|
|
|
* If a window is supplied, the sprite will be initialized with the window's
|
|
|
|
* cursor and positioned in the center of the window's screen. The root window
|
|
|
|
* is a good choice to pass in here.
|
|
|
|
*
|
|
|
|
* It's a good idea to call it only for pointer devices, unless you have a
|
|
|
|
* really talented keyboard.
|
|
|
|
*
|
|
|
|
* @param pDev The device to initialize.
|
|
|
|
* @param pWin The window where to generate the sprite in.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-02-15 04:21:20 +01:00
|
|
|
InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
|
|
|
{
|
|
|
|
SpritePtr pSprite;
|
2007-11-13 07:28:23 +01:00
|
|
|
ScreenPtr pScreen;
|
2010-04-30 21:18:09 +02:00
|
|
|
CursorPtr pCursor;
|
2007-03-01 07:49:37 +01:00
|
|
|
|
2007-03-25 07:30:03 +02:00
|
|
|
if (!pDev->spriteInfo->sprite)
|
2007-03-01 07:49:37 +01:00
|
|
|
{
|
2007-05-01 03:32:05 +02:00
|
|
|
DeviceIntPtr it;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
pDev->spriteInfo->sprite = (SpritePtr)calloc(1, sizeof(SpriteRec));
|
2007-03-25 07:30:03 +02:00
|
|
|
if (!pDev->spriteInfo->sprite)
|
2007-03-01 07:49:37 +01:00
|
|
|
FatalError("InitializeSprite: failed to allocate sprite struct");
|
2007-05-01 03:32:05 +02:00
|
|
|
|
|
|
|
/* We may have paired another device with this device before our
|
|
|
|
* device had a actual sprite. We need to check for this and reset the
|
|
|
|
* sprite field for all paired devices.
|
|
|
|
*
|
|
|
|
* The VCK is always paired with the VCP before the VCP has a sprite.
|
|
|
|
*/
|
|
|
|
for (it = inputInfo.devices; it; it = it->next)
|
|
|
|
{
|
|
|
|
if (it->spriteInfo->paired == pDev)
|
|
|
|
it->spriteInfo->sprite = pDev->spriteInfo->sprite;
|
|
|
|
}
|
|
|
|
if (inputInfo.keyboard->spriteInfo->paired == pDev)
|
|
|
|
inputInfo.keyboard->spriteInfo->sprite = pDev->spriteInfo->sprite;
|
2007-03-01 07:49:37 +01:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2007-03-25 07:30:03 +02:00
|
|
|
pSprite = pDev->spriteInfo->sprite;
|
|
|
|
pDev->spriteInfo->spriteOwner = TRUE;
|
2007-03-02 05:51:46 +01:00
|
|
|
|
|
|
|
pScreen = (pWin) ? pWin->drawable.pScreen : (ScreenPtr)NULL;
|
|
|
|
pSprite->hot.pScreen = pScreen;
|
2007-02-15 04:21:20 +01:00
|
|
|
pSprite->hotPhys.pScreen = pScreen;
|
2007-03-02 05:51:46 +01:00
|
|
|
if (pScreen)
|
|
|
|
{
|
|
|
|
pSprite->hotPhys.x = pScreen->width / 2;
|
|
|
|
pSprite->hotPhys.y = pScreen->height / 2;
|
|
|
|
pSprite->hotLimits.x2 = pScreen->width;
|
|
|
|
pSprite->hotLimits.y2 = pScreen->height;
|
|
|
|
}
|
|
|
|
|
2007-02-15 04:21:20 +01:00
|
|
|
pSprite->hot = pSprite->hotPhys;
|
|
|
|
pSprite->win = pWin;
|
2007-03-02 05:51:46 +01:00
|
|
|
|
2007-03-01 07:49:37 +01:00
|
|
|
if (pWin)
|
|
|
|
{
|
2010-04-30 21:18:09 +02:00
|
|
|
pCursor = wCursor(pWin);
|
2010-05-05 20:44:06 +02:00
|
|
|
pSprite->spriteTrace = (WindowPtr *)calloc(1, 32*sizeof(WindowPtr));
|
2007-04-26 08:28:50 +02:00
|
|
|
if (!pSprite->spriteTrace)
|
|
|
|
FatalError("Failed to allocate spriteTrace");
|
|
|
|
pSprite->spriteTraceSize = 32;
|
|
|
|
|
2010-12-27 14:06:03 +01:00
|
|
|
RootWindow(pDev->spriteInfo->sprite) = pWin;
|
2007-04-26 08:28:50 +02:00
|
|
|
pSprite->spriteTraceGood = 1;
|
|
|
|
|
|
|
|
pSprite->pEnqueueScreen = pScreen;
|
|
|
|
pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
|
|
|
|
|
|
|
|
} else {
|
2010-04-30 21:18:09 +02:00
|
|
|
pCursor = NullCursor;
|
2007-04-26 08:28:50 +02:00
|
|
|
pSprite->spriteTrace = NULL;
|
|
|
|
pSprite->spriteTraceSize = 0;
|
|
|
|
pSprite->spriteTraceGood = 0;
|
|
|
|
pSprite->pEnqueueScreen = screenInfo.screens[0];
|
|
|
|
pSprite->pDequeueScreen = pSprite->pEnqueueScreen;
|
|
|
|
}
|
2010-04-30 21:18:09 +02:00
|
|
|
if (pCursor)
|
|
|
|
pCursor->refcnt++;
|
|
|
|
if (pSprite->current)
|
|
|
|
FreeCursor(pSprite->current, None);
|
|
|
|
pSprite->current = pCursor;
|
2007-02-15 04:21:20 +01:00
|
|
|
|
2007-03-02 05:51:46 +01:00
|
|
|
if (pScreen)
|
|
|
|
{
|
2008-06-09 04:15:57 +02:00
|
|
|
(*pScreen->RealizeCursor) ( pDev, pScreen, pSprite->current);
|
2007-03-02 05:51:46 +01:00
|
|
|
(*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
|
|
|
|
&pSprite->hotLimits, &pSprite->physLimits);
|
|
|
|
pSprite->confined = FALSE;
|
2007-02-15 04:21:20 +01:00
|
|
|
|
2007-03-02 05:51:46 +01:00
|
|
|
(*pScreen->ConstrainCursor) (pDev, pScreen,
|
|
|
|
&pSprite->physLimits);
|
|
|
|
(*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x,
|
|
|
|
pSprite->hot.y,
|
2007-11-13 07:28:23 +01:00
|
|
|
FALSE);
|
2007-03-02 05:51:46 +01:00
|
|
|
(*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
2007-02-15 04:21:20 +01:00
|
|
|
if(!noPanoramiXExtension) {
|
2010-05-23 19:11:47 +02:00
|
|
|
pSprite->hotLimits.x1 = -screenInfo.screens[0]->x;
|
|
|
|
pSprite->hotLimits.y1 = -screenInfo.screens[0]->y;
|
|
|
|
pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x;
|
|
|
|
pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y;
|
2007-02-15 04:21:20 +01:00
|
|
|
pSprite->physLimits = pSprite->hotLimits;
|
|
|
|
pSprite->confineWin = NullWindow;
|
|
|
|
pSprite->hotShape = NullRegion;
|
|
|
|
pSprite->screen = pScreen;
|
|
|
|
/* gotta UNINIT these someplace */
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionNull(&pSprite->Reg1);
|
|
|
|
RegionNull(&pSprite->Reg2);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2007-02-15 04:21:20 +01:00
|
|
|
#endif
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-10-02 13:11:28 +02:00
|
|
|
/**
|
|
|
|
* Update the mouse sprite info when the server switches from a pScreen to another.
|
|
|
|
* Otherwise, the pScreen of the mouse sprite is never updated when we switch
|
|
|
|
* from a pScreen to another. Never updating the pScreen of the mouse sprite
|
|
|
|
* implies that windows that are in pScreen whose pScreen->myNum >0 will never
|
|
|
|
* get pointer events. This is because in CheckMotion(), sprite.hotPhys.pScreen
|
|
|
|
* always points to the first pScreen it has been set by
|
|
|
|
* DefineInitialRootWindow().
|
|
|
|
*
|
|
|
|
* Calling this function is useful for use cases where the server
|
|
|
|
* has more than one pScreen.
|
|
|
|
* This function is similar to DefineInitialRootWindow() but it does not
|
|
|
|
* reset the mouse pointer position.
|
|
|
|
* @param win must be the new pScreen we are switching to.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-11-07 06:07:23 +01:00
|
|
|
UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen)
|
2007-10-02 13:11:28 +02:00
|
|
|
{
|
2007-11-07 06:07:23 +01:00
|
|
|
SpritePtr pSprite = NULL;
|
2007-10-02 13:11:28 +02:00
|
|
|
WindowPtr win = NULL;
|
2010-04-30 21:18:09 +02:00
|
|
|
CursorPtr pCursor;
|
2007-10-02 13:11:28 +02:00
|
|
|
if (!pScreen)
|
|
|
|
return ;
|
2007-11-07 06:07:23 +01:00
|
|
|
|
|
|
|
if (!pDev->spriteInfo->sprite)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pSprite = pDev->spriteInfo->sprite;
|
|
|
|
|
2010-05-22 09:26:28 +02:00
|
|
|
win = pScreen->root;
|
2007-10-02 13:11:28 +02:00
|
|
|
|
2007-11-07 06:07:23 +01:00
|
|
|
pSprite->hotPhys.pScreen = pScreen;
|
|
|
|
pSprite->hot = pSprite->hotPhys;
|
|
|
|
pSprite->hotLimits.x2 = pScreen->width;
|
|
|
|
pSprite->hotLimits.y2 = pScreen->height;
|
|
|
|
pSprite->win = win;
|
2010-04-30 21:18:09 +02:00
|
|
|
pCursor = wCursor(win);
|
|
|
|
if (pCursor)
|
|
|
|
pCursor->refcnt++;
|
|
|
|
if (pSprite->current)
|
|
|
|
FreeCursor(pSprite->current, 0);
|
|
|
|
pSprite->current = pCursor;
|
2007-11-07 06:07:23 +01:00
|
|
|
pSprite->spriteTraceGood = 1;
|
|
|
|
pSprite->spriteTrace[0] = win;
|
|
|
|
(*pScreen->CursorLimits) (pDev,
|
|
|
|
pScreen,
|
|
|
|
pSprite->current,
|
|
|
|
&pSprite->hotLimits,
|
|
|
|
&pSprite->physLimits);
|
|
|
|
pSprite->confined = FALSE;
|
|
|
|
(*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits);
|
|
|
|
(*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
|
2007-10-02 13:11:28 +02:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension) {
|
2010-05-23 19:11:47 +02:00
|
|
|
pSprite->hotLimits.x1 = -screenInfo.screens[0]->x;
|
|
|
|
pSprite->hotLimits.y1 = -screenInfo.screens[0]->y;
|
|
|
|
pSprite->hotLimits.x2 = PanoramiXPixWidth - screenInfo.screens[0]->x;
|
|
|
|
pSprite->hotLimits.y2 = PanoramiXPixHeight - screenInfo.screens[0]->y;
|
2007-11-07 06:07:23 +01:00
|
|
|
pSprite->physLimits = pSprite->hotLimits;
|
|
|
|
pSprite->screen = pScreen;
|
2007-10-02 13:11:28 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* This does not take any shortcuts, and even ignores its argument, since
|
|
|
|
* it does not happen very often, and one has to walk up the tree since
|
|
|
|
* this might be a newly instantiated cursor for an intermediate window
|
|
|
|
* between the one the pointer is in and the one that the last cursor was
|
|
|
|
* instantiated from.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
WindowHasNewCursor(WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-18 06:03:54 +01:00
|
|
|
DeviceIntPtr pDev;
|
|
|
|
|
|
|
|
for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
|
|
|
if (DevHasCursor(pDev))
|
|
|
|
PostNewCursor(pDev);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-11-23 07:45:14 +01:00
|
|
|
NewCurrentScreen(DeviceIntPtr pDev, ScreenPtr newScreen, int x, int y)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2011-09-02 01:53:02 +02:00
|
|
|
DeviceIntPtr ptr;
|
|
|
|
SpritePtr pSprite;
|
|
|
|
|
|
|
|
ptr = IsFloating(pDev) ? pDev : GetXTestDevice(GetMaster(pDev, MASTER_POINTER));
|
|
|
|
pSprite = ptr->spriteInfo->sprite;
|
2006-11-23 07:45:14 +01:00
|
|
|
|
|
|
|
pSprite->hotPhys.x = x;
|
|
|
|
pSprite->hotPhys.y = y;
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension) {
|
2010-05-23 19:11:47 +02:00
|
|
|
pSprite->hotPhys.x += newScreen->x - screenInfo.screens[0]->x;
|
|
|
|
pSprite->hotPhys.y += newScreen->y - screenInfo.screens[0]->y;
|
2006-11-23 07:45:14 +01:00
|
|
|
if (newScreen != pSprite->screen) {
|
|
|
|
pSprite->screen = newScreen;
|
2003-11-14 17:49:22 +01:00
|
|
|
/* Make sure we tell the DDX to update its copy of the screen */
|
2006-11-23 07:45:14 +01:00
|
|
|
if(pSprite->confineWin)
|
2011-09-02 01:53:02 +02:00
|
|
|
XineramaConfineCursorToWindow(ptr,
|
2006-12-11 08:39:59 +01:00
|
|
|
pSprite->confineWin, TRUE);
|
2003-11-14 17:49:22 +01:00
|
|
|
else
|
2011-09-02 01:53:02 +02:00
|
|
|
XineramaConfineCursorToWindow(ptr, screenInfo.screens[0]->root, TRUE);
|
2007-11-13 07:28:23 +01:00
|
|
|
/* if the pointer wasn't confined, the DDX won't get
|
2003-11-14 17:49:22 +01:00
|
|
|
told of the pointer warp so we reposition it here */
|
|
|
|
if(!syncEvents.playingEvents)
|
2006-11-23 07:45:14 +01:00
|
|
|
(*pSprite->screen->SetCursorPosition)(
|
2011-09-02 01:53:02 +02:00
|
|
|
ptr,
|
2006-11-23 07:45:14 +01:00
|
|
|
pSprite->screen,
|
2010-05-23 19:11:47 +02:00
|
|
|
pSprite->hotPhys.x + screenInfo.screens[0]->x -
|
|
|
|
pSprite->screen->x,
|
|
|
|
pSprite->hotPhys.y + screenInfo.screens[0]->y -
|
|
|
|
pSprite->screen->y, FALSE);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
} else
|
2003-11-14 17:49:22 +01:00
|
|
|
#endif
|
2006-11-23 07:45:14 +01:00
|
|
|
if (newScreen != pSprite->hotPhys.pScreen)
|
2011-09-02 01:53:02 +02:00
|
|
|
ConfineCursorToWindow(ptr, newScreen->root, TRUE, FALSE);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
XineramaPointInWindowIsVisible(
|
|
|
|
WindowPtr pWin,
|
|
|
|
int x,
|
|
|
|
int y
|
|
|
|
)
|
|
|
|
{
|
|
|
|
BoxRec box;
|
|
|
|
int i, xoff, yoff;
|
|
|
|
|
|
|
|
if (!pWin->realized) return FALSE;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if (RegionContainsPoint(&pWin->borderClip, x, y, &box))
|
2003-11-14 17:49:22 +01:00
|
|
|
return TRUE;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2006-12-11 08:39:59 +01:00
|
|
|
if(!XineramaSetWindowPntrs(inputInfo.pointer, pWin)) return FALSE;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-23 19:11:47 +02:00
|
|
|
xoff = x + screenInfo.screens[0]->x;
|
|
|
|
yoff = y + screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2011-03-09 06:05:26 +01:00
|
|
|
FOR_NSCREENS_FORWARD_SKIP(i) {
|
2007-03-25 07:30:03 +02:00
|
|
|
pWin = inputInfo.pointer->spriteInfo->sprite->windows[i];
|
2010-05-23 19:11:47 +02:00
|
|
|
x = xoff - screenInfo.screens[i]->x;
|
|
|
|
y = yoff - screenInfo.screens[i]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if(RegionContainsPoint(&pWin->borderClip, x, y, &box)
|
2005-06-10 06:01:14 +02:00
|
|
|
&& (!wInputShape(pWin) ||
|
2010-06-06 05:55:29 +02:00
|
|
|
RegionContainsPoint(wInputShape(pWin),
|
|
|
|
x - pWin->drawable.x,
|
|
|
|
y - pWin->drawable.y, &box)))
|
2003-11-14 17:49:22 +01:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
XineramaWarpPointer(ClientPtr client)
|
|
|
|
{
|
|
|
|
WindowPtr dest = NULL;
|
2006-12-15 21:50:46 +01:00
|
|
|
int x, y, rc;
|
2011-07-29 08:33:54 +02:00
|
|
|
DeviceIntPtr dev;
|
|
|
|
SpritePtr pSprite;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
REQUEST(xWarpPointerReq);
|
|
|
|
|
2006-12-15 21:50:46 +01:00
|
|
|
if (stuff->dstWid != None) {
|
|
|
|
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2011-07-29 08:33:54 +02:00
|
|
|
|
|
|
|
/* Post through the XTest device */
|
|
|
|
dev = PickPointer(client);
|
|
|
|
dev = GetXTestDevice(dev);
|
|
|
|
pSprite = dev->spriteInfo->sprite;
|
2006-12-11 08:39:59 +01:00
|
|
|
x = pSprite->hotPhys.x;
|
|
|
|
y = pSprite->hotPhys.y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
if (stuff->srcWid != None)
|
|
|
|
{
|
|
|
|
int winX, winY;
|
2007-11-13 07:28:23 +01:00
|
|
|
XID winID = stuff->srcWid;
|
2003-11-14 17:49:22 +01:00
|
|
|
WindowPtr source;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2006-12-15 21:50:46 +01:00
|
|
|
rc = dixLookupWindow(&source, winID, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
winX = source->drawable.x;
|
|
|
|
winY = source->drawable.y;
|
2010-05-22 09:26:28 +02:00
|
|
|
if(source == screenInfo.screens[0]->root) {
|
2010-05-23 19:11:47 +02:00
|
|
|
winX -= screenInfo.screens[0]->x;
|
|
|
|
winY -= screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
if (x < winX + stuff->srcX ||
|
|
|
|
y < winY + stuff->srcY ||
|
|
|
|
(stuff->srcWidth != 0 &&
|
|
|
|
winX + stuff->srcX + (int)stuff->srcWidth < x) ||
|
|
|
|
(stuff->srcHeight != 0 &&
|
|
|
|
winY + stuff->srcY + (int)stuff->srcHeight < y) ||
|
|
|
|
!XineramaPointInWindowIsVisible(source, x, y))
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
if (dest) {
|
|
|
|
x = dest->drawable.x;
|
|
|
|
y = dest->drawable.y;
|
2010-05-22 09:26:28 +02:00
|
|
|
if(dest == screenInfo.screens[0]->root) {
|
2010-05-23 19:11:47 +02:00
|
|
|
x -= screenInfo.screens[0]->x;
|
|
|
|
y -= screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
x += stuff->dstX;
|
|
|
|
y += stuff->dstY;
|
|
|
|
|
2006-12-11 08:39:59 +01:00
|
|
|
if (x < pSprite->physLimits.x1)
|
|
|
|
x = pSprite->physLimits.x1;
|
|
|
|
else if (x >= pSprite->physLimits.x2)
|
|
|
|
x = pSprite->physLimits.x2 - 1;
|
|
|
|
if (y < pSprite->physLimits.y1)
|
|
|
|
y = pSprite->physLimits.y1;
|
|
|
|
else if (y >= pSprite->physLimits.y2)
|
|
|
|
y = pSprite->physLimits.y2 - 1;
|
|
|
|
if (pSprite->hotShape)
|
2011-07-29 08:33:54 +02:00
|
|
|
ConfineToShape(dev, pSprite->hotShape, &x, &y);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2011-07-29 08:33:54 +02:00
|
|
|
XineramaSetCursorPosition(dev, x, y, TRUE);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for WarpPointer request.
|
|
|
|
* Warps the cursor position to the coordinates given in the request.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcWarpPointer(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr dest = NULL;
|
2006-12-15 21:50:46 +01:00
|
|
|
int x, y, rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
ScreenPtr newScreen;
|
2011-07-29 08:33:54 +02:00
|
|
|
DeviceIntPtr dev, tmp, xtest_dev = NULL;
|
2009-01-12 06:29:36 +01:00
|
|
|
SpritePtr pSprite;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST(xWarpPointerReq);
|
|
|
|
REQUEST_SIZE_MATCH(xWarpPointerReq);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-03-13 06:19:23 +01:00
|
|
|
dev = PickPointer(client);
|
|
|
|
|
|
|
|
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
2011-02-18 02:45:29 +01:00
|
|
|
if (GetMaster(tmp, MASTER_ATTACHED) == dev) {
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2011-07-29 08:33:54 +02:00
|
|
|
if (IsXTestDevice(tmp, dev))
|
|
|
|
xtest_dev = tmp;
|
2007-08-28 21:10:20 +02:00
|
|
|
}
|
|
|
|
}
|
2009-01-12 06:29:36 +01:00
|
|
|
|
2011-07-29 08:33:54 +02:00
|
|
|
/* Use the XTest device to actually move the pointer */
|
|
|
|
dev = xtest_dev;
|
2009-01-12 06:29:36 +01:00
|
|
|
pSprite = dev->spriteInfo->sprite;
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension)
|
|
|
|
return XineramaWarpPointer(client);
|
|
|
|
#endif
|
|
|
|
|
2006-12-15 21:50:46 +01:00
|
|
|
if (stuff->dstWid != None) {
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = dixLookupWindow(&dest, stuff->dstWid, client, DixGetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2006-12-11 08:39:59 +01:00
|
|
|
x = pSprite->hotPhys.x;
|
|
|
|
y = pSprite->hotPhys.y;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (stuff->srcWid != None)
|
|
|
|
{
|
|
|
|
int winX, winY;
|
2007-11-13 07:28:23 +01:00
|
|
|
XID winID = stuff->srcWid;
|
2003-11-14 17:49:22 +01:00
|
|
|
WindowPtr source;
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = dixLookupWindow(&source, winID, client, DixGetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
winX = source->drawable.x;
|
|
|
|
winY = source->drawable.y;
|
2006-12-11 08:39:59 +01:00
|
|
|
if (source->drawable.pScreen != pSprite->hotPhys.pScreen ||
|
2003-11-14 16:54:54 +01:00
|
|
|
x < winX + stuff->srcX ||
|
|
|
|
y < winY + stuff->srcY ||
|
|
|
|
(stuff->srcWidth != 0 &&
|
|
|
|
winX + stuff->srcX + (int)stuff->srcWidth < x) ||
|
|
|
|
(stuff->srcHeight != 0 &&
|
|
|
|
winY + stuff->srcY + (int)stuff->srcHeight < y) ||
|
|
|
|
!PointInWindowIsVisible(source, x, y))
|
|
|
|
return Success;
|
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
if (dest)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
x = dest->drawable.x;
|
|
|
|
y = dest->drawable.y;
|
|
|
|
newScreen = dest->drawable.pScreen;
|
2007-11-13 07:28:23 +01:00
|
|
|
} else
|
2006-12-11 08:39:59 +01:00
|
|
|
newScreen = pSprite->hotPhys.pScreen;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
x += stuff->dstX;
|
|
|
|
y += stuff->dstY;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (x < 0)
|
|
|
|
x = 0;
|
|
|
|
else if (x >= newScreen->width)
|
|
|
|
x = newScreen->width - 1;
|
|
|
|
if (y < 0)
|
|
|
|
y = 0;
|
|
|
|
else if (y >= newScreen->height)
|
|
|
|
y = newScreen->height - 1;
|
|
|
|
|
2006-12-11 08:39:59 +01:00
|
|
|
if (newScreen == pSprite->hotPhys.pScreen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-11 08:39:59 +01:00
|
|
|
if (x < pSprite->physLimits.x1)
|
|
|
|
x = pSprite->physLimits.x1;
|
|
|
|
else if (x >= pSprite->physLimits.x2)
|
|
|
|
x = pSprite->physLimits.x2 - 1;
|
|
|
|
if (y < pSprite->physLimits.y1)
|
|
|
|
y = pSprite->physLimits.y1;
|
|
|
|
else if (y >= pSprite->physLimits.y2)
|
|
|
|
y = pSprite->physLimits.y2 - 1;
|
|
|
|
if (pSprite->hotShape)
|
2009-01-12 06:29:36 +01:00
|
|
|
ConfineToShape(dev, pSprite->hotShape, &x, &y);
|
|
|
|
(*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-01-12 06:29:36 +01:00
|
|
|
else if (!PointerConfinedToScreen(dev))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-01-12 06:29:36 +01:00
|
|
|
NewCurrentScreen(dev, newScreen, x, y);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
static Bool
|
2006-12-11 08:39:59 +01:00
|
|
|
BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2010-05-22 00:05:48 +02:00
|
|
|
if(RegionNotEmpty(&pWin->borderSize))
|
2003-11-14 17:49:22 +01:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
2006-12-11 08:39:59 +01:00
|
|
|
if(!noPanoramiXExtension && XineramaSetWindowPntrs(pDev, pWin)) {
|
2003-11-14 17:49:22 +01:00
|
|
|
int i;
|
|
|
|
|
2011-03-09 06:05:26 +01:00
|
|
|
FOR_NSCREENS_FORWARD_SKIP(i) {
|
2010-06-06 05:55:29 +02:00
|
|
|
if(RegionNotEmpty(&pDev->spriteInfo->sprite->windows[i]->borderSize))
|
2003-11-14 17:49:22 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-11-25 22:57:03 +01:00
|
|
|
/**
|
|
|
|
* Activate the given passive grab. If the grab is activated successfully, the
|
|
|
|
* event has been delivered to the client.
|
|
|
|
*
|
|
|
|
* @param device The device of the event to check.
|
|
|
|
* @param grab The grab to check.
|
|
|
|
* @param event The current device event.
|
|
|
|
*
|
|
|
|
* @return Whether the grab has been activated.
|
|
|
|
*/
|
|
|
|
Bool
|
|
|
|
ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event)
|
|
|
|
{
|
|
|
|
SpritePtr pSprite = device->spriteInfo->sprite;
|
|
|
|
GrabInfoPtr grabinfo = &device->deviceGrab;
|
|
|
|
xEvent *xE = NULL;
|
|
|
|
int count;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* The only consumers of corestate are Xi 1.x and core events, which
|
|
|
|
* are guaranteed to come from DeviceEvents. */
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == XI || grab->grabtype == CORE)
|
2011-11-25 22:57:03 +01:00
|
|
|
{
|
|
|
|
DeviceIntPtr gdev;
|
|
|
|
|
|
|
|
event->device_event.corestate &= 0x1f00;
|
|
|
|
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == CORE)
|
2011-11-25 22:57:03 +01:00
|
|
|
gdev = GetMaster(device, KEYBOARD_OR_FLOAT);
|
|
|
|
else
|
|
|
|
gdev = grab->modifierDevice;
|
|
|
|
|
|
|
|
if (gdev && gdev->key && gdev->key->xkbInfo)
|
|
|
|
event->device_event.corestate |=
|
|
|
|
gdev->key->xkbInfo->state.grab_mods & (~0x1f00);
|
|
|
|
}
|
|
|
|
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == CORE)
|
2011-11-25 22:57:03 +01:00
|
|
|
{
|
|
|
|
rc = EventToCore(event, &xE, &count);
|
|
|
|
if (rc != Success)
|
|
|
|
{
|
|
|
|
BUG_WARN_MSG(rc != BadMatch,"[dix] %s: core conversion failed"
|
|
|
|
"(%d, %d).\n", device->name, event->any.type, rc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-12-08 05:27:01 +01:00
|
|
|
} else if (grab->grabtype == XI2)
|
2011-11-25 22:57:03 +01:00
|
|
|
{
|
|
|
|
rc = EventToXI2(event, &xE);
|
|
|
|
if (rc != Success)
|
|
|
|
{
|
|
|
|
if (rc != BadMatch)
|
|
|
|
BUG_WARN_MSG(rc != BadMatch,"[dix] %s: XI2 conversion failed"
|
|
|
|
"(%d, %d).\n", device->name, event->any.type, rc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
count = 1;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
rc = EventToXI(event, &xE, &count);
|
|
|
|
if (rc != Success)
|
|
|
|
{
|
|
|
|
if (rc != BadMatch)
|
|
|
|
BUG_WARN_MSG(rc != BadMatch,"[dix] %s: XI conversion failed"
|
|
|
|
"(%d, %d).\n", device->name, event->any.type, rc);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
|
|
|
|
|
|
|
|
if (xE)
|
|
|
|
{
|
|
|
|
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
|
|
|
|
|
|
|
/* XXX: XACE? */
|
|
|
|
TryClientEvents(rClient(grab), device, xE, count,
|
|
|
|
GetEventFilter(device, xE),
|
|
|
|
GetEventFilter(device, xE), grab);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (grabinfo->sync.state == FROZEN_NO_EVENT)
|
|
|
|
grabinfo->sync.state = FROZEN_WITH_EVENT;
|
2011-12-08 06:38:44 +01:00
|
|
|
*grabinfo->sync.event = event->device_event;
|
2011-11-25 22:57:03 +01:00
|
|
|
|
|
|
|
free(xE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-12-07 04:57:25 +01:00
|
|
|
static BOOL
|
|
|
|
CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab)
|
|
|
|
{
|
|
|
|
DeviceIntPtr other;
|
|
|
|
BOOL interfering = FALSE;
|
|
|
|
|
|
|
|
for (other = inputInfo.devices; other; other = other->next)
|
|
|
|
{
|
|
|
|
GrabPtr othergrab = other->deviceGrab.grab;
|
2011-12-08 05:27:01 +01:00
|
|
|
if (othergrab && othergrab->grabtype == CORE &&
|
2011-12-07 04:57:25 +01:00
|
|
|
SameClient(grab, rClient(othergrab)) &&
|
|
|
|
((IsPointerDevice(grab->device) &&
|
|
|
|
IsPointerDevice(othergrab->device)) ||
|
|
|
|
(IsKeyboardDevice(grab->device) &&
|
|
|
|
IsKeyboardDevice(othergrab->device))))
|
|
|
|
{
|
|
|
|
interfering = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return interfering;
|
|
|
|
}
|
|
|
|
|
2011-12-07 05:41:18 +01:00
|
|
|
enum MatchFlags {
|
|
|
|
NO_MATCH = 0x0,
|
|
|
|
CORE_MATCH = 0x1,
|
|
|
|
XI_MATCH = 0x2,
|
|
|
|
XI2_MATCH = 0x4,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Match the grab against the temporary grab on the given input level.
|
|
|
|
* Modifies the temporary grab pointer.
|
|
|
|
*
|
|
|
|
* @param grab The grab to match against
|
|
|
|
* @param tmp The temporary grab to use for matching
|
|
|
|
* @param level The input level we want to match on
|
|
|
|
* @param event_type Wire protocol event type
|
|
|
|
*
|
|
|
|
* @return The respective matched flag or 0 for no match
|
|
|
|
*/
|
|
|
|
static enum MatchFlags
|
|
|
|
MatchForType(const GrabPtr grab, GrabPtr tmp, enum InputLevel level, int event_type)
|
|
|
|
{
|
|
|
|
enum MatchFlags match;
|
|
|
|
BOOL ignore_device = FALSE;
|
|
|
|
int grabtype;
|
|
|
|
int evtype;
|
|
|
|
|
|
|
|
switch(level)
|
|
|
|
{
|
|
|
|
case XI2:
|
2011-12-08 05:27:01 +01:00
|
|
|
grabtype = XI2;
|
2011-12-07 05:41:18 +01:00
|
|
|
evtype = GetXI2Type(event_type);
|
|
|
|
BUG_WARN(!evtype);
|
|
|
|
match = XI2_MATCH;
|
|
|
|
break;
|
|
|
|
case XI:
|
2011-12-08 05:27:01 +01:00
|
|
|
grabtype = XI;
|
2011-12-07 05:41:18 +01:00
|
|
|
evtype = GetXIType(event_type);
|
|
|
|
match = XI_MATCH;
|
|
|
|
break;
|
|
|
|
case CORE:
|
2011-12-08 05:27:01 +01:00
|
|
|
grabtype = CORE;
|
2011-12-07 05:41:18 +01:00
|
|
|
evtype = GetCoreType(event_type);
|
|
|
|
match = CORE_MATCH;
|
|
|
|
ignore_device = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp->grabtype = grabtype;
|
|
|
|
tmp->type = evtype;
|
|
|
|
|
|
|
|
if (tmp->type && GrabMatchesSecond(tmp, grab, ignore_device))
|
|
|
|
return match;
|
|
|
|
|
|
|
|
return NO_MATCH;
|
|
|
|
}
|
|
|
|
|
2011-11-18 02:40:24 +01:00
|
|
|
/**
|
|
|
|
* Check an individual grab against an event to determine if a passive grab
|
|
|
|
* should be activated.
|
|
|
|
*
|
|
|
|
* @param device The device of the event to check.
|
|
|
|
* @param grab The grab to check.
|
|
|
|
* @param event The current device event.
|
|
|
|
* @param checkCore Check for core grabs too.
|
|
|
|
* @param tempGrab A pre-allocated temporary grab record for matching. This
|
|
|
|
* must have the window and device values filled in.
|
|
|
|
*
|
|
|
|
* @return Whether the grab matches the event.
|
|
|
|
*/
|
|
|
|
static Bool
|
|
|
|
CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
|
2011-11-25 22:57:03 +01:00
|
|
|
Bool checkCore, GrabPtr tempGrab)
|
2011-11-18 02:40:24 +01:00
|
|
|
{
|
|
|
|
DeviceIntPtr gdev;
|
|
|
|
XkbSrvInfoPtr xkbi = NULL;
|
2011-12-07 05:41:18 +01:00
|
|
|
enum MatchFlags match = 0;
|
2011-11-18 02:40:24 +01:00
|
|
|
|
|
|
|
gdev = grab->modifierDevice;
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == CORE)
|
2011-11-18 02:40:24 +01:00
|
|
|
{
|
|
|
|
gdev = GetMaster(device, KEYBOARD_OR_FLOAT);
|
2011-12-08 05:27:01 +01:00
|
|
|
} else if (grab->grabtype == XI2)
|
2011-11-18 02:40:24 +01:00
|
|
|
{
|
|
|
|
/* if the device is an attached slave device, gdev must be the
|
|
|
|
* attached master keyboard. Since the slave may have been
|
|
|
|
* reattached after the grab, the modifier device may not be the
|
|
|
|
* same. */
|
|
|
|
if (!IsMaster(grab->device) && !IsFloating(device))
|
|
|
|
gdev = GetMaster(device, MASTER_KEYBOARD);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gdev && gdev->key)
|
|
|
|
xkbi= gdev->key->xkbInfo;
|
|
|
|
tempGrab->modifierDevice = grab->modifierDevice;
|
|
|
|
tempGrab->modifiersDetail.exact = xkbi ? xkbi->state.grab_mods : 0;
|
|
|
|
|
|
|
|
/* Check for XI2 and XI grabs first */
|
2011-12-07 05:41:18 +01:00
|
|
|
match = MatchForType(grab, tempGrab, XI2, GetXI2Type(event->any.type));
|
2011-11-18 02:40:24 +01:00
|
|
|
|
|
|
|
if (!match)
|
2011-12-07 05:41:18 +01:00
|
|
|
match = MatchForType(grab, tempGrab, XI, GetXIType(event->any.type));
|
2011-11-18 02:40:24 +01:00
|
|
|
|
|
|
|
if (!match && checkCore)
|
2011-12-07 05:41:18 +01:00
|
|
|
match = MatchForType(grab, tempGrab, CORE, GetCoreType(event->any.type));
|
2011-11-18 02:40:24 +01:00
|
|
|
|
|
|
|
if (!match || (grab->confineTo &&
|
|
|
|
(!grab->confineTo->realized ||
|
|
|
|
!BorderSizeNotEmpty(device, grab->confineTo))))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* In some cases a passive core grab may exist, but the client
|
|
|
|
* already has a core grab on some other device. In this case we
|
|
|
|
* must not get the grab, otherwise we may never ungrab the
|
|
|
|
* device.
|
|
|
|
*/
|
|
|
|
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab->grabtype == CORE)
|
2011-11-18 02:40:24 +01:00
|
|
|
{
|
|
|
|
/* A passive grab may have been created for a different device
|
|
|
|
than it is assigned to at this point in time.
|
|
|
|
Update the grab's device and modifier device to reflect the
|
|
|
|
current state.
|
|
|
|
Since XGrabDeviceButton requires to specify the
|
|
|
|
modifierDevice explicitly, we don't override this choice.
|
|
|
|
*/
|
2011-12-07 04:54:28 +01:00
|
|
|
if (grab->type < GenericEvent)
|
2011-11-18 02:40:24 +01:00
|
|
|
{
|
|
|
|
grab->device = device;
|
|
|
|
grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD);
|
|
|
|
}
|
|
|
|
|
2011-12-07 04:57:25 +01:00
|
|
|
if (CoreGrabInterferes(device, grab))
|
2011-11-18 02:40:24 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
/**
|
2007-04-13 05:38:44 +02:00
|
|
|
* "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a
|
2007-11-13 07:28:23 +01:00
|
|
|
* passive grab set on the window to be activated.
|
2010-12-07 12:48:14 +01:00
|
|
|
* If activate is true and a passive grab is found, it will be activated,
|
|
|
|
* and the event will be delivered to the client.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param pWin The window that may be subject to a passive grab.
|
|
|
|
* @param device Device that caused the event.
|
2009-02-01 00:58:15 +01:00
|
|
|
* @param event The current device event.
|
|
|
|
* @param checkCore Check for core grabs too.
|
2010-12-07 12:48:14 +01:00
|
|
|
* @param activate If a grab is found, activate it and deliver the event.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-12-07 12:48:14 +01:00
|
|
|
GrabPtr
|
2003-11-14 17:49:22 +01:00
|
|
|
CheckPassiveGrabsOnWindow(
|
|
|
|
WindowPtr pWin,
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr device,
|
2011-01-19 21:38:44 +01:00
|
|
|
InternalEvent *event,
|
2010-12-07 12:48:14 +01:00
|
|
|
BOOL checkCore,
|
|
|
|
BOOL activate)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
GrabPtr grab = wPassiveGrabs(pWin);
|
2011-11-04 01:47:27 +01:00
|
|
|
GrabPtr tempGrab;
|
2009-02-01 00:58:15 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!grab)
|
2010-12-07 12:48:14 +01:00
|
|
|
return NULL;
|
2011-11-04 01:47:27 +01:00
|
|
|
|
|
|
|
tempGrab = AllocGrab();
|
|
|
|
|
2009-02-01 00:58:15 +01:00
|
|
|
/* Fill out the grab details, but leave the type for later before
|
|
|
|
* comparing */
|
2011-01-19 21:38:44 +01:00
|
|
|
switch (event->any.type)
|
|
|
|
{
|
|
|
|
case ET_KeyPress:
|
|
|
|
case ET_KeyRelease:
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->detail.exact = event->device_event.detail.key;
|
2011-01-19 21:38:44 +01:00
|
|
|
break;
|
|
|
|
case ET_ButtonPress:
|
|
|
|
case ET_ButtonRelease:
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->detail.exact = event->device_event.detail.button;
|
2011-01-19 21:38:44 +01:00
|
|
|
break;
|
|
|
|
default:
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->detail.exact = 0;
|
2011-01-19 21:38:44 +01:00
|
|
|
break;
|
|
|
|
}
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->window = pWin;
|
|
|
|
tempGrab->device = device;
|
|
|
|
tempGrab->detail.pMask = NULL;
|
|
|
|
tempGrab->modifiersDetail.pMask = NULL;
|
|
|
|
tempGrab->next = NULL;
|
2007-10-03 07:48:17 +02:00
|
|
|
|
2011-11-18 02:40:24 +01:00
|
|
|
for (; grab; grab = grab->next)
|
2011-11-25 22:57:03 +01:00
|
|
|
{
|
|
|
|
if (!CheckPassiveGrab(device, grab, event, checkCore, tempGrab))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (activate && !ActivatePassiveGrab(device, grab, event))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2011-11-04 06:37:32 +01:00
|
|
|
|
2011-11-04 01:47:27 +01:00
|
|
|
FreeGrab(tempGrab);
|
2011-11-04 06:37:32 +01:00
|
|
|
return grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2005-03-08 00:02:59 +01:00
|
|
|
/**
|
2007-06-15 09:46:16 +02:00
|
|
|
* CheckDeviceGrabs handles both keyboard and pointer events that may cause
|
2007-11-13 07:28:23 +01:00
|
|
|
* a passive grab to be activated.
|
2007-06-15 09:46:16 +02:00
|
|
|
*
|
|
|
|
* If the event is a keyboard event, the ancestors of the focus window are
|
|
|
|
* traced down and tried to see if they have any passive grabs to be
|
|
|
|
* activated. If the focus window itself is reached and it's descendants
|
|
|
|
* contain the pointer, the ancestors of the window that the pointer is in
|
|
|
|
* are then traced down starting at the focus window, otherwise no grabs are
|
2007-11-13 07:28:23 +01:00
|
|
|
* activated.
|
2007-06-15 09:46:16 +02:00
|
|
|
* If the event is a pointer event, the ancestors of the window that the
|
|
|
|
* pointer is in are traced down starting at the root until CheckPassiveGrabs
|
|
|
|
* causes a passive grab to activate or all the windows are
|
|
|
|
* tried. PRH
|
|
|
|
*
|
|
|
|
* If a grab is activated, the event has been sent to the client already!
|
|
|
|
*
|
2008-01-15 02:01:12 +01:00
|
|
|
* The event we pass in must always be an XI event. From this, we then emulate
|
|
|
|
* the core event and then check for grabs.
|
|
|
|
*
|
2007-06-15 09:46:16 +02:00
|
|
|
* @param device The device that caused the event.
|
2008-01-15 02:01:12 +01:00
|
|
|
* @param xE The event to handle (Device{Button|Key}Press).
|
2007-06-15 09:46:16 +02:00
|
|
|
* @param count Number of events in list.
|
|
|
|
* @return TRUE if a grab has been activated or false otherwise.
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2010-08-04 20:44:05 +02:00
|
|
|
CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
int i;
|
|
|
|
WindowPtr pWin = NULL;
|
2009-02-01 00:58:15 +01:00
|
|
|
FocusClassPtr focus = IsPointerEvent((InternalEvent*)event) ? NULL : device->focus;
|
2009-05-20 07:28:16 +02:00
|
|
|
BOOL sendCore = (IsMaster(device) && device->coreEvents);
|
2011-02-15 12:27:57 +01:00
|
|
|
Bool ret = FALSE;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-02-01 00:58:15 +01:00
|
|
|
if (event->type != ET_ButtonPress &&
|
|
|
|
event->type != ET_KeyPress)
|
2008-01-15 02:01:12 +01:00
|
|
|
return FALSE;
|
|
|
|
|
2009-02-01 00:58:15 +01:00
|
|
|
if (event->type == ET_ButtonPress
|
|
|
|
&& (device->button->buttonsDown != 1))
|
|
|
|
return FALSE;
|
2008-01-15 02:01:12 +01:00
|
|
|
|
2010-08-04 04:40:26 +02:00
|
|
|
if (device->deviceGrab.grab)
|
|
|
|
return FALSE;
|
|
|
|
|
2010-08-04 20:44:05 +02:00
|
|
|
i = 0;
|
|
|
|
if (ancestor)
|
|
|
|
{
|
|
|
|
while (i < device->spriteInfo->sprite->spriteTraceGood)
|
|
|
|
if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor)
|
|
|
|
break;
|
|
|
|
if (i == device->spriteInfo->sprite->spriteTraceGood)
|
2011-02-15 12:27:57 +01:00
|
|
|
goto out;
|
2010-08-04 20:44:05 +02:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (focus)
|
|
|
|
{
|
|
|
|
for (; i < focus->traceGood; i++)
|
|
|
|
{
|
|
|
|
pWin = focus->trace[i];
|
2011-01-19 21:38:44 +01:00
|
|
|
if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
|
|
|
|
sendCore, TRUE))
|
2011-02-15 12:27:57 +01:00
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
goto out;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if ((focus->win == NoneWin) ||
|
2007-04-26 08:28:50 +02:00
|
|
|
(i >= device->spriteInfo->sprite->spriteTraceGood) ||
|
2010-08-04 20:44:05 +02:00
|
|
|
(pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1]))
|
2011-02-15 12:27:57 +01:00
|
|
|
goto out;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2007-04-26 08:28:50 +02:00
|
|
|
for (; i < device->spriteInfo->sprite->spriteTraceGood; i++)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-04-26 08:28:50 +02:00
|
|
|
pWin = device->spriteInfo->sprite->spriteTrace[i];
|
2011-01-19 21:38:44 +01:00
|
|
|
if (CheckPassiveGrabsOnWindow(pWin, device, (InternalEvent *) event,
|
|
|
|
sendCore, TRUE))
|
2011-02-15 12:27:57 +01:00
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
goto out;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2011-02-15 12:27:57 +01:00
|
|
|
out:
|
|
|
|
if (ret == TRUE && event->type == ET_KeyPress)
|
|
|
|
device->deviceGrab.activatingKey = event->detail.key;
|
|
|
|
return ret;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Called for keyboard events to deliver event to whatever client owns the
|
2009-02-02 05:00:41 +01:00
|
|
|
* focus.
|
|
|
|
*
|
|
|
|
* The event is delivered to the keyboard's focus window, the root window or
|
|
|
|
* to the window owning the input focus.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* @param keybd The keyboard originating the event.
|
2009-02-02 05:00:41 +01:00
|
|
|
* @param event The event, not yet in wire format.
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param window Window underneath the sprite.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-02-01 11:18:33 +01:00
|
|
|
DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-02-02 05:00:41 +01:00
|
|
|
DeviceIntPtr ptr;
|
2003-11-14 16:54:54 +01:00
|
|
|
WindowPtr focus = keybd->focus->win;
|
2009-05-20 07:28:16 +02:00
|
|
|
BOOL sendCore = (IsMaster(keybd) && keybd->coreEvents);
|
2011-02-15 12:28:02 +01:00
|
|
|
xEvent *core = NULL, *xE = NULL, *xi2 = NULL;
|
2009-02-02 05:00:41 +01:00
|
|
|
int count, rc;
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
int deliveries = 0;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (focus == FollowKeyboardWin)
|
|
|
|
focus = inputInfo.keyboard->focus->win;
|
|
|
|
if (!focus)
|
|
|
|
return;
|
|
|
|
if (focus == PointerRootWin)
|
|
|
|
{
|
2009-02-01 11:18:33 +01:00
|
|
|
DeliverDeviceEvents(window, event, NullGrab, NullWindow, keybd);
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((focus == window) || IsParent(focus, window))
|
|
|
|
{
|
2009-02-01 11:18:33 +01:00
|
|
|
if (DeliverDeviceEvents(window, event, NullGrab, focus, keybd))
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
|
|
|
}
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
|
2009-06-03 02:45:28 +02:00
|
|
|
/* just deliver it to the focus window */
|
2011-08-01 06:14:02 +02:00
|
|
|
ptr = GetMaster(keybd, POINTER_OR_FLOAT);
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
|
2009-03-06 05:45:26 +01:00
|
|
|
rc = EventToXI2(event, &xi2);
|
2009-06-03 02:45:28 +02:00
|
|
|
if (rc == Success)
|
2009-03-06 05:45:26 +01:00
|
|
|
{
|
2009-06-03 02:45:28 +02:00
|
|
|
/* XXX: XACE */
|
2009-03-06 05:45:26 +01:00
|
|
|
int filter = GetEventFilter(keybd, xi2);
|
2010-09-20 07:03:04 +02:00
|
|
|
FixUpEventFromWindow(ptr->spriteInfo->sprite, xi2, focus, None, FALSE);
|
2009-03-06 05:45:26 +01:00
|
|
|
deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1,
|
2009-03-18 01:21:59 +01:00
|
|
|
filter, NullGrab);
|
2009-03-06 05:45:26 +01:00
|
|
|
if (deliveries > 0)
|
|
|
|
goto unwind;
|
2009-06-03 02:45:28 +02:00
|
|
|
} else if (rc != BadMatch)
|
|
|
|
ErrorF("[dix] %s: XI2 conversion failed in DFE (%d, %d). Skipping delivery.\n",
|
|
|
|
keybd->name, event->any.type, rc);
|
2009-03-06 05:45:26 +01:00
|
|
|
|
2009-06-03 02:45:28 +02:00
|
|
|
rc = EventToXI(event, &xE, &count);
|
|
|
|
if (rc == Success &&
|
|
|
|
XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success)
|
|
|
|
{
|
2010-09-20 07:03:04 +02:00
|
|
|
FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE);
|
2009-06-03 02:45:28 +02:00
|
|
|
deliveries = DeliverEventsToWindow(keybd, focus, xE, count,
|
|
|
|
GetEventFilter(keybd, xE),
|
|
|
|
NullGrab);
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
|
2009-06-03 02:45:28 +02:00
|
|
|
if (deliveries > 0)
|
|
|
|
goto unwind;
|
|
|
|
} else if (rc != BadMatch)
|
|
|
|
ErrorF("[dix] %s: XI conversion failed in DFE (%d, %d). Skipping delivery.\n",
|
|
|
|
keybd->name, event->any.type, rc);
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
|
2009-02-02 05:00:41 +01:00
|
|
|
if (sendCore)
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
{
|
2011-02-15 12:28:02 +01:00
|
|
|
rc = EventToCore(event, &core, &count);
|
2009-10-22 03:59:01 +02:00
|
|
|
if (rc == Success) {
|
2011-02-15 12:28:02 +01:00
|
|
|
if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, core, count) == Success) {
|
|
|
|
FixUpEventFromWindow(keybd->spriteInfo->sprite, core, focus,
|
2010-09-20 07:03:04 +02:00
|
|
|
None, FALSE);
|
2011-02-15 12:28:02 +01:00
|
|
|
deliveries = DeliverEventsToWindow(keybd, focus, core, count,
|
|
|
|
GetEventFilter(keybd, core),
|
2009-10-22 03:59:01 +02:00
|
|
|
NullGrab);
|
|
|
|
}
|
2009-10-22 03:46:50 +02:00
|
|
|
} else if (rc != BadMatch)
|
|
|
|
ErrorF("[dix] %s: core conversion failed DFE (%d, %d). Skipping delivery.\n",
|
|
|
|
keybd->name, event->any.type, rc);
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
}
|
2009-02-02 05:00:41 +01:00
|
|
|
|
|
|
|
unwind:
|
2011-02-15 12:28:02 +01:00
|
|
|
free(core);
|
2010-06-06 10:28:30 +02:00
|
|
|
free(xE);
|
|
|
|
free(xi2);
|
2009-02-02 05:00:41 +01:00
|
|
|
return;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2011-12-05 09:42:05 +01:00
|
|
|
|
|
|
|
int
|
|
|
|
DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, enum InputLevel level)
|
|
|
|
{
|
|
|
|
SpritePtr pSprite = dev->spriteInfo->sprite;
|
|
|
|
int rc;
|
|
|
|
xEvent *xE = NULL;
|
|
|
|
int count = 0;
|
|
|
|
int deliveries = 0;
|
|
|
|
Mask mask;
|
|
|
|
GrabInfoPtr grabinfo = &dev->deviceGrab;
|
|
|
|
GrabPtr grab = grabinfo->grab;
|
|
|
|
Mask filter;
|
|
|
|
|
|
|
|
switch(level)
|
|
|
|
{
|
|
|
|
case XI2:
|
|
|
|
rc = EventToXI2(event, &xE);
|
|
|
|
count = 1;
|
|
|
|
if (rc == Success)
|
|
|
|
{
|
|
|
|
int evtype = xi2_get_type(xE);
|
|
|
|
mask = xi2mask_isset(grab->xi2mask, dev, evtype);
|
|
|
|
filter = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XI:
|
|
|
|
if (grabinfo->fromPassiveGrab && grabinfo->implicitGrab)
|
|
|
|
mask = grab->deviceMask;
|
|
|
|
else
|
|
|
|
mask = grab->eventMask;
|
|
|
|
rc = EventToXI(event, &xE, &count);
|
|
|
|
if (rc == Success)
|
|
|
|
filter = GetEventFilter(dev, xE);
|
|
|
|
break;
|
|
|
|
case CORE:
|
|
|
|
rc = EventToCore(event, &xE, &count);
|
|
|
|
mask = grab->eventMask;
|
|
|
|
if (rc == Success)
|
|
|
|
filter = GetEventFilter(dev, xE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
BUG_WARN_MSG(1, "Invalid input level %d\n", level);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rc == Success)
|
|
|
|
{
|
|
|
|
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
|
|
|
if (XaceHook(XACE_SEND_ACCESS, 0, dev,
|
|
|
|
grab->window, xE, count) ||
|
|
|
|
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
|
|
|
grab->window, xE, count))
|
|
|
|
deliveries = 1; /* don't send, but pretend we did */
|
|
|
|
else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE))
|
|
|
|
{
|
|
|
|
deliveries = TryClientEvents(rClient(grab), dev,
|
|
|
|
xE, count, mask, filter,
|
|
|
|
grab);
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
BUG_WARN_MSG(rc != BadMatch, "%s: conversion to mode %d failed on %d with %d\n",
|
|
|
|
dev->name, level, event->any.type, rc);
|
|
|
|
|
|
|
|
free(xE);
|
|
|
|
return deliveries;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Deliver an event from a device that is currently grabbed. Uses
|
|
|
|
* DeliverDeviceEvents() for further delivery if a ownerEvents is set on the
|
|
|
|
* grab. If not, TryClientEvents() is used.
|
|
|
|
*
|
|
|
|
* @param deactivateGrab True if the device's grab should be deactivated.
|
2011-04-14 07:43:56 +02:00
|
|
|
*
|
|
|
|
* @return The number of events delivered.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
2011-04-14 07:43:56 +02:00
|
|
|
int
|
2009-02-01 11:18:33 +01:00
|
|
|
DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
|
|
|
Bool deactivateGrab)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-19 00:12:56 +01:00
|
|
|
GrabPtr grab;
|
2007-03-08 07:47:23 +01:00
|
|
|
GrabInfoPtr grabinfo;
|
2003-11-14 16:54:54 +01:00
|
|
|
int deliveries = 0;
|
2007-03-08 08:20:19 +01:00
|
|
|
DeviceIntPtr dev;
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = thisDev->spriteInfo->sprite;
|
dix: Process an input event as a single event, instead of two separate ones.
This is a significant shift in how input events are perceived. The common
approach was to treat a core event as a different entity than the XI event.
This could result in the XI event being delivered to a different client than
the core event. This doesn't work nicely if they come from the same device.
Instead, we treat an input event as a single event, that is delivered through
two separate APIs. So when delivering an event, we first try the XI event,
then the core event. If the window want's neither, we go to the parent and
repeat. Once either core or XI has been delivered, the processing stops.
Important: Different to the previous method, if a client registers for core
button events, the parent window will not get XI events. This should only
cause problems when you're mixing core and XI events, so don't do that!
Generic events don't fit into this yet, they cause me headaches.
2008-01-15 05:52:39 +01:00
|
|
|
BOOL sendCore = FALSE;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-05-14 10:42:56 +02:00
|
|
|
grabinfo = &thisDev->deviceGrab;
|
2007-03-08 07:47:23 +01:00
|
|
|
grab = grabinfo->grab;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (grab->ownerEvents)
|
|
|
|
{
|
|
|
|
WindowPtr focus;
|
2011-12-05 09:54:30 +01:00
|
|
|
WindowPtr win;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2008-04-10 02:28:50 +02:00
|
|
|
/* Hack: Some pointer device have a focus class. So we need to check
|
|
|
|
* for the type of event, to see if we really want to deliver it to
|
|
|
|
* the focus window. For pointer events, the answer is no.
|
|
|
|
*/
|
2009-02-01 11:18:33 +01:00
|
|
|
if (IsPointerEvent(event))
|
2008-04-10 02:28:50 +02:00
|
|
|
focus = PointerRootWin;
|
2009-01-14 05:56:10 +01:00
|
|
|
else if (thisDev->focus)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
focus = thisDev->focus->win;
|
|
|
|
if (focus == FollowKeyboardWin)
|
|
|
|
focus = inputInfo.keyboard->focus->win;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
focus = PointerRootWin;
|
|
|
|
if (focus == PointerRootWin)
|
2011-12-05 09:54:30 +01:00
|
|
|
{
|
|
|
|
win = pSprite->win;
|
|
|
|
focus = NullWindow;
|
|
|
|
} else if (focus && (focus == pSprite->win ||
|
|
|
|
IsParent(focus, pSprite->win)))
|
|
|
|
win = pSprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
else if (focus)
|
2011-12-05 09:54:30 +01:00
|
|
|
win = focus;
|
|
|
|
|
|
|
|
deliveries = DeliverDeviceEvents(win, event, grab, focus, thisDev);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
if (!deliveries)
|
|
|
|
{
|
2009-02-02 05:54:34 +01:00
|
|
|
/* XXX: In theory, we could pass the internal events through to
|
|
|
|
* everything and only convert just before hitting the wire. We can't
|
|
|
|
* do that yet, so DGE is the last stop for internal events. From here
|
|
|
|
* onwards, we deal with core/XI events.
|
|
|
|
*/
|
2009-02-01 11:41:16 +01:00
|
|
|
|
2009-05-20 07:28:16 +02:00
|
|
|
sendCore = (IsMaster(thisDev) && thisDev->coreEvents);
|
2009-01-15 08:16:22 +01:00
|
|
|
/* try core event */
|
2011-12-08 05:27:01 +01:00
|
|
|
if (sendCore && grab->grabtype == CORE)
|
2008-10-31 07:10:41 +01:00
|
|
|
{
|
2011-12-05 09:42:05 +01:00
|
|
|
deliveries = DeliverOneGrabbedEvent(event, thisDev, CORE);
|
2009-01-15 08:16:22 +01:00
|
|
|
}
|
2008-10-31 07:10:41 +01:00
|
|
|
|
2009-01-15 08:16:22 +01:00
|
|
|
if (!deliveries)
|
2009-03-09 07:36:07 +01:00
|
|
|
{
|
2011-12-05 09:42:05 +01:00
|
|
|
deliveries = DeliverOneGrabbedEvent(event, thisDev, XI2);
|
2009-03-09 07:36:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!deliveries)
|
2009-01-15 08:16:22 +01:00
|
|
|
{
|
2011-12-05 09:42:05 +01:00
|
|
|
deliveries = DeliverOneGrabbedEvent(event, thisDev, XI);
|
2007-02-22 10:30:59 +01:00
|
|
|
}
|
2009-01-15 08:16:22 +01:00
|
|
|
|
2009-05-20 09:02:50 +02:00
|
|
|
if (deliveries && (event->any.type == ET_Motion))
|
2008-10-31 07:10:41 +01:00
|
|
|
thisDev->valuator->motionHintWindow = grab->window;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-05-20 09:02:50 +02:00
|
|
|
if (deliveries && !deactivateGrab && event->any.type != ET_Motion)
|
2007-12-04 07:21:52 +01:00
|
|
|
{
|
2007-03-08 07:47:23 +01:00
|
|
|
switch (grabinfo->sync.state)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
case FREEZE_BOTH_NEXT_EVENT:
|
2011-02-22 14:43:28 +01:00
|
|
|
dev = GetPairedDevice(thisDev);
|
|
|
|
if (dev)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
FreezeThaw(dev, TRUE);
|
2009-03-19 11:24:06 +01:00
|
|
|
if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
|
2007-03-08 07:47:23 +01:00
|
|
|
(CLIENT_BITS(grab->resource) ==
|
2010-04-14 09:43:22 +02:00
|
|
|
CLIENT_BITS(dev->deviceGrab.grab->resource)))
|
2009-03-19 11:24:06 +01:00
|
|
|
dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
|
2011-02-22 14:43:28 +01:00
|
|
|
else
|
2009-03-19 11:24:06 +01:00
|
|
|
dev->deviceGrab.sync.other = grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
/* fall through */
|
|
|
|
case FREEZE_NEXT_EVENT:
|
2007-03-08 07:47:23 +01:00
|
|
|
grabinfo->sync.state = FROZEN_WITH_EVENT;
|
2003-11-14 16:54:54 +01:00
|
|
|
FreezeThaw(thisDev, TRUE);
|
2009-09-18 02:03:02 +02:00
|
|
|
*grabinfo->sync.event = event->device_event;
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
}
|
2007-12-04 07:21:52 +01:00
|
|
|
}
|
2009-02-02 05:54:34 +01:00
|
|
|
|
2011-04-14 07:43:56 +02:00
|
|
|
return deliveries;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/* This function is used to set the key pressed or key released state -
|
2007-11-13 07:28:23 +01:00
|
|
|
this is only used when the pressing of keys does not cause
|
2007-09-06 11:22:02 +02:00
|
|
|
the device's processInputProc to be called, as in for example Mouse Keys.
|
2003-11-14 17:49:22 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-30 05:35:22 +01:00
|
|
|
FixKeyState (DeviceEvent *event, DeviceIntPtr keybd)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2010-07-06 01:19:09 +02:00
|
|
|
int key = event->detail.key;
|
2006-10-08 15:23:14 +02:00
|
|
|
|
2009-03-03 04:24:54 +01:00
|
|
|
if (event->type == ET_KeyPress) {
|
2006-10-08 15:23:14 +02:00
|
|
|
DebugF("FixKeyState: Key %d %s\n",key,
|
2009-03-03 04:24:54 +01:00
|
|
|
((event->type == ET_KeyPress) ? "down" : "up"));
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2006-10-08 15:23:14 +02:00
|
|
|
|
2009-01-30 05:35:22 +01:00
|
|
|
if (event->type == ET_KeyPress)
|
2010-07-06 01:19:09 +02:00
|
|
|
set_key_down(keybd, key, KEY_PROCESSED);
|
2009-01-30 05:35:22 +01:00
|
|
|
else if (event->type == ET_KeyRelease)
|
2010-07-06 01:19:09 +02:00
|
|
|
set_key_up(keybd, key, KEY_PROCESSED);
|
2007-09-06 11:22:02 +02:00
|
|
|
else
|
|
|
|
FatalError("Impossible keyboard event");
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#define AtMostOneClient \
|
|
|
|
(SubstructureRedirectMask | ResizeRedirectMask | ButtonPressMask)
|
2007-10-26 01:01:29 +02:00
|
|
|
#define ManagerMask \
|
|
|
|
(SubstructureRedirectMask | ResizeRedirectMask)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Recalculate which events may be deliverable for the given window.
|
|
|
|
* Recalculated mask is used for quicker determination which events may be
|
|
|
|
* delivered to a window.
|
|
|
|
*
|
|
|
|
* The otherEventMasks on a WindowOptional is the combination of all event
|
|
|
|
* masks set by all clients on the window.
|
|
|
|
* deliverableEventMask is the combination of the eventMask and the
|
2009-02-11 07:06:36 +01:00
|
|
|
* otherEventMask plus the events that may be propagated to the parent.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* Traverses to siblings and parents of the window.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-11 08:20:06 +01:00
|
|
|
RecalculateDeliverableEvents(WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
OtherClients *others;
|
|
|
|
WindowPtr pChild;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
pChild = pWin;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (pChild->optional)
|
|
|
|
{
|
|
|
|
pChild->optional->otherEventMasks = 0;
|
|
|
|
for (others = wOtherClients(pChild); others; others = others->next)
|
|
|
|
{
|
|
|
|
pChild->optional->otherEventMasks |= others->mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pChild->deliverableEvents = pChild->eventMask|
|
|
|
|
wOtherEventMasks(pChild);
|
|
|
|
if (pChild->parent)
|
|
|
|
pChild->deliverableEvents |=
|
|
|
|
(pChild->parent->deliverableEvents &
|
|
|
|
~wDontPropagateMask(pChild) & PropagateMask);
|
|
|
|
if (pChild->firstChild)
|
|
|
|
{
|
|
|
|
pChild = pChild->firstChild;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
while (!pChild->nextSib && (pChild != pWin))
|
|
|
|
pChild = pChild->parent;
|
|
|
|
if (pChild == pWin)
|
|
|
|
break;
|
|
|
|
pChild = pChild->nextSib;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-08 00:02:59 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* \param value must conform to DeleteType
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
OtherClientGone(pointer value, XID id)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
OtherClientsPtr other, prev;
|
|
|
|
WindowPtr pWin = (WindowPtr)value;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
prev = 0;
|
|
|
|
for (other = wOtherClients(pWin); other; other = other->next)
|
|
|
|
{
|
|
|
|
if (other->resource == id)
|
|
|
|
{
|
|
|
|
if (prev)
|
|
|
|
prev->next = other->next;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!(pWin->optional->otherClients = other->next))
|
|
|
|
CheckWindowOptionalNeed (pWin);
|
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
free(other);
|
2003-11-14 16:54:54 +01:00
|
|
|
RecalculateDeliverableEvents(pWin);
|
2010-06-06 16:18:40 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
prev = other;
|
|
|
|
}
|
|
|
|
FatalError("client not on event list");
|
|
|
|
/*NOTREACHED*/
|
|
|
|
return -1; /* make compiler happy */
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-08 08:20:19 +01:00
|
|
|
EventSelectForWindow(WindowPtr pWin, ClientPtr client, Mask mask)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
Mask check;
|
|
|
|
OtherClients * others;
|
2008-01-18 09:47:42 +01:00
|
|
|
DeviceIntPtr dev;
|
2007-10-26 01:01:29 +02:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (mask & ~AllEventMasks)
|
|
|
|
{
|
|
|
|
client->errorValue = mask;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2007-10-26 01:01:29 +02:00
|
|
|
check = (mask & ManagerMask);
|
|
|
|
if (check) {
|
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pWin->drawable.id,
|
|
|
|
RT_WINDOW, pWin, RT_NONE, NULL, DixManageAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
check = (mask & AtMostOneClient);
|
|
|
|
if (check & (pWin->eventMask|wOtherEventMasks(pWin)))
|
|
|
|
{ /* It is illegal for two different
|
|
|
|
clients to select on any of the
|
|
|
|
events for AtMostOneClient. However,
|
|
|
|
it is OK, for some client to
|
|
|
|
continue selecting on one of those
|
|
|
|
events. */
|
|
|
|
if ((wClient(pWin) != client) && (check & pWin->eventMask))
|
|
|
|
return BadAccess;
|
|
|
|
for (others = wOtherClients (pWin); others; others = others->next)
|
|
|
|
{
|
|
|
|
if (!SameClient(others, client) && (check & others->mask))
|
|
|
|
return BadAccess;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (wClient (pWin) == client)
|
|
|
|
{
|
|
|
|
check = pWin->eventMask;
|
|
|
|
pWin->eventMask = mask;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (others = wOtherClients (pWin); others; others = others->next)
|
|
|
|
{
|
|
|
|
if (SameClient(others, client))
|
|
|
|
{
|
|
|
|
check = others->mask;
|
|
|
|
if (mask == 0)
|
|
|
|
{
|
|
|
|
FreeResource(others->resource, RT_NONE);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
others->mask = mask;
|
|
|
|
goto maskSet;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
check = 0;
|
|
|
|
if (!pWin->optional && !MakeWindowOptional (pWin))
|
|
|
|
return BadAlloc;
|
2010-05-05 20:44:06 +02:00
|
|
|
others = malloc(sizeof(OtherClients));
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!others)
|
|
|
|
return BadAlloc;
|
|
|
|
others->mask = mask;
|
|
|
|
others->resource = FakeClientID(client->index);
|
|
|
|
others->next = pWin->optional->otherClients;
|
|
|
|
pWin->optional->otherClients = others;
|
|
|
|
if (!AddResource(others->resource, RT_OTHERCLIENT, (pointer)pWin))
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
maskSet:
|
2008-01-18 09:47:42 +01:00
|
|
|
if ((mask & PointerMotionHintMask) && !(check & PointerMotionHintMask))
|
|
|
|
{
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
|
|
|
{
|
|
|
|
if (dev->valuator && dev->valuator->motionHintWindow == pWin)
|
|
|
|
dev->valuator->motionHintWindow = NullWindow;
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
RecalculateDeliverableEvents(pWin);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-11-13 07:28:23 +01:00
|
|
|
EventSuppressForWindow(WindowPtr pWin, ClientPtr client,
|
2005-03-08 00:02:59 +01:00
|
|
|
Mask mask, Bool *checkOptional)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
int i, free;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-08-07 22:43:40 +02:00
|
|
|
if (mask & ~PropagateMask)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = mask;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (pWin->dontPropagate)
|
|
|
|
DontPropagateRefCnts[pWin->dontPropagate]--;
|
|
|
|
if (!mask)
|
|
|
|
i = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = DNPMCOUNT, free = 0; --i > 0; )
|
|
|
|
{
|
|
|
|
if (!DontPropagateRefCnts[i])
|
|
|
|
free = i;
|
|
|
|
else if (mask == DontPropagateMasks[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!i && free)
|
|
|
|
{
|
|
|
|
i = free;
|
|
|
|
DontPropagateMasks[i] = mask;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i || !mask)
|
|
|
|
{
|
|
|
|
pWin->dontPropagate = i;
|
|
|
|
if (i)
|
|
|
|
DontPropagateRefCnts[i]++;
|
|
|
|
if (pWin->optional)
|
|
|
|
{
|
|
|
|
pWin->optional->dontPropagateMask = mask;
|
|
|
|
*checkOptional = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!pWin->optional && !MakeWindowOptional (pWin))
|
|
|
|
{
|
|
|
|
if (pWin->dontPropagate)
|
|
|
|
DontPropagateRefCnts[pWin->dontPropagate]++;
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
pWin->dontPropagate = 0;
|
|
|
|
pWin->optional->dontPropagateMask = mask;
|
|
|
|
}
|
|
|
|
RecalculateDeliverableEvents(pWin);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2007-11-13 07:28:23 +01:00
|
|
|
* Assembles an EnterNotify or LeaveNotify and sends it event to the client.
|
2007-05-30 10:14:31 +02:00
|
|
|
* Uses the paired keyboard to get some additional information.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
2008-11-14 06:18:56 +01:00
|
|
|
void
|
2008-11-14 06:37:35 +01:00
|
|
|
CoreEnterLeaveEvent(
|
2007-04-12 09:05:43 +02:00
|
|
|
DeviceIntPtr mouse,
|
2003-11-14 17:49:22 +01:00
|
|
|
int type,
|
|
|
|
int mode,
|
|
|
|
int detail,
|
2007-03-08 08:20:19 +01:00
|
|
|
WindowPtr pWin,
|
2003-11-14 17:49:22 +01:00
|
|
|
Window child)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-01-10 05:22:13 +01:00
|
|
|
xEvent event;
|
2003-11-14 16:54:54 +01:00
|
|
|
WindowPtr focus;
|
2007-04-12 09:05:43 +02:00
|
|
|
DeviceIntPtr keybd;
|
2007-05-14 05:04:53 +02:00
|
|
|
GrabPtr grab = mouse->deviceGrab.grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
Mask mask;
|
2007-01-10 05:22:13 +01:00
|
|
|
|
2011-08-01 06:14:02 +02:00
|
|
|
keybd = GetMaster(mouse, KEYBOARD_OR_FLOAT);
|
2007-04-12 09:05:43 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if ((pWin == mouse->valuator->motionHintWindow) &&
|
|
|
|
(detail != NotifyInferior))
|
|
|
|
mouse->valuator->motionHintWindow = NullWindow;
|
|
|
|
if (grab)
|
|
|
|
{
|
|
|
|
mask = (pWin == grab->window) ? grab->eventMask : 0;
|
|
|
|
if (grab->ownerEvents)
|
|
|
|
mask |= EventMaskForClient(pWin, rClient(grab));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mask = pWin->eventMask | wOtherEventMasks(pWin);
|
|
|
|
}
|
2007-01-10 05:22:13 +01:00
|
|
|
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&event, 0, sizeof(xEvent));
|
2007-01-10 05:22:13 +01:00
|
|
|
event.u.u.type = type;
|
|
|
|
event.u.u.detail = detail;
|
|
|
|
event.u.enterLeave.time = currentTime.milliseconds;
|
2007-04-12 09:05:43 +02:00
|
|
|
event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x;
|
|
|
|
event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y;
|
2007-01-10 05:22:13 +01:00
|
|
|
/* Counts on the same initial structure of crossing & button events! */
|
2010-09-20 07:03:04 +02:00
|
|
|
FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE);
|
2007-01-10 05:22:13 +01:00
|
|
|
/* Enter/Leave events always set child */
|
|
|
|
event.u.enterLeave.child = child;
|
|
|
|
event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ?
|
|
|
|
ELFlagSameScreen : 0;
|
2009-05-21 03:16:37 +02:00
|
|
|
event.u.enterLeave.state = mouse->button ? (mouse->button->state & 0x1f00) : 0;
|
2008-03-18 09:05:57 +01:00
|
|
|
if (keybd)
|
|
|
|
event.u.enterLeave.state |=
|
2007-11-09 02:03:27 +01:00
|
|
|
XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
|
2007-01-10 05:22:13 +01:00
|
|
|
event.u.enterLeave.mode = mode;
|
2007-11-09 02:03:27 +01:00
|
|
|
focus = (keybd) ? keybd->focus->win : None;
|
2007-01-10 05:22:13 +01:00
|
|
|
if ((focus != NoneWin) &&
|
|
|
|
((pWin == focus) || (focus == PointerRootWin) ||
|
|
|
|
IsParent(focus, pWin)))
|
|
|
|
event.u.enterLeave.flags |= ELFlagFocus;
|
|
|
|
|
2009-02-13 07:42:02 +01:00
|
|
|
if ((mask & GetEventFilter(mouse, &event)))
|
2007-04-17 03:47:04 +02:00
|
|
|
{
|
|
|
|
if (grab)
|
2008-01-18 09:18:46 +01:00
|
|
|
TryClientEvents(rClient(grab), mouse, &event, 1, mask,
|
2009-02-13 07:42:02 +01:00
|
|
|
GetEventFilter(mouse, &event), grab);
|
2007-04-17 03:47:04 +02:00
|
|
|
else
|
2008-01-18 09:18:46 +01:00
|
|
|
DeliverEventsToWindow(mouse, pWin, &event, 1,
|
2009-02-13 07:42:02 +01:00
|
|
|
GetEventFilter(mouse, &event),
|
2009-03-18 01:21:59 +01:00
|
|
|
NullGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-01-10 05:22:13 +01:00
|
|
|
|
2008-11-14 06:37:35 +01:00
|
|
|
if ((type == EnterNotify) && (mask & KeymapStateMask))
|
|
|
|
{
|
|
|
|
xKeymapEvent ke;
|
2009-05-20 01:36:03 +02:00
|
|
|
ClientPtr client = grab ? rClient(grab) : wClient(pWin);
|
2008-11-14 06:37:35 +01:00
|
|
|
if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess))
|
2010-06-04 10:35:31 +02:00
|
|
|
memset((char *)&ke.map[0], 0, 31);
|
2008-11-14 06:37:35 +01:00
|
|
|
else
|
|
|
|
memmove((char *)&ke.map[0], (char *)&keybd->key->down[1], 31);
|
|
|
|
|
|
|
|
ke.type = KeymapNotify;
|
|
|
|
if (grab)
|
|
|
|
TryClientEvents(rClient(grab), keybd, (xEvent *)&ke, 1,
|
|
|
|
mask, KeymapStateMask, grab);
|
|
|
|
else
|
|
|
|
DeliverEventsToWindow(mouse, pWin, (xEvent *)&ke, 1,
|
2009-03-18 01:21:59 +01:00
|
|
|
KeymapStateMask, NullGrab);
|
2008-11-14 06:37:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DeviceEnterLeaveEvent(
|
|
|
|
DeviceIntPtr mouse,
|
2009-07-29 08:34:28 +02:00
|
|
|
int sourceid,
|
2008-11-14 06:37:35 +01:00
|
|
|
int type,
|
|
|
|
int mode,
|
|
|
|
int detail,
|
|
|
|
WindowPtr pWin,
|
|
|
|
Window child)
|
|
|
|
{
|
|
|
|
GrabPtr grab = mouse->deviceGrab.grab;
|
2009-03-11 00:01:23 +01:00
|
|
|
xXIEnterEvent *event;
|
|
|
|
int filter;
|
|
|
|
int btlen, len, i;
|
|
|
|
DeviceIntPtr kbd;
|
|
|
|
|
2009-05-27 07:47:12 +02:00
|
|
|
if ((mode == XINotifyPassiveGrab && type == XI_Leave) ||
|
|
|
|
(mode == XINotifyPassiveUngrab && type == XI_Enter))
|
|
|
|
return;
|
|
|
|
|
2009-07-03 08:50:03 +02:00
|
|
|
btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
|
|
|
|
btlen = bytes_to_int32(btlen);
|
2009-03-11 00:01:23 +01:00
|
|
|
len = sizeof(xXIEnterEvent) + btlen * 4;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
event = calloc(1, len);
|
2009-03-11 00:01:23 +01:00
|
|
|
event->type = GenericEvent;
|
|
|
|
event->extension = IReqCode;
|
|
|
|
event->evtype = type;
|
|
|
|
event->length = (len - sizeof(xEvent))/4;
|
|
|
|
event->buttons_len = btlen;
|
|
|
|
event->detail = detail;
|
|
|
|
event->time = currentTime.milliseconds;
|
|
|
|
event->deviceid = mouse->id;
|
2009-07-29 08:34:28 +02:00
|
|
|
event->sourceid = sourceid;
|
2009-03-11 00:01:23 +01:00
|
|
|
event->mode = mode;
|
2009-04-19 14:12:11 +02:00
|
|
|
event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0);
|
|
|
|
event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0);
|
2009-03-11 00:01:23 +01:00
|
|
|
|
|
|
|
for (i = 0; mouse && mouse->button && i < mouse->button->numButtons; i++)
|
|
|
|
if (BitIsOn(mouse->button->down, i))
|
|
|
|
SetBit(&event[1], i);
|
|
|
|
|
2011-02-11 03:48:30 +01:00
|
|
|
kbd = GetMaster(mouse, MASTER_KEYBOARD);
|
2009-03-11 00:01:23 +01:00
|
|
|
if (kbd && kbd->key)
|
2007-01-10 05:22:13 +01:00
|
|
|
{
|
2009-03-11 00:01:23 +01:00
|
|
|
event->mods.base_mods = kbd->key->xkbInfo->state.base_mods;
|
|
|
|
event->mods.latched_mods = kbd->key->xkbInfo->state.latched_mods;
|
|
|
|
event->mods.locked_mods = kbd->key->xkbInfo->state.locked_mods;
|
|
|
|
|
|
|
|
event->group.base_group = kbd->key->xkbInfo->state.base_group;
|
|
|
|
event->group.latched_group = kbd->key->xkbInfo->state.latched_group;
|
|
|
|
event->group.locked_group = kbd->key->xkbInfo->state.locked_group;
|
2007-01-10 05:22:13 +01:00
|
|
|
}
|
|
|
|
|
2010-09-20 07:03:04 +02:00
|
|
|
FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent*)event, pWin,
|
|
|
|
None, FALSE);
|
2009-03-11 00:01:23 +01:00
|
|
|
|
|
|
|
filter = GetEventFilter(mouse, (xEvent*)event);
|
|
|
|
|
|
|
|
if (grab)
|
2009-05-26 03:12:08 +02:00
|
|
|
{
|
|
|
|
Mask mask;
|
2011-11-04 02:29:01 +01:00
|
|
|
mask = xi2mask_isset(grab->xi2mask, mouse, type);
|
|
|
|
TryClientEvents(rClient(grab), mouse, (xEvent*)event, 1, mask, 1, grab);
|
2009-05-26 03:12:08 +02:00
|
|
|
} else {
|
2011-11-03 05:54:06 +01:00
|
|
|
if (!WindowXI2MaskIsset(mouse, pWin, (xEvent*)event))
|
2009-09-23 03:44:12 +02:00
|
|
|
goto out;
|
2009-03-11 00:01:23 +01:00
|
|
|
DeliverEventsToWindow(mouse, pWin, (xEvent*)event, 1, filter,
|
2009-03-18 01:21:59 +01:00
|
|
|
NullGrab);
|
2009-05-26 03:12:08 +02:00
|
|
|
}
|
2009-09-23 03:44:12 +02:00
|
|
|
|
|
|
|
out:
|
2010-05-05 20:44:06 +02:00
|
|
|
free(event);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2008-12-19 12:05:47 +01:00
|
|
|
void
|
|
|
|
CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
xEvent event;
|
2007-04-17 09:21:16 +02:00
|
|
|
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&event, 0, sizeof(xEvent));
|
2008-12-19 12:05:47 +01:00
|
|
|
event.u.focus.mode = mode;
|
|
|
|
event.u.u.type = type;
|
|
|
|
event.u.u.detail = detail;
|
|
|
|
event.u.focus.window = pWin->drawable.id;
|
2009-02-13 07:42:02 +01:00
|
|
|
|
|
|
|
DeliverEventsToWindow(dev, pWin, &event, 1,
|
2009-03-18 01:21:59 +01:00
|
|
|
GetEventFilter(dev, &event), NullGrab);
|
2008-12-19 12:05:47 +01:00
|
|
|
if ((type == FocusIn) &&
|
|
|
|
((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2008-12-19 12:05:47 +01:00
|
|
|
xKeymapEvent ke;
|
2009-05-20 01:36:03 +02:00
|
|
|
ClientPtr client = wClient(pWin);
|
2009-05-20 01:30:33 +02:00
|
|
|
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess))
|
2010-06-04 10:35:31 +02:00
|
|
|
memset((char *)&ke.map[0], 0, 31);
|
2009-05-20 01:30:33 +02:00
|
|
|
else
|
|
|
|
memmove((char *)&ke.map[0], (char *)&dev->key->down[1], 31);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2008-12-19 12:05:47 +01:00
|
|
|
ke.type = KeymapNotify;
|
2009-03-05 06:22:41 +01:00
|
|
|
DeliverEventsToWindow(dev, pWin, (xEvent *)&ke, 1,
|
2009-03-18 01:21:59 +01:00
|
|
|
KeymapStateMask, NullGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Set the input focus to the given window. Subsequent keyboard events will be
|
|
|
|
* delivered to the given window.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* Usually called from ProcSetInputFocus as result of a client request. If so,
|
|
|
|
* the device is the inputInfo.keyboard.
|
|
|
|
* If called from ProcXSetInputFocus as result of a client xinput request, the
|
|
|
|
* device is set to the device specified by the client.
|
|
|
|
*
|
|
|
|
* @param client Client that requested input focus change.
|
2007-11-13 07:28:23 +01:00
|
|
|
* @param dev Focus device.
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param focusID The window to obtain the focus. Can be PointerRoot or None.
|
|
|
|
* @param revertTo Specifies where the focus reverts to when window becomes
|
|
|
|
* unviewable.
|
|
|
|
* @param ctime Specifies the time.
|
|
|
|
* @param followOK True if pointer is allowed to follow the keyboard.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
SetInputFocus(
|
|
|
|
ClientPtr client,
|
|
|
|
DeviceIntPtr dev,
|
|
|
|
Window focusID,
|
|
|
|
CARD8 revertTo,
|
|
|
|
Time ctime,
|
|
|
|
Bool followOK)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
FocusClassPtr focus;
|
2006-12-15 21:50:46 +01:00
|
|
|
WindowPtr focusWin;
|
|
|
|
int mode, rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
TimeStamp time;
|
2007-04-13 09:45:22 +02:00
|
|
|
DeviceIntPtr keybd; /* used for FollowKeyboard or FollowKeyboardWin */
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
UpdateCurrentTime();
|
|
|
|
if ((revertTo != RevertToParent) &&
|
|
|
|
(revertTo != RevertToPointerRoot) &&
|
|
|
|
(revertTo != RevertToNone) &&
|
|
|
|
((revertTo != RevertToFollowKeyboard) || !followOK))
|
|
|
|
{
|
|
|
|
client->errorValue = revertTo;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
time = ClientTimeToServerTime(ctime);
|
2007-04-13 09:45:22 +02:00
|
|
|
|
2011-08-01 06:14:02 +02:00
|
|
|
keybd = GetMaster(dev, KEYBOARD_OR_FLOAT);
|
2007-04-13 09:45:22 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if ((focusID == None) || (focusID == PointerRoot))
|
2003-11-14 17:49:22 +01:00
|
|
|
focusWin = (WindowPtr)(long)focusID;
|
2003-11-14 16:54:54 +01:00
|
|
|
else if ((focusID == FollowKeyboard) && followOK)
|
2007-04-13 09:45:22 +02:00
|
|
|
{
|
|
|
|
focusWin = keybd->focus->win;
|
|
|
|
}
|
2006-12-15 21:50:46 +01:00
|
|
|
else {
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = dixLookupWindow(&focusWin, focusID, client, DixSetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2007-11-13 07:28:23 +01:00
|
|
|
/* It is a match error to try to set the input focus to an
|
2003-11-14 16:54:54 +01:00
|
|
|
unviewable window. */
|
|
|
|
if(!focusWin->realized)
|
2010-06-06 16:18:40 +02:00
|
|
|
return BadMatch;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixSetFocusAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return Success;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
focus = dev->focus;
|
|
|
|
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
|
|
|
(CompareTimeStamps(time, focus->time) == EARLIER))
|
|
|
|
return Success;
|
2007-05-14 05:04:53 +02:00
|
|
|
mode = (dev->deviceGrab.grab) ? NotifyWhileGrabbed : NotifyNormal;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (focus->win == FollowKeyboardWin)
|
2009-05-26 06:42:25 +02:00
|
|
|
{
|
2009-05-27 07:47:12 +02:00
|
|
|
if (!ActivateFocusInGrab(dev, keybd->focus->win, focusWin))
|
2009-05-26 06:42:25 +02:00
|
|
|
DoFocusEvents(dev, keybd->focus->win, focusWin, mode);
|
|
|
|
} else
|
|
|
|
{
|
2009-05-27 07:47:12 +02:00
|
|
|
if (!ActivateFocusInGrab(dev, focus->win, focusWin))
|
2009-05-26 06:42:25 +02:00
|
|
|
DoFocusEvents(dev, focus->win, focusWin, mode);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
focus->time = time;
|
|
|
|
focus->revert = revertTo;
|
|
|
|
if (focusID == FollowKeyboard)
|
|
|
|
focus->win = FollowKeyboardWin;
|
|
|
|
else
|
|
|
|
focus->win = focusWin;
|
|
|
|
if ((focusWin == NoneWin) || (focusWin == PointerRootWin))
|
|
|
|
focus->traceGood = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int depth = 0;
|
2007-03-08 08:20:19 +01:00
|
|
|
WindowPtr pWin;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
for (pWin = focusWin; pWin; pWin = pWin->parent) depth++;
|
|
|
|
if (depth > focus->traceSize)
|
|
|
|
{
|
|
|
|
focus->traceSize = depth+1;
|
2010-05-05 20:44:06 +02:00
|
|
|
focus->trace = realloc(focus->trace,
|
2008-10-03 22:05:19 +02:00
|
|
|
focus->traceSize * sizeof(WindowPtr));
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
focus->traceGood = depth;
|
2007-11-13 07:28:23 +01:00
|
|
|
for (pWin = focusWin, depth--; pWin; pWin = pWin->parent, depth--)
|
2003-11-14 16:54:54 +01:00
|
|
|
focus->trace[depth] = pWin;
|
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for SetInputFocus request.
|
|
|
|
*
|
|
|
|
* Sets the input focus for the virtual core keyboard.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2009-01-11 08:20:06 +01:00
|
|
|
ProcSetInputFocus(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-22 08:17:01 +01:00
|
|
|
DeviceIntPtr kbd = PickKeyboard(client);
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST(xSetInputFocusReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xSetInputFocusReq);
|
2006-12-02 02:48:15 +01:00
|
|
|
|
2007-03-22 08:17:01 +01:00
|
|
|
return SetInputFocus(client, kbd, stuff->focus,
|
2003-11-14 16:54:54 +01:00
|
|
|
stuff->revertTo, stuff->time, FALSE);
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for GetInputFocus request.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Sends the current input focus for the client's keyboard back to the
|
2007-04-13 05:38:44 +02:00
|
|
|
* client.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcGetInputFocus(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-22 08:17:01 +01:00
|
|
|
DeviceIntPtr kbd = PickKeyboard(client);
|
2003-11-14 16:54:54 +01:00
|
|
|
xGetInputFocusReply rep;
|
2007-03-22 08:17:01 +01:00
|
|
|
FocusClassPtr focus = kbd->focus;
|
2007-08-28 21:10:20 +02:00
|
|
|
int rc;
|
|
|
|
/* REQUEST(xReq); */
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST_SIZE_MATCH(xReq);
|
2007-08-28 21:10:20 +02:00
|
|
|
|
2008-01-03 07:34:54 +01:00
|
|
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess);
|
2007-08-28 21:10:20 +02:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&rep, 0, sizeof(xGetInputFocusReply));
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
if (focus->win == NoneWin)
|
|
|
|
rep.focus = None;
|
|
|
|
else if (focus->win == PointerRootWin)
|
|
|
|
rep.focus = PointerRoot;
|
|
|
|
else rep.focus = focus->win->drawable.id;
|
|
|
|
rep.revertTo = focus->revert;
|
|
|
|
WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
2007-08-08 05:40:00 +02:00
|
|
|
* Server-side protocol handling for GrabPointer request.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Sets an active grab on the client's ClientPointer and returns success
|
|
|
|
* status to client.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcGrabPointer(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
xGrabPointerReply rep;
|
2007-03-02 05:51:46 +01:00
|
|
|
DeviceIntPtr device = PickPointer(client);
|
2003-11-14 16:54:54 +01:00
|
|
|
GrabPtr grab;
|
2009-04-12 09:38:28 +02:00
|
|
|
GrabMask mask;
|
2009-03-19 00:33:02 +01:00
|
|
|
WindowPtr confineTo;
|
|
|
|
CursorPtr oldCursor;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST(xGrabPointerReq);
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xGrabPointerReq);
|
|
|
|
UpdateCurrentTime();
|
2009-03-19 00:33:02 +01:00
|
|
|
|
2006-08-07 22:43:40 +02:00
|
|
|
if (stuff->eventMask & ~PointerGrabMask)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->eventMask;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2009-03-19 00:33:02 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (stuff->confineTo == None)
|
|
|
|
confineTo = NullWindow;
|
2007-11-13 07:28:23 +01:00
|
|
|
else
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-15 21:50:46 +01:00
|
|
|
rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
|
2007-08-28 21:10:20 +02:00
|
|
|
DixSetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-03-19 00:33:02 +01:00
|
|
|
|
|
|
|
memset(&rep, 0, sizeof(xGrabPointerReply));
|
|
|
|
oldCursor = NullCursor;
|
|
|
|
grab = device->deviceGrab.grab;
|
|
|
|
|
|
|
|
if (grab)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-03-19 00:33:02 +01:00
|
|
|
if (grab->confineTo && !confineTo)
|
2010-12-27 14:06:03 +01:00
|
|
|
ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE,
|
|
|
|
FALSE);
|
2009-03-19 00:33:02 +01:00
|
|
|
oldCursor = grab->cursor;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2009-03-19 00:33:02 +01:00
|
|
|
|
2009-04-12 09:38:28 +02:00
|
|
|
mask.core = stuff->eventMask;
|
|
|
|
|
2009-03-19 00:33:02 +01:00
|
|
|
rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode,
|
|
|
|
stuff->grabWindow, stuff->ownerEvents, stuff->time,
|
2011-12-08 05:27:01 +01:00
|
|
|
&mask, CORE, stuff->cursor,
|
2009-03-19 00:33:02 +01:00
|
|
|
stuff->confineTo, &rep.status);
|
2007-08-28 21:10:20 +02:00
|
|
|
if (rc != Success)
|
2009-03-19 00:33:02 +01:00
|
|
|
return rc;
|
|
|
|
|
2009-05-01 03:06:06 +02:00
|
|
|
if (oldCursor && rep.status == GrabSuccess)
|
2009-03-19 00:33:02 +01:00
|
|
|
FreeCursor (oldCursor, (Cursor)0);
|
2007-08-28 21:10:20 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.length = 0;
|
|
|
|
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for ChangeActivePointerGrab request.
|
|
|
|
*
|
|
|
|
* Changes properties of the grab hold by the client. If the client does not
|
2007-11-13 07:28:23 +01:00
|
|
|
* hold an active grab on the device, nothing happens.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcChangeActivePointerGrab(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2008-04-25 07:45:31 +02:00
|
|
|
DeviceIntPtr device;
|
2007-08-20 02:36:13 +02:00
|
|
|
GrabPtr grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
CursorPtr newCursor, oldCursor;
|
|
|
|
REQUEST(xChangeActivePointerGrabReq);
|
|
|
|
TimeStamp time;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xChangeActivePointerGrabReq);
|
2006-08-07 22:43:40 +02:00
|
|
|
if (stuff->eventMask & ~PointerGrabMask)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->eventMask;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (stuff->cursor == None)
|
|
|
|
newCursor = NullCursor;
|
|
|
|
else
|
|
|
|
{
|
2008-08-07 00:26:24 +02:00
|
|
|
int rc = dixLookupResourceByType((pointer *)&newCursor, stuff->cursor,
|
|
|
|
RT_CURSOR, client, DixUseAccess);
|
2007-08-15 20:13:53 +02:00
|
|
|
if (rc != Success)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->cursor;
|
2010-04-25 08:26:40 +02:00
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
2007-08-20 02:36:13 +02:00
|
|
|
|
|
|
|
device = PickPointer(client);
|
|
|
|
grab = device->deviceGrab.grab;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!grab)
|
|
|
|
return Success;
|
|
|
|
if (!SameClient(grab, client))
|
|
|
|
return Success;
|
|
|
|
time = ClientTimeToServerTime(stuff->time);
|
|
|
|
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
2007-05-14 05:04:53 +02:00
|
|
|
(CompareTimeStamps(time, device->deviceGrab.grabTime) == EARLIER))
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
oldCursor = grab->cursor;
|
|
|
|
grab->cursor = newCursor;
|
|
|
|
if (newCursor)
|
|
|
|
newCursor->refcnt++;
|
2007-01-11 04:35:39 +01:00
|
|
|
PostNewCursor(device);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (oldCursor)
|
|
|
|
FreeCursor(oldCursor, (Cursor)0);
|
|
|
|
grab->eventMask = stuff->eventMask;
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for UngrabPointer request.
|
|
|
|
*
|
2008-04-25 07:45:31 +02:00
|
|
|
* Deletes a pointer grab on a device the client has grabbed.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcUngrabPointer(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2008-04-25 07:45:31 +02:00
|
|
|
DeviceIntPtr device = PickPointer(client);
|
2003-11-14 16:54:54 +01:00
|
|
|
GrabPtr grab;
|
|
|
|
TimeStamp time;
|
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
UpdateCurrentTime();
|
2007-05-14 05:04:53 +02:00
|
|
|
grab = device->deviceGrab.grab;
|
2007-08-08 05:40:00 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
time = ClientTimeToServerTime(stuff->id);
|
|
|
|
if ((CompareTimeStamps(time, currentTime) != LATER) &&
|
2007-05-14 05:04:53 +02:00
|
|
|
(CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
|
2003-11-14 16:54:54 +01:00
|
|
|
(grab) && SameClient(grab, client))
|
2007-05-14 05:04:53 +02:00
|
|
|
(*device->deviceGrab.DeactivateGrab)(device);
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Sets a grab on the given device.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Called from ProcGrabKeyboard to work on the client's keyboard.
|
2007-04-13 05:38:44 +02:00
|
|
|
* Called from ProcXGrabDevice to work on the device specified by the client.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* The parameters this_mode and other_mode represent the keyboard_mode and
|
2007-11-13 07:28:23 +01:00
|
|
|
* pointer_mode parameters of XGrabKeyboard().
|
2007-04-13 05:38:44 +02:00
|
|
|
* See man page for details on all the parameters
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param client Client that owns the grab.
|
2007-11-13 07:28:23 +01:00
|
|
|
* @param dev The device to grab.
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param this_mode GrabModeSync or GrabModeAsync
|
|
|
|
* @param other_mode GrabModeSync or GrabModeAsync
|
|
|
|
* @param status Return code to be returned to the caller.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* @returns Success or BadValue.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-11-13 07:28:23 +01:00
|
|
|
GrabDevice(ClientPtr client, DeviceIntPtr dev,
|
2009-03-19 00:33:02 +01:00
|
|
|
unsigned pointer_mode, unsigned keyboard_mode, Window grabWindow,
|
2009-04-12 09:38:28 +02:00
|
|
|
unsigned ownerEvents, Time ctime, GrabMask *mask,
|
2009-04-12 08:19:45 +02:00
|
|
|
int grabtype, Cursor curs, Window confineToWin, CARD8 *status)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-03-19 00:33:02 +01:00
|
|
|
WindowPtr pWin, confineTo;
|
2007-03-08 08:20:19 +01:00
|
|
|
GrabPtr grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
TimeStamp time;
|
2007-08-28 21:10:20 +02:00
|
|
|
Mask access_mode = DixGrabAccess;
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2007-05-17 10:29:02 +02:00
|
|
|
GrabInfoPtr grabInfo = &dev->deviceGrab;
|
2009-03-19 00:33:02 +01:00
|
|
|
CursorPtr cursor;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
UpdateCurrentTime();
|
2009-03-19 00:33:02 +01:00
|
|
|
if ((keyboard_mode != GrabModeSync) && (keyboard_mode != GrabModeAsync))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-03-19 00:33:02 +01:00
|
|
|
client->errorValue = keyboard_mode;
|
2003-11-14 16:54:54 +01:00
|
|
|
return BadValue;
|
|
|
|
}
|
2009-03-19 00:33:02 +01:00
|
|
|
if ((pointer_mode != GrabModeSync) && (pointer_mode != GrabModeAsync))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-03-19 00:33:02 +01:00
|
|
|
client->errorValue = pointer_mode;
|
2003-11-14 16:54:54 +01:00
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((ownerEvents != xFalse) && (ownerEvents != xTrue))
|
|
|
|
{
|
|
|
|
client->errorValue = ownerEvents;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2007-08-28 21:10:20 +02:00
|
|
|
|
|
|
|
rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2009-03-19 00:33:02 +01:00
|
|
|
|
|
|
|
if (confineToWin == None)
|
|
|
|
confineTo = NullWindow;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rc = dixLookupWindow(&confineTo, confineToWin, client,
|
|
|
|
DixSetAttrAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (curs == None)
|
|
|
|
cursor = NullCursor;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rc = dixLookupResourceByType((pointer *)&cursor, curs, RT_CURSOR,
|
|
|
|
client, DixUseAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
{
|
|
|
|
client->errorValue = curs;
|
2010-04-25 08:26:40 +02:00
|
|
|
return rc;
|
2009-03-19 00:33:02 +01:00
|
|
|
}
|
|
|
|
access_mode |= DixForceAccess;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (keyboard_mode == GrabModeSync || pointer_mode == GrabModeSync)
|
2007-08-28 21:10:20 +02:00
|
|
|
access_mode |= DixFreezeAccess;
|
|
|
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2007-08-28 21:10:20 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
time = ClientTimeToServerTime(ctime);
|
2007-04-03 07:36:26 +02:00
|
|
|
grab = grabInfo->grab;
|
2009-04-12 08:19:45 +02:00
|
|
|
if (grab && grab->grabtype != grabtype)
|
|
|
|
*status = AlreadyGrabbed;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (grab && !SameClient(grab, client))
|
|
|
|
*status = AlreadyGrabbed;
|
2009-03-19 00:33:02 +01:00
|
|
|
else if ((!pWin->realized) ||
|
|
|
|
(confineTo &&
|
|
|
|
!(confineTo->realized
|
|
|
|
&& BorderSizeNotEmpty(dev, confineTo))))
|
2003-11-14 16:54:54 +01:00
|
|
|
*status = GrabNotViewable;
|
|
|
|
else if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
2007-04-03 07:36:26 +02:00
|
|
|
(CompareTimeStamps(time, grabInfo->grabTime) == EARLIER))
|
2003-11-14 16:54:54 +01:00
|
|
|
*status = GrabInvalidTime;
|
2007-04-03 07:36:26 +02:00
|
|
|
else if (grabInfo->sync.frozen &&
|
|
|
|
grabInfo->sync.other && !SameClient(grabInfo->sync.other, client))
|
2003-11-14 16:54:54 +01:00
|
|
|
*status = GrabFrozen;
|
|
|
|
else
|
|
|
|
{
|
2011-11-04 01:47:27 +01:00
|
|
|
GrabPtr tempGrab;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab = AllocGrab();
|
2006-12-18 06:03:54 +01:00
|
|
|
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->next = NULL;
|
|
|
|
tempGrab->window = pWin;
|
|
|
|
tempGrab->resource = client->clientAsMask;
|
|
|
|
tempGrab->ownerEvents = ownerEvents;
|
|
|
|
tempGrab->keyboardMode = keyboard_mode;
|
|
|
|
tempGrab->pointerMode = pointer_mode;
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grabtype == CORE)
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->eventMask = mask->core;
|
2011-12-08 05:27:01 +01:00
|
|
|
else if (grabtype == XI)
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->eventMask = mask->xi;
|
2009-04-12 09:38:28 +02:00
|
|
|
else
|
2011-11-04 02:29:01 +01:00
|
|
|
xi2mask_merge(tempGrab->xi2mask, mask->xi2mask);
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->device = dev;
|
|
|
|
tempGrab->cursor = cursor;
|
|
|
|
tempGrab->confineTo = confineTo;
|
|
|
|
tempGrab->grabtype = grabtype;
|
|
|
|
(*grabInfo->ActivateGrab)(dev, tempGrab, time, FALSE);
|
2003-11-14 16:54:54 +01:00
|
|
|
*status = GrabSuccess;
|
2011-11-04 01:47:27 +01:00
|
|
|
|
|
|
|
FreeGrab(tempGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for GrabKeyboard request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Grabs the client's keyboard and returns success status to client.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcGrabKeyboard(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
xGrabKeyboardReply rep;
|
|
|
|
REQUEST(xGrabKeyboardReq);
|
|
|
|
int result;
|
2008-04-25 07:45:31 +02:00
|
|
|
DeviceIntPtr keyboard = PickKeyboard(client);
|
2009-04-12 09:38:28 +02:00
|
|
|
GrabMask mask;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xGrabKeyboardReq);
|
2006-12-02 02:48:15 +01:00
|
|
|
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&rep, 0, sizeof(xGrabKeyboardReply));
|
2009-04-12 09:38:28 +02:00
|
|
|
mask.core = KeyPressMask | KeyReleaseMask;
|
|
|
|
|
2009-03-19 00:33:02 +01:00
|
|
|
result = GrabDevice(client, keyboard, stuff->pointerMode,
|
|
|
|
stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents,
|
2011-12-08 05:27:01 +01:00
|
|
|
stuff->time, &mask, CORE, None, None,
|
2009-03-19 00:33:02 +01:00
|
|
|
&rep.status);
|
2007-08-08 05:40:00 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (result != Success)
|
|
|
|
return result;
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.length = 0;
|
|
|
|
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for UngrabKeyboard request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Deletes a possible grab on the client's keyboard.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcUngrabKeyboard(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2008-04-25 07:45:31 +02:00
|
|
|
DeviceIntPtr device = PickKeyboard(client);
|
2003-11-14 16:54:54 +01:00
|
|
|
GrabPtr grab;
|
|
|
|
TimeStamp time;
|
|
|
|
REQUEST(xResourceReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
|
|
|
UpdateCurrentTime();
|
2007-08-08 05:40:00 +02:00
|
|
|
|
2007-08-15 14:42:29 +02:00
|
|
|
grab = device->deviceGrab.grab;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
time = ClientTimeToServerTime(stuff->id);
|
|
|
|
if ((CompareTimeStamps(time, currentTime) != LATER) &&
|
2007-05-14 05:04:53 +02:00
|
|
|
(CompareTimeStamps(time, device->deviceGrab.grabTime) != EARLIER) &&
|
2011-12-08 05:27:01 +01:00
|
|
|
(grab) && SameClient(grab, client) && grab->grabtype == CORE)
|
2007-05-14 05:04:53 +02:00
|
|
|
(*device->deviceGrab.DeactivateGrab)(device);
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for QueryPointer request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Returns the current state and position of the client's ClientPointer to the
|
2007-11-13 07:28:23 +01:00
|
|
|
* client.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcQueryPointer(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
xQueryPointerReply rep;
|
|
|
|
WindowPtr pWin, t;
|
2007-03-02 05:51:46 +01:00
|
|
|
DeviceIntPtr mouse = PickPointer(client);
|
2009-03-13 06:34:29 +01:00
|
|
|
DeviceIntPtr keyboard;
|
2008-01-18 12:14:22 +01:00
|
|
|
SpritePtr pSprite;
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2006-12-19 01:01:40 +01:00
|
|
|
REQUEST(xResourceReq);
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST_SIZE_MATCH(xResourceReq);
|
2007-08-28 21:10:20 +02:00
|
|
|
|
|
|
|
rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess);
|
2009-09-16 01:29:34 +02:00
|
|
|
if (rc != Success && rc != BadAccess)
|
2006-12-15 21:50:46 +01:00
|
|
|
return rc;
|
2007-08-28 21:10:20 +02:00
|
|
|
|
2011-08-01 06:14:02 +02:00
|
|
|
keyboard = GetMaster(mouse, MASTER_KEYBOARD);
|
2009-03-13 06:34:29 +01:00
|
|
|
|
2008-01-18 12:14:22 +01:00
|
|
|
pSprite = mouse->spriteInfo->sprite;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (mouse->valuator->motionHintWindow)
|
|
|
|
MaybeStopHint(mouse, client);
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&rep, 0, sizeof(xQueryPointerReply));
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
2009-05-21 03:16:37 +02:00
|
|
|
rep.mask = mouse->button ? (mouse->button->state) : 0;
|
2009-03-13 06:34:29 +01:00
|
|
|
rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state);
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.length = 0;
|
2010-12-27 14:06:03 +01:00
|
|
|
rep.root = (GetCurrentRootWindow(mouse))->drawable.id;
|
2006-12-11 08:39:59 +01:00
|
|
|
rep.rootX = pSprite->hot.x;
|
|
|
|
rep.rootY = pSprite->hot.y;
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.child = None;
|
2006-12-11 08:39:59 +01:00
|
|
|
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
rep.sameScreen = xTrue;
|
2006-12-11 08:39:59 +01:00
|
|
|
rep.winX = pSprite->hot.x - pWin->drawable.x;
|
|
|
|
rep.winY = pSprite->hot.y - pWin->drawable.y;
|
|
|
|
for (t = pSprite->win; t; t = t->parent)
|
2003-11-14 16:54:54 +01:00
|
|
|
if (t->parent == pWin)
|
|
|
|
{
|
|
|
|
rep.child = t->drawable.id;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rep.sameScreen = xFalse;
|
|
|
|
rep.winX = 0;
|
|
|
|
rep.winY = 0;
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension) {
|
2010-05-23 19:11:47 +02:00
|
|
|
rep.rootX += screenInfo.screens[0]->x;
|
|
|
|
rep.rootY += screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
if(stuff->id == rep.root) {
|
2010-05-23 19:11:47 +02:00
|
|
|
rep.winX += screenInfo.screens[0]->x;
|
|
|
|
rep.winY += screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-09-16 01:29:34 +02:00
|
|
|
if (rc == BadAccess) {
|
|
|
|
rep.mask = 0;
|
|
|
|
rep.child = None;
|
|
|
|
rep.rootX = 0;
|
|
|
|
rep.rootY = 0;
|
|
|
|
rep.winX = 0;
|
|
|
|
rep.winY = 0;
|
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep);
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Initializes the device list and the DIX sprite to sane values. Allocates
|
|
|
|
* trace memory used for quick window traversal.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-04-09 23:33:15 +02:00
|
|
|
InitEvents(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
int i;
|
2011-11-21 20:41:12 +01:00
|
|
|
QdEventPtr qe, tmp;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
inputInfo.numDevices = 0;
|
|
|
|
inputInfo.devices = (DeviceIntPtr)NULL;
|
|
|
|
inputInfo.off_devices = (DeviceIntPtr)NULL;
|
|
|
|
inputInfo.keyboard = (DeviceIntPtr)NULL;
|
|
|
|
inputInfo.pointer = (DeviceIntPtr)NULL;
|
2011-04-23 07:19:39 +02:00
|
|
|
for (i = 0; i < MAXDEVICES; i++)
|
2007-12-04 09:37:46 +01:00
|
|
|
{
|
2011-12-09 09:38:53 +01:00
|
|
|
memcpy(&event_filters[i], default_filter, sizeof(default_filter));
|
2007-12-04 09:37:46 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
syncEvents.replayDev = (DeviceIntPtr)NULL;
|
|
|
|
syncEvents.replayWin = NullWindow;
|
2011-11-21 20:41:12 +01:00
|
|
|
if (syncEvents.pending.next)
|
|
|
|
list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next)
|
|
|
|
free(qe);
|
|
|
|
list_init(&syncEvents.pending);
|
2003-11-14 16:54:54 +01:00
|
|
|
syncEvents.playingEvents = FALSE;
|
|
|
|
syncEvents.time.months = 0;
|
|
|
|
syncEvents.time.milliseconds = 0; /* hardly matters */
|
|
|
|
currentTime.months = 0;
|
|
|
|
currentTime.milliseconds = GetTimeInMillis();
|
|
|
|
lastDeviceEventTime = currentTime;
|
|
|
|
for (i = 0; i < DNPMCOUNT; i++)
|
|
|
|
{
|
|
|
|
DontPropagateMasks[i] = 0;
|
|
|
|
DontPropagateRefCnts[i] = 0;
|
|
|
|
}
|
2008-02-03 00:26:19 +01:00
|
|
|
|
2011-04-15 02:07:10 +02:00
|
|
|
InputEventList = InitEventList(GetMaximumEventsNum());
|
2008-02-03 00:26:19 +01:00
|
|
|
if (!InputEventList)
|
|
|
|
FatalError("[dix] Failed to allocate input event list.\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
CloseDownEvents(void)
|
|
|
|
{
|
2011-04-15 02:07:10 +02:00
|
|
|
FreeEventList(InputEventList, GetMaximumEventsNum());
|
2009-11-27 07:01:53 +01:00
|
|
|
InputEventList = NULL;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
2011-09-14 03:58:34 +02:00
|
|
|
#define SEND_EVENT_BIT 0x80
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for SendEvent request.
|
|
|
|
*
|
2007-11-13 07:28:23 +01:00
|
|
|
* Locates the window to send the event to and forwards the event.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcSendEvent(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */
|
2009-03-19 01:09:04 +01:00
|
|
|
DeviceIntPtr dev = PickPointer(client);
|
2011-08-01 06:14:02 +02:00
|
|
|
DeviceIntPtr keybd = GetMaster(dev, MASTER_KEYBOARD);
|
2009-03-19 01:09:04 +01:00
|
|
|
SpritePtr pSprite = dev->spriteInfo->sprite;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST(xSendEventReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xSendEventReq);
|
|
|
|
|
2011-09-14 03:58:34 +02:00
|
|
|
/* libXext and other extension libraries may set the bit indicating
|
|
|
|
* that this event came from a SendEvent request so remove it
|
|
|
|
* since otherwise the event type may fail the range checks
|
|
|
|
* and cause an invalid BadValue error to be returned.
|
|
|
|
*
|
|
|
|
* This is safe to do since we later add the SendEvent bit (0x80)
|
|
|
|
* back in once we send the event to the client */
|
|
|
|
|
|
|
|
stuff->event.u.u.type &= ~(SEND_EVENT_BIT);
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* The client's event type must be a core event type or one defined by an
|
|
|
|
extension. */
|
|
|
|
|
|
|
|
if ( ! ((stuff->event.u.u.type > X_Reply &&
|
2007-11-13 07:28:23 +01:00
|
|
|
stuff->event.u.u.type < LASTEvent) ||
|
2003-11-14 16:54:54 +01:00
|
|
|
(stuff->event.u.u.type >= EXTENSION_EVENT_BASE &&
|
|
|
|
stuff->event.u.u.type < (unsigned)lastEvent)))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->event.u.u.type;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (stuff->event.u.u.type == ClientMessage &&
|
|
|
|
stuff->event.u.u.detail != 8 &&
|
|
|
|
stuff->event.u.u.detail != 16 &&
|
2006-08-07 22:43:40 +02:00
|
|
|
stuff->event.u.u.detail != 32)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->event.u.u.detail;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2006-08-07 22:43:40 +02:00
|
|
|
if (stuff->eventMask & ~AllEventMasks)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->eventMask;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stuff->destination == PointerWindow)
|
2006-12-11 08:39:59 +01:00
|
|
|
pWin = pSprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
else if (stuff->destination == InputFocus)
|
|
|
|
{
|
2009-03-19 01:09:04 +01:00
|
|
|
WindowPtr inputFocus = (keybd) ? keybd->focus->win : NoneWin;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (inputFocus == NoneWin)
|
|
|
|
return Success;
|
|
|
|
|
|
|
|
/* If the input focus is PointerRootWin, send the event to where
|
|
|
|
the pointer is if possible, then perhaps propogate up to root. */
|
2007-11-13 07:28:23 +01:00
|
|
|
if (inputFocus == PointerRootWin)
|
2010-12-27 14:06:03 +01:00
|
|
|
inputFocus = GetCurrentRootWindow(dev);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-12-11 08:39:59 +01:00
|
|
|
if (IsParent(inputFocus, pSprite->win))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
effectiveFocus = inputFocus;
|
2006-12-11 08:39:59 +01:00
|
|
|
pWin = pSprite->win;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
effectiveFocus = pWin = inputFocus;
|
|
|
|
}
|
|
|
|
else
|
2007-08-28 21:10:20 +02:00
|
|
|
dixLookupWindow(&pWin, stuff->destination, client, DixSendAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!pWin)
|
|
|
|
return BadWindow;
|
|
|
|
if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->propagate;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2011-09-14 03:58:34 +02:00
|
|
|
stuff->event.u.u.type |= SEND_EVENT_BIT;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (stuff->propagate)
|
|
|
|
{
|
|
|
|
for (;pWin; pWin = pWin->parent)
|
|
|
|
{
|
2007-08-29 20:16:46 +02:00
|
|
|
if (XaceHook(XACE_SEND_ACCESS, client, NULL, pWin,
|
|
|
|
&stuff->event, 1))
|
|
|
|
return Success;
|
2009-03-06 13:27:54 +01:00
|
|
|
if (DeliverEventsToWindow(dev, pWin,
|
2009-03-18 01:21:59 +01:00
|
|
|
&stuff->event, 1, stuff->eventMask, NullGrab))
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
if (pWin == effectiveFocus)
|
|
|
|
return Success;
|
|
|
|
stuff->eventMask &= ~wDontPropagateMask(pWin);
|
|
|
|
if (!stuff->eventMask)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-08-29 20:16:46 +02:00
|
|
|
else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, &stuff->event, 1))
|
2009-03-06 13:27:54 +01:00
|
|
|
DeliverEventsToWindow(dev, pWin, &stuff->event,
|
2009-03-18 01:21:59 +01:00
|
|
|
1, stuff->eventMask, NullGrab);
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for UngrabKey request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Deletes a passive grab for the given key. Works on the
|
|
|
|
* client's keyboard.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcUngrabKey(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xUngrabKeyReq);
|
|
|
|
WindowPtr pWin;
|
2011-11-04 01:47:27 +01:00
|
|
|
GrabPtr tempGrab;
|
2007-03-29 07:13:50 +02:00
|
|
|
DeviceIntPtr keybd = PickKeyboard(client);
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xUngrabKeyReq);
|
2009-08-11 00:39:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixGetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2008-10-18 21:26:00 +02:00
|
|
|
if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) ||
|
|
|
|
(stuff->key < keybd->key->xkbInfo->desc->min_key_code))
|
2003-11-14 16:54:54 +01:00
|
|
|
&& (stuff->key != AnyKey))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->key;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((stuff->modifiers != AnyModifier) &&
|
|
|
|
(stuff->modifiers & ~AllModifiersMask))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->modifiers;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab = AllocGrab();
|
|
|
|
if (!tempGrab)
|
|
|
|
return BadAlloc;
|
|
|
|
tempGrab->resource = client->clientAsMask;
|
|
|
|
tempGrab->device = keybd;
|
|
|
|
tempGrab->window = pWin;
|
|
|
|
tempGrab->modifiersDetail.exact = stuff->modifiers;
|
|
|
|
tempGrab->modifiersDetail.pMask = NULL;
|
|
|
|
tempGrab->modifierDevice = keybd;
|
|
|
|
tempGrab->type = KeyPress;
|
2011-12-08 05:27:01 +01:00
|
|
|
tempGrab->grabtype = CORE;
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->detail.exact = stuff->key;
|
|
|
|
tempGrab->detail.pMask = NULL;
|
|
|
|
tempGrab->next = NULL;
|
|
|
|
|
|
|
|
if (!DeletePassiveGrabFromList(tempGrab))
|
|
|
|
rc = BadAlloc;
|
|
|
|
|
|
|
|
FreeGrab(tempGrab);
|
|
|
|
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for GrabKey request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Creates a grab for the client's keyboard and adds it to the list of passive
|
2007-11-13 07:28:23 +01:00
|
|
|
* grabs.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcGrabKey(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
REQUEST(xGrabKeyReq);
|
|
|
|
GrabPtr grab;
|
2007-03-29 07:13:50 +02:00
|
|
|
DeviceIntPtr keybd = PickKeyboard(client);
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2009-04-28 08:49:45 +02:00
|
|
|
GrabParameters param;
|
|
|
|
GrabMask mask;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xGrabKeyReq);
|
2009-04-28 08:49:45 +02:00
|
|
|
|
|
|
|
memset(¶m, 0, sizeof(param));
|
2011-12-08 05:27:01 +01:00
|
|
|
param.grabtype = CORE;
|
2009-04-28 08:49:45 +02:00
|
|
|
param.ownerEvents = stuff->ownerEvents;
|
|
|
|
param.this_device_mode = stuff->keyboardMode;
|
|
|
|
param.other_devices_mode = stuff->pointerMode;
|
|
|
|
param.modifiers = stuff->modifiers;
|
|
|
|
|
|
|
|
rc = CheckGrabValues(client, ¶m);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
|
2008-10-18 21:26:00 +02:00
|
|
|
if (((stuff->key > keybd->key->xkbInfo->desc->max_key_code) ||
|
|
|
|
(stuff->key < keybd->key->xkbInfo->desc->min_key_code))
|
2003-11-14 16:54:54 +01:00
|
|
|
&& (stuff->key != AnyKey))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->key;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-04-28 08:49:45 +02:00
|
|
|
|
|
|
|
mask.core = (KeyPressMask | KeyReleaseMask);
|
|
|
|
|
2011-12-08 05:27:01 +01:00
|
|
|
grab = CreateGrab(client->index, keybd, keybd, pWin, CORE, &mask,
|
2009-04-28 08:49:45 +02:00
|
|
|
¶m, KeyPress, stuff->key, NullWindow, NullCursor);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!grab)
|
|
|
|
return BadAlloc;
|
2007-10-18 18:24:55 +02:00
|
|
|
return AddPassiveGrabToList(client, grab);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for GrabButton request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Creates a grab for the client's ClientPointer and adds it as a passive grab
|
|
|
|
* to the list.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcGrabButton(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin, confineTo;
|
|
|
|
REQUEST(xGrabButtonReq);
|
|
|
|
CursorPtr cursor;
|
|
|
|
GrabPtr grab;
|
2008-01-03 07:34:54 +01:00
|
|
|
DeviceIntPtr ptr, modifierDevice;
|
2007-08-28 21:10:20 +02:00
|
|
|
Mask access_mode = DixGrabAccess;
|
2009-04-28 08:49:45 +02:00
|
|
|
GrabMask mask;
|
|
|
|
GrabParameters param;
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xGrabButtonReq);
|
|
|
|
if ((stuff->pointerMode != GrabModeSync) &&
|
|
|
|
(stuff->pointerMode != GrabModeAsync))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->pointerMode;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((stuff->keyboardMode != GrabModeSync) &&
|
|
|
|
(stuff->keyboardMode != GrabModeAsync))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->keyboardMode;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((stuff->modifiers != AnyModifier) &&
|
|
|
|
(stuff->modifiers & ~AllModifiersMask))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->modifiers;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((stuff->ownerEvents != xFalse) && (stuff->ownerEvents != xTrue))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->ownerEvents;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (stuff->eventMask & ~PointerGrabMask)
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->eventMask;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2007-08-28 21:10:20 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (stuff->confineTo == None)
|
2003-11-14 17:49:22 +01:00
|
|
|
confineTo = NullWindow;
|
|
|
|
else {
|
2006-12-15 21:50:46 +01:00
|
|
|
rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
|
2007-08-28 21:10:20 +02:00
|
|
|
DixSetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
if (stuff->cursor == None)
|
|
|
|
cursor = NullCursor;
|
|
|
|
else
|
|
|
|
{
|
2008-08-07 00:26:24 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor, RT_CURSOR,
|
2007-08-28 21:10:20 +02:00
|
|
|
client, DixUseAccess);
|
|
|
|
if (rc != Success)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->cursor;
|
2010-04-25 08:26:40 +02:00
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2007-08-28 21:10:20 +02:00
|
|
|
access_mode |= DixForceAccess;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2008-01-03 07:34:54 +01:00
|
|
|
ptr = PickPointer(client);
|
2011-08-01 06:14:02 +02:00
|
|
|
modifierDevice = GetMaster(ptr, MASTER_KEYBOARD);
|
2007-08-28 21:10:20 +02:00
|
|
|
if (stuff->pointerMode == GrabModeSync ||
|
|
|
|
stuff->keyboardMode == GrabModeSync)
|
|
|
|
access_mode |= DixFreezeAccess;
|
2008-01-03 07:34:54 +01:00
|
|
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, access_mode);
|
2007-08-28 21:10:20 +02:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2009-04-28 08:49:45 +02:00
|
|
|
memset(¶m, 0, sizeof(param));
|
2011-12-08 05:27:01 +01:00
|
|
|
param.grabtype = CORE;
|
2009-04-28 08:49:45 +02:00
|
|
|
param.ownerEvents = stuff->ownerEvents;
|
|
|
|
param.this_device_mode = stuff->keyboardMode;
|
|
|
|
param.other_devices_mode = stuff->pointerMode;
|
|
|
|
param.modifiers = stuff->modifiers;
|
|
|
|
|
|
|
|
mask.core = stuff->eventMask;
|
|
|
|
|
|
|
|
grab = CreateGrab(client->index, ptr, modifierDevice, pWin,
|
2011-12-08 05:27:01 +01:00
|
|
|
CORE, &mask, ¶m, ButtonPress,
|
2009-04-28 08:49:45 +02:00
|
|
|
stuff->button, confineTo, cursor);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!grab)
|
|
|
|
return BadAlloc;
|
2007-10-18 18:24:55 +02:00
|
|
|
return AddPassiveGrabToList(client, grab);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for UngrabButton request.
|
|
|
|
*
|
2007-05-30 10:14:31 +02:00
|
|
|
* Deletes a passive grab on the client's ClientPointer from the list.
|
2007-04-13 05:38:44 +02:00
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcUngrabButton(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xUngrabButtonReq);
|
|
|
|
WindowPtr pWin;
|
2011-11-04 01:47:27 +01:00
|
|
|
GrabPtr tempGrab;
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2009-03-13 05:59:18 +01:00
|
|
|
DeviceIntPtr ptr;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xUngrabButtonReq);
|
|
|
|
if ((stuff->modifiers != AnyModifier) &&
|
|
|
|
(stuff->modifiers & ~AllModifiersMask))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->modifiers;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2006-12-15 21:50:46 +01:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2009-03-13 05:59:18 +01:00
|
|
|
|
|
|
|
ptr = PickPointer(client);
|
|
|
|
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab = AllocGrab();
|
|
|
|
if (!tempGrab)
|
|
|
|
return BadAlloc;
|
|
|
|
tempGrab->resource = client->clientAsMask;
|
|
|
|
tempGrab->device = ptr;
|
|
|
|
tempGrab->window = pWin;
|
|
|
|
tempGrab->modifiersDetail.exact = stuff->modifiers;
|
|
|
|
tempGrab->modifiersDetail.pMask = NULL;
|
|
|
|
tempGrab->modifierDevice = GetMaster(ptr, MASTER_KEYBOARD);
|
|
|
|
tempGrab->type = ButtonPress;
|
|
|
|
tempGrab->detail.exact = stuff->button;
|
2011-12-08 05:27:01 +01:00
|
|
|
tempGrab->grabtype = CORE;
|
2011-11-04 01:47:27 +01:00
|
|
|
tempGrab->detail.pMask = NULL;
|
|
|
|
tempGrab->next = NULL;
|
|
|
|
|
|
|
|
if (!DeletePassiveGrabFromList(tempGrab))
|
|
|
|
rc = BadAlloc;
|
|
|
|
|
|
|
|
FreeGrab(tempGrab);
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Deactivate any grab that may be on the window, remove the focus.
|
|
|
|
* Delete any XInput extension events from the window too. Does not change the
|
|
|
|
* window mask. Use just before the window is deleted.
|
|
|
|
*
|
|
|
|
* If freeResources is set, passive grabs on the window are deleted.
|
|
|
|
*
|
|
|
|
* @param pWin The window to delete events from.
|
|
|
|
* @param freeResources True if resources associated with the window should be
|
|
|
|
* deleted.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr parent;
|
|
|
|
DeviceIntPtr mouse = inputInfo.pointer;
|
|
|
|
DeviceIntPtr keybd = inputInfo.keyboard;
|
2007-04-03 11:32:14 +02:00
|
|
|
FocusClassPtr focus;
|
2003-11-14 16:54:54 +01:00
|
|
|
OtherClientsPtr oc;
|
|
|
|
GrabPtr passive;
|
2007-11-13 07:28:23 +01:00
|
|
|
GrabPtr grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Deactivate any grabs performed on this window, before making any
|
|
|
|
input focus changes. */
|
2007-05-14 05:04:53 +02:00
|
|
|
grab = mouse->deviceGrab.grab;
|
2007-03-08 07:47:23 +01:00
|
|
|
if (grab &&
|
|
|
|
((grab->window == pWin) || (grab->confineTo == pWin)))
|
2007-05-14 05:04:53 +02:00
|
|
|
(*mouse->deviceGrab.DeactivateGrab)(mouse);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
|
2007-04-03 11:32:14 +02:00
|
|
|
/* Deactivating a keyboard grab should cause focus events. */
|
2007-05-14 05:04:53 +02:00
|
|
|
grab = keybd->deviceGrab.grab;
|
2007-03-08 07:47:23 +01:00
|
|
|
if (grab && (grab->window == pWin))
|
2007-05-14 05:04:53 +02:00
|
|
|
(*keybd->deviceGrab.DeactivateGrab)(keybd);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-04-03 11:32:14 +02:00
|
|
|
/* And now the real devices */
|
|
|
|
for (mouse = inputInfo.devices; mouse; mouse = mouse->next)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
grab = mouse->deviceGrab.grab;
|
2007-04-03 11:32:14 +02:00
|
|
|
if (grab && ((grab->window == pWin) || (grab->confineTo == pWin)))
|
2007-05-14 05:04:53 +02:00
|
|
|
(*mouse->deviceGrab.DeactivateGrab)(mouse);
|
2007-04-03 11:32:14 +02:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
|
2007-04-03 11:32:14 +02:00
|
|
|
for (keybd = inputInfo.devices; keybd; keybd = keybd->next)
|
|
|
|
{
|
|
|
|
if (IsKeyboardDevice(keybd))
|
|
|
|
{
|
|
|
|
focus = keybd->focus;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-11-13 07:28:23 +01:00
|
|
|
/* If the focus window is a root window (ie. has no parent) then don't
|
2007-04-03 11:32:14 +02:00
|
|
|
delete the focus from it. */
|
|
|
|
|
|
|
|
if ((pWin == focus->win) && (pWin->parent != NullWindow))
|
|
|
|
{
|
|
|
|
int focusEventMode = NotifyNormal;
|
|
|
|
|
|
|
|
/* If a grab is in progress, then alter the mode of focus events. */
|
|
|
|
|
2007-05-14 05:04:53 +02:00
|
|
|
if (keybd->deviceGrab.grab)
|
2007-04-03 11:32:14 +02:00
|
|
|
focusEventMode = NotifyWhileGrabbed;
|
|
|
|
|
|
|
|
switch (focus->revert)
|
|
|
|
{
|
|
|
|
case RevertToNone:
|
|
|
|
DoFocusEvents(keybd, pWin, NoneWin, focusEventMode);
|
|
|
|
focus->win = NoneWin;
|
|
|
|
focus->traceGood = 0;
|
|
|
|
break;
|
|
|
|
case RevertToParent:
|
|
|
|
parent = pWin;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
parent = parent->parent;
|
|
|
|
focus->traceGood--;
|
|
|
|
} while (!parent->realized
|
|
|
|
/* This would be a good protocol change -- windows being reparented
|
|
|
|
during SaveSet processing would cause the focus to revert to the
|
|
|
|
nearest enclosing window which will survive the death of the exiting
|
|
|
|
client, instead of ending up reverting to a dying window and thence
|
|
|
|
to None
|
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
#ifdef NOTDEF
|
2009-05-20 01:36:03 +02:00
|
|
|
|| wClient(parent)->clientGone
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
2007-04-03 11:32:14 +02:00
|
|
|
);
|
2009-05-27 07:47:12 +02:00
|
|
|
if (!ActivateFocusInGrab(keybd, pWin, parent))
|
2009-05-26 06:42:25 +02:00
|
|
|
DoFocusEvents(keybd, pWin, parent, focusEventMode);
|
2007-04-03 11:32:14 +02:00
|
|
|
focus->win = parent;
|
|
|
|
focus->revert = RevertToNone;
|
|
|
|
break;
|
|
|
|
case RevertToPointerRoot:
|
2009-05-27 07:47:12 +02:00
|
|
|
if (!ActivateFocusInGrab(keybd, pWin, PointerRootWin))
|
2009-05-26 06:42:25 +02:00
|
|
|
DoFocusEvents(keybd, pWin, PointerRootWin, focusEventMode);
|
2007-04-03 11:32:14 +02:00
|
|
|
focus->win = PointerRootWin;
|
|
|
|
focus->traceGood = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-04-03 11:32:14 +02:00
|
|
|
if (IsPointerDevice(keybd))
|
|
|
|
{
|
|
|
|
if (keybd->valuator->motionHintWindow == pWin)
|
|
|
|
keybd->valuator->motionHintWindow = NullWindow;
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (freeResources)
|
|
|
|
{
|
|
|
|
if (pWin->dontPropagate)
|
|
|
|
DontPropagateRefCnts[pWin->dontPropagate]--;
|
|
|
|
while ( (oc = wOtherClients(pWin)) )
|
|
|
|
FreeResource(oc->resource, RT_NONE);
|
|
|
|
while ( (passive = wPassiveGrabs(pWin)) )
|
|
|
|
FreeResource(passive->resource, RT_NONE);
|
|
|
|
}
|
2007-12-04 07:21:52 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
DeleteWindowFromAnyExtEvents(pWin, freeResources);
|
|
|
|
}
|
|
|
|
|
2005-03-08 00:02:59 +01:00
|
|
|
/**
|
2007-04-13 05:38:44 +02:00
|
|
|
* Call this whenever some window at or below pWin has changed geometry. If
|
|
|
|
* there is a grab on the window, the cursor will be re-confined into the
|
|
|
|
* window.
|
2005-03-08 00:02:59 +01:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
CheckCursorConfinement(WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-11 08:39:59 +01:00
|
|
|
GrabPtr grab;
|
2003-11-14 16:54:54 +01:00
|
|
|
WindowPtr confineTo;
|
2006-12-11 08:39:59 +01:00
|
|
|
DeviceIntPtr pDev;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum) return;
|
|
|
|
#endif
|
|
|
|
|
2006-12-11 08:39:59 +01:00
|
|
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-12-18 06:03:54 +01:00
|
|
|
if (DevHasCursor(pDev))
|
2006-12-11 08:39:59 +01:00
|
|
|
{
|
2007-05-14 05:04:53 +02:00
|
|
|
grab = pDev->deviceGrab.grab;
|
2006-12-14 01:20:18 +01:00
|
|
|
if (grab && (confineTo = grab->confineTo))
|
|
|
|
{
|
|
|
|
if (!BorderSizeNotEmpty(pDev, confineTo))
|
2009-03-13 06:49:22 +01:00
|
|
|
(*pDev->deviceGrab.DeactivateGrab)(pDev);
|
2006-12-14 01:20:18 +01:00
|
|
|
else if ((pWin == confineTo) || IsParent(pWin, confineTo))
|
|
|
|
ConfineCursorToWindow(pDev, confineTo, TRUE, TRUE);
|
|
|
|
}
|
2006-12-11 08:39:59 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Mask
|
2005-03-08 00:02:59 +01:00
|
|
|
EventMaskForClient(WindowPtr pWin, ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
OtherClientsPtr other;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (wClient (pWin) == client)
|
|
|
|
return pWin->eventMask;
|
|
|
|
for (other = wOtherClients(pWin); other; other = other->next)
|
|
|
|
{
|
|
|
|
if (SameClient(other, client))
|
|
|
|
return other->mask;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Server-side protocol handling for RecolorCursor request.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
ProcRecolorCursor(ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
CursorPtr pCursor;
|
2007-08-15 20:13:53 +02:00
|
|
|
int rc, nscr;
|
2003-11-14 16:54:54 +01:00
|
|
|
ScreenPtr pscr;
|
2007-11-13 07:28:23 +01:00
|
|
|
Bool displayed;
|
2007-03-25 07:30:03 +02:00
|
|
|
SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST(xRecolorCursorReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xRecolorCursorReq);
|
2008-08-07 00:26:24 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
|
2007-08-15 20:13:53 +02:00
|
|
|
client, DixWriteAccess);
|
|
|
|
if (rc != Success)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
client->errorValue = stuff->cursor;
|
2010-04-25 08:26:40 +02:00
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pCursor->foreRed = stuff->foreRed;
|
|
|
|
pCursor->foreGreen = stuff->foreGreen;
|
|
|
|
pCursor->foreBlue = stuff->foreBlue;
|
|
|
|
|
|
|
|
pCursor->backRed = stuff->backRed;
|
|
|
|
pCursor->backGreen = stuff->backGreen;
|
|
|
|
pCursor->backBlue = stuff->backBlue;
|
|
|
|
|
|
|
|
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
|
|
|
|
{
|
|
|
|
pscr = screenInfo.screens[nscr];
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
if(!noPanoramiXExtension)
|
2006-12-11 08:39:59 +01:00
|
|
|
displayed = (pscr == pSprite->screen);
|
2003-11-14 17:49:22 +01:00
|
|
|
else
|
|
|
|
#endif
|
2006-12-11 08:39:59 +01:00
|
|
|
displayed = (pscr == pSprite->hotPhys.pScreen);
|
2007-03-02 05:51:46 +01:00
|
|
|
( *pscr->RecolorCursor)(PickPointer(client), pscr, pCursor,
|
2006-12-11 08:39:59 +01:00
|
|
|
(pCursor == pSprite->current) && displayed);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-06-06 16:18:40 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2007-04-13 05:38:44 +02:00
|
|
|
/**
|
|
|
|
* Write the given events to a client, swapping the byte order if necessary.
|
|
|
|
* To swap the byte ordering, a callback is called that has to be set up for
|
|
|
|
* the given event type.
|
|
|
|
*
|
|
|
|
* In the case of DeviceMotionNotify trailed by DeviceValuators, the events
|
2007-11-13 07:28:23 +01:00
|
|
|
* can be more than one. Usually it's just one event.
|
2007-04-13 05:38:44 +02:00
|
|
|
*
|
|
|
|
* Do not modify the event structure passed in. See comment below.
|
2007-11-13 07:28:23 +01:00
|
|
|
*
|
2007-04-13 05:38:44 +02:00
|
|
|
* @param pClient Client to send events to.
|
|
|
|
* @param count Number of events.
|
|
|
|
* @param events The event list.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
xEvent eventCopy;
|
|
|
|
#endif
|
2007-04-30 05:27:42 +02:00
|
|
|
xEvent *eventTo, *eventFrom;
|
|
|
|
int i,
|
|
|
|
eventlength = sizeof(xEvent);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-15 21:31:34 +02:00
|
|
|
if (!pClient || pClient == serverClient || pClient->clientGone)
|
|
|
|
return;
|
|
|
|
|
2010-05-15 22:12:44 +02:00
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
if ((events[i].u.u.type & 0x7f) != KeymapNotify)
|
|
|
|
events[i].u.u.sequenceNumber = pClient->sequence;
|
|
|
|
|
2009-08-21 08:03:36 +02:00
|
|
|
/* Let XKB rewrite the state, as it depends on client preferences. */
|
|
|
|
XkbFilterEvents(pClient, count, events);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#ifdef PANORAMIX
|
2007-11-13 07:28:23 +01:00
|
|
|
if(!noPanoramiXExtension &&
|
2010-05-23 19:11:47 +02:00
|
|
|
(screenInfo.screens[0]->x || screenInfo.screens[0]->y))
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
switch(events->u.u.type) {
|
|
|
|
case MotionNotify:
|
|
|
|
case ButtonPress:
|
|
|
|
case ButtonRelease:
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
case EnterNotify:
|
|
|
|
case LeaveNotify:
|
2007-11-13 07:28:23 +01:00
|
|
|
/*
|
2003-11-14 17:49:22 +01:00
|
|
|
When multiple clients want the same event DeliverEventsToWindow
|
2007-11-13 07:28:23 +01:00
|
|
|
passes the same event structure multiple times so we can't
|
|
|
|
modify the one passed to us
|
2003-11-14 17:49:22 +01:00
|
|
|
*/
|
|
|
|
count = 1; /* should always be 1 */
|
|
|
|
memcpy(&eventCopy, events, sizeof(xEvent));
|
2010-05-23 19:11:47 +02:00
|
|
|
eventCopy.u.keyButtonPointer.rootX += screenInfo.screens[0]->x;
|
|
|
|
eventCopy.u.keyButtonPointer.rootY += screenInfo.screens[0]->y;
|
2007-11-13 07:28:23 +01:00
|
|
|
if(eventCopy.u.keyButtonPointer.event ==
|
|
|
|
eventCopy.u.keyButtonPointer.root)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2010-05-23 19:11:47 +02:00
|
|
|
eventCopy.u.keyButtonPointer.eventX += screenInfo.screens[0]->x;
|
|
|
|
eventCopy.u.keyButtonPointer.eventY += screenInfo.screens[0]->y;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
events = &eventCopy;
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
if (EventCallback)
|
|
|
|
{
|
|
|
|
EventInfoRec eventinfo;
|
|
|
|
eventinfo.client = pClient;
|
|
|
|
eventinfo.events = events;
|
|
|
|
eventinfo.count = count;
|
|
|
|
CallCallbacks(&EventCallback, (pointer)&eventinfo);
|
|
|
|
}
|
2006-11-03 21:54:43 +01:00
|
|
|
#ifdef XSERVER_DTRACE
|
|
|
|
if (XSERVER_SEND_EVENT_ENABLED()) {
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
XSERVER_SEND_EVENT(pClient->index, events[i].u.u.type, &events[i]);
|
|
|
|
}
|
|
|
|
}
|
2007-11-13 07:28:23 +01:00
|
|
|
#endif
|
2007-04-30 05:27:42 +02:00
|
|
|
/* Just a safety check to make sure we only have one GenericEvent, it just
|
|
|
|
* makes things easier for me right now. (whot) */
|
|
|
|
for (i = 1; i < count; i++)
|
|
|
|
{
|
|
|
|
if (events[i].u.u.type == GenericEvent)
|
|
|
|
{
|
2007-09-26 07:49:53 +02:00
|
|
|
ErrorF("[dix] TryClientEvents: Only one GenericEvent at a time.\n");
|
2007-11-13 07:28:23 +01:00
|
|
|
return;
|
2007-04-30 05:27:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (events->u.u.type == GenericEvent)
|
|
|
|
{
|
|
|
|
eventlength += ((xGenericEvent*)events)->length * 4;
|
2008-06-18 01:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(pClient->swapped)
|
|
|
|
{
|
2007-04-30 05:27:42 +02:00
|
|
|
if (eventlength > swapEventLen)
|
|
|
|
{
|
|
|
|
swapEventLen = eventlength;
|
2010-05-05 20:44:06 +02:00
|
|
|
swapEvent = realloc(swapEvent, swapEventLen);
|
2007-04-30 05:27:42 +02:00
|
|
|
if (!swapEvent)
|
|
|
|
{
|
|
|
|
FatalError("WriteEventsToClient: Out of memory.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
for(i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
eventFrom = &events[i];
|
2007-04-30 05:27:42 +02:00
|
|
|
eventTo = swapEvent;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* Remember to strip off the leading bit of type in case
|
|
|
|
this event was sent with "SendEvent." */
|
|
|
|
(*EventSwapVector[eventFrom->u.u.type & 0177])
|
2007-04-30 05:27:42 +02:00
|
|
|
(eventFrom, eventTo);
|
|
|
|
|
2009-03-05 06:22:41 +01:00
|
|
|
WriteToClient(pClient, eventlength, (char *)eventTo);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-04-30 05:27:42 +02:00
|
|
|
/* only one GenericEvent, remember? that means either count is 1 and
|
|
|
|
* eventlength is arbitrary or eventlength is 32 and count doesn't
|
|
|
|
* matter. And we're all set. Woohoo. */
|
2009-03-05 06:22:41 +01:00
|
|
|
WriteToClient(pClient, count * eventlength, (char *) events);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
2007-03-02 05:51:46 +01:00
|
|
|
|
2007-03-09 06:15:25 +01:00
|
|
|
/*
|
2009-06-11 08:26:23 +02:00
|
|
|
* Set the client pointer for the given client.
|
2007-05-30 10:14:31 +02:00
|
|
|
*
|
|
|
|
* A client can have exactly one ClientPointer. Each time a
|
|
|
|
* request/reply/event is processed and the choice of devices is ambiguous
|
|
|
|
* (e.g. QueryPointer request), the server will pick the ClientPointer (see
|
2007-11-13 07:28:23 +01:00
|
|
|
* PickPointer()).
|
2007-05-30 10:14:31 +02:00
|
|
|
* If a keyboard is needed, the first keyboard paired with the CP is used.
|
2007-03-09 06:15:25 +01:00
|
|
|
*/
|
2009-06-19 03:41:17 +02:00
|
|
|
int
|
2009-06-11 08:26:23 +02:00
|
|
|
SetClientPointer(ClientPtr client, DeviceIntPtr device)
|
2007-03-09 06:15:25 +01:00
|
|
|
{
|
2009-06-19 03:41:17 +02:00
|
|
|
int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
|
2009-05-20 07:28:16 +02:00
|
|
|
if (!IsMaster(device))
|
2007-10-14 00:27:24 +02:00
|
|
|
{
|
|
|
|
ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n");
|
2009-06-19 03:41:17 +02:00
|
|
|
return BadDevice;
|
2007-10-14 00:27:24 +02:00
|
|
|
} else if (!device->spriteInfo->spriteOwner)
|
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
ErrorF("[dix] Device %d does not have a sprite. "
|
2007-10-14 00:27:24 +02:00
|
|
|
"Cannot be ClientPointer\n", device->id);
|
2009-06-19 03:41:17 +02:00
|
|
|
return BadDevice;
|
2007-10-14 00:27:24 +02:00
|
|
|
}
|
2007-03-09 06:15:25 +01:00
|
|
|
client->clientPtr = device;
|
2009-06-19 03:41:17 +02:00
|
|
|
return Success;
|
2007-03-09 06:15:25 +01:00
|
|
|
}
|
|
|
|
|
2008-04-25 07:32:13 +02:00
|
|
|
/* PickPointer will pick an appropriate pointer for the given client.
|
|
|
|
*
|
|
|
|
* An "appropriate device" is (in order of priority):
|
|
|
|
* 1) A device the given client has a core grab on.
|
|
|
|
* 2) A device set as ClientPointer for the given client.
|
|
|
|
* 3) The first master device.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
DeviceIntPtr
|
2007-03-02 05:51:46 +01:00
|
|
|
PickPointer(ClientPtr client)
|
|
|
|
{
|
2008-04-25 07:32:13 +02:00
|
|
|
DeviceIntPtr it = inputInfo.devices;
|
|
|
|
|
|
|
|
/* First, check if the client currently has a grab on a device. Even
|
|
|
|
* keyboards count. */
|
|
|
|
for(it = inputInfo.devices; it; it = it->next)
|
|
|
|
{
|
|
|
|
GrabPtr grab = it->deviceGrab.grab;
|
2011-12-08 05:27:01 +01:00
|
|
|
if (grab && grab->grabtype == CORE && SameClient(grab, client))
|
2008-04-25 07:32:13 +02:00
|
|
|
{
|
2009-06-03 04:18:17 +02:00
|
|
|
it = GetMaster(it, MASTER_POINTER);
|
2008-04-25 07:32:13 +02:00
|
|
|
return it; /* Always return a core grabbed device */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-02 05:51:46 +01:00
|
|
|
if (!client->clientPtr)
|
|
|
|
{
|
2011-05-15 01:23:59 +02:00
|
|
|
it = inputInfo.devices;
|
2007-03-02 05:51:46 +01:00
|
|
|
while (it)
|
|
|
|
{
|
2009-05-20 07:28:16 +02:00
|
|
|
if (IsMaster(it) && it->spriteInfo->spriteOwner)
|
2007-03-02 05:51:46 +01:00
|
|
|
{
|
|
|
|
client->clientPtr = it;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
it = it->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return client->clientPtr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PickKeyboard will pick an appropriate keyboard for the given client by
|
|
|
|
* searching the list of devices for the keyboard device that is paired with
|
|
|
|
* the client's pointer.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
DeviceIntPtr
|
2007-03-02 05:51:46 +01:00
|
|
|
PickKeyboard(ClientPtr client)
|
|
|
|
{
|
2007-03-13 09:46:56 +01:00
|
|
|
DeviceIntPtr ptr = PickPointer(client);
|
2009-06-03 04:18:17 +02:00
|
|
|
DeviceIntPtr kbd = GetMaster(ptr, MASTER_KEYBOARD);
|
2007-03-02 05:51:46 +01:00
|
|
|
|
2007-10-14 00:30:06 +02:00
|
|
|
if (!kbd)
|
2007-03-16 06:22:24 +01:00
|
|
|
{
|
2007-11-13 07:28:23 +01:00
|
|
|
ErrorF("[dix] ClientPointer not paired with a keyboard. This "
|
2007-10-14 00:30:06 +02:00
|
|
|
"is a bug.\n");
|
2007-03-16 06:22:24 +01:00
|
|
|
}
|
2007-03-02 05:51:46 +01:00
|
|
|
|
2007-10-14 00:30:06 +02:00
|
|
|
return kbd;
|
2007-03-02 05:51:46 +01:00
|
|
|
}
|
|
|
|
|
2007-03-09 07:43:05 +01:00
|
|
|
/* A client that has one or more core grabs does not get core events from
|
|
|
|
* devices it does not have a grab on. Legacy applications behave bad
|
|
|
|
* otherwise because they are not used to it and the events interfere.
|
|
|
|
* Only applies for core events.
|
|
|
|
*
|
|
|
|
* Return true if a core event from the device would interfere and should not
|
|
|
|
* be delivered.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2007-05-15 02:54:22 +02:00
|
|
|
IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
|
2007-03-09 07:43:05 +01:00
|
|
|
{
|
2007-05-15 02:54:22 +02:00
|
|
|
DeviceIntPtr it = inputInfo.devices;
|
2007-03-09 07:43:05 +01:00
|
|
|
|
|
|
|
switch(event->u.u.type)
|
|
|
|
{
|
|
|
|
case KeyPress:
|
|
|
|
case KeyRelease:
|
|
|
|
case ButtonPress:
|
|
|
|
case ButtonRelease:
|
|
|
|
case MotionNotify:
|
|
|
|
case EnterNotify:
|
|
|
|
case LeaveNotify:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-12 07:07:15 +01:00
|
|
|
if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
|
|
|
|
return FALSE;
|
|
|
|
|
2007-03-09 07:43:05 +01:00
|
|
|
while(it)
|
|
|
|
{
|
|
|
|
if (it != dev)
|
|
|
|
{
|
2007-05-31 09:35:14 +02:00
|
|
|
if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client)
|
|
|
|
&& !it->deviceGrab.fromPassiveGrab)
|
2007-03-09 07:43:05 +01:00
|
|
|
{
|
2007-10-24 02:56:12 +02:00
|
|
|
if ((IsPointerDevice(it) && IsPointerDevice(dev)) ||
|
|
|
|
(IsKeyboardDevice(it) && IsKeyboardDevice(dev)))
|
|
|
|
return TRUE;
|
2007-03-09 07:43:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
it = it->next;
|
|
|
|
}
|
|
|
|
|
2007-05-15 02:54:22 +02:00
|
|
|
return FALSE;
|
2007-03-09 07:43:05 +01:00
|
|
|
}
|
2009-02-13 07:42:02 +01:00
|
|
|
|