2003-11-14 16:54:54 +01:00
|
|
|
/*
|
2003-11-14 17:49:22 +01:00
|
|
|
* Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
|
|
|
* 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 Frederic Lepied not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
* specific, written prior permission. Frederic Lepied makes no
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
2003-11-25 20:29:01 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2000-2002 by The XFree86 Project, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of the copyright holder(s)
|
|
|
|
* and author(s) shall not be used in advertising or otherwise to promote
|
|
|
|
* the sale, use or other dealings in this Software without prior written
|
|
|
|
* authorization from the copyright holder(s) and author(s).
|
|
|
|
*/
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/Xfuncproto.h>
|
|
|
|
#include <X11/Xmd.h>
|
|
|
|
#include <X11/extensions/XI.h>
|
|
|
|
#include <X11/extensions/XIproto.h>
|
2008-11-25 05:12:02 +01:00
|
|
|
#include <X11/Xatom.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "xf86.h"
|
|
|
|
#include "xf86Priv.h"
|
|
|
|
#include "xf86Xinput.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "XIstubs.h"
|
2006-07-21 21:23:37 +02:00
|
|
|
#include "xf86Optrec.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "mipointer.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "xf86InPriv.h"
|
2008-10-22 05:30:35 +02:00
|
|
|
#include "compiler.h"
|
2008-10-26 11:16:05 +01:00
|
|
|
#include "extinit.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
#ifdef DPMSExtension
|
2009-07-15 08:51:05 +02:00
|
|
|
#include <X11/extensions/dpmsconst.h>
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "dpmsproc.h"
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "exevents.h" /* AddInputDevice */
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "exglobals.h"
|
2009-07-27 08:54:33 +02:00
|
|
|
#include "eventstr.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
#include "extnsionst.h"
|
|
|
|
|
|
|
|
#include "windowstr.h" /* screenIsSaved */
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/Xpoll.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-10-08 19:34:32 +02:00
|
|
|
#include "mi.h"
|
|
|
|
|
2008-07-10 15:03:39 +02:00
|
|
|
#include <ptrveloc.h> /* dix pointer acceleration */
|
2008-11-25 05:12:02 +01:00
|
|
|
#include <xserver-properties.h>
|
2008-07-10 15:03:39 +02:00
|
|
|
|
2007-03-20 23:12:02 +01:00
|
|
|
#ifdef XFreeXDGA
|
|
|
|
#include "dgaproc.h"
|
|
|
|
#endif
|
|
|
|
|
2008-10-26 11:16:05 +01:00
|
|
|
#include "xkbsrv.h"
|
|
|
|
|
2008-08-10 23:07:46 +02:00
|
|
|
#include "os.h"
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
EventListPtr xf86Events = NULL;
|
2006-08-10 13:00:14 +02:00
|
|
|
|
2008-07-10 15:03:39 +02:00
|
|
|
/**
|
|
|
|
* Eval config and modify DeviceVelocityRec accordingly
|
|
|
|
*/
|
|
|
|
static void
|
2008-11-25 05:12:02 +01:00
|
|
|
ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
|
|
|
|
DeviceVelocityPtr s)
|
|
|
|
{
|
2009-02-28 22:17:47 +01:00
|
|
|
int tempi;
|
|
|
|
float tempf;
|
2008-11-25 05:12:02 +01:00
|
|
|
Atom float_prop = XIGetKnownProperty(XATOM_FLOAT);
|
|
|
|
Atom prop;
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
if(!s)
|
|
|
|
return;
|
|
|
|
|
2008-11-25 05:12:02 +01:00
|
|
|
/* common settings (available via device properties) */
|
2009-10-28 06:59:40 +01:00
|
|
|
tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0);
|
2008-11-25 05:12:02 +01:00
|
|
|
if(tempf > 1.0){
|
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n",
|
|
|
|
devname, tempf);
|
|
|
|
prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
|
|
|
|
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
|
|
|
|
PropModeReplace, 1, &tempf, FALSE);
|
|
|
|
}
|
|
|
|
|
2009-10-28 06:59:40 +01:00
|
|
|
tempf = xf86SetRealOption(list, "AdaptiveDeceleration", 1.0);
|
2008-11-25 05:12:02 +01:00
|
|
|
if(tempf > 1.0){
|
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n",
|
|
|
|
devname, tempf);
|
|
|
|
prop = XIGetKnownProperty(ACCEL_PROP_ADAPTIVE_DECELERATION);
|
|
|
|
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
|
|
|
|
PropModeReplace, 1, &tempf, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* select profile by number */
|
|
|
|
tempi = xf86SetIntOption(list, "AccelerationProfile",
|
|
|
|
s->statistics.profile_number);
|
|
|
|
|
|
|
|
prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
|
|
|
|
if (XIChangeDeviceProperty(pDev, prop, XA_INTEGER, 32,
|
|
|
|
PropModeReplace, 1, &tempi, FALSE) == Success)
|
|
|
|
{
|
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i\n", devname,
|
|
|
|
tempi);
|
|
|
|
} else {
|
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) acceleration profile %i is unknown\n",
|
|
|
|
devname, tempi);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set scaling */
|
|
|
|
tempf = xf86SetRealOption(list, "ExpectedRate", 0);
|
|
|
|
prop = XIGetKnownProperty(ACCEL_PROP_VELOCITY_SCALING);
|
|
|
|
if(tempf > 0){
|
|
|
|
tempf = 1000.0 / tempf;
|
|
|
|
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
|
|
|
|
PropModeReplace, 1, &tempf, FALSE);
|
|
|
|
}else{
|
|
|
|
tempf = xf86SetRealOption(list, "VelocityScale", s->corr_mul);
|
|
|
|
XIChangeDeviceProperty(pDev, prop, float_prop, 32,
|
|
|
|
PropModeReplace, 1, &tempf, FALSE);
|
|
|
|
}
|
|
|
|
|
2009-02-28 22:17:47 +01:00
|
|
|
tempi = xf86SetIntOption(list, "VelocityTrackerCount", -1);
|
|
|
|
if(tempi > 1){
|
|
|
|
InitTrackers(s, tempi);
|
|
|
|
}
|
2008-07-31 00:39:03 +02:00
|
|
|
|
2009-02-28 22:17:47 +01:00
|
|
|
s->initial_range = xf86SetIntOption(list, "VelocityInitialRange",
|
|
|
|
s->initial_range);
|
2008-11-25 05:28:26 +01:00
|
|
|
|
2009-02-28 22:17:47 +01:00
|
|
|
s->max_diff = xf86SetRealOption(list, "VelocityAbsDiff", s->max_diff);
|
2008-07-10 15:03:39 +02:00
|
|
|
|
2009-02-28 22:17:47 +01:00
|
|
|
tempf = xf86SetRealOption(list, "VelocityRelDiff", -1);
|
2008-07-31 00:39:03 +02:00
|
|
|
if(tempf >= 0){
|
2009-02-28 22:17:47 +01:00
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) max rel. velocity difference: %.1f%%\n",
|
|
|
|
devname, tempf*100.0);
|
|
|
|
s->max_rel_diff = tempf;
|
2008-07-31 00:39:03 +02:00
|
|
|
}
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
/* Configure softening. If const deceleration is used, this is expected
|
|
|
|
* to provide better subpixel information so we enable
|
|
|
|
* softening by default only if ConstantDeceleration is not used
|
|
|
|
*/
|
|
|
|
s->use_softening = xf86SetBoolOption(list, "Softening",
|
|
|
|
s->const_acceleration == 1.0);
|
|
|
|
|
2008-07-31 00:39:03 +02:00
|
|
|
s->average_accel = xf86SetBoolOption(list, "AccelerationProfileAveraging",
|
|
|
|
s->average_accel);
|
2008-07-29 10:07:43 +02:00
|
|
|
|
2008-07-31 00:39:03 +02:00
|
|
|
s->reset_time = xf86SetIntOption(list, "VelocityReset", s->reset_time);
|
2008-07-10 15:03:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ApplyAccelerationSettings(DeviceIntPtr dev){
|
|
|
|
int scheme;
|
|
|
|
DeviceVelocityPtr pVel;
|
|
|
|
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
|
2008-07-23 12:06:34 +02:00
|
|
|
char* schemeStr;
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
if(dev->valuator){
|
2008-07-23 12:06:34 +02:00
|
|
|
schemeStr = xf86SetStrOption(local->options, "AccelerationScheme", "");
|
|
|
|
|
|
|
|
scheme = dev->valuator->accelScheme.number;
|
|
|
|
|
|
|
|
if(!xf86NameCmp(schemeStr, "predictable"))
|
|
|
|
scheme = PtrAccelPredictable;
|
|
|
|
|
|
|
|
if(!xf86NameCmp(schemeStr, "lightweight"))
|
|
|
|
scheme = PtrAccelLightweight;
|
|
|
|
|
|
|
|
if(!xf86NameCmp(schemeStr, "none"))
|
|
|
|
scheme = PtrAccelNoOp;
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
/* reinit scheme if needed */
|
|
|
|
if(dev->valuator->accelScheme.number != scheme){
|
|
|
|
if(dev->valuator->accelScheme.AccelCleanupProc){
|
|
|
|
dev->valuator->accelScheme.AccelCleanupProc(dev);
|
|
|
|
}
|
|
|
|
|
2008-07-23 12:06:34 +02:00
|
|
|
if(InitPointerAccelerationScheme(dev, scheme)){
|
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) selected scheme %s/%i\n",
|
|
|
|
local->name, schemeStr, scheme);
|
|
|
|
}else{
|
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) could not init scheme %s\n",
|
|
|
|
local->name, schemeStr);
|
|
|
|
scheme = dev->valuator->accelScheme.number;
|
|
|
|
}
|
2008-07-10 15:03:39 +02:00
|
|
|
}else{
|
2008-07-23 12:06:34 +02:00
|
|
|
xf86Msg(X_CONFIG, "%s: (accel) keeping acceleration scheme %i\n",
|
|
|
|
local->name, scheme);
|
2008-07-10 15:03:39 +02:00
|
|
|
}
|
|
|
|
|
2008-07-23 12:06:34 +02:00
|
|
|
xfree(schemeStr);
|
|
|
|
|
2008-07-10 15:03:39 +02:00
|
|
|
/* process special configuration */
|
|
|
|
switch(scheme){
|
2008-07-23 12:06:34 +02:00
|
|
|
case PtrAccelPredictable:
|
2008-07-29 10:07:43 +02:00
|
|
|
pVel = GetDevicePredictableAccelData(dev);
|
2008-11-25 05:12:02 +01:00
|
|
|
ProcessVelocityConfiguration (dev, local->name, local->options,
|
2008-07-10 15:03:39 +02:00
|
|
|
pVel);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static Bool
|
|
|
|
xf86SendDragEvents(DeviceIntPtr device)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
LocalDevicePtr local = (LocalDevicePtr) device->public.devicePrivate;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-06-04 15:09:20 +02:00
|
|
|
if (device->button && device->button->buttonsDown > 0)
|
2006-07-21 21:23:37 +02:00
|
|
|
return (local->flags & XI86_SEND_DRAG_EVENTS);
|
2003-11-14 17:49:22 +01:00
|
|
|
else
|
2006-07-21 21:23:37 +02:00
|
|
|
return (TRUE);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
2003-11-14 17:49:22 +01:00
|
|
|
* xf86ProcessCommonOptions --
|
|
|
|
*
|
|
|
|
* Process global options.
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
|
|
|
***********************************************************************
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86ProcessCommonOptions(LocalDevicePtr local,
|
2006-07-21 21:23:37 +02:00
|
|
|
pointer list)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2008-01-29 00:31:37 +01:00
|
|
|
if (!xf86SetBoolOption(list, "AlwaysCore", 1) ||
|
2007-05-28 12:54:16 +02:00
|
|
|
!xf86SetBoolOption(list, "SendCoreEvents", 1) ||
|
|
|
|
!xf86SetBoolOption(list, "CorePointer", 1) ||
|
|
|
|
!xf86SetBoolOption(list, "CoreKeyboard", 1)) {
|
|
|
|
xf86Msg(X_CONFIG, "%s: doesn't report core events\n", local->name);
|
|
|
|
} else {
|
2006-07-21 21:23:37 +02:00
|
|
|
local->flags |= XI86_ALWAYS_CORE;
|
|
|
|
xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
if (xf86SetBoolOption(list, "SendDragEvents", 1)) {
|
2006-07-21 21:23:37 +02:00
|
|
|
local->flags |= XI86_SEND_DRAG_EVENTS;
|
2003-11-14 16:54:54 +01:00
|
|
|
} else {
|
2006-07-21 21:23:37 +02:00
|
|
|
xf86Msg(X_CONFIG, "%s: doesn't report drag events\n", local->name);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2007-03-20 23:18:24 +01:00
|
|
|
|
|
|
|
/* Backwards compatibility. */
|
|
|
|
local->history_size = GetMotionHistorySize();
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
2003-11-14 17:49:22 +01:00
|
|
|
* xf86ActivateDevice --
|
2008-11-26 05:15:04 +01:00
|
|
|
*
|
2003-11-14 17:49:22 +01:00
|
|
|
* Initialize an input device.
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
2008-11-26 05:15:04 +01:00
|
|
|
* Returns TRUE on success, or FALSE otherwise.
|
2003-11-14 16:54:54 +01:00
|
|
|
***********************************************************************
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86ActivateDevice(LocalDevicePtr local)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
DeviceIntPtr dev;
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
if (local->flags & XI86_CONFIGURED) {
|
2008-01-21 14:13:53 +01:00
|
|
|
dev = AddInputDevice(serverClient, local->device_control, TRUE);
|
2006-10-15 20:48:01 +02:00
|
|
|
|
2006-07-21 21:23:37 +02:00
|
|
|
if (dev == NULL)
|
2008-11-26 05:15:04 +01:00
|
|
|
{
|
|
|
|
xf86Msg(X_ERROR, "Too many input devices. Ignoring %s\n",
|
|
|
|
local->name);
|
|
|
|
local->dev = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-07-21 21:23:37 +02:00
|
|
|
local->atom = MakeAtom(local->type_name,
|
|
|
|
strlen(local->type_name),
|
|
|
|
TRUE);
|
|
|
|
AssignTypeAndName(dev, local->atom, local->name);
|
|
|
|
dev->public.devicePrivate = (pointer) local;
|
|
|
|
local->dev = dev;
|
|
|
|
|
2007-01-29 08:53:24 +01:00
|
|
|
dev->coreEvents = local->flags & XI86_ALWAYS_CORE;
|
2009-05-20 07:28:16 +02:00
|
|
|
dev->type = SLAVE;
|
2007-10-16 08:20:07 +02:00
|
|
|
dev->spriteInfo->spriteOwner = FALSE;
|
2007-01-29 08:53:24 +01:00
|
|
|
|
2009-05-20 05:59:22 +02:00
|
|
|
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
|
|
|
|
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
|
2006-12-11 08:39:59 +01:00
|
|
|
|
2007-09-26 07:42:49 +02:00
|
|
|
RegisterOtherDevice(dev);
|
2008-03-18 09:05:57 +01:00
|
|
|
XkbSetExtension(dev, ProcessKeyboardEvent);
|
2006-07-21 21:23:37 +02:00
|
|
|
|
|
|
|
if (serverGeneration == 1)
|
|
|
|
xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n",
|
|
|
|
local->name, local->type_name);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2008-11-26 05:15:04 +01:00
|
|
|
|
|
|
|
return TRUE;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Caller: ProcXOpenDevice
|
|
|
|
*
|
|
|
|
* This is the implementation-dependent routine to open an input device.
|
|
|
|
* Some implementations open all input devices when the server is first
|
|
|
|
* initialized, and never close them. Other implementations open only
|
|
|
|
* the X pointer and keyboard devices during server initialization,
|
|
|
|
* and only open other input devices when some client makes an
|
|
|
|
* XOpenDevice request. This entry point is for the latter type of
|
|
|
|
* implementation.
|
|
|
|
*
|
|
|
|
* If the physical device is not already open, do it here. In this case,
|
|
|
|
* you need to keep track of the fact that one or more clients has the
|
|
|
|
* device open, and physically close it when the last client that has
|
|
|
|
* it open does an XCloseDevice.
|
|
|
|
*
|
|
|
|
* The default implementation is to do nothing (assume all input devices
|
|
|
|
* are opened during X server initialization and kept open).
|
|
|
|
*
|
|
|
|
***********************************************************************
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
OpenInputDevice(DeviceIntPtr dev,
|
2006-07-21 21:23:37 +02:00
|
|
|
ClientPtr client,
|
|
|
|
int *status)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-07-24 01:02:12 +02:00
|
|
|
if (!dev->inited)
|
2009-05-12 08:09:35 +02:00
|
|
|
ActivateDevice(dev, TRUE);
|
2006-07-24 01:02:12 +02:00
|
|
|
|
|
|
|
*status = Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-10-29 02:43:34 +02:00
|
|
|
CloseInputDevice(DeviceIntPtr dev,
|
|
|
|
ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* Caller: ProcXSetDeviceMode
|
|
|
|
*
|
|
|
|
* Change the mode of an extension device.
|
|
|
|
* This function is used to change the mode of a device from reporting
|
|
|
|
* relative motion to reporting absolute positional information, and
|
|
|
|
* vice versa.
|
|
|
|
* The default implementation below is that no such devices are supported.
|
|
|
|
*
|
|
|
|
***********************************************************************
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
SetDeviceMode (ClientPtr client, DeviceIntPtr dev, int mode)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
|
|
|
|
|
|
|
|
if (local->switch_mode) {
|
|
|
|
return (*local->switch_mode)(client, dev, mode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Caller: ProcXSetDeviceValuators
|
|
|
|
*
|
|
|
|
* Set the value of valuators on an extension input device.
|
|
|
|
* This function is used to set the initial value of valuators on
|
|
|
|
* those input devices that are capable of reporting either relative
|
|
|
|
* motion or an absolute position, and allow an initial position to be set.
|
|
|
|
* The default implementation below is that no such devices are supported.
|
|
|
|
*
|
|
|
|
***********************************************************************
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
SetDeviceValuators (ClientPtr client, DeviceIntPtr dev, int *valuators,
|
2006-07-21 21:23:37 +02:00
|
|
|
int first_valuator, int num_valuators)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-10-18 10:57:22 +02:00
|
|
|
LocalDevicePtr local = (LocalDevicePtr) dev->public.devicePrivate;
|
|
|
|
|
|
|
|
if (local->set_device_valuators)
|
|
|
|
return (*local->set_device_valuators)(local, valuators, first_valuator,
|
|
|
|
num_valuators);
|
|
|
|
|
|
|
|
return BadMatch;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Caller: ProcXChangeDeviceControl
|
|
|
|
*
|
|
|
|
* Change the specified device controls on an extension input device.
|
|
|
|
*
|
|
|
|
***********************************************************************
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
ChangeDeviceControl (ClientPtr client, DeviceIntPtr dev, xDeviceCtl *control)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
LocalDevicePtr local = (LocalDevicePtr)dev->public.devicePrivate;
|
|
|
|
|
|
|
|
if (!local->control_proc) {
|
2006-07-24 01:02:12 +02:00
|
|
|
switch (control->control) {
|
|
|
|
case DEVICE_CORE:
|
2008-07-13 12:53:14 +02:00
|
|
|
return BadMatch;
|
2006-07-24 01:02:12 +02:00
|
|
|
case DEVICE_RESOLUTION:
|
2006-10-21 10:24:49 +02:00
|
|
|
case DEVICE_ABS_CALIB:
|
|
|
|
case DEVICE_ABS_AREA:
|
2007-07-31 23:19:14 +02:00
|
|
|
case DEVICE_ENABLE:
|
2006-07-24 01:02:12 +02:00
|
|
|
return Success;
|
|
|
|
default:
|
|
|
|
return BadMatch;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (*local->control_proc)(local, control);
|
|
|
|
}
|
|
|
|
}
|
2006-10-29 02:43:34 +02:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-11 08:33:18 +01:00
|
|
|
AddOtherInputDevices(void)
|
2006-10-29 02:43:34 +02:00
|
|
|
{
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2008-11-21 03:02:02 +01:00
|
|
|
/**
|
|
|
|
* Create a new input device, activate and enable it.
|
|
|
|
*
|
2008-11-26 05:15:04 +01:00
|
|
|
* Possible return codes:
|
|
|
|
* BadName .. a bad driver name was supplied.
|
|
|
|
* BadImplementation ... The driver does not have a PreInit function. This
|
|
|
|
* is a driver bug.
|
|
|
|
* BadMatch .. device initialization failed.
|
|
|
|
* BadAlloc .. too many input devices
|
|
|
|
*
|
2008-11-21 03:02:02 +01:00
|
|
|
* @param idev The device, already set up with identifier, driver, and the
|
|
|
|
* options.
|
|
|
|
* @param pdev Pointer to the new device, if Success was reported.
|
|
|
|
* @param enable Enable the device after activating it.
|
|
|
|
*
|
|
|
|
* @return Success or an error code
|
|
|
|
*/
|
|
|
|
_X_INTERNAL int
|
|
|
|
xf86NewInputDevice(IDevPtr idev, DeviceIntPtr *pdev, BOOL enable)
|
|
|
|
{
|
|
|
|
InputDriverPtr drv = NULL;
|
|
|
|
InputInfoPtr pInfo = NULL;
|
|
|
|
DeviceIntPtr dev = NULL;
|
|
|
|
int rval;
|
|
|
|
|
|
|
|
/* Memory leak for every attached device if we don't
|
|
|
|
* test if the module is already loaded first */
|
|
|
|
drv = xf86LookupInputDriver(idev->driver);
|
|
|
|
if (!drv)
|
|
|
|
if (xf86LoadOneModule(idev->driver, NULL))
|
|
|
|
drv = xf86LookupInputDriver(idev->driver);
|
|
|
|
if (!drv) {
|
|
|
|
xf86Msg(X_ERROR, "No input driver matching `%s'\n", idev->driver);
|
|
|
|
rval = BadName;
|
|
|
|
goto unwind;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!drv->PreInit) {
|
|
|
|
xf86Msg(X_ERROR,
|
|
|
|
"Input driver `%s' has no PreInit function (ignoring)\n",
|
|
|
|
drv->driverName);
|
|
|
|
rval = BadImplementation;
|
|
|
|
goto unwind;
|
|
|
|
}
|
|
|
|
|
|
|
|
pInfo = drv->PreInit(drv, idev, 0);
|
|
|
|
|
|
|
|
if (!pInfo) {
|
|
|
|
xf86Msg(X_ERROR, "PreInit returned NULL for \"%s\"\n", idev->identifier);
|
|
|
|
rval = BadMatch;
|
|
|
|
goto unwind;
|
|
|
|
}
|
|
|
|
else if (!(pInfo->flags & XI86_CONFIGURED)) {
|
|
|
|
xf86Msg(X_ERROR, "PreInit failed for input device \"%s\"\n",
|
|
|
|
idev->identifier);
|
|
|
|
rval = BadMatch;
|
|
|
|
goto unwind;
|
|
|
|
}
|
|
|
|
|
2008-11-26 05:15:04 +01:00
|
|
|
if (!xf86ActivateDevice(pInfo))
|
|
|
|
{
|
|
|
|
rval = BadAlloc;
|
|
|
|
goto unwind;
|
|
|
|
}
|
2008-11-21 03:02:02 +01:00
|
|
|
|
|
|
|
dev = pInfo->dev;
|
2009-05-12 08:09:35 +02:00
|
|
|
rval = ActivateDevice(dev, TRUE);
|
2008-12-23 00:59:28 +01:00
|
|
|
if (rval != Success)
|
2008-12-26 08:32:41 +01:00
|
|
|
{
|
|
|
|
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
|
2009-05-12 08:09:35 +02:00
|
|
|
RemoveDevice(dev, TRUE);
|
2008-12-23 00:59:28 +01:00
|
|
|
goto unwind;
|
2008-12-26 08:32:41 +01:00
|
|
|
}
|
2008-12-23 00:59:28 +01:00
|
|
|
|
2008-11-21 03:02:02 +01:00
|
|
|
/* Enable it if it's properly initialised and we're currently in the VT */
|
|
|
|
if (enable && dev->inited && dev->startup && xf86Screens[0]->vtSema)
|
2008-12-23 01:00:34 +01:00
|
|
|
{
|
2009-05-12 08:09:35 +02:00
|
|
|
EnableDevice(dev, TRUE);
|
2008-12-26 08:32:41 +01:00
|
|
|
if (!dev->enabled)
|
|
|
|
{
|
|
|
|
xf86Msg(X_ERROR, "Couldn't init device \"%s\"\n", idev->identifier);
|
|
|
|
rval = BadMatch;
|
|
|
|
goto unwind;
|
|
|
|
}
|
2008-12-23 01:00:34 +01:00
|
|
|
/* send enter/leave event, update sprite window */
|
|
|
|
CheckMotion(NULL, dev);
|
|
|
|
}
|
2008-11-21 03:02:02 +01:00
|
|
|
|
|
|
|
*pdev = dev;
|
|
|
|
return Success;
|
|
|
|
|
|
|
|
unwind:
|
|
|
|
if(pInfo) {
|
|
|
|
if(drv->UnInit)
|
|
|
|
drv->UnInit(drv, pInfo, 0);
|
|
|
|
else
|
|
|
|
xf86DeleteInput(pInfo, 0);
|
|
|
|
}
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-04-10 23:38:16 +02:00
|
|
|
NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev)
|
2006-07-19 17:41:16 +02:00
|
|
|
{
|
|
|
|
IDevRec *idev = NULL;
|
|
|
|
InputOption *option = NULL;
|
2007-04-10 22:52:08 +02:00
|
|
|
int rval = Success;
|
2007-08-01 02:30:07 +02:00
|
|
|
int is_auto = 0;
|
2006-07-19 17:41:16 +02:00
|
|
|
|
|
|
|
idev = xcalloc(sizeof(*idev), 1);
|
|
|
|
if (!idev)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
for (option = options; option; option = option->next) {
|
2007-05-28 12:54:47 +02:00
|
|
|
if (strcasecmp(option->key, "driver") == 0) {
|
2007-04-10 22:52:08 +02:00
|
|
|
if (idev->driver) {
|
|
|
|
rval = BadRequest;
|
|
|
|
goto unwind;
|
|
|
|
}
|
2006-07-19 17:41:16 +02:00
|
|
|
idev->driver = xstrdup(option->value);
|
|
|
|
if (!idev->driver) {
|
2007-04-10 22:52:08 +02:00
|
|
|
rval = BadAlloc;
|
|
|
|
goto unwind;
|
2006-07-19 17:41:16 +02:00
|
|
|
}
|
|
|
|
}
|
2007-08-01 02:30:07 +02:00
|
|
|
|
2007-05-28 12:54:47 +02:00
|
|
|
if (strcasecmp(option->key, "name") == 0 ||
|
|
|
|
strcasecmp(option->key, "identifier") == 0) {
|
2007-04-10 22:52:08 +02:00
|
|
|
if (idev->identifier) {
|
|
|
|
rval = BadRequest;
|
|
|
|
goto unwind;
|
|
|
|
}
|
2006-07-19 17:41:16 +02:00
|
|
|
idev->identifier = xstrdup(option->value);
|
|
|
|
if (!idev->identifier) {
|
2007-04-10 22:52:08 +02:00
|
|
|
rval = BadAlloc;
|
|
|
|
goto unwind;
|
2006-07-19 17:41:16 +02:00
|
|
|
}
|
|
|
|
}
|
2007-08-01 02:30:07 +02:00
|
|
|
|
|
|
|
/* Right now, the only automatic config we know of is HAL. */
|
|
|
|
if (strcmp(option->key, "_source") == 0 &&
|
|
|
|
strcmp(option->value, "server/hal") == 0) {
|
2009-04-30 03:39:50 +02:00
|
|
|
is_auto = 1;
|
2007-08-01 02:30:07 +02:00
|
|
|
if (!xf86Info.autoAddDevices) {
|
|
|
|
rval = BadMatch;
|
|
|
|
goto unwind;
|
|
|
|
}
|
|
|
|
}
|
2006-07-19 17:41:16 +02:00
|
|
|
}
|
2007-08-01 01:08:02 +02:00
|
|
|
if (!idev->driver || !idev->identifier) {
|
2007-04-10 22:52:08 +02:00
|
|
|
xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n");
|
|
|
|
rval = BadRequest;
|
|
|
|
goto unwind;
|
|
|
|
}
|
2006-07-19 17:41:16 +02:00
|
|
|
|
2007-02-15 04:21:20 +01:00
|
|
|
if (!idev->identifier) {
|
|
|
|
xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n");
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
2007-04-10 22:52:08 +02:00
|
|
|
for (option = options; option; option = option->next) {
|
|
|
|
/* Steal option key/value strings from the provided list.
|
|
|
|
* We need those strings, the InputOption list doesn't. */
|
2006-07-19 17:41:16 +02:00
|
|
|
idev->commonOptions = xf86addNewOption(idev->commonOptions,
|
|
|
|
option->key, option->value);
|
2007-04-10 22:52:08 +02:00
|
|
|
option->key = NULL;
|
|
|
|
option->value = NULL;
|
|
|
|
}
|
2006-07-19 17:41:16 +02:00
|
|
|
|
2008-11-21 03:02:02 +01:00
|
|
|
rval = xf86NewInputDevice(idev, pdev,
|
|
|
|
(!is_auto || (is_auto && xf86Info.autoEnableDevices)));
|
|
|
|
if (rval == Success)
|
|
|
|
return Success;
|
2007-04-10 22:52:08 +02:00
|
|
|
|
|
|
|
unwind:
|
2009-04-30 03:39:50 +02:00
|
|
|
if (is_auto && !xf86Info.autoAddDevices)
|
|
|
|
xf86Msg(X_INFO, "AutoAddDevices is off - not adding device.\n");
|
2007-04-10 22:52:08 +02:00
|
|
|
if(idev->driver)
|
|
|
|
xfree(idev->driver);
|
|
|
|
if(idev->identifier)
|
|
|
|
xfree(idev->identifier);
|
|
|
|
xf86optionListFree(idev->commonOptions);
|
|
|
|
xfree(idev);
|
|
|
|
return rval;
|
2006-07-19 17:41:16 +02:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-04-10 22:54:32 +02:00
|
|
|
DeleteInputDeviceRequest(DeviceIntPtr pDev)
|
|
|
|
{
|
|
|
|
LocalDevicePtr pInfo = (LocalDevicePtr) pDev->public.devicePrivate;
|
2008-12-04 00:47:25 +01:00
|
|
|
InputDriverPtr drv = NULL;
|
|
|
|
IDevRec *idev = NULL;
|
2008-04-23 04:08:08 +02:00
|
|
|
IDevPtr *it;
|
2009-05-20 07:28:16 +02:00
|
|
|
Bool isMaster = IsMaster(pDev);
|
2007-04-10 22:54:32 +02:00
|
|
|
|
2008-02-22 01:31:51 +01:00
|
|
|
if (pInfo) /* need to get these before RemoveDevice */
|
|
|
|
{
|
|
|
|
drv = pInfo->drv;
|
|
|
|
idev = pInfo->conf_idev;
|
|
|
|
}
|
2007-04-10 22:54:32 +02:00
|
|
|
|
2008-06-02 03:10:10 +02:00
|
|
|
OsBlockSignals();
|
2009-05-12 08:09:35 +02:00
|
|
|
RemoveDevice(pDev, TRUE);
|
2008-02-22 01:31:51 +01:00
|
|
|
|
2009-02-23 00:28:26 +01:00
|
|
|
if (!isMaster && pInfo != NULL)
|
2008-06-02 03:10:10 +02:00
|
|
|
{
|
|
|
|
if(drv->UnInit)
|
|
|
|
drv->UnInit(drv, pInfo, 0);
|
|
|
|
else
|
|
|
|
xf86DeleteInput(pInfo, 0);
|
2007-04-10 22:54:32 +02:00
|
|
|
|
2008-06-02 03:10:10 +02:00
|
|
|
/* devices added through HAL aren't in the config layout */
|
|
|
|
it = xf86ConfigLayout.inputs;
|
|
|
|
while(*it && *it != idev)
|
|
|
|
it++;
|
2008-04-23 04:08:08 +02:00
|
|
|
|
2008-06-02 03:10:10 +02:00
|
|
|
if (!(*it)) /* end of list, not in the layout */
|
|
|
|
{
|
|
|
|
xfree(idev->driver);
|
|
|
|
xfree(idev->identifier);
|
|
|
|
xf86optionListFree(idev->commonOptions);
|
|
|
|
xfree(idev);
|
|
|
|
}
|
2008-04-23 04:08:08 +02:00
|
|
|
}
|
2008-06-02 03:10:10 +02:00
|
|
|
OsReleaseSignals();
|
2006-07-19 17:41:16 +02:00
|
|
|
}
|
|
|
|
|
2006-07-21 21:23:37 +02:00
|
|
|
/*
|
|
|
|
* convenient functions to post events
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2006-07-21 21:23:37 +02:00
|
|
|
xf86PostMotionEvent(DeviceIntPtr device,
|
|
|
|
int is_absolute,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
...)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
va_list var;
|
2007-06-04 12:48:06 +02:00
|
|
|
int i = 0;
|
2008-02-01 04:43:29 +01:00
|
|
|
static int valuators[MAX_VALUATORS];
|
2007-06-04 12:59:42 +02:00
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
2007-06-04 12:48:06 +02:00
|
|
|
|
|
|
|
va_start(var, num_valuators);
|
|
|
|
for (i = 0; i < num_valuators; i++)
|
|
|
|
valuators[i] = va_arg(var, int);
|
|
|
|
va_end(var);
|
|
|
|
|
|
|
|
xf86PostMotionEventP(device, is_absolute, first_valuator, num_valuators, valuators);
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-06-04 12:48:06 +02:00
|
|
|
xf86PostMotionEventP(DeviceIntPtr device,
|
|
|
|
int is_absolute,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
int *valuators)
|
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
int i = 0, nevents = 0;
|
|
|
|
Bool drag = xf86SendDragEvents(device);
|
2009-05-06 04:07:07 +02:00
|
|
|
DeviceEvent *event;
|
2007-06-04 12:48:06 +02:00
|
|
|
int flags = 0;
|
2006-03-24 21:50:13 +01:00
|
|
|
|
2009-10-22 14:43:25 +02:00
|
|
|
#if XFreeXDGA
|
|
|
|
int index;
|
|
|
|
int dx = 0, dy = 0;
|
|
|
|
#endif
|
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
2008-02-01 04:54:04 +01:00
|
|
|
|
2006-07-21 21:23:37 +02:00
|
|
|
if (is_absolute)
|
|
|
|
flags = POINTER_ABSOLUTE;
|
|
|
|
else
|
|
|
|
flags = POINTER_RELATIVE | POINTER_ACCELERATE;
|
2006-11-16 03:21:08 +01:00
|
|
|
|
2007-03-20 23:12:02 +01:00
|
|
|
#if XFreeXDGA
|
2007-10-02 05:49:07 +02:00
|
|
|
/* The evdev driver may not always send all axes across. */
|
|
|
|
if (num_valuators >= 1 && first_valuator <= 1) {
|
|
|
|
if (miPointerGetScreen(device)) {
|
|
|
|
index = miPointerGetScreen(device)->myNum;
|
|
|
|
if (first_valuator == 0)
|
|
|
|
{
|
2007-03-21 01:35:31 +01:00
|
|
|
dx = valuators[0];
|
2007-10-02 05:49:07 +02:00
|
|
|
if (is_absolute)
|
2008-05-23 04:21:53 +02:00
|
|
|
dx -= device->last.valuators[0];
|
2007-10-02 05:49:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (first_valuator == 1 || num_valuators >= 2)
|
|
|
|
{
|
|
|
|
dy = valuators[1 - first_valuator];
|
|
|
|
if (is_absolute)
|
2008-05-23 04:21:53 +02:00
|
|
|
dy -= device->last.valuators[1];
|
2007-03-21 01:35:31 +01:00
|
|
|
}
|
2007-10-02 05:49:07 +02:00
|
|
|
|
|
|
|
if (DGAStealMotionEvent(device, index, dx, dy))
|
2007-06-04 12:48:06 +02:00
|
|
|
return;
|
2007-03-20 23:12:02 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-08-10 13:00:14 +02:00
|
|
|
nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0,
|
2006-10-08 20:42:15 +02:00
|
|
|
flags, first_valuator, num_valuators,
|
|
|
|
valuators);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-11-27 21:39:56 +01:00
|
|
|
for (i = 0; i < nevents; i++) {
|
2009-05-06 04:07:07 +02:00
|
|
|
event = (DeviceEvent*)((xf86Events + i)->event);
|
2006-11-27 21:39:56 +01:00
|
|
|
/* Don't post core motion events for devices not registered to send
|
|
|
|
* drag events. */
|
2009-05-06 04:07:07 +02:00
|
|
|
if (event->header == ET_Internal &&
|
|
|
|
(event->type != ET_Motion || drag)) {
|
2009-04-09 00:42:06 +02:00
|
|
|
mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
|
2006-11-27 21:39:56 +01:00
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 16:54:54 +01:00
|
|
|
xf86PostProximityEvent(DeviceIntPtr device,
|
2006-07-21 21:23:37 +02:00
|
|
|
int is_in,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
...)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-10-23 05:56:07 +02:00
|
|
|
va_list var;
|
2009-07-28 07:20:37 +02:00
|
|
|
int i;
|
2008-02-01 04:43:29 +01:00
|
|
|
int valuators[MAX_VALUATORS];
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2006-10-23 05:56:07 +02:00
|
|
|
va_start(var, num_valuators);
|
|
|
|
for (i = 0; i < num_valuators; i++)
|
|
|
|
valuators[i] = va_arg(var, int);
|
|
|
|
va_end(var);
|
2006-07-21 21:23:37 +02:00
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
xf86PostProximityEventP(device, is_in, first_valuator, num_valuators,
|
|
|
|
valuators);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
xf86PostProximityEventP(DeviceIntPtr device,
|
|
|
|
int is_in,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
int *valuators)
|
|
|
|
{
|
|
|
|
int i, nevents;
|
|
|
|
|
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
|
|
|
|
2006-10-23 05:56:07 +02:00
|
|
|
nevents = GetProximityEvents(xf86Events, device,
|
|
|
|
is_in ? ProximityIn : ProximityOut,
|
|
|
|
first_valuator, num_valuators, valuators);
|
|
|
|
for (i = 0; i < nevents; i++)
|
2009-04-09 00:42:06 +02:00
|
|
|
mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 16:54:54 +01:00
|
|
|
xf86PostButtonEvent(DeviceIntPtr device,
|
2006-07-21 21:23:37 +02:00
|
|
|
int is_absolute,
|
|
|
|
int button,
|
|
|
|
int is_down,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
...)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
va_list var;
|
2008-02-01 04:43:29 +01:00
|
|
|
int valuators[MAX_VALUATORS];
|
2009-07-28 07:20:37 +02:00
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
|
|
|
|
|
|
|
va_start(var, num_valuators);
|
|
|
|
for (i = 0; i < num_valuators; i++)
|
|
|
|
valuators[i] = va_arg(var, int);
|
|
|
|
va_end(var);
|
|
|
|
|
|
|
|
xf86PostButtonEventP(device, is_absolute, button, is_down, first_valuator,
|
|
|
|
num_valuators, valuators);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
xf86PostButtonEventP(DeviceIntPtr device,
|
|
|
|
int is_absolute,
|
|
|
|
int button,
|
|
|
|
int is_down,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
int *valuators)
|
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
int i = 0, nevents = 0;
|
2009-08-03 01:46:57 +02:00
|
|
|
int flags = 0;
|
|
|
|
|
2009-10-22 14:43:25 +02:00
|
|
|
#if XFreeXDGA
|
|
|
|
int index;
|
|
|
|
#endif
|
|
|
|
|
2009-08-03 01:46:57 +02:00
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
|
|
|
|
|
|
|
if (is_absolute)
|
|
|
|
flags = POINTER_ABSOLUTE;
|
|
|
|
else
|
|
|
|
flags = POINTER_RELATIVE | POINTER_ACCELERATE;
|
2006-11-16 03:21:08 +01:00
|
|
|
|
2007-03-20 23:12:02 +01:00
|
|
|
#if XFreeXDGA
|
2007-10-02 05:49:07 +02:00
|
|
|
if (miPointerGetScreen(device)) {
|
|
|
|
index = miPointerGetScreen(device)->myNum;
|
|
|
|
if (DGAStealButtonEvent(device, index, button, is_down))
|
2007-03-21 01:35:31 +01:00
|
|
|
return;
|
|
|
|
}
|
2007-03-20 23:12:02 +01:00
|
|
|
#endif
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2006-08-10 13:00:14 +02:00
|
|
|
nevents = GetPointerEvents(xf86Events, device,
|
2006-07-21 21:23:37 +02:00
|
|
|
is_down ? ButtonPress : ButtonRelease, button,
|
2009-08-03 01:46:57 +02:00
|
|
|
flags, first_valuator, num_valuators, valuators);
|
2006-07-21 21:23:37 +02:00
|
|
|
|
2006-08-10 13:00:14 +02:00
|
|
|
for (i = 0; i < nevents; i++)
|
2009-04-09 00:42:06 +02:00
|
|
|
mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
|
2006-10-23 05:56:07 +02:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 16:54:54 +01:00
|
|
|
xf86PostKeyEvent(DeviceIntPtr device,
|
2006-07-21 21:23:37 +02:00
|
|
|
unsigned int key_code,
|
|
|
|
int is_down,
|
|
|
|
int is_absolute,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
...)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
va_list var;
|
2009-07-28 07:20:37 +02:00
|
|
|
int i = 0;
|
2008-02-01 04:43:29 +01:00
|
|
|
static int valuators[MAX_VALUATORS];
|
2006-07-21 21:23:37 +02:00
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
2008-02-01 04:54:04 +01:00
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
va_start(var, num_valuators);
|
|
|
|
for (i = 0; i < num_valuators; i++)
|
|
|
|
valuators[i] = va_arg(var, int);
|
|
|
|
va_end(var);
|
|
|
|
|
|
|
|
xf86PostKeyEventP(device, key_code, is_down, is_absolute, first_valuator,
|
|
|
|
num_valuators, valuators);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
xf86PostKeyEventP(DeviceIntPtr device,
|
|
|
|
unsigned int key_code,
|
|
|
|
int is_down,
|
|
|
|
int is_absolute,
|
|
|
|
int first_valuator,
|
|
|
|
int num_valuators,
|
|
|
|
int *valuators)
|
|
|
|
{
|
|
|
|
int i = 0, nevents = 0;
|
|
|
|
|
|
|
|
XI_VERIFY_VALUATORS(num_valuators);
|
2006-08-10 13:00:14 +02:00
|
|
|
|
2009-07-28 07:20:37 +02:00
|
|
|
if (is_absolute) {
|
2006-08-10 13:00:14 +02:00
|
|
|
nevents = GetKeyboardValuatorEvents(xf86Events, device,
|
|
|
|
is_down ? KeyPress : KeyRelease,
|
2006-10-08 20:42:15 +02:00
|
|
|
key_code, first_valuator,
|
|
|
|
num_valuators, valuators);
|
2006-07-21 21:23:37 +02:00
|
|
|
}
|
|
|
|
else {
|
2006-08-10 13:00:14 +02:00
|
|
|
nevents = GetKeyboardEvents(xf86Events, device,
|
2006-07-21 21:23:37 +02:00
|
|
|
is_down ? KeyPress : KeyRelease,
|
|
|
|
key_code);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2006-08-10 13:00:14 +02:00
|
|
|
for (i = 0; i < nevents; i++)
|
2009-04-09 00:42:06 +02:00
|
|
|
mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event));
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86PostKeyboardEvent(DeviceIntPtr device,
|
|
|
|
unsigned int key_code,
|
|
|
|
int is_down)
|
|
|
|
{
|
2009-07-28 07:20:37 +02:00
|
|
|
xf86PostKeyEventP(device, key_code, is_down, 0, 0, 0, NULL);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
LocalDevicePtr
|
2009-01-11 08:33:18 +01:00
|
|
|
xf86FirstLocalDevice(void)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
return xf86InputDevs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Cx - raw data from touch screen
|
|
|
|
* Sxhigh - scaled highest dimension
|
|
|
|
* (remember, this is of rows - 1 because of 0 origin)
|
|
|
|
* Sxlow - scaled lowest dimension
|
|
|
|
* Rxhigh - highest raw value from touch screen calibration
|
|
|
|
* Rxlow - lowest raw value from touch screen calibration
|
|
|
|
*
|
|
|
|
* This function is the same for X or Y coordinates.
|
|
|
|
* You may have to reverse the high and low values to compensate for
|
|
|
|
* different orgins on the touch screen vs X.
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86ScaleAxis(int Cx,
|
2006-07-21 21:23:37 +02:00
|
|
|
int Sxhigh,
|
|
|
|
int Sxlow,
|
|
|
|
int Rxhigh,
|
|
|
|
int Rxlow )
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
int X;
|
|
|
|
int dSx = Sxhigh - Sxlow;
|
|
|
|
int dRx = Rxhigh - Rxlow;
|
|
|
|
|
|
|
|
dSx = Sxhigh - Sxlow;
|
|
|
|
if (dRx) {
|
|
|
|
X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
X = 0;
|
|
|
|
ErrorF ("Divide by Zero in xf86ScaleAxis");
|
|
|
|
}
|
|
|
|
|
2008-06-08 16:08:45 +02:00
|
|
|
if (X > Sxhigh)
|
2003-11-14 17:49:22 +01:00
|
|
|
X = Sxhigh;
|
2008-10-30 06:32:13 +01:00
|
|
|
if (X < Sxlow)
|
|
|
|
X = Sxlow;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
return (X);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This function checks the given screen against the current screen and
|
|
|
|
* makes changes if appropriate. It should be called from an XInput driver's
|
|
|
|
* ReadInput function before any events are posted, if the device is screen
|
|
|
|
* specific like a touch screen.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86XInputSetScreen(LocalDevicePtr local,
|
|
|
|
int screen_number,
|
|
|
|
int x,
|
|
|
|
int y)
|
|
|
|
{
|
2006-10-08 20:42:15 +02:00
|
|
|
if (miPointerGetScreen(local->dev) !=
|
|
|
|
screenInfo.screens[screen_number]) {
|
|
|
|
miPointerSetScreen(local->dev, screen_number, x, y);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-06-16 08:38:11 +02:00
|
|
|
xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, Atom label, int minval, int maxval,
|
2003-11-14 17:49:22 +01:00
|
|
|
int resolution, int min_res, int max_res)
|
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
if (!dev || !dev->valuator)
|
|
|
|
return;
|
|
|
|
|
2009-06-16 08:38:11 +02:00
|
|
|
InitValuatorAxisStruct(dev, axnum, label, minval, maxval, resolution, min_res,
|
2003-11-14 17:49:22 +01:00
|
|
|
max_res);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the valuator values to be in synch with dix/event.c
|
|
|
|
* DefineInitialRootWindow().
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
|
|
|
|
{
|
2006-07-21 21:23:37 +02:00
|
|
|
if (axnum == 0) {
|
2003-11-14 17:49:22 +01:00
|
|
|
dev->valuator->axisVal[0] = screenInfo.screens[0]->width / 2;
|
2008-05-23 04:21:53 +02:00
|
|
|
dev->last.valuators[0] = dev->valuator->axisVal[0];
|
2006-07-21 21:23:37 +02:00
|
|
|
}
|
|
|
|
else if (axnum == 1) {
|
2003-11-14 17:49:22 +01:00
|
|
|
dev->valuator->axisVal[1] = screenInfo.screens[0]->height / 2;
|
2008-05-23 04:21:53 +02:00
|
|
|
dev->last.valuators[1] = dev->valuator->axisVal[1];
|
2006-07-21 21:23:37 +02:00
|
|
|
}
|
2008-07-10 15:03:39 +02:00
|
|
|
|
|
|
|
if(axnum == 0) /* to prevent double invocation */
|
|
|
|
ApplyAccelerationSettings(dev);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
|
2007-04-24 14:04:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deactivate a device. Call this function from the driver if you receive a
|
|
|
|
* read error or something else that spoils your day.
|
|
|
|
* Device will be moved to the off_devices list, but it will still be there
|
|
|
|
* until you really clean up after it.
|
|
|
|
* Notifies the client about an inactive device.
|
2007-04-24 15:22:33 +02:00
|
|
|
*
|
|
|
|
* @param panic True if device is unrecoverable and needs to be removed.
|
2007-04-24 14:04:47 +02:00
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-04-24 15:22:33 +02:00
|
|
|
xf86DisableDevice(DeviceIntPtr dev, Bool panic)
|
2007-04-24 14:04:47 +02:00
|
|
|
{
|
2007-04-24 15:22:33 +02:00
|
|
|
if(!panic)
|
|
|
|
{
|
2009-05-12 08:09:35 +02:00
|
|
|
DisableDevice(dev, TRUE);
|
2007-04-24 15:22:33 +02:00
|
|
|
} else
|
|
|
|
{
|
2009-09-17 08:01:29 +02:00
|
|
|
SendDevicePresenceEvent(dev->id, DeviceUnrecoverable);
|
2007-04-24 15:22:33 +02:00
|
|
|
DeleteInputDeviceRequest(dev);
|
|
|
|
}
|
2007-04-24 14:04:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reactivate a device. Call this function from the driver if you just found
|
|
|
|
* out that the read error wasn't quite that bad after all.
|
|
|
|
* Device will be re-activated, and an event sent to the client.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-04-24 14:04:47 +02:00
|
|
|
xf86EnableDevice(DeviceIntPtr dev)
|
|
|
|
{
|
2009-05-12 08:09:35 +02:00
|
|
|
EnableDevice(dev, TRUE);
|
2007-04-24 14:04:47 +02:00
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* end of xf86Xinput.c */
|