Merge remote branch 'whot/for-keith'
This commit is contained in:
commit
6c90e839d9
|
@ -94,12 +94,6 @@ if XCSECURITY
|
||||||
BUILTIN_SRCS += $(XCSECURITY_SRCS)
|
BUILTIN_SRCS += $(XCSECURITY_SRCS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
XCALIBRATE_SRCS = xcalibrate.c
|
|
||||||
if XCALIBRATE
|
|
||||||
BUILTIN_SRCS += $(XCALIBRATE_SRCS)
|
|
||||||
# XCalibrate needs tslib
|
|
||||||
endif
|
|
||||||
|
|
||||||
# XF86 Big Font extension
|
# XF86 Big Font extension
|
||||||
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
|
BIGFONT_SRCS = xf86bigfont.c xf86bigfontsrv.h
|
||||||
if XF86BIGFONT
|
if XF86BIGFONT
|
||||||
|
@ -132,7 +126,6 @@ EXTRA_DIST = \
|
||||||
$(XACE_SRCS) \
|
$(XACE_SRCS) \
|
||||||
$(XCSECURITY_SRCS) \
|
$(XCSECURITY_SRCS) \
|
||||||
$(XSELINUX_SRCS) \
|
$(XSELINUX_SRCS) \
|
||||||
$(XCALIBRATE_SRCS) \
|
|
||||||
$(XINERAMA_SRCS) \
|
$(XINERAMA_SRCS) \
|
||||||
$(BIGFONT_SRCS) \
|
$(BIGFONT_SRCS) \
|
||||||
$(DPMS_SRCS) \
|
$(DPMS_SRCS) \
|
||||||
|
|
|
@ -1,297 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2003 Philip Blundell
|
|
||||||
*
|
|
||||||
* 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, and that the name of Philip Blundell not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Philip Blundell makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* PHILIP BLUNDELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL PHILIP BLUNDELL 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_KDRIVE_CONFIG_H
|
|
||||||
#include <kdrive-config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <X11/X.h>
|
|
||||||
#include <X11/Xproto.h>
|
|
||||||
#include "misc.h"
|
|
||||||
#include "os.h"
|
|
||||||
#include "dixstruct.h"
|
|
||||||
#include "extnsionst.h"
|
|
||||||
#include "swaprep.h"
|
|
||||||
#include "protocol-versions.h"
|
|
||||||
|
|
||||||
#include <X11/extensions/xcalibrateproto.h>
|
|
||||||
#include <X11/extensions/xcalibratewire.h>
|
|
||||||
|
|
||||||
extern void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure);
|
|
||||||
extern void *tslib_raw_event_closure;
|
|
||||||
|
|
||||||
static CARD8 XCalibrateReqCode;
|
|
||||||
int XCalibrateEventBase;
|
|
||||||
int XCalibrateReqBase;
|
|
||||||
int XCalibrateErrorBase;
|
|
||||||
|
|
||||||
static ClientPtr xcalibrate_client;
|
|
||||||
|
|
||||||
static void
|
|
||||||
xcalibrate_event_hook (int x, int y, int pressure, void *closure)
|
|
||||||
{
|
|
||||||
ClientPtr pClient = (ClientPtr) closure;
|
|
||||||
xXCalibrateRawTouchscreenEvent ev;
|
|
||||||
|
|
||||||
ev.type = XCalibrateEventBase + X_XCalibrateRawTouchscreen;
|
|
||||||
ev.x = x;
|
|
||||||
ev.y = y;
|
|
||||||
ev.pressure = pressure;
|
|
||||||
|
|
||||||
WriteEventsToClient (pClient, 1, (xEvent *) &ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ProcXCalibrateQueryVersion (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXCalibrateQueryVersionReq);
|
|
||||||
xXCalibrateQueryVersionReply rep;
|
|
||||||
CARD16 client_major, client_minor; /* not used */
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXCalibrateQueryVersionReq);
|
|
||||||
|
|
||||||
client_major = stuff->majorVersion;
|
|
||||||
client_minor = stuff->minorVersion;
|
|
||||||
|
|
||||||
fprintf(stderr, "%s(): called\n", __func__);
|
|
||||||
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.length = 0;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
rep.majorVersion = SERVER_XCALIBRATE_MAJOR_VERSION;
|
|
||||||
rep.minorVersion = SERVER_XCALIBRATE_MINOR_VERSION;
|
|
||||||
if (client->swapped) {
|
|
||||||
int n;
|
|
||||||
swaps(&rep.sequenceNumber, n);
|
|
||||||
swapl(&rep.length, n);
|
|
||||||
swaps(&rep.majorVersion, n);
|
|
||||||
swaps(&rep.minorVersion, n);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof (xXCalibrateQueryVersionReply), (char *)&rep);
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
SProcXCalibrateQueryVersion (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXCalibrateQueryVersionReq);
|
|
||||||
int n;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXCalibrateQueryVersionReq);
|
|
||||||
swaps(&stuff->majorVersion,n);
|
|
||||||
swaps(&stuff->minorVersion,n);
|
|
||||||
return ProcXCalibrateQueryVersion(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ProcXCalibrateSetRawMode (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXCalibrateRawModeReq);
|
|
||||||
xXCalibrateRawModeReply rep;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXCalibrateRawModeReq);
|
|
||||||
|
|
||||||
memset (&rep, 0, sizeof (rep));
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
|
|
||||||
if (stuff->on)
|
|
||||||
{
|
|
||||||
if (xcalibrate_client == NULL)
|
|
||||||
{
|
|
||||||
/* Start calibrating. */
|
|
||||||
xcalibrate_client = client;
|
|
||||||
tslib_raw_event_hook = xcalibrate_event_hook;
|
|
||||||
tslib_raw_event_closure = client;
|
|
||||||
rep.status = GrabSuccess;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rep.status = AlreadyGrabbed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xcalibrate_client == client)
|
|
||||||
{
|
|
||||||
/* Stop calibrating. */
|
|
||||||
xcalibrate_client = NULL;
|
|
||||||
tslib_raw_event_hook = NULL;
|
|
||||||
tslib_raw_event_closure = NULL;
|
|
||||||
rep.status = GrabSuccess;
|
|
||||||
|
|
||||||
/* Cycle input off and on to reload configuration. */
|
|
||||||
KdDisableInput ();
|
|
||||||
KdEnableInput ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rep.status = AlreadyGrabbed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (client->swapped)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
swaps (&rep.sequenceNumber, n);
|
|
||||||
swaps (&rep.status, n);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof (rep), (char *) &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
SProcXCalibrateSetRawMode (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXCalibrateRawModeReq);
|
|
||||||
int n;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXCalibrateRawModeReq);
|
|
||||||
|
|
||||||
swaps(&stuff->on, n);
|
|
||||||
|
|
||||||
return ProcXCalibrateSetRawMode(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ProcXCalibrateScreenToCoord (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXCalibrateScreenToCoordReq);
|
|
||||||
xXCalibrateScreenToCoordReply rep;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
|
|
||||||
|
|
||||||
memset (&rep, 0, sizeof (rep));
|
|
||||||
rep.type = X_Reply;
|
|
||||||
rep.sequenceNumber = client->sequence;
|
|
||||||
rep.x = stuff->x;
|
|
||||||
rep.y = stuff->y;
|
|
||||||
|
|
||||||
KdScreenToPointerCoords(&rep.x, &rep.y);
|
|
||||||
|
|
||||||
if (client->swapped)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
swaps (&rep.x, n);
|
|
||||||
swaps (&rep.y, n);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof (rep), (char *) &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
SProcXCalibrateScreenToCoord (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xXCalibrateScreenToCoordReq);
|
|
||||||
int n;
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xXCalibrateScreenToCoordReq);
|
|
||||||
|
|
||||||
swaps(&stuff->x, n);
|
|
||||||
swaps(&stuff->y, n);
|
|
||||||
|
|
||||||
return ProcXCalibrateScreenToCoord(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ProcXCalibrateDispatch (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_XCalibrateQueryVersion:
|
|
||||||
return ProcXCalibrateQueryVersion(client);
|
|
||||||
case X_XCalibrateRawMode:
|
|
||||||
return ProcXCalibrateSetRawMode(client);
|
|
||||||
case X_XCalibrateScreenToCoord:
|
|
||||||
return ProcXCalibrateScreenToCoord(client);
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
SProcXCalibrateDispatch (ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
int n;
|
|
||||||
|
|
||||||
swaps(&stuff->length,n);
|
|
||||||
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_XCalibrateQueryVersion:
|
|
||||||
return SProcXCalibrateQueryVersion(client);
|
|
||||||
case X_XCalibrateRawMode:
|
|
||||||
return SProcXCalibrateSetRawMode(client);
|
|
||||||
case X_XCalibrateScreenToCoord:
|
|
||||||
return SProcXCalibrateScreenToCoord(client);
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
XCalibrateClientCallback (CallbackListPtr *list,
|
|
||||||
pointer closure,
|
|
||||||
pointer data)
|
|
||||||
{
|
|
||||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
|
||||||
ClientPtr pClient = clientinfo->client;
|
|
||||||
|
|
||||||
if (clientinfo->setup == NULL
|
|
||||||
&& xcalibrate_client != NULL
|
|
||||||
&& xcalibrate_client == pClient)
|
|
||||||
{
|
|
||||||
/* Stop calibrating. */
|
|
||||||
xcalibrate_client = NULL;
|
|
||||||
tslib_raw_event_hook = NULL;
|
|
||||||
tslib_raw_event_closure = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
XCalibrateExtensionInit(void)
|
|
||||||
{
|
|
||||||
ExtensionEntry *extEntry;
|
|
||||||
|
|
||||||
if (!AddCallback (&ClientStateCallback, XCalibrateClientCallback, 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
extEntry = AddExtension(XCALIBRATE_NAME, XCalibrateNumberEvents, XCalibrateNumberErrors,
|
|
||||||
ProcXCalibrateDispatch, SProcXCalibrateDispatch,
|
|
||||||
NULL, StandardMinorOpcode);
|
|
||||||
|
|
||||||
if (!extEntry)
|
|
||||||
return;
|
|
||||||
|
|
||||||
XCalibrateReqCode = (unsigned char)extEntry->base;
|
|
||||||
XCalibrateEventBase = extEntry->eventBase;
|
|
||||||
XCalibrateErrorBase = extEntry->errorBase;
|
|
||||||
|
|
||||||
xcalibrate_client = 0;
|
|
||||||
}
|
|
|
@ -710,10 +710,13 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return; /* Device has disappeared */
|
return; /* Device has disappeared */
|
||||||
|
|
||||||
if (!slave->u.master)
|
if (IsMaster(slave))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (IsFloating(slave))
|
||||||
return; /* set floating since the event */
|
return; /* set floating since the event */
|
||||||
|
|
||||||
if (slave->u.master->id != dce->masterid)
|
if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
|
||||||
return; /* not our slave anymore, don't care */
|
return; /* not our slave anymore, don't care */
|
||||||
|
|
||||||
/* FIXME: we probably need to send a DCE for the new slave now */
|
/* FIXME: we probably need to send a DCE for the new slave now */
|
||||||
|
@ -866,7 +869,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
|
||||||
* event being delivered through the slave first
|
* event being delivered through the slave first
|
||||||
*/
|
*/
|
||||||
for (sd = inputInfo.devices; sd; sd = sd->next) {
|
for (sd = inputInfo.devices; sd; sd = sd->next) {
|
||||||
if (IsMaster(sd) || sd->u.master != device)
|
if (IsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
|
||||||
continue;
|
continue;
|
||||||
if (!sd->button)
|
if (!sd->button)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1006,7 +1009,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
|
||||||
b = device->button;
|
b = device->button;
|
||||||
k = device->key;
|
k = device->key;
|
||||||
|
|
||||||
if (IsMaster(device) || !device->u.master)
|
if (IsMaster(device) || IsFloating(device))
|
||||||
CheckMotion(event, device);
|
CheckMotion(event, device);
|
||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
|
@ -1047,10 +1050,8 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
|
||||||
switch(event->type)
|
switch(event->type)
|
||||||
{
|
{
|
||||||
case ET_KeyPress:
|
case ET_KeyPress:
|
||||||
if (!grab && CheckDeviceGrabs(device, event, 0)) {
|
if (!grab && CheckDeviceGrabs(device, event, 0))
|
||||||
device->deviceGrab.activatingKey = key;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ET_KeyRelease:
|
case ET_KeyRelease:
|
||||||
if (grab && device->deviceGrab.fromPassiveGrab &&
|
if (grab && device->deviceGrab.fromPassiveGrab &&
|
||||||
|
@ -1223,7 +1224,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
|
||||||
DeviceIntPtr mouse;
|
DeviceIntPtr mouse;
|
||||||
int btlen, len, i;
|
int btlen, len, i;
|
||||||
|
|
||||||
mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, MASTER_POINTER) : dev;
|
mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER);
|
||||||
|
|
||||||
/* XI 2 event */
|
/* XI 2 event */
|
||||||
btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
|
btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
|
||||||
|
@ -1280,7 +1281,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
|
||||||
DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1,
|
DeliverEventsToWindow(dev, pWin, (xEvent *) & event, 1,
|
||||||
DeviceFocusChangeMask, NullGrab);
|
DeviceFocusChangeMask, NullGrab);
|
||||||
|
|
||||||
if ((type == DeviceFocusIn) &&
|
if ((event.type == DeviceFocusIn) &&
|
||||||
(wOtherInputMasks(pWin)) &&
|
(wOtherInputMasks(pWin)) &&
|
||||||
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
|
(wOtherInputMasks(pWin)->inputEvents[dev->id] & DeviceStateNotifyMask))
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
|
|
||||||
ev = calloc(1, sizeof(xXIHierarchyEvent) +
|
ev = calloc(1, sizeof(xXIHierarchyEvent) +
|
||||||
MAXDEVICES * sizeof(xXIHierarchyInfo));
|
MAXDEVICES * sizeof(xXIHierarchyInfo));
|
||||||
|
if (!ev)
|
||||||
|
return;
|
||||||
ev->type = GenericEvent;
|
ev->type = GenericEvent;
|
||||||
ev->extension = IReqCode;
|
ev->extension = IReqCode;
|
||||||
ev->evtype = XI_HierarchyChanged;
|
ev->evtype = XI_HierarchyChanged;
|
||||||
|
@ -282,12 +284,12 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
||||||
for (attached = inputInfo.devices; attached; attached = attached->next)
|
for (attached = inputInfo.devices; attached; attached = attached->next)
|
||||||
{
|
{
|
||||||
if (!IsMaster(attached)) {
|
if (!IsMaster(attached)) {
|
||||||
if (attached->u.master == ptr)
|
if (GetMaster(attached, MASTER_ATTACHED) == ptr)
|
||||||
{
|
{
|
||||||
AttachDevice(client, attached, newptr);
|
AttachDevice(client, attached, newptr);
|
||||||
flags[attached->id] |= XISlaveAttached;
|
flags[attached->id] |= XISlaveAttached;
|
||||||
}
|
}
|
||||||
if (attached->u.master == keybd)
|
if (GetMaster(attached, MASTER_ATTACHED) == keybd)
|
||||||
{
|
{
|
||||||
AttachDevice(client, attached, newkeybd);
|
AttachDevice(client, attached, newkeybd);
|
||||||
flags[attached->id] |= XISlaveAttached;
|
flags[attached->id] |= XISlaveAttached;
|
||||||
|
|
|
@ -162,10 +162,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
if (!modifiers_failed)
|
if (!modifiers_failed)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (!IsMaster(dev) && dev->u.master)
|
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||||
mod_dev = GetMaster(dev, MASTER_KEYBOARD);
|
|
||||||
else
|
|
||||||
mod_dev = dev;
|
|
||||||
|
|
||||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
|
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
|
||||||
{
|
{
|
||||||
|
@ -280,10 +277,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (!IsMaster(dev) && dev->u.master)
|
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||||
mod_dev = GetMaster(dev, MASTER_KEYBOARD);
|
|
||||||
else
|
|
||||||
mod_dev = dev;
|
|
||||||
|
|
||||||
tempGrab.resource = client->clientAsMask;
|
tempGrab.resource = client->clientAsMask;
|
||||||
tempGrab.device = dev;
|
tempGrab.device = dev;
|
||||||
|
|
|
@ -375,7 +375,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
|
||||||
|
|
||||||
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
|
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
|
||||||
{
|
{
|
||||||
DeviceIntPtr master = dev->u.master;
|
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
|
||||||
int use;
|
int use;
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev))
|
||||||
|
@ -383,7 +383,7 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
|
||||||
DeviceIntPtr paired = GetPairedDevice(dev);
|
DeviceIntPtr paired = GetPairedDevice(dev);
|
||||||
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
|
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
|
||||||
*attachment = (paired ? paired->id : 0);
|
*attachment = (paired ? paired->id : 0);
|
||||||
} else if (master)
|
} else if (!IsFloating(dev))
|
||||||
{
|
{
|
||||||
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
|
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
|
||||||
*attachment = master->id;
|
*attachment = master->id;
|
||||||
|
|
|
@ -93,7 +93,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
|
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
|
||||||
(!IsMaster(pDev) && pDev->u.master)) /* no attached devices */
|
(!IsMaster(pDev) && !IsFloating(pDev))) /* no attached devices */
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
|
@ -97,7 +97,7 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!IsMaster(pDev) && pDev->u.master) ||
|
if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
|
||||||
(IsMaster(pDev) && !IsPointerDevice(pDev)))
|
(IsMaster(pDev) && !IsPointerDevice(pDev)))
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
|
|
10
configure.ac
10
configure.ac
|
@ -613,7 +613,6 @@ AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF8
|
||||||
AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
|
AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
|
||||||
AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
|
AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--enable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
|
||||||
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
|
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--enable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
|
||||||
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
|
|
||||||
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
|
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
|
||||||
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
|
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
|
||||||
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
|
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--enable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
|
||||||
|
@ -767,7 +766,6 @@ DRIPROTO="xf86driproto >= 2.1.0"
|
||||||
DRI2PROTO="dri2proto >= 2.3"
|
DRI2PROTO="dri2proto >= 2.3"
|
||||||
XINERAMAPROTO="xineramaproto"
|
XINERAMAPROTO="xineramaproto"
|
||||||
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
|
BIGFONTPROTO="xf86bigfontproto >= 1.2.0"
|
||||||
XCALIBRATEPROTO="xcalibrateproto"
|
|
||||||
DGAPROTO="xf86dgaproto >= 2.0.99.1"
|
DGAPROTO="xf86dgaproto >= 2.0.99.1"
|
||||||
GLPROTO="glproto >= 1.4.10"
|
GLPROTO="glproto >= 1.4.10"
|
||||||
DMXPROTO="dmxproto >= 2.2.99.1"
|
DMXPROTO="dmxproto >= 2.2.99.1"
|
||||||
|
@ -1120,14 +1118,6 @@ if test "x$DPMSExtension" = xyes; then
|
||||||
AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
|
AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
|
|
||||||
AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
|
|
||||||
REQUIRED_MODULES="$REQUIRED_MODULES $XCALIBRATEPROTO"
|
|
||||||
else
|
|
||||||
XCALIBRATE=no
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(XCALIBRATE, [test "x$XCALIBRATE" = xyes])
|
|
||||||
|
|
||||||
AC_DEFINE(RENDER, 1, [Support RENDER extension])
|
AC_DEFINE(RENDER, 1, [Support RENDER extension])
|
||||||
RENDER_LIB='$(top_builddir)/render/librender.la'
|
RENDER_LIB='$(top_builddir)/render/librender.la'
|
||||||
RENDER_INC='-I$(top_srcdir)/render'
|
RENDER_INC='-I$(top_srcdir)/render'
|
||||||
|
|
136
dix/devices.c
136
dix/devices.c
|
@ -446,7 +446,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
{
|
{
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
for (other = inputInfo.devices; other; other = other->next)
|
||||||
{
|
{
|
||||||
if (other->u.master == dev)
|
if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev)
|
||||||
{
|
{
|
||||||
AttachDevice(NULL, other, NULL);
|
AttachDevice(NULL, other, NULL);
|
||||||
flags[other->id] |= XISlaveDetached;
|
flags[other->id] |= XISlaveDetached;
|
||||||
|
@ -457,8 +457,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
{
|
{
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
for (other = inputInfo.devices; other; other = other->next)
|
||||||
{
|
{
|
||||||
if (IsMaster(other) && other->u.lastSlave == dev)
|
if (IsMaster(other) && other->lastSlave == dev)
|
||||||
other->u.lastSlave = NULL;
|
other->lastSlave = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -987,8 +987,8 @@ CloseDownDevices(void)
|
||||||
*/
|
*/
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
if (!IsMaster(dev) && dev->u.master)
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
dev->u.master = NULL;
|
dev->master = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseDeviceList(&inputInfo.devices);
|
CloseDeviceList(&inputInfo.devices);
|
||||||
|
@ -1281,10 +1281,11 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
||||||
|
|
||||||
/* global list of acceleration schemes */
|
/* global list of acceleration schemes */
|
||||||
ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
||||||
{PtrAccelNoOp, NULL, NULL, NULL},
|
{PtrAccelNoOp, NULL, NULL, NULL, NULL},
|
||||||
{PtrAccelPredictable, acceleratePointerPredictable, NULL, AccelerationDefaultCleanup},
|
{PtrAccelPredictable, acceleratePointerPredictable, NULL,
|
||||||
{PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL},
|
InitPredictableAccelerationScheme, AccelerationDefaultCleanup},
|
||||||
{-1, NULL, NULL, NULL} /* terminator */
|
{PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL},
|
||||||
|
{-1, NULL, NULL, NULL, NULL} /* terminator */
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1296,59 +1297,37 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
|
||||||
int scheme)
|
int scheme)
|
||||||
{
|
{
|
||||||
int x, i = -1;
|
int x, i = -1;
|
||||||
void* data = NULL;
|
|
||||||
ValuatorClassPtr val;
|
ValuatorClassPtr val;
|
||||||
|
|
||||||
val = dev->valuator;
|
val = dev->valuator;
|
||||||
|
|
||||||
if(!val)
|
if (!val)
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if(IsMaster(dev) && scheme != PtrAccelNoOp)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for(x = 0; pointerAccelerationScheme[x].number >= 0; x++) {
|
if (IsMaster(dev) && scheme != PtrAccelNoOp)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (x = 0; pointerAccelerationScheme[x].number >= 0; x++) {
|
||||||
if(pointerAccelerationScheme[x].number == scheme){
|
if(pointerAccelerationScheme[x].number == scheme){
|
||||||
i = x;
|
i = x;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(-1 == i)
|
if (-1 == i)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (val->accelScheme.AccelCleanupProc)
|
if (val->accelScheme.AccelCleanupProc)
|
||||||
val->accelScheme.AccelCleanupProc(dev);
|
val->accelScheme.AccelCleanupProc(dev);
|
||||||
|
|
||||||
/* init scheme-specific data */
|
if (pointerAccelerationScheme[i].AccelInitProc) {
|
||||||
switch(scheme){
|
if (!pointerAccelerationScheme[i].AccelInitProc(dev,
|
||||||
case PtrAccelPredictable:
|
&pointerAccelerationScheme[i])) {
|
||||||
{
|
return FALSE;
|
||||||
DeviceVelocityPtr s;
|
|
||||||
s = malloc(sizeof(DeviceVelocityRec));
|
|
||||||
if(!s)
|
|
||||||
return FALSE;
|
|
||||||
InitVelocityData(s);
|
|
||||||
data = s;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
default:
|
} else {
|
||||||
break;
|
val->accelScheme = pointerAccelerationScheme[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
val->accelScheme = pointerAccelerationScheme[i];
|
|
||||||
val->accelScheme.accelData = data;
|
|
||||||
|
|
||||||
/* post-init scheme */
|
|
||||||
switch(scheme){
|
|
||||||
case PtrAccelPredictable:
|
|
||||||
InitializePredictableAccelerationProperties(dev);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1666,7 +1645,7 @@ ProcChangeKeyboardMapping(ClientPtr client)
|
||||||
stuff->keyCodes, NULL, client);
|
stuff->keyCodes, NULL, client);
|
||||||
|
|
||||||
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
||||||
if (IsMaster(tmp) || tmp->u.master != pDev)
|
if (IsMaster(tmp) || GetMaster(tmp, MASTER_KEYBOARD) != pDev)
|
||||||
continue;
|
continue;
|
||||||
if (!tmp->key)
|
if (!tmp->key)
|
||||||
continue;
|
continue;
|
||||||
|
@ -2329,7 +2308,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
if (IsMaster(dev) ||
|
if (IsMaster(dev) ||
|
||||||
dev->u.master != master ||
|
GetMaster(dev, MASTER_ATTACHED) != master ||
|
||||||
!dev->button)
|
!dev->button)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -2377,6 +2356,46 @@ RecalculateMasterButtons(DeviceIntPtr slave)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate release events for all keys/button currently down on this
|
||||||
|
* device.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
ReleaseButtonsAndKeys(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
EventListPtr eventlist = InitEventList(GetMaximumEventsNum());
|
||||||
|
ButtonClassPtr b = dev->button;
|
||||||
|
KeyClassPtr k = dev->key;
|
||||||
|
int i, j, nevents;
|
||||||
|
|
||||||
|
if (!eventlist) /* no release events for you */
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Release all buttons */
|
||||||
|
for (i = 0; b && i < b->numButtons; i++)
|
||||||
|
{
|
||||||
|
if (BitIsOn(b->down, i))
|
||||||
|
{
|
||||||
|
nevents = GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
|
||||||
|
for (j = 0; j < nevents; j++)
|
||||||
|
mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release all keys */
|
||||||
|
for (i = 0; k && i < MAP_LENGTH; i++)
|
||||||
|
{
|
||||||
|
if (BitIsOn(k->down, i))
|
||||||
|
{
|
||||||
|
nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i);
|
||||||
|
for (j = 0; j < nevents; j++)
|
||||||
|
mieqProcessDeviceEvent(dev, (InternalEvent*)(eventlist+j)->event, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeEventList(eventlist, GetMaximumEventsNum());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach device 'dev' to device 'master'.
|
* Attach device 'dev' to device 'master'.
|
||||||
* Client is set to the client that issued the request, or NULL if it comes
|
* Client is set to the client that issued the request, or NULL if it comes
|
||||||
|
@ -2399,19 +2418,21 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
/* set from floating to floating? */
|
/* set from floating to floating? */
|
||||||
if (!dev->u.master && !master && dev->enabled)
|
if (IsFloating(dev) && !master && dev->enabled)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
/* free the existing sprite. */
|
/* free the existing sprite. */
|
||||||
if (!dev->u.master && dev->spriteInfo->paired == dev)
|
if (IsFloating(dev) && dev->spriteInfo->paired == dev)
|
||||||
{
|
{
|
||||||
screen = miPointerGetScreen(dev);
|
screen = miPointerGetScreen(dev);
|
||||||
screen->DeviceCursorCleanup(dev, screen);
|
screen->DeviceCursorCleanup(dev, screen);
|
||||||
free(dev->spriteInfo->sprite);
|
free(dev->spriteInfo->sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldmaster = dev->u.master;
|
ReleaseButtonsAndKeys(dev);
|
||||||
dev->u.master = master;
|
|
||||||
|
oldmaster = GetMaster(dev, MASTER_ATTACHED);
|
||||||
|
dev->master = master;
|
||||||
|
|
||||||
/* If device is set to floating, we need to create a sprite for it,
|
/* If device is set to floating, we need to create a sprite for it,
|
||||||
* otherwise things go bad. However, we don't want to render the cursor,
|
* otherwise things go bad. However, we don't want to render the cursor,
|
||||||
|
@ -2461,8 +2482,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
DeviceIntPtr
|
DeviceIntPtr
|
||||||
GetPairedDevice(DeviceIntPtr dev)
|
GetPairedDevice(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
if (!IsMaster(dev) && dev->u.master)
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
dev = dev->u.master;
|
dev = GetMaster(dev, MASTER_ATTACHED);
|
||||||
|
|
||||||
return dev->spriteInfo->paired;
|
return dev->spriteInfo->paired;
|
||||||
}
|
}
|
||||||
|
@ -2475,7 +2496,10 @@ GetPairedDevice(DeviceIntPtr dev)
|
||||||
* returned master is either the device itself or the paired master device.
|
* returned master is either the device itself or the paired master device.
|
||||||
* If dev is a floating slave device, NULL is returned.
|
* If dev is a floating slave device, NULL is returned.
|
||||||
*
|
*
|
||||||
* @type ::MASTER_KEYBOARD or ::MASTER_POINTER
|
* @type ::MASTER_KEYBOARD or ::MASTER_POINTER or ::MASTER_ATTACHED
|
||||||
|
* @return The requested master device. In the case of MASTER_ATTACHED, this
|
||||||
|
* is the directly attached master to this device, regardless of the type.
|
||||||
|
* Otherwise, it is either the master keyboard or pointer for this device.
|
||||||
*/
|
*/
|
||||||
DeviceIntPtr
|
DeviceIntPtr
|
||||||
GetMaster(DeviceIntPtr dev, int which)
|
GetMaster(DeviceIntPtr dev, int which)
|
||||||
|
@ -2485,9 +2509,9 @@ GetMaster(DeviceIntPtr dev, int which)
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev))
|
||||||
master = dev;
|
master = dev;
|
||||||
else
|
else
|
||||||
master = dev->u.master;
|
master = dev->master;
|
||||||
|
|
||||||
if (master)
|
if (master && which != MASTER_ATTACHED)
|
||||||
{
|
{
|
||||||
if (which == MASTER_KEYBOARD)
|
if (which == MASTER_KEYBOARD)
|
||||||
{
|
{
|
||||||
|
@ -2540,7 +2564,7 @@ AllocDevicePair (ClientPtr client, char* name,
|
||||||
pointer->coreEvents = TRUE;
|
pointer->coreEvents = TRUE;
|
||||||
pointer->spriteInfo->spriteOwner = TRUE;
|
pointer->spriteInfo->spriteOwner = TRUE;
|
||||||
|
|
||||||
pointer->u.lastSlave = NULL;
|
pointer->lastSlave = NULL;
|
||||||
pointer->last.slave = NULL;
|
pointer->last.slave = NULL;
|
||||||
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
||||||
|
|
||||||
|
@ -2566,7 +2590,7 @@ AllocDevicePair (ClientPtr client, char* name,
|
||||||
keyboard->coreEvents = TRUE;
|
keyboard->coreEvents = TRUE;
|
||||||
keyboard->spriteInfo->spriteOwner = FALSE;
|
keyboard->spriteInfo->spriteOwner = FALSE;
|
||||||
|
|
||||||
keyboard->u.lastSlave = NULL;
|
keyboard->lastSlave = NULL;
|
||||||
keyboard->last.slave = NULL;
|
keyboard->last.slave = NULL;
|
||||||
keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
|
keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,12 @@ EventIsKeyRepeat(xEvent *event)
|
||||||
* @return Success or the matching error code.
|
* @return Success or the matching error code.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EventToCore(InternalEvent *event, xEvent *core)
|
EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
|
||||||
{
|
{
|
||||||
|
xEvent *core = NULL;
|
||||||
|
int count = 0;
|
||||||
|
int ret = BadImplementation;
|
||||||
|
|
||||||
switch(event->any.type)
|
switch(event->any.type)
|
||||||
{
|
{
|
||||||
case ET_Motion:
|
case ET_Motion:
|
||||||
|
@ -108,7 +112,10 @@ EventToCore(InternalEvent *event, xEvent *core)
|
||||||
* present */
|
* present */
|
||||||
if (!BitIsOn(e->valuators.mask, 0) &&
|
if (!BitIsOn(e->valuators.mask, 0) &&
|
||||||
!BitIsOn(e->valuators.mask, 1))
|
!BitIsOn(e->valuators.mask, 1))
|
||||||
return BadMatch;
|
{
|
||||||
|
ret = BadMatch;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case ET_ButtonPress:
|
case ET_ButtonPress:
|
||||||
|
@ -119,9 +126,15 @@ EventToCore(InternalEvent *event, xEvent *core)
|
||||||
DeviceEvent *e = &event->device_event;
|
DeviceEvent *e = &event->device_event;
|
||||||
|
|
||||||
if (e->detail.key > 0xFF)
|
if (e->detail.key > 0xFF)
|
||||||
return BadMatch;
|
{
|
||||||
|
ret = BadMatch;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
memset(core, 0, sizeof(xEvent));
|
core = calloc(1, sizeof(*core));
|
||||||
|
if (!core)
|
||||||
|
return BadAlloc;
|
||||||
|
count = 1;
|
||||||
core->u.u.type = e->type - ET_KeyPress + KeyPress;
|
core->u.u.type = e->type - ET_KeyPress + KeyPress;
|
||||||
core->u.u.detail = e->detail.key & 0xFF;
|
core->u.u.detail = e->detail.key & 0xFF;
|
||||||
core->u.keyButtonPointer.time = e->time;
|
core->u.keyButtonPointer.time = e->time;
|
||||||
|
@ -129,7 +142,10 @@ EventToCore(InternalEvent *event, xEvent *core)
|
||||||
core->u.keyButtonPointer.rootY = e->root_y;
|
core->u.keyButtonPointer.rootY = e->root_y;
|
||||||
core->u.keyButtonPointer.state = e->corestate;
|
core->u.keyButtonPointer.state = e->corestate;
|
||||||
core->u.keyButtonPointer.root = e->root;
|
core->u.keyButtonPointer.root = e->root;
|
||||||
EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
|
EventSetKeyRepeatFlag(core,
|
||||||
|
(e->type == ET_KeyPress &&
|
||||||
|
e->key_repeat));
|
||||||
|
ret = Success;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ET_ProximityIn:
|
case ET_ProximityIn:
|
||||||
|
@ -139,13 +155,18 @@ EventToCore(InternalEvent *event, xEvent *core)
|
||||||
case ET_RawButtonPress:
|
case ET_RawButtonPress:
|
||||||
case ET_RawButtonRelease:
|
case ET_RawButtonRelease:
|
||||||
case ET_RawMotion:
|
case ET_RawMotion:
|
||||||
return BadMatch;
|
ret = BadMatch;
|
||||||
|
goto out;
|
||||||
default:
|
default:
|
||||||
/* XXX: */
|
/* XXX: */
|
||||||
ErrorF("[dix] EventToCore: Not implemented yet \n");
|
ErrorF("[dix] EventToCore: Not implemented yet \n");
|
||||||
return BadImplementation;
|
ret = BadImplementation;
|
||||||
}
|
}
|
||||||
return Success;
|
|
||||||
|
out:
|
||||||
|
*core_out = core;
|
||||||
|
*count_out = count;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
177
dix/events.c
177
dix/events.c
|
@ -328,6 +328,13 @@ IsMaster(DeviceIntPtr dev)
|
||||||
return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
|
return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
IsFloating(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
return GetMaster(dev, MASTER_KEYBOARD) == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max event opcode.
|
* Max event opcode.
|
||||||
*/
|
*/
|
||||||
|
@ -1397,10 +1404,10 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
|
||||||
static void
|
static void
|
||||||
DetachFromMaster(DeviceIntPtr dev)
|
DetachFromMaster(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
if (!dev->u.master)
|
if (!IsFloating(dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dev->saved_master_id = dev->u.master->id;
|
dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
|
||||||
|
|
||||||
AttachDevice(NULL, dev, NULL);
|
AttachDevice(NULL, dev, NULL);
|
||||||
}
|
}
|
||||||
|
@ -2287,8 +2294,8 @@ FixUpEventFromWindow(
|
||||||
* @param[in] event The event that is to be sent.
|
* @param[in] event The event that is to be sent.
|
||||||
* @param[in] win The current event window.
|
* @param[in] win The current event window.
|
||||||
*
|
*
|
||||||
* @return Bitmask of ::XI2_MASK, ::XI_MASK, ::CORE_MASK, and
|
* @return Bitmask of ::EVENT_XI2_MASK, ::EVENT_XI1_MASK, ::EVENT_CORE_MASK, and
|
||||||
* ::DONT_PROPAGATE_MASK.
|
* ::EVENT_DONT_PROPAGATE_MASK.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
|
EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
|
||||||
|
@ -2309,7 +2316,7 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
|
||||||
((inputMasks->xi2mask[XIAllDevices][type/8] & filter) ||
|
((inputMasks->xi2mask[XIAllDevices][type/8] & filter) ||
|
||||||
((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) ||
|
((inputMasks->xi2mask[XIAllMasterDevices][type/8] & filter) && IsMaster(dev)) ||
|
||||||
(inputMasks->xi2mask[dev->id][type/8] & filter)))
|
(inputMasks->xi2mask[dev->id][type/8] & filter)))
|
||||||
rc |= XI2_MASK;
|
rc |= EVENT_XI2_MASK;
|
||||||
|
|
||||||
type = GetXIType(event);
|
type = GetXIType(event);
|
||||||
ev.u.u.type = type;
|
ev.u.u.type = type;
|
||||||
|
@ -2319,22 +2326,22 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
|
||||||
if (type && inputMasks &&
|
if (type && inputMasks &&
|
||||||
(inputMasks->deliverableEvents[dev->id] & filter) &&
|
(inputMasks->deliverableEvents[dev->id] & filter) &&
|
||||||
(inputMasks->inputEvents[dev->id] & filter))
|
(inputMasks->inputEvents[dev->id] & filter))
|
||||||
rc |= XI_MASK;
|
rc |= EVENT_XI1_MASK;
|
||||||
|
|
||||||
/* Check for XI DontPropagate mask */
|
/* Check for XI DontPropagate mask */
|
||||||
if (type && inputMasks &&
|
if (type && inputMasks &&
|
||||||
(inputMasks->dontPropagateMask[dev->id] & filter))
|
(inputMasks->dontPropagateMask[dev->id] & filter))
|
||||||
rc |= DONT_PROPAGATE_MASK;
|
rc |= EVENT_DONT_PROPAGATE_MASK;
|
||||||
|
|
||||||
/* Check for core mask */
|
/* Check for core mask */
|
||||||
type = GetCoreType(event);
|
type = GetCoreType(event);
|
||||||
if (type && (win->deliverableEvents & filter) &&
|
if (type && (win->deliverableEvents & filter) &&
|
||||||
((wOtherEventMasks(win) | win->eventMask) & filter))
|
((wOtherEventMasks(win) | win->eventMask) & filter))
|
||||||
rc |= CORE_MASK;
|
rc |= EVENT_CORE_MASK;
|
||||||
|
|
||||||
/* Check for core DontPropagate mask */
|
/* Check for core DontPropagate mask */
|
||||||
if (type && (filter & wDontPropagateMask(win)))
|
if (type && (filter & wDontPropagateMask(win)))
|
||||||
rc |= DONT_PROPAGATE_MASK;
|
rc |= EVENT_DONT_PROPAGATE_MASK;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -2366,8 +2373,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
Window child = None;
|
Window child = None;
|
||||||
Mask filter;
|
Mask filter;
|
||||||
int deliveries = 0;
|
int deliveries = 0;
|
||||||
xEvent core;
|
xEvent *xE = NULL, *core = NULL;
|
||||||
xEvent *xE = NULL;
|
|
||||||
int rc, mask, count = 0;
|
int rc, mask, count = 0;
|
||||||
|
|
||||||
CHECKEVENT(event);
|
CHECKEVENT(event);
|
||||||
|
@ -2377,7 +2383,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
if ((mask = EventIsDeliverable(dev, event, pWin)))
|
if ((mask = EventIsDeliverable(dev, event, pWin)))
|
||||||
{
|
{
|
||||||
/* XI2 events first */
|
/* XI2 events first */
|
||||||
if (mask & XI2_MASK)
|
if (mask & EVENT_XI2_MASK)
|
||||||
{
|
{
|
||||||
xEvent *xi2 = NULL;
|
xEvent *xi2 = NULL;
|
||||||
rc = EventToXI2(event, &xi2);
|
rc = EventToXI2(event, &xi2);
|
||||||
|
@ -2397,7 +2403,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XI events */
|
/* XI events */
|
||||||
if (mask & XI_MASK)
|
if (mask & EVENT_XI1_MASK)
|
||||||
{
|
{
|
||||||
rc = EventToXI(event, &xE, &count);
|
rc = EventToXI(event, &xE, &count);
|
||||||
if (rc == Success) {
|
if (rc == Success) {
|
||||||
|
@ -2415,15 +2421,15 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Core event */
|
/* Core event */
|
||||||
if ((mask & CORE_MASK) && IsMaster(dev) && dev->coreEvents)
|
if ((mask & EVENT_CORE_MASK) && IsMaster(dev) && dev->coreEvents)
|
||||||
{
|
{
|
||||||
rc = EventToCore(event, &core);
|
rc = EventToCore(event, &core, &count);
|
||||||
if (rc == Success) {
|
if (rc == Success) {
|
||||||
if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success) {
|
if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, core, count) == Success) {
|
||||||
filter = GetEventFilter(dev, &core);
|
filter = GetEventFilter(dev, core);
|
||||||
FixUpEventFromWindow(pSprite, &core, pWin, child, FALSE);
|
FixUpEventFromWindow(pSprite, core, pWin, child, FALSE);
|
||||||
deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
|
deliveries = DeliverEventsToWindow(dev, pWin, core,
|
||||||
filter, grab);
|
count, filter, grab);
|
||||||
if (deliveries > 0)
|
if (deliveries > 0)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
@ -2433,7 +2439,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((deliveries < 0) || (pWin == stopAt) ||
|
if ((deliveries < 0) || (pWin == stopAt) ||
|
||||||
(mask & DONT_PROPAGATE_MASK))
|
(mask & EVENT_DONT_PROPAGATE_MASK))
|
||||||
{
|
{
|
||||||
deliveries = 0;
|
deliveries = 0;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
@ -2445,14 +2451,11 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
|
||||||
}
|
}
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
|
free(core);
|
||||||
free(xE);
|
free(xE);
|
||||||
return deliveries;
|
return deliveries;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef XI_MASK
|
|
||||||
#undef CORE_MASK
|
|
||||||
#undef DONT_PROPAGATE_MASK
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deliver event to a window and it's immediate parent. Used for most window
|
* Deliver event to a window and it's immediate parent. Used for most window
|
||||||
* events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
|
* events (CreateNotify, ConfigureNotify, etc.). Not useful for events that
|
||||||
|
@ -2470,9 +2473,8 @@ int
|
||||||
DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
|
DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
|
||||||
WindowPtr otherParent)
|
WindowPtr otherParent)
|
||||||
{
|
{
|
||||||
Mask filter;
|
|
||||||
int deliveries;
|
|
||||||
DeviceIntRec dummy;
|
DeviceIntRec dummy;
|
||||||
|
int deliveries;
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
|
if(!noPanoramiXExtension && pWin->drawable.pScreen->myNum)
|
||||||
|
@ -2483,11 +2485,42 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dummy.id = XIAllDevices;
|
dummy.id = XIAllDevices;
|
||||||
filter = GetEventFilter(&dummy, xE);
|
|
||||||
if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify))
|
switch (xE->u.u.type)
|
||||||
xE->u.destroyNotify.event = pWin->drawable.id;
|
{
|
||||||
if (filter != StructureAndSubMask)
|
case DestroyNotify:
|
||||||
return DeliverEventsToWindow(&dummy, pWin, xE, count, filter, NullGrab);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count,
|
deliveries = DeliverEventsToWindow(&dummy, pWin, xE, count,
|
||||||
StructureNotifyMask, NullGrab);
|
StructureNotifyMask, NullGrab);
|
||||||
if (pWin->parent)
|
if (pWin->parent)
|
||||||
|
@ -2799,7 +2832,7 @@ WindowsRestructured(void)
|
||||||
DeviceIntPtr pDev = inputInfo.devices;
|
DeviceIntPtr pDev = inputInfo.devices;
|
||||||
while(pDev)
|
while(pDev)
|
||||||
{
|
{
|
||||||
if (IsMaster(pDev) || !pDev->u.master)
|
if (IsMaster(pDev) || IsFloating(pDev))
|
||||||
CheckMotion(NULL, pDev);
|
CheckMotion(NULL, pDev);
|
||||||
pDev = pDev->next;
|
pDev = pDev->next;
|
||||||
}
|
}
|
||||||
|
@ -3230,15 +3263,15 @@ ProcWarpPointer(ClientPtr client)
|
||||||
dev = PickPointer(client);
|
dev = PickPointer(client);
|
||||||
|
|
||||||
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
||||||
if ((tmp == dev) || (!IsMaster(tmp) && tmp->u.master == dev)) {
|
if (GetMaster(tmp, MASTER_ATTACHED) == dev) {
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->u.lastSlave)
|
if (dev->lastSlave)
|
||||||
dev = dev->u.lastSlave;
|
dev = dev->lastSlave;
|
||||||
pSprite = dev->spriteInfo->sprite;
|
pSprite = dev->spriteInfo->sprite;
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
|
@ -3394,7 +3427,7 @@ CheckPassiveGrabsOnWindow(
|
||||||
* attached master keyboard. Since the slave may have been
|
* attached master keyboard. Since the slave may have been
|
||||||
* reattached after the grab, the modifier device may not be the
|
* reattached after the grab, the modifier device may not be the
|
||||||
* same. */
|
* same. */
|
||||||
if (!IsMaster(grab->device) && device->u.master)
|
if (!IsMaster(grab->device) && !IsFloating(device))
|
||||||
gdev = GetMaster(device, MASTER_KEYBOARD);
|
gdev = GetMaster(device, MASTER_KEYBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3434,7 +3467,6 @@ CheckPassiveGrabsOnWindow(
|
||||||
{
|
{
|
||||||
int rc, count = 0;
|
int rc, count = 0;
|
||||||
xEvent *xE = NULL;
|
xEvent *xE = NULL;
|
||||||
xEvent core;
|
|
||||||
|
|
||||||
event->corestate &= 0x1f00;
|
event->corestate &= 0x1f00;
|
||||||
event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00);
|
event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00);
|
||||||
|
@ -3486,7 +3518,7 @@ CheckPassiveGrabsOnWindow(
|
||||||
|
|
||||||
if (match & CORE_MATCH)
|
if (match & CORE_MATCH)
|
||||||
{
|
{
|
||||||
rc = EventToCore((InternalEvent*)event, &core);
|
rc = EventToCore((InternalEvent*)event, &xE, &count);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
if (rc != BadMatch)
|
if (rc != BadMatch)
|
||||||
|
@ -3494,8 +3526,6 @@ CheckPassiveGrabsOnWindow(
|
||||||
"(%d, %d).\n", device->name, event->type, rc);
|
"(%d, %d).\n", device->name, event->type, rc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
xE = &core;
|
|
||||||
count = 1;
|
|
||||||
} else if (match & XI2_MATCH)
|
} else if (match & XI2_MATCH)
|
||||||
{
|
{
|
||||||
rc = EventToXI2((InternalEvent*)event, &xE);
|
rc = EventToXI2((InternalEvent*)event, &xE);
|
||||||
|
@ -3525,6 +3555,7 @@ CheckPassiveGrabsOnWindow(
|
||||||
{
|
{
|
||||||
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
||||||
|
|
||||||
|
/* XXX: XACE? */
|
||||||
TryClientEvents(rClient(grab), device, xE, count,
|
TryClientEvents(rClient(grab), device, xE, count,
|
||||||
GetEventFilter(device, xE),
|
GetEventFilter(device, xE),
|
||||||
GetEventFilter(device, xE), grab);
|
GetEventFilter(device, xE), grab);
|
||||||
|
@ -3538,8 +3569,7 @@ CheckPassiveGrabsOnWindow(
|
||||||
grabinfo->sync.state = FROZEN_WITH_EVENT;
|
grabinfo->sync.state = FROZEN_WITH_EVENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match & (XI_MATCH | XI2_MATCH))
|
free(xE);
|
||||||
free(xE); /* on core match xE == &core */
|
|
||||||
return grab;
|
return grab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3582,6 +3612,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
|
||||||
WindowPtr pWin = NULL;
|
WindowPtr pWin = NULL;
|
||||||
FocusClassPtr focus = IsPointerEvent((InternalEvent*)event) ? NULL : device->focus;
|
FocusClassPtr focus = IsPointerEvent((InternalEvent*)event) ? NULL : device->focus;
|
||||||
BOOL sendCore = (IsMaster(device) && device->coreEvents);
|
BOOL sendCore = (IsMaster(device) && device->coreEvents);
|
||||||
|
Bool ret = FALSE;
|
||||||
|
|
||||||
if (event->type != ET_ButtonPress &&
|
if (event->type != ET_ButtonPress &&
|
||||||
event->type != ET_KeyPress)
|
event->type != ET_KeyPress)
|
||||||
|
@ -3601,7 +3632,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
|
||||||
if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor)
|
if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor)
|
||||||
break;
|
break;
|
||||||
if (i == device->spriteInfo->sprite->spriteTraceGood)
|
if (i == device->spriteInfo->sprite->spriteTraceGood)
|
||||||
return FALSE;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (focus)
|
if (focus)
|
||||||
|
@ -3610,23 +3641,32 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor)
|
||||||
{
|
{
|
||||||
pWin = focus->trace[i];
|
pWin = focus->trace[i];
|
||||||
if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE))
|
if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE))
|
||||||
return TRUE;
|
{
|
||||||
|
ret = TRUE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((focus->win == NoneWin) ||
|
if ((focus->win == NoneWin) ||
|
||||||
(i >= device->spriteInfo->sprite->spriteTraceGood) ||
|
(i >= device->spriteInfo->sprite->spriteTraceGood) ||
|
||||||
(pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1]))
|
(pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1]))
|
||||||
return FALSE;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; i < device->spriteInfo->sprite->spriteTraceGood; i++)
|
for (; i < device->spriteInfo->sprite->spriteTraceGood; i++)
|
||||||
{
|
{
|
||||||
pWin = device->spriteInfo->sprite->spriteTrace[i];
|
pWin = device->spriteInfo->sprite->spriteTrace[i];
|
||||||
if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE))
|
if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE))
|
||||||
return TRUE;
|
{
|
||||||
|
ret = TRUE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
out:
|
||||||
|
if (ret == TRUE && event->type == ET_KeyPress)
|
||||||
|
device->deviceGrab.activatingKey = event->detail.key;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3646,8 +3686,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
|
||||||
DeviceIntPtr ptr;
|
DeviceIntPtr ptr;
|
||||||
WindowPtr focus = keybd->focus->win;
|
WindowPtr focus = keybd->focus->win;
|
||||||
BOOL sendCore = (IsMaster(keybd) && keybd->coreEvents);
|
BOOL sendCore = (IsMaster(keybd) && keybd->coreEvents);
|
||||||
xEvent core;
|
xEvent *core = NULL, *xE = NULL, *xi2 = NULL;
|
||||||
xEvent *xE = NULL, *xi2 = NULL;
|
|
||||||
int count, rc;
|
int count, rc;
|
||||||
int deliveries = 0;
|
int deliveries = 0;
|
||||||
|
|
||||||
|
@ -3701,13 +3740,13 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
|
||||||
|
|
||||||
if (sendCore)
|
if (sendCore)
|
||||||
{
|
{
|
||||||
rc = EventToCore(event, &core);
|
rc = EventToCore(event, &core, &count);
|
||||||
if (rc == Success) {
|
if (rc == Success) {
|
||||||
if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success) {
|
if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, core, count) == Success) {
|
||||||
FixUpEventFromWindow(keybd->spriteInfo->sprite, &core, focus,
|
FixUpEventFromWindow(keybd->spriteInfo->sprite, core, focus,
|
||||||
None, FALSE);
|
None, FALSE);
|
||||||
deliveries = DeliverEventsToWindow(keybd, focus, &core, 1,
|
deliveries = DeliverEventsToWindow(keybd, focus, core, count,
|
||||||
GetEventFilter(keybd, &core),
|
GetEventFilter(keybd, core),
|
||||||
NullGrab);
|
NullGrab);
|
||||||
}
|
}
|
||||||
} else if (rc != BadMatch)
|
} else if (rc != BadMatch)
|
||||||
|
@ -3716,6 +3755,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
|
||||||
}
|
}
|
||||||
|
|
||||||
unwind:
|
unwind:
|
||||||
|
free(core);
|
||||||
free(xE);
|
free(xE);
|
||||||
free(xi2);
|
free(xi2);
|
||||||
return;
|
return;
|
||||||
|
@ -3741,6 +3781,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
int rc, count = 0;
|
int rc, count = 0;
|
||||||
xEvent *xi = NULL;
|
xEvent *xi = NULL;
|
||||||
xEvent *xi2 = NULL;
|
xEvent *xi2 = NULL;
|
||||||
|
xEvent *core = NULL;
|
||||||
|
|
||||||
grabinfo = &thisDev->deviceGrab;
|
grabinfo = &thisDev->deviceGrab;
|
||||||
grab = grabinfo->grab;
|
grab = grabinfo->grab;
|
||||||
|
@ -3790,22 +3831,20 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
/* try core event */
|
/* try core event */
|
||||||
if (sendCore && grab->grabtype == GRABTYPE_CORE)
|
if (sendCore && grab->grabtype == GRABTYPE_CORE)
|
||||||
{
|
{
|
||||||
xEvent core;
|
rc = EventToCore(event, &core, &count);
|
||||||
|
|
||||||
rc = EventToCore(event, &core);
|
|
||||||
if (rc == Success)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
FixUpEventFromWindow(pSprite, &core, grab->window, None, TRUE);
|
FixUpEventFromWindow(pSprite, core, grab->window, None, TRUE);
|
||||||
if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
|
if (XaceHook(XACE_SEND_ACCESS, 0, thisDev,
|
||||||
grab->window, &core, 1) ||
|
grab->window, core, count) ||
|
||||||
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
XaceHook(XACE_RECEIVE_ACCESS, rClient(grab),
|
||||||
grab->window, &core, 1))
|
grab->window, core, count))
|
||||||
deliveries = 1; /* don't send, but pretend we did */
|
deliveries = 1; /* don't send, but pretend we did */
|
||||||
else if (!IsInterferingGrab(rClient(grab), thisDev, &core))
|
else if (!IsInterferingGrab(rClient(grab), thisDev, core))
|
||||||
{
|
{
|
||||||
deliveries = TryClientEvents(rClient(grab), thisDev,
|
deliveries = TryClientEvents(rClient(grab), thisDev,
|
||||||
&core, 1, mask,
|
core, count, mask,
|
||||||
GetEventFilter(thisDev, &core),
|
GetEventFilter(thisDev, core),
|
||||||
grab);
|
grab);
|
||||||
}
|
}
|
||||||
} else if (rc != BadMatch)
|
} else if (rc != BadMatch)
|
||||||
|
@ -3872,16 +3911,15 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
switch (grabinfo->sync.state)
|
switch (grabinfo->sync.state)
|
||||||
{
|
{
|
||||||
case FREEZE_BOTH_NEXT_EVENT:
|
case FREEZE_BOTH_NEXT_EVENT:
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
dev = GetPairedDevice(thisDev);
|
||||||
|
if (dev)
|
||||||
{
|
{
|
||||||
if (dev == thisDev)
|
|
||||||
continue;
|
|
||||||
FreezeThaw(dev, TRUE);
|
FreezeThaw(dev, TRUE);
|
||||||
if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
|
if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
|
||||||
(CLIENT_BITS(grab->resource) ==
|
(CLIENT_BITS(grab->resource) ==
|
||||||
CLIENT_BITS(dev->deviceGrab.grab->resource)))
|
CLIENT_BITS(dev->deviceGrab.grab->resource)))
|
||||||
dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
|
dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
|
||||||
else if (GetPairedDevice(thisDev) == dev)
|
else
|
||||||
dev->deviceGrab.sync.other = grab;
|
dev->deviceGrab.sync.other = grab;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -3895,6 +3933,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(core);
|
||||||
free(xi);
|
free(xi);
|
||||||
free(xi2);
|
free(xi2);
|
||||||
}
|
}
|
||||||
|
@ -4277,7 +4316,7 @@ DeviceEnterLeaveEvent(
|
||||||
if (BitIsOn(mouse->button->down, i))
|
if (BitIsOn(mouse->button->down, i))
|
||||||
SetBit(&event[1], i);
|
SetBit(&event[1], i);
|
||||||
|
|
||||||
kbd = (IsMaster(mouse) || mouse->u.master) ? GetPairedDevice(mouse) : NULL;
|
kbd = GetMaster(mouse, MASTER_KEYBOARD);
|
||||||
if (kbd && kbd->key)
|
if (kbd && kbd->key)
|
||||||
{
|
{
|
||||||
event->mods.base_mods = kbd->key->xkbInfo->state.base_mods;
|
event->mods.base_mods = kbd->key->xkbInfo->state.base_mods;
|
||||||
|
|
|
@ -767,7 +767,7 @@ moveRelative(DeviceIntPtr dev, int *x, int *y, ValuatorMask *mask)
|
||||||
/* if attached, clip both x and y to the defined limits (usually
|
/* if attached, clip both x and y to the defined limits (usually
|
||||||
* co-ord space limit). If it is attached, we need x/y to go over the
|
* co-ord space limit). If it is attached, we need x/y to go over the
|
||||||
* limits to be able to change screens. */
|
* limits to be able to change screens. */
|
||||||
if(dev->u.master && dev->valuator) {
|
if(dev->valuator && IsMaster(dev) || !IsFloating(dev)) {
|
||||||
if (valuator_get_mode(dev, 0) == Absolute)
|
if (valuator_get_mode(dev, 0) == Absolute)
|
||||||
clipAxis(dev, 0, x);
|
clipAxis(dev, 0, x);
|
||||||
if (valuator_get_mode(dev, 1) == Absolute)
|
if (valuator_get_mode(dev, 1) == Absolute)
|
||||||
|
@ -865,11 +865,12 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
|
||||||
* to the current screen. */
|
* to the current screen. */
|
||||||
miPointerSetPosition(dev, screenx, screeny);
|
miPointerSetPosition(dev, screenx, screeny);
|
||||||
|
|
||||||
if (dev->u.master) {
|
if(!IsMaster(dev) || !IsFloating(dev)) {
|
||||||
dev->u.master->last.valuators[0] = *screenx;
|
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
|
||||||
dev->u.master->last.valuators[1] = *screeny;
|
master->last.valuators[0] = *screenx;
|
||||||
dev->u.master->last.remainder[0] = *screenx_frac;
|
master->last.valuators[1] = *screeny;
|
||||||
dev->u.master->last.remainder[1] = *screeny_frac;
|
master->last.remainder[0] = *screenx_frac;
|
||||||
|
master->last.remainder[1] = *screeny_frac;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->valuator)
|
if (dev->valuator)
|
||||||
|
@ -911,7 +912,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateMotionHistory(dev, ms, mask, dev->last.valuators);
|
updateMotionHistory(dev, ms, mask, dev->last.valuators);
|
||||||
if (dev->u.master)
|
if(!IsMaster(dev) || !IsFloating(dev))
|
||||||
{
|
{
|
||||||
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
|
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
|
||||||
updateMotionHistory(master, ms, mask, dev->last.valuators);
|
updateMotionHistory(master, ms, mask, dev->last.valuators);
|
||||||
|
|
|
@ -268,15 +268,15 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
|
||||||
/* Change any attached masters/slaves. */
|
/* Change any attached masters/slaves. */
|
||||||
if (IsMaster(dev)) {
|
if (IsMaster(dev)) {
|
||||||
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
|
||||||
if (!IsMaster(tmp) && tmp->u.master == dev)
|
if (!IsMaster(tmp) && GetMaster(tmp, MASTER_KEYBOARD) == dev)
|
||||||
if (check_modmap_change_slave(client, dev, tmp, modmap))
|
if (check_modmap_change_slave(client, dev, tmp, modmap))
|
||||||
do_modmap_change(client, tmp, modmap);
|
do_modmap_change(client, tmp, modmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dev->u.master && dev->u.master->u.lastSlave == dev) {
|
else if (!IsFloating(dev) && GetMaster(dev, MASTER_KEYBOARD)->lastSlave == dev) {
|
||||||
/* If this fails, expect the results to be weird. */
|
/* If this fails, expect the results to be weird. */
|
||||||
if (check_modmap_change(client, dev->u.master, modmap))
|
if (check_modmap_change(client, dev->master, modmap))
|
||||||
do_modmap_change(client, dev->u.master, modmap);
|
do_modmap_change(client, dev->master, modmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
|
@ -67,6 +67,10 @@ SimpleSmoothProfile(DeviceIntPtr dev, DeviceVelocityPtr vel, float velocity,
|
||||||
float threshold, float acc);
|
float threshold, float acc);
|
||||||
static PointerAccelerationProfileFunc
|
static PointerAccelerationProfileFunc
|
||||||
GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
||||||
|
static BOOL
|
||||||
|
InitializePredictableAccelerationProperties(DeviceIntPtr dev);
|
||||||
|
static BOOL
|
||||||
|
DeletePredictableAccelerationProperties(DeviceIntPtr dev);
|
||||||
|
|
||||||
/*#define PTRACCEL_DEBUGGING*/
|
/*#define PTRACCEL_DEBUGGING*/
|
||||||
|
|
||||||
|
@ -85,7 +89,7 @@ GetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init struct so it should match the average case
|
* Init DeviceVelocity struct so it should match the average case
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
InitVelocityData(DeviceVelocityPtr vel)
|
InitVelocityData(DeviceVelocityPtr vel)
|
||||||
|
@ -107,7 +111,7 @@ InitVelocityData(DeviceVelocityPtr vel)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up
|
* Clean up DeviceVelocityRec
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
FreeVelocityData(DeviceVelocityPtr vel){
|
FreeVelocityData(DeviceVelocityPtr vel){
|
||||||
|
@ -116,8 +120,28 @@ FreeVelocityData(DeviceVelocityPtr vel){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* dix uninit helper, called through scheme
|
* Init predictable scheme
|
||||||
|
*/
|
||||||
|
Bool
|
||||||
|
InitPredictableAccelerationScheme(DeviceIntPtr dev,
|
||||||
|
ValuatorAccelerationPtr protoScheme) {
|
||||||
|
DeviceVelocityPtr vel;
|
||||||
|
ValuatorAccelerationRec scheme;
|
||||||
|
scheme = *protoScheme;
|
||||||
|
vel = calloc(1, sizeof(DeviceVelocityRec));
|
||||||
|
if (!vel)
|
||||||
|
return FALSE;
|
||||||
|
InitVelocityData(vel);
|
||||||
|
scheme.accelData = vel;
|
||||||
|
dev->valuator->accelScheme = scheme;
|
||||||
|
InitializePredictableAccelerationProperties(dev);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninit scheme
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
AccelerationDefaultCleanup(DeviceIntPtr dev)
|
AccelerationDefaultCleanup(DeviceIntPtr dev)
|
||||||
|
@ -1024,12 +1048,10 @@ acceleratePointerPredictable(
|
||||||
int *valuators,
|
int *valuators,
|
||||||
int evtime)
|
int evtime)
|
||||||
{
|
{
|
||||||
float mult = 0.0;
|
float fdx, fdy, tmp, mult; /* no need to init */
|
||||||
int dx = 0, dy = 0;
|
int dx = 0, dy = 0;
|
||||||
int *px = NULL, *py = NULL;
|
int *px = NULL, *py = NULL;
|
||||||
DeviceVelocityPtr velocitydata =
|
DeviceVelocityPtr velocitydata = GetDevicePredictableAccelData(dev);
|
||||||
(DeviceVelocityPtr) dev->valuator->accelScheme.accelData;
|
|
||||||
float fdx, fdy, tmp; /* no need to init */
|
|
||||||
Bool soften = TRUE;
|
Bool soften = TRUE;
|
||||||
|
|
||||||
if (!num_valuators || !valuators || !velocitydata)
|
if (!num_valuators || !valuators || !velocitydata)
|
||||||
|
@ -1062,11 +1084,11 @@ acceleratePointerPredictable(
|
||||||
(float)dev->ptrfeed->ctrl.num /
|
(float)dev->ptrfeed->ctrl.num /
|
||||||
(float)dev->ptrfeed->ctrl.den);
|
(float)dev->ptrfeed->ctrl.den);
|
||||||
|
|
||||||
if(mult != 1.0 || velocitydata->const_acceleration != 1.0) {
|
if(mult != 1.0f || velocitydata->const_acceleration != 1.0f) {
|
||||||
ApplySofteningAndConstantDeceleration( velocitydata,
|
ApplySofteningAndConstantDeceleration( velocitydata,
|
||||||
dx, dy,
|
dx, dy,
|
||||||
&fdx, &fdy,
|
&fdx, &fdy,
|
||||||
(mult > 1.0) && soften);
|
(mult > 1.0f) && soften);
|
||||||
|
|
||||||
if (dx) {
|
if (dx) {
|
||||||
tmp = mult * fdx + dev->last.remainder[0];
|
tmp = mult * fdx + dev->last.remainder[0];
|
||||||
|
|
|
@ -1224,7 +1224,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
||||||
*devs[count - 1] = Pointer;
|
*devs[count - 1] = Pointer;
|
||||||
devs[count - 1]->options =
|
devs[count - 1]->options =
|
||||||
xf86addNewOption(NULL, xnfstrdup("CorePointer"), NULL);
|
xf86addNewOption(devs[count -1]->options,
|
||||||
|
xnfstrdup("CorePointer"), NULL);
|
||||||
devs[count] = NULL;
|
devs[count] = NULL;
|
||||||
servlayoutp->inputs = devs;
|
servlayoutp->inputs = devs;
|
||||||
}
|
}
|
||||||
|
@ -1364,7 +1365,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
|
||||||
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
devs[count - 1] = xnfalloc(sizeof(InputInfoRec));
|
||||||
*devs[count - 1] = Keyboard;
|
*devs[count - 1] = Keyboard;
|
||||||
devs[count - 1]->options =
|
devs[count - 1]->options =
|
||||||
xf86addNewOption(NULL, xnfstrdup("CoreKeyboard"), NULL);
|
xf86addNewOption(devs[count - 1]->options,
|
||||||
|
xnfstrdup("CoreKeyboard"), NULL);
|
||||||
devs[count] = NULL;
|
devs[count] = NULL;
|
||||||
servlayoutp->inputs = devs;
|
servlayoutp->inputs = devs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ LookupBoolOption(pointer optlist, const char *name, int deflt, Bool markUsed)
|
||||||
return deflt;
|
return deflt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static double
|
||||||
LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed)
|
LookupPercentOption(pointer optlist, const char *name, double deflt, Bool markUsed)
|
||||||
{
|
{
|
||||||
OptionInfoRec o;
|
OptionInfoRec o;
|
||||||
|
@ -496,27 +496,33 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
switch (p->type) {
|
switch (p->type) {
|
||||||
case OPTV_INTEGER:
|
case OPTV_INTEGER:
|
||||||
if (*s == '\0') {
|
if (*s == '\0') {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires an integer value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires an integer value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
} else {
|
} else {
|
||||||
p->value.num = strtoul(s, &end, 0);
|
p->value.num = strtoul(s, &end, 0);
|
||||||
if (*end == '\0') {
|
if (*end == '\0') {
|
||||||
p->found = TRUE;
|
p->found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires an integer value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires an integer value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPTV_STRING:
|
case OPTV_STRING:
|
||||||
if (*s == '\0') {
|
if (*s == '\0') {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires an string value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires an string value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
} else {
|
} else {
|
||||||
p->value.str = s;
|
p->value.str = s;
|
||||||
|
@ -529,18 +535,22 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
break;
|
break;
|
||||||
case OPTV_REAL:
|
case OPTV_REAL:
|
||||||
if (*s == '\0') {
|
if (*s == '\0') {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires a floating point value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires a floating point "
|
||||||
|
"value\n", p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
} else {
|
} else {
|
||||||
p->value.realnum = strtod(s, &end);
|
p->value.realnum = strtod(s, &end);
|
||||||
if (*end == '\0') {
|
if (*end == '\0') {
|
||||||
p->found = TRUE;
|
p->found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires a floating point value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires a floating point "
|
||||||
|
"value\n", p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,8 +559,11 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
if (GetBoolValue(p, s)) {
|
if (GetBoolValue(p, s)) {
|
||||||
p->found = TRUE;
|
p->found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires a boolean value\n", p->name);
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
|
"Option \"%s\" requires a boolean value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -561,8 +574,10 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
* hence 100 looks the same as 100% to the caller of sccanf
|
* hence 100 looks the same as 100% to the caller of sccanf
|
||||||
*/
|
*/
|
||||||
if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') {
|
if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
"Option \"%s\" requires a percent value\n", p->name);
|
"Option \"%s\" requires a percent value\n", p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
} else {
|
} else {
|
||||||
p->found = TRUE;
|
p->found = TRUE;
|
||||||
|
@ -571,9 +586,11 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
break;
|
break;
|
||||||
case OPTV_FREQ:
|
case OPTV_FREQ:
|
||||||
if (*s == '\0') {
|
if (*s == '\0') {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires a frequency value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires a frequency value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
} else {
|
} else {
|
||||||
double freq = strtod(s, &end);
|
double freq = strtod(s, &end);
|
||||||
|
@ -590,17 +607,21 @@ ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p,
|
||||||
!xf86NameCmp(end, "M"))
|
!xf86NameCmp(end, "M"))
|
||||||
units = 1000000;
|
units = 1000000;
|
||||||
else {
|
else {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires a frequency value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires a frequency value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
}
|
}
|
||||||
if (p->found)
|
if (p->found)
|
||||||
freq *= (double)units;
|
freq *= (double)units;
|
||||||
} else {
|
} else {
|
||||||
xf86DrvMsg(scrnIndex, X_WARNING,
|
if (markUsed) {
|
||||||
"Option \"%s\" requires a frequency value\n",
|
xf86DrvMsg(scrnIndex, X_WARNING,
|
||||||
p->name);
|
"Option \"%s\" requires a frequency value\n",
|
||||||
|
p->name);
|
||||||
|
}
|
||||||
p->found = FALSE;
|
p->found = FALSE;
|
||||||
}
|
}
|
||||||
if (p->found) {
|
if (p->found) {
|
||||||
|
|
|
@ -242,11 +242,20 @@ xf86RandRSetConfig (ScreenPtr pScreen,
|
||||||
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
||||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
int px, py;
|
int pos[MAXDEVICES][2];
|
||||||
Bool useVirtual = FALSE;
|
Bool useVirtual = FALSE;
|
||||||
Rotation oldRotation = randrp->rotation;
|
Rotation oldRotation = randrp->rotation;
|
||||||
|
DeviceIntPtr dev;
|
||||||
|
Bool view_adjusted = FALSE;
|
||||||
|
|
||||||
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
|
{
|
||||||
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
|
||||||
|
}
|
||||||
|
|
||||||
miPointerGetPosition(inputInfo.pointer, &px, &py);
|
|
||||||
for (mode = scrp->modes; ; mode = mode->next)
|
for (mode = scrp->modes; ; mode = mode->next)
|
||||||
{
|
{
|
||||||
if (mode->HDisplay == pSize->width &&
|
if (mode->HDisplay == pSize->width &&
|
||||||
|
@ -303,17 +312,31 @@ xf86RandRSetConfig (ScreenPtr pScreen,
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move the cursor back where it belongs; SwitchMode repositions it
|
* Move the cursor back where it belongs; SwitchMode repositions it
|
||||||
|
* FIXME: duplicated code, see modes/xf86RandR12.c
|
||||||
*/
|
*/
|
||||||
if (pScreen == miPointerCurrentScreen ())
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
px = (px >= pScreen->width ? (pScreen->width - 1) : px);
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
|
continue;
|
||||||
|
|
||||||
xf86SetViewport(pScreen, px, py);
|
if (pScreen == miPointerGetScreen(dev)) {
|
||||||
|
int px = pos[dev->id][0];
|
||||||
|
int py = pos[dev->id][1];
|
||||||
|
|
||||||
(*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE);
|
px = (px >= pScreen->width ? (pScreen->width - 1) : px);
|
||||||
|
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
|
||||||
|
|
||||||
|
/* Setting the viewpoint makes only sense on one device */
|
||||||
|
if (!view_adjusted && IsMaster(dev)) {
|
||||||
|
xf86SetViewport(pScreen, px, py);
|
||||||
|
view_adjusted = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -584,10 +584,12 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
|
||||||
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
|
||||||
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
int px, py;
|
int pos[MAXDEVICES][2];
|
||||||
Bool useVirtual = FALSE;
|
Bool useVirtual = FALSE;
|
||||||
int maxX = 0, maxY = 0;
|
int maxX = 0, maxY = 0;
|
||||||
Rotation oldRotation = randrp->rotation;
|
Rotation oldRotation = randrp->rotation;
|
||||||
|
DeviceIntPtr dev;
|
||||||
|
Bool view_adjusted = FALSE;
|
||||||
|
|
||||||
randrp->rotation = rotation;
|
randrp->rotation = rotation;
|
||||||
|
|
||||||
|
@ -597,7 +599,14 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
|
||||||
randrp->virtualY = scrp->virtualY;
|
randrp->virtualY = scrp->virtualY;
|
||||||
}
|
}
|
||||||
|
|
||||||
miPointerGetPosition (inputInfo.pointer, &px, &py);
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
|
{
|
||||||
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
|
||||||
|
}
|
||||||
|
|
||||||
for (mode = scrp->modes; ; mode = mode->next)
|
for (mode = scrp->modes; ; mode = mode->next)
|
||||||
{
|
{
|
||||||
if (randrp->maxX == 0 || randrp->maxY == 0)
|
if (randrp->maxX == 0 || randrp->maxY == 0)
|
||||||
|
@ -643,15 +652,28 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move the cursor back where it belongs; SwitchMode repositions it
|
* Move the cursor back where it belongs; SwitchMode repositions it
|
||||||
|
* FIXME: duplicated code, see modes/xf86RandR12.c
|
||||||
*/
|
*/
|
||||||
if (pScreen == miPointerGetScreen(inputInfo.pointer))
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
{
|
{
|
||||||
px = (px >= pScreen->width ? (pScreen->width - 1) : px);
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
|
continue;
|
||||||
|
|
||||||
xf86SetViewport(pScreen, px, py);
|
if (pScreen == miPointerGetScreen(dev)) {
|
||||||
|
int px = pos[dev->id][0];
|
||||||
|
int py = pos[dev->id][1];
|
||||||
|
|
||||||
(*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE);
|
px = (px >= pScreen->width ? (pScreen->width - 1) : px);
|
||||||
|
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
|
||||||
|
|
||||||
|
/* Setting the viewpoint makes only sense on one device */
|
||||||
|
if (!view_adjusted && IsMaster(dev)) {
|
||||||
|
xf86SetViewport(pScreen, px, py);
|
||||||
|
view_adjusted = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
(*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -317,8 +317,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
|
||||||
|
|
||||||
/* only update for VCP, otherwise we get cursor jumps when removing a
|
/* only update for VCP, otherwise we get cursor jumps when removing a
|
||||||
sprite. The second cursor is never HW rendered anyway. */
|
sprite. The second cursor is never HW rendered anyway. */
|
||||||
if (pDev == inputInfo.pointer ||
|
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
|
||||||
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
|
|
||||||
{
|
{
|
||||||
pCurs->refcnt++;
|
pCurs->refcnt++;
|
||||||
if (ScreenPriv->CurrentCursor)
|
if (ScreenPriv->CurrentCursor)
|
||||||
|
@ -386,8 +385,7 @@ xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||||
|
|
||||||
/* only update coordinate state for first sprite, otherwise we get jumps
|
/* only update coordinate state for first sprite, otherwise we get jumps
|
||||||
when removing a sprite. The second sprite is never HW rendered anyway */
|
when removing a sprite. The second sprite is never HW rendered anyway */
|
||||||
if (pDev == inputInfo.pointer ||
|
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
|
||||||
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
|
|
||||||
{
|
{
|
||||||
ScreenPriv->x = x;
|
ScreenPriv->x = x;
|
||||||
ScreenPriv->y = y;
|
ScreenPriv->y = y;
|
||||||
|
|
|
@ -570,6 +570,7 @@ extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
|
||||||
extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
|
extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
|
||||||
extern Bool IsPointerEvent(InternalEvent *event);
|
extern Bool IsPointerEvent(InternalEvent *event);
|
||||||
extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
|
extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
|
||||||
|
extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev);
|
||||||
|
|
||||||
extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
|
extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
|
||||||
extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
|
extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
|
#define FP1616(integral, frac) ((integral) * (1 << 16) + (frac) * (1 << 16))
|
||||||
|
|
||||||
_X_EXPORT int EventToCore(InternalEvent *event, xEvent *core);
|
_X_EXPORT int EventToCore(InternalEvent *event, xEvent **core, int *count);
|
||||||
_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
|
_X_EXPORT int EventToXI(InternalEvent *ev, xEvent **xi, int *count);
|
||||||
_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);
|
_X_EXPORT int EventToXI2(InternalEvent *ev, xEvent **xi);
|
||||||
_X_INTERNAL int GetCoreType(InternalEvent* ev);
|
_X_INTERNAL int GetCoreType(InternalEvent* ev);
|
||||||
|
|
|
@ -150,6 +150,11 @@ typedef void (*PointerAccelSchemeProc)(
|
||||||
typedef void (*DeviceCallbackProc)(
|
typedef void (*DeviceCallbackProc)(
|
||||||
DeviceIntPtr /*pDev*/);
|
DeviceIntPtr /*pDev*/);
|
||||||
|
|
||||||
|
struct _ValuatorAccelerationRec;
|
||||||
|
typedef Bool (*PointerAccelSchemeInitProc)(
|
||||||
|
DeviceIntPtr /*dev*/,
|
||||||
|
struct _ValuatorAccelerationRec* /*protoScheme*/);
|
||||||
|
|
||||||
typedef struct _DeviceRec {
|
typedef struct _DeviceRec {
|
||||||
pointer devicePrivate;
|
pointer devicePrivate;
|
||||||
ProcessInputProc processInputProc; /* current */
|
ProcessInputProc processInputProc; /* current */
|
||||||
|
@ -538,14 +543,15 @@ extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
|
||||||
extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
|
extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
|
||||||
WindowPtr win);
|
WindowPtr win);
|
||||||
/**
|
/**
|
||||||
* Return masks for EventIsDeliverable.
|
* Masks specifying the type of event to deliver for an InternalEvent; used
|
||||||
|
* by EventIsDeliverable.
|
||||||
* @defgroup EventIsDeliverable return flags
|
* @defgroup EventIsDeliverable return flags
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define XI_MASK (1 << 0) /**< XI mask set on window */
|
#define EVENT_XI1_MASK (1 << 0) /**< XI1.x event */
|
||||||
#define CORE_MASK (1 << 1) /**< Core mask set on window */
|
#define EVENT_CORE_MASK (1 << 1) /**< Core event */
|
||||||
#define DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set on window */
|
#define EVENT_DONT_PROPAGATE_MASK (1 << 2) /**< DontPropagate mask set */
|
||||||
#define XI2_MASK (1 << 3) /**< XI2 mask set on window */
|
#define EVENT_XI2_MASK (1 << 3) /**< XI2 mask set on window */
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
/* Implemented by the DDX. */
|
/* Implemented by the DDX. */
|
||||||
|
|
|
@ -266,6 +266,7 @@ typedef struct _ValuatorAccelerationRec {
|
||||||
int number;
|
int number;
|
||||||
PointerAccelSchemeProc AccelSchemeProc;
|
PointerAccelSchemeProc AccelSchemeProc;
|
||||||
void *accelData; /* at disposal of AccelScheme */
|
void *accelData; /* at disposal of AccelScheme */
|
||||||
|
PointerAccelSchemeInitProc AccelInitProc;
|
||||||
DeviceCallbackProc AccelCleanupProc;
|
DeviceCallbackProc AccelCleanupProc;
|
||||||
} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
|
} ValuatorAccelerationRec, *ValuatorAccelerationPtr;
|
||||||
|
|
||||||
|
@ -493,6 +494,7 @@ typedef struct _SpriteInfoRec {
|
||||||
#define MASTER_POINTER 1
|
#define MASTER_POINTER 1
|
||||||
#define MASTER_KEYBOARD 2
|
#define MASTER_KEYBOARD 2
|
||||||
#define SLAVE 3
|
#define SLAVE 3
|
||||||
|
#define MASTER_ATTACHED 4 /* special type for GetMaster */
|
||||||
|
|
||||||
typedef struct _DeviceIntRec {
|
typedef struct _DeviceIntRec {
|
||||||
DeviceRec public;
|
DeviceRec public;
|
||||||
|
@ -529,10 +531,8 @@ typedef struct _DeviceIntRec {
|
||||||
PrivateRec *devPrivates;
|
PrivateRec *devPrivates;
|
||||||
DeviceUnwrapProc unwrapProc;
|
DeviceUnwrapProc unwrapProc;
|
||||||
SpriteInfoPtr spriteInfo;
|
SpriteInfoPtr spriteInfo;
|
||||||
union {
|
DeviceIntPtr master; /* master device */
|
||||||
DeviceIntPtr master; /* master device */
|
DeviceIntPtr lastSlave; /* last slave device used */
|
||||||
DeviceIntPtr lastSlave; /* last slave device used */
|
|
||||||
} u;
|
|
||||||
|
|
||||||
/* last valuator values recorded, not posted to client;
|
/* last valuator values recorded, not posted to client;
|
||||||
* for slave devices, valuators is in device coordinates
|
* for slave devices, valuators is in device coordinates
|
||||||
|
|
182
include/list.h
182
include/list.h
|
@ -26,11 +26,102 @@
|
||||||
#ifndef _LIST_H_
|
#ifndef _LIST_H_
|
||||||
#define _LIST_H_
|
#define _LIST_H_
|
||||||
|
|
||||||
/* classic doubly-link circular list */
|
/**
|
||||||
|
* @file Classic doubly-link circular list implementation.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* We need to keep a list of struct foo in the parent struct bar, i.e. what
|
||||||
|
* we want is something like this.
|
||||||
|
*
|
||||||
|
* struct bar {
|
||||||
|
* ...
|
||||||
|
* struct foo *foos; -----> struct foo {}, struct foo {}, struct foo{}
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* We need one list head in bar and a list element in all foos (both are of
|
||||||
|
* data type 'struct list').
|
||||||
|
*
|
||||||
|
* struct bar {
|
||||||
|
* ...
|
||||||
|
* struct list foos;
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* struct foo {
|
||||||
|
* ...
|
||||||
|
* struct list entry;
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Now we initialize the list head:
|
||||||
|
*
|
||||||
|
* struct bar bar;
|
||||||
|
* ...
|
||||||
|
* list_init(&bar.foos);
|
||||||
|
*
|
||||||
|
* Then we create the first element and add it to this list:
|
||||||
|
*
|
||||||
|
* struct foo *foo = malloc(...);
|
||||||
|
* ....
|
||||||
|
* list_add(&foo->entry, &bar.foos);
|
||||||
|
*
|
||||||
|
* Repeat the above for each element you want to add to the list. Deleting
|
||||||
|
* works with the element itself.
|
||||||
|
* list_del(&foo->entry);
|
||||||
|
* free(foo);
|
||||||
|
*
|
||||||
|
* Note: calling list_del(&bar.foos) will set bar.foos to an empty
|
||||||
|
* list again.
|
||||||
|
*
|
||||||
|
* Looping through the list requires a 'struct foo' as iterator and the
|
||||||
|
* name of the field the subnodes use.
|
||||||
|
*
|
||||||
|
* struct foo *iterator;
|
||||||
|
* list_for_each_entry(iterator, &bar.foos, entry) {
|
||||||
|
* if (iterator->something == ...)
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Note: You must not call list_del() on the iterator if you continue the
|
||||||
|
* loop. You need to run the safe for-each loop instead:
|
||||||
|
*
|
||||||
|
* struct foo *iterator, *next;
|
||||||
|
* list_for_each_entry_safe(iterator, next, &bar.foos, entry) {
|
||||||
|
* if (...)
|
||||||
|
* list_del(&iterator->entry);
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The linkage struct for list nodes. This struct must be part of your
|
||||||
|
* to-be-linked struct.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo {
|
||||||
|
* int a;
|
||||||
|
* void *b;
|
||||||
|
* struct list *mylist;
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Position and name of the struct list field is irrelevant.
|
||||||
|
* There are no requirements that elements of a list are of the same type.
|
||||||
|
* There are no requirements for a list head, any struct list can be a list
|
||||||
|
* head.
|
||||||
|
*/
|
||||||
struct list {
|
struct list {
|
||||||
struct list *next, *prev;
|
struct list *next, *prev;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the list as an empty list.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* list_init(&foo->mylist);
|
||||||
|
*
|
||||||
|
* @param The list to initialized.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
list_init(struct list *list)
|
list_init(struct list *list)
|
||||||
{
|
{
|
||||||
|
@ -48,6 +139,20 @@ __list_add(struct list *entry,
|
||||||
prev->next = entry;
|
prev->next = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a new element after the given list head.
|
||||||
|
* The list changes from:
|
||||||
|
* head → some element → ...
|
||||||
|
* to
|
||||||
|
* head → new element → older element → ...
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *newfoo = malloc(...);
|
||||||
|
* list_add(&newfoo->mylist, &foo->mylist);
|
||||||
|
*
|
||||||
|
* @param entry The new element to prepend to the list.
|
||||||
|
* @param head The existing list.
|
||||||
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
list_add(struct list *entry, struct list *head)
|
list_add(struct list *entry, struct list *head)
|
||||||
{
|
{
|
||||||
|
@ -61,6 +166,20 @@ __list_del(struct list *prev, struct list *next)
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the element from the list it is in. Using this function will reset
|
||||||
|
* the pointers to/from this element so it is removed from the list. It does
|
||||||
|
* NOT free the element itself or manipulate it otherwise.
|
||||||
|
*
|
||||||
|
* Using list_del on a pure list head (like in the example at the top of
|
||||||
|
* this file) will NOT remove the first element from
|
||||||
|
* the list but rather reset the list as empty list.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* list_del(&newfoo->mylist);
|
||||||
|
*
|
||||||
|
* @param entry The element to remove.
|
||||||
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
list_del(struct list *entry)
|
list_del(struct list *entry)
|
||||||
{
|
{
|
||||||
|
@ -68,32 +187,91 @@ list_del(struct list *entry)
|
||||||
list_init(entry);
|
list_init(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the list is empty.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* list_is_empty(&foo->mylist);
|
||||||
|
*
|
||||||
|
* @return True if the list contains one or more elements or False otherwise.
|
||||||
|
*/
|
||||||
static inline Bool
|
static inline Bool
|
||||||
list_is_empty(struct list *head)
|
list_is_empty(struct list *head)
|
||||||
{
|
{
|
||||||
return head->next == head;
|
return head->next == head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a pointer to the container of this list element.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo* f;
|
||||||
|
* f = container_of(&foo->mylist, struct foo, mylist);
|
||||||
|
* assert(f == foo);
|
||||||
|
*
|
||||||
|
* @param ptr Pointer to the struct list.
|
||||||
|
* @param type Data type of the list element.
|
||||||
|
* @param member Member name of the struct list field in the list element.
|
||||||
|
* @return A pointer to the data struct containing the list head.
|
||||||
|
*/
|
||||||
#ifndef container_of
|
#ifndef container_of
|
||||||
#define container_of(ptr, type, member) \
|
#define container_of(ptr, type, member) \
|
||||||
(type *)((char *)(ptr) - (char *) &((type *)0)->member)
|
(type *)((char *)(ptr) - (char *) &((type *)0)->member)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alias of container_of
|
||||||
|
*/
|
||||||
#define list_entry(ptr, type, member) \
|
#define list_entry(ptr, type, member) \
|
||||||
container_of(ptr, type, member)
|
container_of(ptr, type, member)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the first list entry for the given list pointer.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *first;
|
||||||
|
* first = list_first_entry(&foo->mylist, struct foo, mylist);
|
||||||
|
*
|
||||||
|
* @param ptr The list head
|
||||||
|
* @param type Data type of the list element to retrieve
|
||||||
|
* @param member Member name of the struct list field in the list element.
|
||||||
|
* @return A pointer to the first list element.
|
||||||
|
*/
|
||||||
#define list_first_entry(ptr, type, member) \
|
#define list_first_entry(ptr, type, member) \
|
||||||
list_entry((ptr)->next, type, member)
|
list_entry((ptr)->next, type, member)
|
||||||
|
|
||||||
#define __container_of(ptr, sample, member) \
|
#define __container_of(ptr, sample, member) \
|
||||||
(void *)((char *)(ptr) \
|
(void *)((char *)(ptr) \
|
||||||
- ((char *)&(sample)->member - (char *)(sample)))
|
- ((char *)&(sample)->member - (char *)(sample)))
|
||||||
|
/**
|
||||||
|
* Loop through the list given by head and set pos to struct in the list.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* struct foo *iterator;
|
||||||
|
* list_for_each_entry(iterator, &foo->mylist, mylist) {
|
||||||
|
* [modify iterator]
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* This macro is not safe for node deletion. Use list_for_each_entry_safe
|
||||||
|
* instead.
|
||||||
|
*
|
||||||
|
* @param pos Iterator variable of the type of the list elements.
|
||||||
|
* @param head List head
|
||||||
|
* @param member Member name of the struct list in the list elements.
|
||||||
|
*
|
||||||
|
*/
|
||||||
#define list_for_each_entry(pos, head, member) \
|
#define list_for_each_entry(pos, head, member) \
|
||||||
for (pos = __container_of((head)->next, pos, member); \
|
for (pos = __container_of((head)->next, pos, member); \
|
||||||
&pos->member != (head); \
|
&pos->member != (head); \
|
||||||
pos = __container_of(pos->member.next, pos, member))
|
pos = __container_of(pos->member.next, pos, member))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loop through the list, keeping a backup pointer to the element. This
|
||||||
|
* macro allows for the deletion of a list element while looping through the
|
||||||
|
* list.
|
||||||
|
*
|
||||||
|
* See list_for_each_entry for more details.
|
||||||
|
*/
|
||||||
#define list_for_each_entry_safe(pos, tmp, head, member) \
|
#define list_for_each_entry_safe(pos, tmp, head, member) \
|
||||||
for (pos = __container_of((head)->next, pos, member), \
|
for (pos = __container_of((head)->next, pos, member), \
|
||||||
tmp = __container_of(pos->member.next, pos, member); \
|
tmp = __container_of(pos->member.next, pos, member); \
|
||||||
|
|
|
@ -104,10 +104,6 @@
|
||||||
#define SERVER_WINDOWSWM_MINOR_VERSION 0
|
#define SERVER_WINDOWSWM_MINOR_VERSION 0
|
||||||
#define SERVER_WINDOWSWM_PATCH_VERSION 0
|
#define SERVER_WINDOWSWM_PATCH_VERSION 0
|
||||||
|
|
||||||
/* Xcalibrate */
|
|
||||||
#define SERVER_XCALIBRATE_MAJOR_VERSION 0
|
|
||||||
#define SERVER_XCALIBRATE_MINOR_VERSION 1
|
|
||||||
|
|
||||||
/* DGA */
|
/* DGA */
|
||||||
#define SERVER_XDGA_MAJOR_VERSION 2
|
#define SERVER_XDGA_MAJOR_VERSION 2
|
||||||
#define SERVER_XDGA_MINOR_VERSION 0
|
#define SERVER_XDGA_MINOR_VERSION 0
|
||||||
|
|
|
@ -110,12 +110,6 @@ BasicComputeAcceleration(DeviceIntPtr dev, DeviceVelocityPtr vel,
|
||||||
extern _X_EXPORT void
|
extern _X_EXPORT void
|
||||||
FreeVelocityData(DeviceVelocityPtr vel);
|
FreeVelocityData(DeviceVelocityPtr vel);
|
||||||
|
|
||||||
extern _X_INTERNAL BOOL
|
|
||||||
InitializePredictableAccelerationProperties(DeviceIntPtr dev);
|
|
||||||
|
|
||||||
extern _X_INTERNAL BOOL
|
|
||||||
DeletePredictableAccelerationProperties(DeviceIntPtr dev);
|
|
||||||
|
|
||||||
extern _X_EXPORT int
|
extern _X_EXPORT int
|
||||||
SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
SetAccelerationProfile(DeviceVelocityPtr vel, int profile_num);
|
||||||
|
|
||||||
|
@ -129,6 +123,10 @@ SetDeviceSpecificAccelerationProfile(DeviceVelocityPtr vel,
|
||||||
extern _X_INTERNAL void
|
extern _X_INTERNAL void
|
||||||
AccelerationDefaultCleanup(DeviceIntPtr dev);
|
AccelerationDefaultCleanup(DeviceIntPtr dev);
|
||||||
|
|
||||||
|
extern _X_INTERNAL Bool
|
||||||
|
InitPredictableAccelerationScheme(DeviceIntPtr dev,
|
||||||
|
struct _ValuatorAccelerationRec* protoScheme);
|
||||||
|
|
||||||
extern _X_INTERNAL void
|
extern _X_INTERNAL void
|
||||||
acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
|
acceleratePointerPredictable(DeviceIntPtr dev, int first_valuator,
|
||||||
int num_valuators, int *valuators, int evtime);
|
int num_valuators, int *valuators, int evtime);
|
||||||
|
|
|
@ -846,10 +846,6 @@ extern _X_EXPORT XkbGeometryPtr XkbLookupNamedGeometry(
|
||||||
Bool * /* shouldFree */
|
Bool * /* shouldFree */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern _X_EXPORT char * _XkbDupString(
|
|
||||||
const char * /* str */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern _X_EXPORT void XkbConvertCase(
|
extern _X_EXPORT void XkbConvertCase(
|
||||||
KeySym /* sym */,
|
KeySym /* sym */,
|
||||||
KeySym * /* lower */,
|
KeySym * /* lower */,
|
||||||
|
|
|
@ -76,7 +76,7 @@ typedef struct {
|
||||||
#define miGetDCDevice(dev, screen) \
|
#define miGetDCDevice(dev, screen) \
|
||||||
((DevHasCursor(dev)) ? \
|
((DevHasCursor(dev)) ? \
|
||||||
(miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \
|
(miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \
|
||||||
(miDCBufferPtr)dixLookupScreenPrivate(&dev->u.master->devPrivates, miDCDeviceKey, screen))
|
(miDCBufferPtr)dixLookupScreenPrivate(&GetMaster(dev, MASTER_POINTER)->devPrivates, miDCDeviceKey, screen))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The core pointer buffer will point to the index of the virtual core pointer
|
* The core pointer buffer will point to the index of the virtual core pointer
|
||||||
|
|
18
mi/mieq.c
18
mi/mieq.c
|
@ -321,11 +321,12 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
|
||||||
DeviceIntPtr mdev;
|
DeviceIntPtr mdev;
|
||||||
int len = original->any.length;
|
int len = original->any.length;
|
||||||
int type = original->any.type;
|
int type = original->any.type;
|
||||||
|
int mtype; /* which master type? */
|
||||||
|
|
||||||
CHECKEVENT(original);
|
CHECKEVENT(original);
|
||||||
|
|
||||||
/* ET_XQuartz has sdev == NULL */
|
/* ET_XQuartz has sdev == NULL */
|
||||||
if (!sdev || !sdev->u.master)
|
if (!sdev || IsMaster(sdev) || IsFloating(sdev))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#if XFreeXDGA
|
#if XFreeXDGA
|
||||||
|
@ -337,20 +338,21 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
|
||||||
{
|
{
|
||||||
case ET_KeyPress:
|
case ET_KeyPress:
|
||||||
case ET_KeyRelease:
|
case ET_KeyRelease:
|
||||||
mdev = GetMaster(sdev, MASTER_KEYBOARD);
|
mtype = MASTER_KEYBOARD;
|
||||||
break;
|
break;
|
||||||
case ET_ButtonPress:
|
case ET_ButtonPress:
|
||||||
case ET_ButtonRelease:
|
case ET_ButtonRelease:
|
||||||
case ET_Motion:
|
case ET_Motion:
|
||||||
case ET_ProximityIn:
|
case ET_ProximityIn:
|
||||||
case ET_ProximityOut:
|
case ET_ProximityOut:
|
||||||
mdev = GetMaster(sdev, MASTER_POINTER);
|
mtype = MASTER_POINTER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mdev = sdev->u.master;
|
mtype = MASTER_ATTACHED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mdev = GetMaster(sdev, mtype);
|
||||||
memcpy(copy, original, len);
|
memcpy(copy, original, len);
|
||||||
ChangeDeviceID(mdev, copy);
|
ChangeDeviceID(mdev, copy);
|
||||||
FixUpEventForMaster(mdev, sdev, original, copy);
|
FixUpEventForMaster(mdev, sdev, original, copy);
|
||||||
|
@ -400,7 +402,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
|
||||||
master = CopyGetMasterEvent(dev, event, &mevent);
|
master = CopyGetMasterEvent(dev, event, &mevent);
|
||||||
|
|
||||||
if (master)
|
if (master)
|
||||||
master->u.lastSlave = dev;
|
master->lastSlave = dev;
|
||||||
|
|
||||||
/* If someone's registered a custom event handler, let them
|
/* If someone's registered a custom event handler, let them
|
||||||
* steal it. */
|
* steal it. */
|
||||||
|
@ -410,7 +412,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
|
||||||
handler(screenNum, event, dev);
|
handler(screenNum, event, dev);
|
||||||
/* Check for the SD's master in case the device got detached
|
/* Check for the SD's master in case the device got detached
|
||||||
* during event processing */
|
* during event processing */
|
||||||
if (master && dev->u.master)
|
if (master && !IsFloating(dev))
|
||||||
handler(screenNum, &mevent, master);
|
handler(screenNum, &mevent, master);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -419,7 +421,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
|
||||||
|
|
||||||
/* Check for the SD's master in case the device got detached
|
/* Check for the SD's master in case the device got detached
|
||||||
* during event processing */
|
* during event processing */
|
||||||
if (master && dev->u.master)
|
if (master && !IsFloating(dev))
|
||||||
master->public.processInputProc(&mevent, master);
|
master->public.processInputProc(&mevent, master);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,7 +468,7 @@ mieqProcessInputEvents(void)
|
||||||
pthread_mutex_unlock(&miEventQueueMutex);
|
pthread_mutex_unlock(&miEventQueueMutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
master = (dev && !IsMaster(dev) && dev->u.master) ? dev->u.master : NULL;
|
master = (dev) ? GetMaster(dev, MASTER_ATTACHED) : NULL;
|
||||||
|
|
||||||
if (screenIsSaved == SCREEN_SAVER_ON)
|
if (screenIsSaved == SCREEN_SAVER_ON)
|
||||||
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
|
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
|
||||||
|
|
196
mi/mipointer.c
196
mi/mipointer.c
|
@ -23,6 +23,29 @@ used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from The Open Group.
|
in this Software without prior written authorization from The Open Group.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* This file contains functions to move the pointer on the screen and/or
|
||||||
|
* restrict its movement. These functions are divided into two sets:
|
||||||
|
* Screen-specific functions that are used as function pointers from other
|
||||||
|
* parts of the server (and end up heavily wrapped by e.g. animcur and
|
||||||
|
* xfixes):
|
||||||
|
* miPointerConstrainCursor
|
||||||
|
* miPointerCursorLimits
|
||||||
|
* miPointerDisplayCursor
|
||||||
|
* miPointerRealizeCursor
|
||||||
|
* miPointerUnrealizeCursor
|
||||||
|
* miPointerSetCursorPosition
|
||||||
|
* miRecolorCursor
|
||||||
|
* miPointerDeviceInitialize
|
||||||
|
* miPointerDeviceCleanup
|
||||||
|
* If wrapped, these are the last element in the wrapping chain. They may
|
||||||
|
* call into sprite-specific code through further function pointers though.
|
||||||
|
*
|
||||||
|
* The second type of functions are those that are directly called by the
|
||||||
|
* DIX, DDX and some drivers.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,7 +73,7 @@ DevPrivateKeyRec miPointerScreenKeyRec;
|
||||||
DevPrivateKeyRec miPointerPrivKeyRec;
|
DevPrivateKeyRec miPointerPrivKeyRec;
|
||||||
|
|
||||||
#define MIPOINTER(dev) \
|
#define MIPOINTER(dev) \
|
||||||
((!IsMaster(dev) && !dev->u.master) ? \
|
(IsFloating(dev) ? \
|
||||||
(miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
|
(miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
|
||||||
(miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey))
|
(miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey))
|
||||||
|
|
||||||
|
@ -126,36 +149,17 @@ miPointerInitialize (ScreenPtr pScreen,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy screen-specific information.
|
||||||
|
*
|
||||||
|
* @param index Screen index of the screen in screenInfo.screens[]
|
||||||
|
* @param pScreen The actual screen pointer
|
||||||
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
miPointerCloseScreen (int index, ScreenPtr pScreen)
|
miPointerCloseScreen (int index, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
miPointerPtr pPointer;
|
|
||||||
DeviceIntPtr pDev;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SetupScreen(pScreen);
|
SetupScreen(pScreen);
|
||||||
|
|
||||||
#if 0
|
|
||||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
|
||||||
{
|
|
||||||
if (DevHasCursor(pDev))
|
|
||||||
{
|
|
||||||
pPointer = MIPOINTER(pDev);
|
|
||||||
|
|
||||||
if (pScreen == pPointer->pScreen)
|
|
||||||
pPointer->pScreen = 0;
|
|
||||||
if (pScreen == pPointer->pSpriteScreen)
|
|
||||||
pPointer->pSpriteScreen = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MIPOINTER(inputInfo.pointer)->pScreen == pScreen)
|
|
||||||
MIPOINTER(inputInfo.pointer)->pScreen = 0;
|
|
||||||
if (MIPOINTER(inputInfo.pointer)->pSpriteScreen == pScreen)
|
|
||||||
MIPOINTER(inputInfo.pointer)->pSpriteScreen = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
pScreen->CloseScreen = pScreenPriv->CloseScreen;
|
||||||
free((pointer) pScreenPriv);
|
free((pointer) pScreenPriv);
|
||||||
FreeEventList(events, GetMaximumEventsNum());
|
FreeEventList(events, GetMaximumEventsNum());
|
||||||
|
@ -189,8 +193,7 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||||
miPointerPtr pPointer;
|
miPointerPtr pPointer;
|
||||||
|
|
||||||
/* return for keyboards */
|
/* return for keyboards */
|
||||||
if ((IsMaster(pDev) && !DevHasCursor(pDev)) ||
|
if (!IsPointerDevice(pDev))
|
||||||
(!IsMaster(pDev) && pDev->u.master && !DevHasCursor(pDev->u.master)))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pPointer = MIPOINTER(pDev);
|
pPointer = MIPOINTER(pDev);
|
||||||
|
@ -201,6 +204,15 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the constraints for the given device. This function does not
|
||||||
|
* actually constrain the cursor but merely copies the given box to the
|
||||||
|
* internal constraint storage.
|
||||||
|
*
|
||||||
|
* @param pDev The device to constrain to the box
|
||||||
|
* @param pBox The rectangle to constrain the cursor to
|
||||||
|
* @param pScreen Used for copying screen confinement
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
|
miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +224,17 @@ miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
|
||||||
pPointer->confined = PointerConfinedToScreen(pDev);
|
pPointer->confined = PointerConfinedToScreen(pDev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/**
|
||||||
|
* Should calculate the box for the given cursor, based on screen and the
|
||||||
|
* confinement given. But we assume that whatever box is passed in is valid
|
||||||
|
* anyway.
|
||||||
|
*
|
||||||
|
* @param pDev The device to calculate the cursor limits for
|
||||||
|
* @param pScreen The screen the confinement happens on
|
||||||
|
* @param pCursor The screen the confinement happens on
|
||||||
|
* @param pHotBox The confinement box for the cursor
|
||||||
|
* @param[out] pTopLeftBox The new confinement box, always *pHotBox.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
|
miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
|
||||||
BoxPtr pHotBox, BoxPtr pTopLeftBox)
|
BoxPtr pHotBox, BoxPtr pTopLeftBox)
|
||||||
|
@ -220,15 +242,36 @@ miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
|
||||||
*pTopLeftBox = *pHotBox;
|
*pTopLeftBox = *pHotBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool GenerateEvent;
|
/**
|
||||||
|
* Set the device's cursor position to the x/y position on the given screen.
|
||||||
|
* Generates and event if required.
|
||||||
|
*
|
||||||
|
* This function is called from:
|
||||||
|
* - sprite init code to place onto initial position
|
||||||
|
* - the various WarpPointer implementations (core, XI, Xinerama, dmx,…)
|
||||||
|
* - during the cursor update path in CheckMotion
|
||||||
|
* - in the Xinerama part of NewCurrentScreen
|
||||||
|
* - when a RandR/RandR1.2 mode was applied (it may have moved the pointer, so
|
||||||
|
* it's set back to the original pos)
|
||||||
|
*
|
||||||
|
* @param pDev The device to move
|
||||||
|
* @param pScreen The screen the device is on
|
||||||
|
* @param x The x coordinate in per-screen coordinates
|
||||||
|
* @param y The y coordinate in per-screen coordinates
|
||||||
|
* @param generateEvent True if the pointer movement should generate an
|
||||||
|
* event.
|
||||||
|
*
|
||||||
|
* @return TRUE in all cases
|
||||||
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
|
miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
int x, int y, Bool generateEvent)
|
int x, int y, Bool generateEvent)
|
||||||
{
|
{
|
||||||
SetupScreen (pScreen);
|
SetupScreen (pScreen);
|
||||||
|
miPointerPtr pPointer = MIPOINTER(pDev);
|
||||||
|
|
||||||
|
pPointer->generateEvent = generateEvent;
|
||||||
|
|
||||||
GenerateEvent = generateEvent;
|
|
||||||
/* device dependent - must pend signal and call miPointerWarpCursor */
|
/* device dependent - must pend signal and call miPointerWarpCursor */
|
||||||
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
|
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
|
||||||
if (!generateEvent)
|
if (!generateEvent)
|
||||||
|
@ -236,9 +279,13 @@ miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up sprite information for the device.
|
/**
|
||||||
This function will be called once for each device after it is initialized
|
* Set up sprite information for the device.
|
||||||
in the DIX.
|
* This function will be called once for each device after it is initialized
|
||||||
|
* in the DIX.
|
||||||
|
*
|
||||||
|
* @param pDev The newly created device
|
||||||
|
* @param pScreen The initial sprite scree.
|
||||||
*/
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
|
miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
|
@ -261,6 +308,7 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
pPointer->confined = FALSE;
|
pPointer->confined = FALSE;
|
||||||
pPointer->x = 0;
|
pPointer->x = 0;
|
||||||
pPointer->y = 0;
|
pPointer->y = 0;
|
||||||
|
pPointer->generateEvent = FALSE;
|
||||||
|
|
||||||
if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
|
if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
|
||||||
{
|
{
|
||||||
|
@ -272,15 +320,19 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean up after device.
|
/**
|
||||||
This function will be called once before the device is freed in the DIX
|
* Clean up after device.
|
||||||
|
* This function will be called once before the device is freed in the DIX
|
||||||
|
*
|
||||||
|
* @param pDev The device to be removed from the server
|
||||||
|
* @param pScreen Current screen of the device
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
|
miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
SetupScreen(pScreen);
|
SetupScreen(pScreen);
|
||||||
|
|
||||||
if (!IsMaster(pDev) && pDev->u.master)
|
if (!IsMaster(pDev) && !IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
|
(*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
|
||||||
|
@ -289,7 +341,17 @@ miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Once signals are ignored, the WarpCursor function can call this */
|
/**
|
||||||
|
* Warp the pointer to the given position on the given screen. May generate
|
||||||
|
* an event, depending on whether we're coming from miPointerSetPosition.
|
||||||
|
*
|
||||||
|
* Once signals are ignored, the WarpCursor function can call this
|
||||||
|
*
|
||||||
|
* @param pDev The device to warp
|
||||||
|
* @param pScreen Screen to warp on
|
||||||
|
* @param x The x coordinate in per-screen coordinates
|
||||||
|
* @param y The y coordinate in per-screen coordinates
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||||
|
@ -306,7 +368,7 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||||
changedScreen = TRUE;
|
changedScreen = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GenerateEvent)
|
if (pPointer->generateEvent)
|
||||||
miPointerMove (pDev, pScreen, x, y);
|
miPointerMove (pDev, pScreen, x, y);
|
||||||
else
|
else
|
||||||
miPointerMoveNoEvent(pDev, pScreen, x, y);
|
miPointerMoveNoEvent(pDev, pScreen, x, y);
|
||||||
|
@ -322,16 +384,11 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||||
UpdateSpriteForScreen (pDev, pScreen) ;
|
UpdateSpriteForScreen (pDev, pScreen) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Pointer/CursorDisplay interface routines
|
* Syncronize the sprite with the cursor.
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* miPointerUpdateSprite
|
|
||||||
*
|
*
|
||||||
* Syncronize the sprite with the cursor - called from ProcessInputEvents
|
* @param pDev The device to sync
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
miPointerUpdateSprite (DeviceIntPtr pDev)
|
miPointerUpdateSprite (DeviceIntPtr pDev)
|
||||||
{
|
{
|
||||||
|
@ -408,6 +465,14 @@ miPointerUpdateSprite (DeviceIntPtr pDev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the device to the coordinates on the given screen.
|
||||||
|
*
|
||||||
|
* @param pDev The device to move
|
||||||
|
* @param screen_no Index of the screen to move to
|
||||||
|
* @param x The x coordinate in per-screen coordinates
|
||||||
|
* @param y The y coordinate in per-screen coordinates
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
|
miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -426,12 +491,18 @@ miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
|
||||||
pPointer->limits.y2 = pScreen->height;
|
pPointer->limits.y2 = pScreen->height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The current screen of the VCP
|
||||||
|
*/
|
||||||
ScreenPtr
|
ScreenPtr
|
||||||
miPointerCurrentScreen (void)
|
miPointerCurrentScreen (void)
|
||||||
{
|
{
|
||||||
return miPointerGetScreen(inputInfo.pointer);
|
return miPointerGetScreen(inputInfo.pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The current screen of the given device or NULL.
|
||||||
|
*/
|
||||||
ScreenPtr
|
ScreenPtr
|
||||||
miPointerGetScreen(DeviceIntPtr pDev)
|
miPointerGetScreen(DeviceIntPtr pDev)
|
||||||
{
|
{
|
||||||
|
@ -469,7 +540,7 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
* VCP, as this may cause a non-HW rendered cursor to be rendered during
|
* VCP, as this may cause a non-HW rendered cursor to be rendered during
|
||||||
* SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT.
|
* SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT.
|
||||||
*/
|
*/
|
||||||
if ((pDev == inputInfo.pointer || (!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
|
if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer
|
||||||
&& !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
|
&& !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
|
||||||
{
|
{
|
||||||
pPointer->devx = x;
|
pPointer->devx = x;
|
||||||
|
@ -483,6 +554,18 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
pPointer->pScreen = pScreen;
|
pPointer->pScreen = pScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the devices' cursor position to the given x/y position.
|
||||||
|
*
|
||||||
|
* This function is called during the pointer update path in
|
||||||
|
* GetPointerEvents and friends (and the same in the xwin DDX).
|
||||||
|
*
|
||||||
|
* @param pDev The device to move
|
||||||
|
* @param[in,out] x The x coordiante in screen coordinates (in regards to total
|
||||||
|
* desktop size)
|
||||||
|
* @param[in,out] y The y coordiante in screen coordinates (in regards to total
|
||||||
|
* desktop size)
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
|
miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
|
||||||
{
|
{
|
||||||
|
@ -536,6 +619,12 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
|
||||||
miPointerMoveNoEvent(pDev, pScreen, *x, *y);
|
miPointerMoveNoEvent(pDev, pScreen, *x, *y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current position of the device in desktop coordinates.
|
||||||
|
*
|
||||||
|
* @param x Return value for the current x coordinate in desktop coordiates.
|
||||||
|
* @param y Return value for the current y coordinate in desktop coordiates.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
|
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
|
||||||
{
|
{
|
||||||
|
@ -549,6 +638,15 @@ void darwinEvents_lock(void);
|
||||||
void darwinEvents_unlock(void);
|
void darwinEvents_unlock(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the device's pointer to the x/y coordinates on the given screen.
|
||||||
|
* This function generates and enqueues pointer events.
|
||||||
|
*
|
||||||
|
* @param pDev The device to move
|
||||||
|
* @param pScreen The screen the device is on
|
||||||
|
* @param x The x coordinate in per-screen coordinates
|
||||||
|
* @param y The y coordinate in per-screen coordinates
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,6 +44,7 @@ typedef struct {
|
||||||
Bool confined; /* pointer can't change screens */
|
Bool confined; /* pointer can't change screens */
|
||||||
int x, y; /* hot spot location */
|
int x, y; /* hot spot location */
|
||||||
int devx, devy; /* sprite position */
|
int devx, devy; /* sprite position */
|
||||||
|
Bool generateEvent; /* generate an event during warping? */
|
||||||
} miPointerRec, *miPointerPtr;
|
} miPointerRec, *miPointerPtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -143,7 +143,7 @@ typedef struct {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MISPRITE(dev) \
|
#define MISPRITE(dev) \
|
||||||
((!IsMaster(dev) && !dev->u.master) ? \
|
(IsFloating(dev) ? \
|
||||||
(miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \
|
(miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \
|
||||||
(miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey))
|
(miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey))
|
||||||
|
|
||||||
|
@ -766,7 +766,7 @@ miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
||||||
{
|
{
|
||||||
miCursorInfoPtr pCursorInfo;
|
miCursorInfoPtr pCursorInfo;
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pCursorInfo = MISPRITE(pDev);
|
pCursorInfo = MISPRITE(pDev);
|
||||||
|
@ -790,7 +790,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
|
||||||
miCursorInfoPtr pPointer;
|
miCursorInfoPtr pPointer;
|
||||||
miSpriteScreenPtr pScreenPriv;
|
miSpriteScreenPtr pScreenPriv;
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pPointer = MISPRITE(pDev);
|
pPointer = MISPRITE(pDev);
|
||||||
|
@ -848,7 +848,7 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
|
||||||
{
|
{
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pCursor = MISPRITE(pDev)->pCursor;
|
pCursor = MISPRITE(pDev)->pCursor;
|
||||||
|
@ -905,7 +905,7 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
miCursorInfoPtr pCursorInfo;
|
miCursorInfoPtr pCursorInfo;
|
||||||
|
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DamageDrawInternal (pScreen, TRUE);
|
DamageDrawInternal (pScreen, TRUE);
|
||||||
|
@ -944,7 +944,7 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
miCursorInfoPtr pCursorInfo;
|
miCursorInfoPtr pCursorInfo;
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DamageDrawInternal (pScreen, TRUE);
|
DamageDrawInternal (pScreen, TRUE);
|
||||||
|
@ -985,7 +985,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
miCursorInfoPtr pCursorInfo;
|
miCursorInfoPtr pCursorInfo;
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DamageDrawInternal (pScreen, TRUE);
|
DamageDrawInternal (pScreen, TRUE);
|
||||||
|
@ -1025,7 +1025,7 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
miCursorInfoPtr pCursorInfo;
|
miCursorInfoPtr pCursorInfo;
|
||||||
|
|
||||||
if (!IsMaster(pDev) && !pDev->u.master)
|
if (IsFloating(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pCursorInfo = MISPRITE(pDev);
|
pCursorInfo = MISPRITE(pDev);
|
||||||
|
|
|
@ -807,6 +807,7 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
|
||||||
RecordContextPtr pContext;
|
RecordContextPtr pContext;
|
||||||
RecordClientsAndProtocolPtr pRCAP;
|
RecordClientsAndProtocolPtr pRCAP;
|
||||||
int eci; /* enabled context index */
|
int eci; /* enabled context index */
|
||||||
|
int count;
|
||||||
|
|
||||||
for (eci = 0; eci < numEnabledContexts; eci++)
|
for (eci = 0; eci < numEnabledContexts; eci++)
|
||||||
{
|
{
|
||||||
|
@ -821,9 +822,11 @@ RecordADeviceEvent(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
|
||||||
/* TODO check return values */
|
/* TODO check return values */
|
||||||
if (IsMaster(pei->device))
|
if (IsMaster(pei->device))
|
||||||
{
|
{
|
||||||
xEvent xE;
|
xEvent *core_events;
|
||||||
EventToCore(pei->event, &xE);
|
EventToCore(pei->event, &core_events, &count);
|
||||||
RecordSendProtocolEvents(pRCAP, pContext, &xE, 1);
|
RecordSendProtocolEvents(pRCAP, pContext, core_events,
|
||||||
|
count);
|
||||||
|
free(core_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventToXI(pei->event, &xi_events, &count);
|
EventToXI(pei->event, &xi_events, &count);
|
||||||
|
|
68
test/input.c
68
test/input.c
|
@ -149,29 +149,32 @@ static void dix_check_grab_values(void)
|
||||||
static void dix_event_to_core(int type)
|
static void dix_event_to_core(int type)
|
||||||
{
|
{
|
||||||
DeviceEvent ev;
|
DeviceEvent ev;
|
||||||
xEvent core;
|
xEvent *core;
|
||||||
int time;
|
int time;
|
||||||
int x, y;
|
int x, y;
|
||||||
int rc;
|
int rc;
|
||||||
int state;
|
int state;
|
||||||
int detail;
|
int detail;
|
||||||
|
int count;
|
||||||
const int ROOT_WINDOW_ID = 0x100;
|
const int ROOT_WINDOW_ID = 0x100;
|
||||||
|
|
||||||
/* EventToCore memsets the event to 0 */
|
/* EventToCore memsets the event to 0 */
|
||||||
#define test_event() \
|
#define test_event() \
|
||||||
g_assert(rc == Success); \
|
g_assert(rc == Success); \
|
||||||
g_assert(core.u.u.type == type); \
|
g_assert(core); \
|
||||||
g_assert(core.u.u.detail == detail); \
|
g_assert(count == 1); \
|
||||||
g_assert(core.u.keyButtonPointer.time == time); \
|
g_assert(core->u.u.type == type); \
|
||||||
g_assert(core.u.keyButtonPointer.rootX == x); \
|
g_assert(core->u.u.detail == detail); \
|
||||||
g_assert(core.u.keyButtonPointer.rootY == y); \
|
g_assert(core->u.keyButtonPointer.time == time); \
|
||||||
g_assert(core.u.keyButtonPointer.state == state); \
|
g_assert(core->u.keyButtonPointer.rootX == x); \
|
||||||
g_assert(core.u.keyButtonPointer.eventX == 0); \
|
g_assert(core->u.keyButtonPointer.rootY == y); \
|
||||||
g_assert(core.u.keyButtonPointer.eventY == 0); \
|
g_assert(core->u.keyButtonPointer.state == state); \
|
||||||
g_assert(core.u.keyButtonPointer.root == ROOT_WINDOW_ID); \
|
g_assert(core->u.keyButtonPointer.eventX == 0); \
|
||||||
g_assert(core.u.keyButtonPointer.event == 0); \
|
g_assert(core->u.keyButtonPointer.eventY == 0); \
|
||||||
g_assert(core.u.keyButtonPointer.child == 0); \
|
g_assert(core->u.keyButtonPointer.root == ROOT_WINDOW_ID); \
|
||||||
g_assert(core.u.keyButtonPointer.sameScreen == FALSE);
|
g_assert(core->u.keyButtonPointer.event == 0); \
|
||||||
|
g_assert(core->u.keyButtonPointer.child == 0); \
|
||||||
|
g_assert(core->u.keyButtonPointer.sameScreen == FALSE);
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
@ -192,30 +195,33 @@ static void dix_event_to_core(int type)
|
||||||
|
|
||||||
ev.type = type;
|
ev.type = type;
|
||||||
ev.detail.key = 0;
|
ev.detail.key = 0;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
x = 1;
|
x = 1;
|
||||||
y = 2;
|
y = 2;
|
||||||
ev.root_x = x;
|
ev.root_x = x;
|
||||||
ev.root_y = y;
|
ev.root_y = y;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
x = 0x7FFF;
|
x = 0x7FFF;
|
||||||
y = 0x7FFF;
|
y = 0x7FFF;
|
||||||
ev.root_x = x;
|
ev.root_x = x;
|
||||||
ev.root_y = y;
|
ev.root_y = y;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
x = 0x8000; /* too high */
|
x = 0x8000; /* too high */
|
||||||
y = 0x8000; /* too high */
|
y = 0x8000; /* too high */
|
||||||
ev.root_x = x;
|
ev.root_x = x;
|
||||||
ev.root_y = y;
|
ev.root_y = y;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
g_assert(core.u.keyButtonPointer.rootX != x);
|
g_assert(rc == Success);
|
||||||
g_assert(core.u.keyButtonPointer.rootY != y);
|
g_assert(core);
|
||||||
|
g_assert(count == 1);
|
||||||
|
g_assert(core->u.keyButtonPointer.rootX != x);
|
||||||
|
g_assert(core->u.keyButtonPointer.rootY != y);
|
||||||
|
|
||||||
x = 0x7FFF;
|
x = 0x7FFF;
|
||||||
y = 0x7FFF;
|
y = 0x7FFF;
|
||||||
|
@ -223,36 +229,39 @@ static void dix_event_to_core(int type)
|
||||||
ev.root_y = y;
|
ev.root_y = y;
|
||||||
time = 0;
|
time = 0;
|
||||||
ev.time = time;
|
ev.time = time;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
detail = 1;
|
detail = 1;
|
||||||
ev.detail.key = detail;
|
ev.detail.key = detail;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
detail = 0xFF; /* highest value */
|
detail = 0xFF; /* highest value */
|
||||||
ev.detail.key = detail;
|
ev.detail.key = detail;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
detail = 0xFFF; /* too big */
|
detail = 0xFFF; /* too big */
|
||||||
ev.detail.key = detail;
|
ev.detail.key = detail;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
g_assert(rc == BadMatch);
|
g_assert(rc == BadMatch);
|
||||||
|
|
||||||
detail = 0xFF; /* too big */
|
detail = 0xFF; /* too big */
|
||||||
ev.detail.key = detail;
|
ev.detail.key = detail;
|
||||||
state = 0xFFFF; /* highest value */
|
state = 0xFFFF; /* highest value */
|
||||||
ev.corestate = state;
|
ev.corestate = state;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
test_event();
|
test_event();
|
||||||
|
|
||||||
state = 0x10000; /* too big */
|
state = 0x10000; /* too big */
|
||||||
ev.corestate = state;
|
ev.corestate = state;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
g_assert(core.u.keyButtonPointer.state != state);
|
g_assert(rc == Success);
|
||||||
g_assert(core.u.keyButtonPointer.state == (state & 0xFFFF));
|
g_assert(core);
|
||||||
|
g_assert(count == 1);
|
||||||
|
g_assert(core->u.keyButtonPointer.state != state);
|
||||||
|
g_assert(core->u.keyButtonPointer.state == (state & 0xFFFF));
|
||||||
|
|
||||||
#undef test_event
|
#undef test_event
|
||||||
}
|
}
|
||||||
|
@ -260,14 +269,15 @@ static void dix_event_to_core(int type)
|
||||||
static void dix_event_to_core_fail(int evtype, int expected_rc)
|
static void dix_event_to_core_fail(int evtype, int expected_rc)
|
||||||
{
|
{
|
||||||
DeviceEvent ev;
|
DeviceEvent ev;
|
||||||
xEvent core;
|
xEvent *core;
|
||||||
int rc;
|
int rc;
|
||||||
|
int count;
|
||||||
|
|
||||||
ev.header = 0xFF;
|
ev.header = 0xFF;
|
||||||
ev.length = sizeof(DeviceEvent);
|
ev.length = sizeof(DeviceEvent);
|
||||||
|
|
||||||
ev.type = evtype;
|
ev.type = evtype;
|
||||||
rc = EventToCore((InternalEvent*)&ev, &core);
|
rc = EventToCore((InternalEvent*)&ev, &core, &count);
|
||||||
g_assert(rc == expected_rc);
|
g_assert(rc == expected_rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ static void test_XIQueryPointer(void)
|
||||||
request_XIQueryPointer(&client_request, &request, BadDevice);
|
request_XIQueryPointer(&client_request, &request, BadDevice);
|
||||||
|
|
||||||
test_data.dev = devices.mouse;
|
test_data.dev = devices.mouse;
|
||||||
devices.mouse->u.master = NULL; /* Float, kind-of */
|
devices.mouse->master = NULL; /* Float, kind-of */
|
||||||
request.deviceid = devices.mouse->id;
|
request.deviceid = devices.mouse->id;
|
||||||
request_XIQueryPointer(&client_request, &request, Success);
|
request_XIQueryPointer(&client_request, &request, Success);
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ static void test_XIWarpPointer(void)
|
||||||
request.deviceid = devices.kbd->id;
|
request.deviceid = devices.kbd->id;
|
||||||
request_XIWarpPointer(&client_request, &request, BadDevice);
|
request_XIWarpPointer(&client_request, &request, BadDevice);
|
||||||
|
|
||||||
devices.mouse->u.master = NULL; /* Float, kind-of */
|
devices.mouse->master = NULL; /* Float, kind-of */
|
||||||
request.deviceid = devices.mouse->id;
|
request.deviceid = devices.mouse->id;
|
||||||
request_XIWarpPointer(&client_request, &request, Success);
|
request_XIWarpPointer(&client_request, &request, Success);
|
||||||
|
|
||||||
|
|
|
@ -647,9 +647,7 @@ register XkbPropertyPtr prop;
|
||||||
for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
|
for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
|
||||||
if ((prop->name)&&(strcmp(name,prop->name)==0)) {
|
if ((prop->name)&&(strcmp(name,prop->name)==0)) {
|
||||||
free(prop->value);
|
free(prop->value);
|
||||||
prop->value= malloc(strlen(value)+1);
|
prop->value= strdup(value);
|
||||||
if (prop->value)
|
|
||||||
strcpy(prop->value,value);
|
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -658,17 +656,15 @@ register XkbPropertyPtr prop;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
prop= &geom->properties[geom->num_properties];
|
prop= &geom->properties[geom->num_properties];
|
||||||
prop->name= malloc(strlen(name)+1);
|
prop->name= strdup(name);
|
||||||
if (!name)
|
if (!prop->name)
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpy(prop->name,name);
|
prop->value= strdup(value);
|
||||||
prop->value= malloc(strlen(value)+1);
|
if (!prop->value) {
|
||||||
if (!value) {
|
|
||||||
free(prop->name);
|
free(prop->name);
|
||||||
prop->name= NULL;
|
prop->name= NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
strcpy(prop->value,value);
|
|
||||||
geom->num_properties++;
|
geom->num_properties++;
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
@ -720,10 +716,9 @@ register XkbColorPtr color;
|
||||||
}
|
}
|
||||||
color= &geom->colors[geom->num_colors];
|
color= &geom->colors[geom->num_colors];
|
||||||
color->pixel= pixel;
|
color->pixel= pixel;
|
||||||
color->spec= malloc(strlen(spec)+1);
|
color->spec= strdup(spec);
|
||||||
if (!color->spec)
|
if (!color->spec)
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpy(color->spec,spec);
|
|
||||||
geom->num_colors++;
|
geom->num_colors++;
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,15 +303,16 @@ FILE * file;
|
||||||
&&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
|
&&(!isalpha(xkm_output_dir[0]) || xkm_output_dir[1]!=':')
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
if (strlen(XkbBaseDirectory)+strlen(xkm_output_dir)
|
if (snprintf(buf, PATH_MAX, "%s/%s%s.xkm", XkbBaseDirectory,
|
||||||
+strlen(mapName)+6 <= PATH_MAX)
|
xkm_output_dir, mapName) >= PATH_MAX)
|
||||||
{
|
buf[0] = '\0';
|
||||||
sprintf(buf,"%s/%s%s.xkm",XkbBaseDirectory,
|
}
|
||||||
xkm_output_dir,mapName);
|
else
|
||||||
}
|
{
|
||||||
|
if (snprintf(buf, PATH_MAX, "%s%s.xkm", xkm_output_dir, mapName)
|
||||||
|
>= PATH_MAX)
|
||||||
|
buf[0] = '\0';
|
||||||
}
|
}
|
||||||
else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
|
|
||||||
sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
|
|
||||||
if (buf[0] != '\0')
|
if (buf[0] != '\0')
|
||||||
file= fopen(buf,"rb");
|
file= fopen(buf,"rb");
|
||||||
else file= NULL;
|
else file= NULL;
|
||||||
|
@ -388,11 +389,11 @@ XkbRF_RulesPtr rules;
|
||||||
if (!rules_name)
|
if (!rules_name)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (strlen(XkbBaseDirectory) + strlen(rules_name) + 8 > PATH_MAX) {
|
if (snprintf(buf, PATH_MAX, "%s/rules/%s", XkbBaseDirectory, rules_name)
|
||||||
|
>= PATH_MAX) {
|
||||||
LogMessage(X_ERROR, "XKB: Rules name is too long\n");
|
LogMessage(X_ERROR, "XKB: Rules name is too long\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
sprintf(buf,"%s/rules/%s", XkbBaseDirectory, rules_name);
|
|
||||||
|
|
||||||
file = fopen(buf, "r");
|
file = fopen(buf, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
|
|
@ -391,8 +391,8 @@ Bool append = FALSE;
|
||||||
}
|
}
|
||||||
if (*words == '\0')
|
if (*words == '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
group->name = _XkbDupString(gname);
|
group->name = Xstrdup(gname);
|
||||||
group->words = _XkbDupString(words);
|
group->words = Xstrdup(words);
|
||||||
for (i = 1, words = group->words; *words; words++) {
|
for (i = 1, words = group->words; *words; words++) {
|
||||||
if ( *words == ' ') {
|
if ( *words == ' ') {
|
||||||
*words++ = '\0';
|
*words++ = '\0';
|
||||||
|
@ -443,16 +443,16 @@ Bool append = FALSE;
|
||||||
rule->flags|= XkbRF_Append;
|
rule->flags|= XkbRF_Append;
|
||||||
else
|
else
|
||||||
rule->flags|= XkbRF_Normal;
|
rule->flags|= XkbRF_Normal;
|
||||||
rule->model= _XkbDupString(tmp.name[MODEL]);
|
rule->model= Xstrdup(tmp.name[MODEL]);
|
||||||
rule->layout= _XkbDupString(tmp.name[LAYOUT]);
|
rule->layout= Xstrdup(tmp.name[LAYOUT]);
|
||||||
rule->variant= _XkbDupString(tmp.name[VARIANT]);
|
rule->variant= Xstrdup(tmp.name[VARIANT]);
|
||||||
rule->option= _XkbDupString(tmp.name[OPTION]);
|
rule->option= Xstrdup(tmp.name[OPTION]);
|
||||||
|
|
||||||
rule->keycodes= _XkbDupString(tmp.name[KEYCODES]);
|
rule->keycodes= Xstrdup(tmp.name[KEYCODES]);
|
||||||
rule->symbols= _XkbDupString(tmp.name[SYMBOLS]);
|
rule->symbols= Xstrdup(tmp.name[SYMBOLS]);
|
||||||
rule->types= _XkbDupString(tmp.name[TYPES]);
|
rule->types= Xstrdup(tmp.name[TYPES]);
|
||||||
rule->compat= _XkbDupString(tmp.name[COMPAT]);
|
rule->compat= Xstrdup(tmp.name[COMPAT]);
|
||||||
rule->geometry= _XkbDupString(tmp.name[GEOMETRY]);
|
rule->geometry= Xstrdup(tmp.name[GEOMETRY]);
|
||||||
|
|
||||||
rule->layout_num = rule->variant_num = 0;
|
rule->layout_num = rule->variant_num = 0;
|
||||||
for (i = 0; i < nread; i++) {
|
for (i = 0; i < nread; i++) {
|
||||||
|
@ -497,7 +497,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
|
||||||
|
|
||||||
memset((char *)mdefs, 0, sizeof(XkbRF_MultiDefsRec));
|
memset((char *)mdefs, 0, sizeof(XkbRF_MultiDefsRec));
|
||||||
mdefs->model = defs->model;
|
mdefs->model = defs->model;
|
||||||
mdefs->options = _XkbDupString(defs->options);
|
mdefs->options = Xstrdup(defs->options);
|
||||||
if (mdefs->options) squeeze_spaces(mdefs->options);
|
if (mdefs->options) squeeze_spaces(mdefs->options);
|
||||||
|
|
||||||
if (defs->layout) {
|
if (defs->layout) {
|
||||||
|
@ -506,7 +506,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
|
||||||
} else {
|
} else {
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
mdefs->layout[1] = _XkbDupString(defs->layout);
|
mdefs->layout[1] = Xstrdup(defs->layout);
|
||||||
if (mdefs->layout[1] == NULL)
|
if (mdefs->layout[1] == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
squeeze_spaces(mdefs->layout[1]);
|
squeeze_spaces(mdefs->layout[1]);
|
||||||
|
@ -530,7 +530,7 @@ MakeMultiDefs(XkbRF_MultiDefsPtr mdefs, XkbRF_VarDefsPtr defs)
|
||||||
} else {
|
} else {
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
mdefs->variant[1] = _XkbDupString(defs->variant);
|
mdefs->variant[1] = Xstrdup(defs->variant);
|
||||||
if (mdefs->variant[1] == NULL)
|
if (mdefs->variant[1] == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
squeeze_spaces(mdefs->variant[1]);
|
squeeze_spaces(mdefs->variant[1]);
|
||||||
|
@ -566,7 +566,7 @@ Apply(char *src, char **dst)
|
||||||
*dst= _Concat(*dst, src);
|
*dst= _Concat(*dst, src);
|
||||||
} else {
|
} else {
|
||||||
if (*dst == NULL)
|
if (*dst == NULL)
|
||||||
*dst= _XkbDupString(src);
|
*dst= Xstrdup(src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -945,9 +945,8 @@ Bool ok;
|
||||||
if ((!base)||(!rules))
|
if ((!base)||(!rules))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (locale) {
|
if (locale) {
|
||||||
if (strlen(base)+strlen(locale)+2 > PATH_MAX)
|
if (snprintf(buf, PATH_MAX, "%s-%s", base, locale) >= PATH_MAX)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
sprintf(buf,"%s-%s", base, locale);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (strlen(base)+1 > PATH_MAX)
|
if (strlen(base)+1 > PATH_MAX)
|
||||||
|
|
18
xkb/xkb.c
18
xkb/xkb.c
|
@ -5619,17 +5619,17 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
else fwant= stuff->want|stuff->need;
|
else fwant= stuff->want|stuff->need;
|
||||||
if ((!names.compat)&&
|
if ((!names.compat)&&
|
||||||
(fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
|
(fwant&(XkbGBN_CompatMapMask|XkbGBN_IndicatorMapMask))) {
|
||||||
names.compat= _XkbDupString("%");
|
names.compat= Xstrdup("%");
|
||||||
}
|
}
|
||||||
if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
|
if ((!names.types)&&(fwant&(XkbGBN_TypesMask))) {
|
||||||
names.types= _XkbDupString("%");
|
names.types= Xstrdup("%");
|
||||||
}
|
}
|
||||||
if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
|
if ((!names.symbols)&&(fwant&XkbGBN_SymbolsMask)) {
|
||||||
names.symbols= _XkbDupString("%");
|
names.symbols= Xstrdup("%");
|
||||||
}
|
}
|
||||||
geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
|
geom_changed= ((names.geometry!=NULL)&&(strcmp(names.geometry,"%")!=0));
|
||||||
if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
|
if ((!names.geometry)&&(fwant&XkbGBN_GeometryMask)) {
|
||||||
names.geometry= _XkbDupString("%");
|
names.geometry= Xstrdup("%");
|
||||||
geom_changed= FALSE;
|
geom_changed= FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5883,12 +5883,10 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
nkn.changed|= XkbNKN_GeometryMask;
|
nkn.changed|= XkbNKN_GeometryMask;
|
||||||
XkbSendNewKeyboardNotify(dev,&nkn);
|
XkbSendNewKeyboardNotify(dev,&nkn);
|
||||||
|
|
||||||
if (!IsMaster(dev) && dev->u.master)
|
if (!IsMaster(dev)) {
|
||||||
{
|
DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
|
||||||
DeviceIntPtr master = dev->u.master;
|
if (master && master->lastSlave == dev) {
|
||||||
if (master->u.lastSlave == dev)
|
XkbCopyDeviceKeymap(master, dev);
|
||||||
{
|
|
||||||
XkbCopyDeviceKeymap(dev->u.master, dev);
|
|
||||||
XkbSendNewKeyboardNotify(dev,&nkn);
|
XkbSendNewKeyboardNotify(dev,&nkn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -694,7 +694,7 @@ ProcessInputProc backupproc;
|
||||||
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
|
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
|
||||||
DeviceEvent *event = &ev->device_event;
|
DeviceEvent *event = &ev->device_event;
|
||||||
|
|
||||||
dev = (IsMaster(mouse) || mouse->u.master) ? GetMaster(mouse, MASTER_KEYBOARD) : mouse;
|
dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
|
||||||
|
|
||||||
if (dev && dev->key)
|
if (dev && dev->key)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1365,9 +1365,9 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat
|
||||||
|
|
||||||
if (IsMaster(dev)) {
|
if (IsMaster(dev)) {
|
||||||
mpointer = GetMaster(dev, MASTER_POINTER);
|
mpointer = GetMaster(dev, MASTER_POINTER);
|
||||||
lastSlave = mpointer->u.lastSlave;
|
lastSlave = mpointer->lastSlave;
|
||||||
ptr = GetXTestDevice(mpointer);
|
ptr = GetXTestDevice(mpointer);
|
||||||
} else if (!dev->u.master)
|
} else if (IsFloating(dev))
|
||||||
ptr = dev;
|
ptr = dev;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
@ -1397,7 +1397,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
|
||||||
int gpe_flags = 0;
|
int gpe_flags = 0;
|
||||||
|
|
||||||
/* ignore attached SDs */
|
/* ignore attached SDs */
|
||||||
if (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) != NULL)
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
|
if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
|
||||||
|
@ -1427,7 +1427,7 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
|
||||||
if (IsMaster(dev)) {
|
if (IsMaster(dev)) {
|
||||||
DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER);
|
DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER);
|
||||||
ptr = GetXTestDevice(mpointer);
|
ptr = GetXTestDevice(mpointer);
|
||||||
} else if (!dev->u.master)
|
} else if (IsFloating(dev))
|
||||||
ptr = dev;
|
ptr = dev;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -221,15 +221,15 @@ static void
|
||||||
XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
|
XkbSetRulesUsed(XkbRMLVOSet *rmlvo)
|
||||||
{
|
{
|
||||||
free(XkbRulesUsed);
|
free(XkbRulesUsed);
|
||||||
XkbRulesUsed= (rmlvo->rules?_XkbDupString(rmlvo->rules):NULL);
|
XkbRulesUsed= (rmlvo->rules?Xstrdup(rmlvo->rules):NULL);
|
||||||
free(XkbModelUsed);
|
free(XkbModelUsed);
|
||||||
XkbModelUsed= (rmlvo->model?_XkbDupString(rmlvo->model):NULL);
|
XkbModelUsed= (rmlvo->model?Xstrdup(rmlvo->model):NULL);
|
||||||
free(XkbLayoutUsed);
|
free(XkbLayoutUsed);
|
||||||
XkbLayoutUsed= (rmlvo->layout?_XkbDupString(rmlvo->layout):NULL);
|
XkbLayoutUsed= (rmlvo->layout?Xstrdup(rmlvo->layout):NULL);
|
||||||
free(XkbVariantUsed);
|
free(XkbVariantUsed);
|
||||||
XkbVariantUsed= (rmlvo->variant?_XkbDupString(rmlvo->variant):NULL);
|
XkbVariantUsed= (rmlvo->variant?Xstrdup(rmlvo->variant):NULL);
|
||||||
free(XkbOptionsUsed);
|
free(XkbOptionsUsed);
|
||||||
XkbOptionsUsed= (rmlvo->options?_XkbDupString(rmlvo->options):NULL);
|
XkbOptionsUsed= (rmlvo->options?Xstrdup(rmlvo->options):NULL);
|
||||||
if (XkbWantRulesProp)
|
if (XkbWantRulesProp)
|
||||||
QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
|
QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
|
||||||
return;
|
return;
|
||||||
|
@ -240,23 +240,23 @@ XkbSetRulesDflts(XkbRMLVOSet *rmlvo)
|
||||||
{
|
{
|
||||||
if (rmlvo->rules) {
|
if (rmlvo->rules) {
|
||||||
free(XkbRulesDflt);
|
free(XkbRulesDflt);
|
||||||
XkbRulesDflt= _XkbDupString(rmlvo->rules);
|
XkbRulesDflt= Xstrdup(rmlvo->rules);
|
||||||
}
|
}
|
||||||
if (rmlvo->model) {
|
if (rmlvo->model) {
|
||||||
free(XkbModelDflt);
|
free(XkbModelDflt);
|
||||||
XkbModelDflt= _XkbDupString(rmlvo->model);
|
XkbModelDflt= Xstrdup(rmlvo->model);
|
||||||
}
|
}
|
||||||
if (rmlvo->layout) {
|
if (rmlvo->layout) {
|
||||||
free(XkbLayoutDflt);
|
free(XkbLayoutDflt);
|
||||||
XkbLayoutDflt= _XkbDupString(rmlvo->layout);
|
XkbLayoutDflt= Xstrdup(rmlvo->layout);
|
||||||
}
|
}
|
||||||
if (rmlvo->variant) {
|
if (rmlvo->variant) {
|
||||||
free(XkbVariantDflt);
|
free(XkbVariantDflt);
|
||||||
XkbVariantDflt= _XkbDupString(rmlvo->variant);
|
XkbVariantDflt= Xstrdup(rmlvo->variant);
|
||||||
}
|
}
|
||||||
if (rmlvo->options) {
|
if (rmlvo->options) {
|
||||||
free(XkbOptionsDflt);
|
free(XkbOptionsDflt);
|
||||||
XkbOptionsDflt= _XkbDupString(rmlvo->options);
|
XkbOptionsDflt= Xstrdup(rmlvo->options);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ unsigned wantNames,wantConfig,wantDflts;
|
||||||
if (wantNames&XkmTypesMask) {
|
if (wantNames&XkmTypesMask) {
|
||||||
if (old_names->types!=None) {
|
if (old_names->types!=None) {
|
||||||
tmp= NameForAtom(old_names->types);
|
tmp= NameForAtom(old_names->types);
|
||||||
names->types= _XkbDupString(tmp);
|
names->types= Xstrdup(tmp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
wantDflts|= XkmTypesMask;
|
wantDflts|= XkmTypesMask;
|
||||||
|
@ -251,7 +251,7 @@ unsigned wantNames,wantConfig,wantDflts;
|
||||||
if (wantNames&XkmCompatMapMask) {
|
if (wantNames&XkmCompatMapMask) {
|
||||||
if (old_names->compat!=None) {
|
if (old_names->compat!=None) {
|
||||||
tmp= NameForAtom(old_names->compat);
|
tmp= NameForAtom(old_names->compat);
|
||||||
names->compat= _XkbDupString(tmp);
|
names->compat= Xstrdup(tmp);
|
||||||
}
|
}
|
||||||
else wantDflts|= XkmCompatMapMask;
|
else wantDflts|= XkmCompatMapMask;
|
||||||
complete|= XkmCompatMapMask;
|
complete|= XkmCompatMapMask;
|
||||||
|
@ -260,13 +260,13 @@ unsigned wantNames,wantConfig,wantDflts;
|
||||||
if (old_names->symbols==None)
|
if (old_names->symbols==None)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
tmp= NameForAtom(old_names->symbols);
|
tmp= NameForAtom(old_names->symbols);
|
||||||
names->symbols= _XkbDupString(tmp);
|
names->symbols= Xstrdup(tmp);
|
||||||
complete|= XkmSymbolsMask;
|
complete|= XkmSymbolsMask;
|
||||||
}
|
}
|
||||||
if (wantNames&XkmKeyNamesMask) {
|
if (wantNames&XkmKeyNamesMask) {
|
||||||
if (old_names->keycodes!=None) {
|
if (old_names->keycodes!=None) {
|
||||||
tmp= NameForAtom(old_names->keycodes);
|
tmp= NameForAtom(old_names->keycodes);
|
||||||
names->keycodes= _XkbDupString(tmp);
|
names->keycodes= Xstrdup(tmp);
|
||||||
}
|
}
|
||||||
else wantDflts|= XkmKeyNamesMask;
|
else wantDflts|= XkmKeyNamesMask;
|
||||||
complete|= XkmKeyNamesMask;
|
complete|= XkmKeyNamesMask;
|
||||||
|
@ -275,7 +275,7 @@ unsigned wantNames,wantConfig,wantDflts;
|
||||||
if (old_names->geometry==None)
|
if (old_names->geometry==None)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
tmp= NameForAtom(old_names->geometry);
|
tmp= NameForAtom(old_names->geometry);
|
||||||
names->geometry= _XkbDupString(tmp);
|
names->geometry= Xstrdup(tmp);
|
||||||
complete|= XkmGeometryMask;
|
complete|= XkmGeometryMask;
|
||||||
wantNames&= ~XkmGeometryMask;
|
wantNames&= ~XkmGeometryMask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,19 +51,6 @@ XkbInternAtom(char *str,Bool only_if_exists)
|
||||||
return MakeAtom(str,strlen(str),!only_if_exists);
|
return MakeAtom(str,strlen(str),!only_if_exists);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
|
||||||
_XkbDupString(const char *str)
|
|
||||||
{
|
|
||||||
char *new;
|
|
||||||
|
|
||||||
if (str==NULL)
|
|
||||||
return NULL;
|
|
||||||
new= calloc(strlen(str)+1,sizeof(char));
|
|
||||||
if (new)
|
|
||||||
strcpy(new,str);
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -845,9 +832,9 @@ int nRead=0;
|
||||||
doodad->text.height= doodadWire.text.height;
|
doodad->text.height= doodadWire.text.height;
|
||||||
doodad->text.color_ndx= doodadWire.text.color_ndx;
|
doodad->text.color_ndx= doodadWire.text.color_ndx;
|
||||||
nRead+= XkmGetCountedString(file,buf,100);
|
nRead+= XkmGetCountedString(file,buf,100);
|
||||||
doodad->text.text= _XkbDupString(buf);
|
doodad->text.text= Xstrdup(buf);
|
||||||
nRead+= XkmGetCountedString(file,buf,100);
|
nRead+= XkmGetCountedString(file,buf,100);
|
||||||
doodad->text.font= _XkbDupString(buf);
|
doodad->text.font= Xstrdup(buf);
|
||||||
break;
|
break;
|
||||||
case XkbIndicatorDoodad:
|
case XkbIndicatorDoodad:
|
||||||
doodad->indicator.shape_ndx= doodadWire.indicator.shape_ndx;
|
doodad->indicator.shape_ndx= doodadWire.indicator.shape_ndx;
|
||||||
|
@ -859,7 +846,7 @@ int nRead=0;
|
||||||
doodad->logo.color_ndx= doodadWire.logo.color_ndx;
|
doodad->logo.color_ndx= doodadWire.logo.color_ndx;
|
||||||
doodad->logo.shape_ndx= doodadWire.logo.shape_ndx;
|
doodad->logo.shape_ndx= doodadWire.logo.shape_ndx;
|
||||||
nRead+= XkmGetCountedString(file,buf,100);
|
nRead+= XkmGetCountedString(file,buf,100);
|
||||||
doodad->logo.logo_name= _XkbDupString(buf);
|
doodad->logo.logo_name= Xstrdup(buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* report error? */
|
/* report error? */
|
||||||
|
@ -1021,7 +1008,7 @@ XkbGeometrySizesRec sizes;
|
||||||
geom->width_mm= wireGeom.width_mm;
|
geom->width_mm= wireGeom.width_mm;
|
||||||
geom->height_mm= wireGeom.height_mm;
|
geom->height_mm= wireGeom.height_mm;
|
||||||
nRead+= XkmGetCountedString(file,buf,100);
|
nRead+= XkmGetCountedString(file,buf,100);
|
||||||
geom->label_font= _XkbDupString(buf);
|
geom->label_font= Xstrdup(buf);
|
||||||
if (wireGeom.num_properties>0) {
|
if (wireGeom.num_properties>0) {
|
||||||
char val[1024];
|
char val[1024];
|
||||||
for (i=0;i<wireGeom.num_properties;i++) {
|
for (i=0;i<wireGeom.num_properties;i++) {
|
||||||
|
|
Loading…
Reference in New Issue