2003-11-14 16:54:54 +01:00
|
|
|
/*
|
|
|
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
|
|
|
*
|
|
|
|
* 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 Thomas Roell not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
* specific, written prior permission. Thomas Roell makes no representations
|
|
|
|
* about the suitability of this software for any purpose. It is provided
|
|
|
|
* "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL THOMAS ROELL 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) 1994-2003 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,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of the 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
|
|
|
/* [JCH-96/01/21] Extended std reverse map to four buttons. */
|
|
|
|
|
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/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
2014-03-31 11:19:16 +02:00
|
|
|
#include <X11/Xatom.h>
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "xf86.h"
|
|
|
|
#include "xf86Priv.h"
|
|
|
|
#define XF86_OS_PRIVS
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "xf86_OSlib.h"
|
2008-07-24 22:03:58 +02:00
|
|
|
#include <X11/keysym.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
#ifdef XFreeXDGA
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "dgaproc.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/extensions/XI.h>
|
|
|
|
#include <X11/extensions/XIproto.h>
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "inputstr.h"
|
|
|
|
#include "xf86Xinput.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "mi.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "mipointer.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2008-10-18 21:26:00 +02:00
|
|
|
#include "xkbsrv.h"
|
|
|
|
#include "xkbstr.h"
|
|
|
|
|
2004-07-30 22:56:53 +02:00
|
|
|
#ifdef DPMSExtension
|
2009-07-15 08:51:05 +02:00
|
|
|
#include <X11/extensions/dpmsconst.h>
|
2004-07-30 22:56:53 +02:00
|
|
|
#include "dpmsproc.h"
|
|
|
|
#endif
|
|
|
|
|
2013-04-10 08:32:15 +02:00
|
|
|
#include "xf86platformBus.h"
|
2014-01-14 15:37:33 +01:00
|
|
|
#include "systemd-logind.h"
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
extern void (*xf86OSPMClose) (void);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static void xf86VTSwitch(void);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/*
|
2003-11-14 17:49:22 +01:00
|
|
|
* Allow arbitrary drivers or other XFree86 code to register with our main
|
|
|
|
* Wakeup handler.
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
typedef struct x_IHRec {
|
2012-03-21 20:55:09 +01:00
|
|
|
int fd;
|
|
|
|
InputHandlerProc ihproc;
|
2013-12-15 10:05:51 +01:00
|
|
|
void *data;
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool enabled;
|
2013-08-12 18:20:36 +02:00
|
|
|
Bool is_input;
|
2012-03-21 20:55:09 +01:00
|
|
|
struct x_IHRec *next;
|
2003-11-14 17:49:22 +01:00
|
|
|
} IHRec, *IHPtr;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static IHPtr InputHandlers = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* TimeSinceLastInputEvent --
|
2003-11-14 17:49:22 +01:00
|
|
|
* Function used for screensaver purposes by the os module. Returns the
|
2003-11-14 16:54:54 +01:00
|
|
|
* time in milliseconds since there last was any input.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2009-01-11 08:33:18 +01:00
|
|
|
TimeSinceLastInputEvent(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86Info.lastEventTime == 0) {
|
|
|
|
xf86Info.lastEventTime = GetTimeInMillis();
|
|
|
|
}
|
|
|
|
return GetTimeInMillis() - xf86Info.lastEventTime;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SetTimeSinceLastInputEvent --
|
|
|
|
* Set the lastEventTime to now.
|
|
|
|
*/
|
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
|
|
|
SetTimeSinceLastInputEvent(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86Info.lastEventTime = GetTimeInMillis();
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ProcessInputEvents --
|
|
|
|
* Retrieve all waiting input events and pass them to DIX in their
|
|
|
|
* correct chronological order. Only reads from the system pointer
|
|
|
|
* and keyboard.
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcessInputEvents(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
mieqProcessInputEvents();
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* FIXME: This is a problem if we have multiple pointers */
|
|
|
|
miPointerGetPosition(inputInfo.pointer, &x, &y);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
xf86SetViewport(xf86Info.currentScreen, x, y);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/*
|
|
|
|
* Handle keyboard events that cause some kind of "action"
|
|
|
|
* (i.e., server termination, video mode changes, VT switches, etc.)
|
|
|
|
*/
|
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
|
|
|
xf86ProcessActionEvent(ActionEvent action, void *arg)
|
|
|
|
{
|
2015-07-08 00:20:29 +02:00
|
|
|
DebugF("ProcessActionEvent(%d,%p)\n", (int) action, arg);
|
2003-11-14 17:49:22 +01:00
|
|
|
switch (action) {
|
|
|
|
case ACTION_TERMINATE:
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!xf86Info.dontZap) {
|
2012-12-12 02:02:19 +01:00
|
|
|
xf86Msg(X_INFO, "Server zapped. Shutting down.\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
GiveUp(0);
|
|
|
|
}
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
case ACTION_NEXT_MODE:
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!xf86Info.dontZoom)
|
|
|
|
xf86ZoomViewport(xf86Info.currentScreen, 1);
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
case ACTION_PREV_MODE:
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!xf86Info.dontZoom)
|
|
|
|
xf86ZoomViewport(xf86Info.currentScreen, -1);
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
case ACTION_SWITCHSCREEN:
|
2017-06-16 21:44:43 +02:00
|
|
|
if (!xf86Info.dontVTSwitch && arg) {
|
2012-03-21 20:55:09 +01:00
|
|
|
int vtno = *((int *) arg);
|
|
|
|
|
|
|
|
if (vtno != xf86Info.vtno) {
|
|
|
|
if (!xf86VTActivate(vtno)) {
|
|
|
|
ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
|
|
|
|
xf86Info.vtno, vtno, strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
case ACTION_SWITCHSCREEN_NEXT:
|
2017-06-16 21:44:43 +02:00
|
|
|
if (!xf86Info.dontVTSwitch) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!xf86VTActivate(xf86Info.vtno + 1)) {
|
|
|
|
/* If first try failed, assume this is the last VT and
|
|
|
|
* try wrapping around to the first vt.
|
|
|
|
*/
|
|
|
|
if (!xf86VTActivate(1)) {
|
|
|
|
ErrorF("Failed to switch from vt%02d to next vt: %s\n",
|
|
|
|
xf86Info.vtno, strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
case ACTION_SWITCHSCREEN_PREV:
|
2017-06-16 21:44:43 +02:00
|
|
|
if (!xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!xf86VTActivate(xf86Info.vtno - 1)) {
|
|
|
|
/* Don't know what the maximum VT is, so can't wrap around */
|
|
|
|
ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
|
|
|
|
xf86Info.vtno, strerror(errno));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
break;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/*
|
|
|
|
* xf86Wakeup --
|
|
|
|
* Os wakeup handler.
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/* ARGSUSED */
|
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
|
2015-09-02 03:51:14 +02:00
|
|
|
xf86Wakeup(void *blockData, int err)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xf86VTSwitchPending())
|
|
|
|
xf86VTSwitch();
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/*
|
2015-12-08 23:39:46 +01:00
|
|
|
* xf86ReadInput --
|
|
|
|
* input thread handler
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
2015-12-08 23:39:46 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static void
|
2015-12-08 23:39:46 +01:00
|
|
|
xf86ReadInput(int fd, int ready, void *closure)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2009-02-13 23:25:32 +01:00
|
|
|
InputInfoPtr pInfo = closure;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
pInfo->read_input(pInfo);
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/*
|
2003-11-14 17:49:22 +01:00
|
|
|
* xf86AddEnabledDevice --
|
2006-11-08 14:36:47 +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 17:49:22 +01:00
|
|
|
xf86AddEnabledDevice(InputInfoPtr pInfo)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2015-12-08 23:53:08 +01:00
|
|
|
InputThreadRegisterDev(pInfo->fd, xf86ReadInput, pInfo);
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/*
|
|
|
|
* xf86RemoveEnabledDevice --
|
2006-11-08 14:36:47 +01:00
|
|
|
*
|
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
|
2003-11-14 17:49:22 +01:00
|
|
|
xf86RemoveEnabledDevice(InputInfoPtr pInfo)
|
|
|
|
{
|
2015-12-08 23:53:08 +01:00
|
|
|
InputThreadUnregisterDev(pInfo->fd);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2008-08-06 19:37:32 +02:00
|
|
|
/*
|
|
|
|
* xf86PrintBacktrace --
|
|
|
|
* Print a stack backtrace for debugging purposes.
|
|
|
|
*/
|
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
|
2008-08-06 19:37:32 +02:00
|
|
|
xf86PrintBacktrace(void)
|
|
|
|
{
|
|
|
|
xorg_backtrace();
|
|
|
|
}
|
|
|
|
|
2006-07-21 21:23:37 +02:00
|
|
|
static void
|
|
|
|
xf86ReleaseKeys(DeviceIntPtr pDev)
|
|
|
|
{
|
2008-10-18 21:26:00 +02:00
|
|
|
KeyClassPtr keyc;
|
2012-10-24 03:20:54 +02:00
|
|
|
int i;
|
2006-07-21 21:23:37 +02:00
|
|
|
|
|
|
|
if (!pDev || !pDev->key)
|
|
|
|
return;
|
|
|
|
|
|
|
|
keyc = pDev->key;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Hmm... here is the biggest hack of every time !
|
|
|
|
* It may be possible that a switch-vt procedure has finished BEFORE
|
2020-07-05 22:07:33 +02:00
|
|
|
* you released all keys necessary to do this. That peculiar behavior
|
2006-07-21 21:23:37 +02:00
|
|
|
* can fool the X-server pretty much, cause it assumes that some keys
|
2020-07-05 22:07:33 +02:00
|
|
|
* were not released. TWM may stuck almost completely....
|
2006-07-21 21:23:37 +02:00
|
|
|
* OK, what we are doing here is after returning from the vt-switch
|
2020-07-05 22:07:33 +02:00
|
|
|
* explicitly unrelease all keyboard keys before the input-devices
|
|
|
|
* are re-enabled.
|
2006-07-21 21:23:37 +02:00
|
|
|
*/
|
|
|
|
|
2008-10-18 21:26:00 +02:00
|
|
|
for (i = keyc->xkbInfo->desc->min_key_code;
|
2012-03-21 20:55:09 +01:00
|
|
|
i < keyc->xkbInfo->desc->max_key_code; i++) {
|
2010-07-06 01:19:09 +02:00
|
|
|
if (key_is_down(pDev, i, KEY_POSTED)) {
|
2015-12-08 23:39:46 +01:00
|
|
|
input_lock();
|
2014-12-16 05:43:29 +01:00
|
|
|
QueueKeyboardEvents(pDev, KeyRelease, i);
|
2015-12-08 23:39:46 +01:00
|
|
|
input_unlock();
|
2006-07-21 21:23:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-19 14:10:18 +01:00
|
|
|
void
|
|
|
|
xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo)
|
|
|
|
{
|
|
|
|
if (!pInfo->dev)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!pInfo->dev->enabled)
|
|
|
|
pInfo->flags |= XI86_DEVICE_DISABLED;
|
|
|
|
|
|
|
|
xf86ReleaseKeys(pInfo->dev);
|
|
|
|
ProcessInputEvents();
|
|
|
|
DisableDevice(pInfo->dev, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
|
|
|
|
{
|
|
|
|
if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
|
|
|
|
EnableDevice(pInfo->dev, TRUE);
|
|
|
|
pInfo->flags &= ~XI86_DEVICE_DISABLED;
|
|
|
|
}
|
|
|
|
|
2014-03-31 11:19:16 +02:00
|
|
|
/*
|
|
|
|
* xf86UpdateHasVTProperty --
|
|
|
|
* Update a flag property on the root window to say whether the server VT
|
|
|
|
* is currently the active one as some clients need to know this.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
xf86UpdateHasVTProperty(Bool hasVT)
|
|
|
|
{
|
|
|
|
Atom property_name;
|
|
|
|
int32_t value = hasVT ? 1 : 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
|
|
|
|
FALSE);
|
|
|
|
if (property_name == BAD_RESOURCE)
|
|
|
|
FatalError("Failed to retrieve \"HAS_VT\" atom\n");
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
2015-11-24 14:31:21 +01:00
|
|
|
dixChangeWindowProperty(serverClient,
|
|
|
|
xf86ScrnToScreen(xf86Screens[i])->root,
|
|
|
|
property_name, XA_INTEGER, 32,
|
|
|
|
PropModeReplace, 1, &value, TRUE);
|
2014-03-31 11:19:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-19 11:26:36 +01:00
|
|
|
void
|
|
|
|
xf86VTLeave(void)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i;
|
|
|
|
InputInfoPtr pInfo;
|
|
|
|
IHPtr ih;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2013-12-19 11:26:36 +01:00
|
|
|
DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
|
|
|
|
BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
|
|
|
|
#ifdef DPMSExtension
|
|
|
|
if (DPMSPowerLevel != DPMSModeOn)
|
|
|
|
DPMSSet(serverClient, DPMSModeOn);
|
2003-11-14 17:49:22 +01:00
|
|
|
#endif
|
2013-12-19 11:26:36 +01:00
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
if (!(dispatchException & DE_TERMINATE))
|
|
|
|
if (xf86Screens[i]->EnableDisableFBAccess)
|
|
|
|
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
|
|
|
|
}
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*
|
2013-12-19 11:26:36 +01:00
|
|
|
* Keep the order: Disable Device > LeaveVT
|
|
|
|
* EnterVT > EnableDevice
|
2012-03-21 20:55:09 +01:00
|
|
|
*/
|
2013-12-19 11:26:36 +01:00
|
|
|
for (ih = InputHandlers; ih; ih = ih->next) {
|
|
|
|
if (ih->is_input)
|
|
|
|
xf86DisableInputHandler(ih);
|
|
|
|
else
|
|
|
|
xf86DisableGeneralHandler(ih);
|
|
|
|
}
|
2013-12-19 14:10:18 +01:00
|
|
|
for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
|
|
|
|
xf86DisableInputDeviceForVTSwitch(pInfo);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2015-12-08 23:39:46 +01:00
|
|
|
input_lock();
|
2013-12-19 11:26:36 +01:00
|
|
|
for (i = 0; i < xf86NumScreens; i++)
|
|
|
|
xf86Screens[i]->LeaveVT(xf86Screens[i]);
|
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++)
|
|
|
|
xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2013-12-19 11:28:40 +01:00
|
|
|
if (!xf86VTSwitchAway())
|
|
|
|
goto switch_failed;
|
|
|
|
|
|
|
|
if (xf86OSPMClose)
|
|
|
|
xf86OSPMClose();
|
|
|
|
xf86OSPMClose = NULL;
|
|
|
|
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
2013-12-19 11:26:36 +01:00
|
|
|
/*
|
2013-12-19 11:28:40 +01:00
|
|
|
* zero all access functions to
|
|
|
|
* trap calls when switched away.
|
2013-12-19 11:26:36 +01:00
|
|
|
*/
|
2013-12-19 11:28:40 +01:00
|
|
|
xf86Screens[i]->vtSema = FALSE;
|
|
|
|
}
|
|
|
|
if (xorgHWAccess)
|
|
|
|
xf86DisableIO();
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2014-03-31 11:19:16 +02:00
|
|
|
xf86UpdateHasVTProperty(FALSE);
|
|
|
|
|
2013-12-19 11:28:40 +01:00
|
|
|
return;
|
2013-12-19 11:26:36 +01:00
|
|
|
|
2013-12-19 11:28:40 +01:00
|
|
|
switch_failed:
|
|
|
|
DebugF("xf86VTSwitch: Leave failed\n");
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
|
|
|
|
FatalError("EnterVT failed for screen %d\n", i);
|
2013-12-19 11:26:36 +01:00
|
|
|
}
|
2013-12-19 11:28:40 +01:00
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
|
|
|
if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
|
|
|
|
FatalError("EnterVT failed for gpu screen %d\n", i);
|
|
|
|
}
|
|
|
|
if (!(dispatchException & DE_TERMINATE)) {
|
2013-12-19 11:26:36 +01:00
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
2013-12-19 11:28:40 +01:00
|
|
|
if (xf86Screens[i]->EnableDisableFBAccess)
|
|
|
|
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
|
2013-12-19 11:26:36 +01:00
|
|
|
}
|
|
|
|
}
|
2013-12-19 11:28:40 +01:00
|
|
|
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
|
|
|
|
|
2013-12-19 14:10:18 +01:00
|
|
|
for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
|
|
|
|
xf86EnableInputDeviceForVTSwitch(pInfo);
|
2013-12-19 11:28:40 +01:00
|
|
|
for (ih = InputHandlers; ih; ih = ih->next) {
|
|
|
|
if (ih->is_input)
|
|
|
|
xf86EnableInputHandler(ih);
|
|
|
|
else
|
|
|
|
xf86EnableGeneralHandler(ih);
|
|
|
|
}
|
2015-12-08 23:39:46 +01:00
|
|
|
input_unlock();
|
2013-12-19 11:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
xf86VTEnter(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
InputInfoPtr pInfo;
|
|
|
|
IHPtr ih;
|
|
|
|
|
|
|
|
DebugF("xf86VTSwitch: Entering\n");
|
|
|
|
if (!xf86VTSwitchTo())
|
|
|
|
return;
|
|
|
|
|
|
|
|
xf86OSPMClose = xf86OSPMOpen();
|
|
|
|
|
|
|
|
if (xorgHWAccess)
|
|
|
|
xf86EnableIO();
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
xf86Screens[i]->vtSema = TRUE;
|
|
|
|
if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
|
|
|
|
FatalError("EnterVT failed for screen %d\n", i);
|
|
|
|
}
|
|
|
|
for (i = 0; i < xf86NumGPUScreens; i++) {
|
|
|
|
xf86GPUScreens[i]->vtSema = TRUE;
|
|
|
|
if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
|
|
|
|
FatalError("EnterVT failed for gpu screen %d\n", i);
|
|
|
|
}
|
|
|
|
for (i = 0; i < xf86NumScreens; i++) {
|
|
|
|
if (xf86Screens[i]->EnableDisableFBAccess)
|
|
|
|
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Turn screen saver off when switching back */
|
|
|
|
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
|
|
|
|
|
2015-04-08 14:07:52 +02:00
|
|
|
for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
|
|
|
|
/* Devices with server managed fds get enabled on logind resume */
|
|
|
|
if (!(pInfo->flags & XI86_SERVER_FD))
|
2014-01-14 15:37:33 +01:00
|
|
|
xf86EnableInputDeviceForVTSwitch(pInfo);
|
2015-04-08 14:07:52 +02:00
|
|
|
}
|
2014-01-14 15:37:33 +01:00
|
|
|
|
2013-12-19 11:26:36 +01:00
|
|
|
for (ih = InputHandlers; ih; ih = ih->next) {
|
|
|
|
if (ih->is_input)
|
|
|
|
xf86EnableInputHandler(ih);
|
|
|
|
else
|
|
|
|
xf86EnableGeneralHandler(ih);
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
2013-12-19 11:26:36 +01:00
|
|
|
#ifdef XSERVER_PLATFORM_BUS
|
|
|
|
/* check for any new output devices */
|
|
|
|
xf86platformVTProbe();
|
|
|
|
#endif
|
|
|
|
|
2014-03-31 11:19:16 +02:00
|
|
|
xf86UpdateHasVTProperty(TRUE);
|
|
|
|
|
2015-12-08 23:39:46 +01:00
|
|
|
input_unlock();
|
2013-12-19 11:26:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xf86VTSwitch --
|
|
|
|
* Handle requests for switching the vt.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
xf86VTSwitch(void)
|
|
|
|
{
|
|
|
|
DebugF("xf86VTSwitch()\n");
|
|
|
|
|
|
|
|
#ifdef XFreeXDGA
|
|
|
|
if (!DGAVTSwitch())
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Since all screens are currently all in the same state it is sufficient
|
|
|
|
* check the first. This might change in future.
|
2014-01-14 15:37:33 +01:00
|
|
|
*
|
|
|
|
* VTLeave is always handled here (VT_PROCESS guarantees this is safe),
|
|
|
|
* if we use systemd_logind xf86VTEnter() gets called by systemd-logind.c
|
|
|
|
* once it has resumed all drm nodes.
|
2013-12-19 11:26:36 +01:00
|
|
|
*/
|
|
|
|
if (xf86VTOwner())
|
|
|
|
xf86VTLeave();
|
2014-01-14 15:37:33 +01:00
|
|
|
else if (!systemd_logind_controls_session())
|
2013-12-19 11:26:36 +01:00
|
|
|
xf86VTEnter();
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/* Input handler registration */
|
|
|
|
|
2015-12-03 08:02:02 +01:00
|
|
|
static void
|
|
|
|
xf86InputHandlerNotify(int fd, int ready, void *data)
|
|
|
|
{
|
|
|
|
IHPtr ih = data;
|
|
|
|
|
|
|
|
if (ih->enabled && ih->fd >= 0 && ih->ihproc) {
|
|
|
|
ih->ihproc(ih->fd, ih->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
static void *
|
|
|
|
addInputHandler(int fd, InputHandlerProc proc, void *data)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
IHPtr ih;
|
|
|
|
|
|
|
|
if (fd < 0 || !proc)
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
ih = calloc(sizeof(*ih), 1);
|
2003-11-14 17:49:22 +01:00
|
|
|
if (!ih)
|
2012-03-21 20:55:09 +01:00
|
|
|
return NULL;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
ih->fd = fd;
|
|
|
|
ih->ihproc = proc;
|
|
|
|
ih->data = data;
|
|
|
|
ih->enabled = TRUE;
|
|
|
|
|
2015-12-03 08:02:02 +01:00
|
|
|
if (!SetNotifyFd(fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih)) {
|
|
|
|
free(ih);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
ih->next = InputHandlers;
|
|
|
|
InputHandlers = ih;
|
|
|
|
|
2006-11-08 14:27:58 +01:00
|
|
|
return ih;
|
|
|
|
}
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
void *
|
|
|
|
xf86AddInputHandler(int fd, InputHandlerProc proc, void *data)
|
2006-11-08 14:36:47 +01:00
|
|
|
{
|
2006-11-08 14:27:58 +01:00
|
|
|
IHPtr ih = addInputHandler(fd, proc, data);
|
|
|
|
|
2015-12-03 08:02:02 +01:00
|
|
|
if (ih)
|
2013-08-12 18:20:36 +02:00
|
|
|
ih->is_input = TRUE;
|
2006-11-08 14:27:58 +01:00
|
|
|
return ih;
|
|
|
|
}
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
void *
|
|
|
|
xf86AddGeneralHandler(int fd, InputHandlerProc proc, void *data)
|
2006-11-08 14:36:47 +01:00
|
|
|
{
|
2006-11-08 14:27:58 +01:00
|
|
|
IHPtr ih = addInputHandler(fd, proc, data);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
return ih;
|
|
|
|
}
|
|
|
|
|
2010-09-06 03:32:38 +02:00
|
|
|
/**
|
|
|
|
* Set the handler for the console's fd. Replaces (and returns) the previous
|
|
|
|
* handler or NULL, whichever appropriate.
|
|
|
|
* proc may be NULL if the server should not handle events on the console.
|
|
|
|
*/
|
|
|
|
InputHandlerProc
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86SetConsoleHandler(InputHandlerProc proc, void *data)
|
2010-09-06 03:32:38 +02:00
|
|
|
{
|
2011-10-11 09:11:18 +02:00
|
|
|
static IHPtr handler = NULL;
|
2013-01-09 04:58:56 +01:00
|
|
|
InputHandlerProc old_proc = NULL;
|
2010-09-06 03:32:38 +02:00
|
|
|
|
2013-01-09 04:58:56 +01:00
|
|
|
if (handler) {
|
|
|
|
old_proc = handler->ihproc;
|
|
|
|
xf86RemoveGeneralHandler(handler);
|
|
|
|
}
|
2010-09-06 03:32:38 +02:00
|
|
|
|
2011-10-11 09:11:18 +02:00
|
|
|
handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
|
2010-09-06 03:32:38 +02:00
|
|
|
|
2013-01-09 04:58:56 +01:00
|
|
|
return old_proc;
|
2010-09-06 03:32:38 +02:00
|
|
|
}
|
|
|
|
|
2006-11-08 14:27:58 +01:00
|
|
|
static void
|
|
|
|
removeInputHandler(IHPtr ih)
|
|
|
|
{
|
|
|
|
IHPtr p;
|
|
|
|
|
2015-12-03 08:02:02 +01:00
|
|
|
if (ih->fd >= 0)
|
|
|
|
RemoveNotifyFd(ih->fd);
|
2006-11-08 14:27:58 +01:00
|
|
|
if (ih == InputHandlers)
|
2012-03-21 20:55:09 +01:00
|
|
|
InputHandlers = ih->next;
|
2006-11-08 14:27:58 +01:00
|
|
|
else {
|
2012-03-21 20:55:09 +01:00
|
|
|
p = InputHandlers;
|
|
|
|
while (p && p->next != ih)
|
|
|
|
p = p->next;
|
|
|
|
if (ih)
|
|
|
|
p->next = ih->next;
|
2006-11-08 14:27:58 +01:00
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
free(ih);
|
2006-11-08 14:27:58 +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
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86RemoveInputHandler(void *handler)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
2006-11-08 14:27:58 +01:00
|
|
|
IHPtr ih;
|
2003-11-14 17:49:22 +01:00
|
|
|
int fd;
|
2006-11-08 14:36:47 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
if (!handler)
|
2012-03-21 20:55:09 +01:00
|
|
|
return -1;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
ih = handler;
|
|
|
|
fd = ih->fd;
|
2006-11-08 14:36:47 +01:00
|
|
|
|
2006-11-08 14:27:58 +01:00
|
|
|
removeInputHandler(ih);
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
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
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86RemoveGeneralHandler(void *handler)
|
2006-11-08 14:27:58 +01:00
|
|
|
{
|
|
|
|
IHPtr ih;
|
|
|
|
int fd;
|
2006-11-08 14:36:47 +01:00
|
|
|
|
2006-11-08 14:27:58 +01:00
|
|
|
if (!handler)
|
2012-03-21 20:55:09 +01:00
|
|
|
return -1;
|
2006-11-08 14:27:58 +01:00
|
|
|
|
|
|
|
ih = handler;
|
|
|
|
fd = ih->fd;
|
2006-11-08 14:36:47 +01:00
|
|
|
|
2006-11-08 14:27:58 +01:00
|
|
|
removeInputHandler(ih);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
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
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86DisableInputHandler(void *handler)
|
2008-10-13 01:07:24 +02:00
|
|
|
{
|
|
|
|
IHPtr ih;
|
|
|
|
|
|
|
|
if (!handler)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2008-10-13 01:07:24 +02:00
|
|
|
|
|
|
|
ih = handler;
|
|
|
|
ih->enabled = FALSE;
|
|
|
|
if (ih->fd >= 0)
|
2015-12-03 08:02:02 +01:00
|
|
|
RemoveNotifyFd(ih->fd);
|
2008-10-13 01:07:24 +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
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86DisableGeneralHandler(void *handler)
|
2008-10-13 01:08:26 +02:00
|
|
|
{
|
|
|
|
IHPtr ih;
|
|
|
|
|
|
|
|
if (!handler)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2008-10-13 01:08:26 +02:00
|
|
|
|
|
|
|
ih = handler;
|
|
|
|
ih->enabled = FALSE;
|
|
|
|
if (ih->fd >= 0)
|
2015-12-03 08:02:02 +01:00
|
|
|
RemoveNotifyFd(ih->fd);
|
2008-10-13 01:08:26 +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
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86EnableInputHandler(void *handler)
|
2008-10-13 01:07:24 +02:00
|
|
|
{
|
|
|
|
IHPtr ih;
|
|
|
|
|
|
|
|
if (!handler)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2008-10-13 01:07:24 +02:00
|
|
|
|
|
|
|
ih = handler;
|
|
|
|
ih->enabled = TRUE;
|
|
|
|
if (ih->fd >= 0)
|
2015-12-03 08:02:02 +01:00
|
|
|
SetNotifyFd(ih->fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih);
|
2008-10-13 01:07:24 +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
|
2013-12-15 10:05:51 +01:00
|
|
|
xf86EnableGeneralHandler(void *handler)
|
2008-10-13 01:08:26 +02:00
|
|
|
{
|
|
|
|
IHPtr ih;
|
|
|
|
|
|
|
|
if (!handler)
|
2012-03-21 20:55:09 +01:00
|
|
|
return;
|
2008-10-13 01:08:26 +02:00
|
|
|
|
|
|
|
ih = handler;
|
|
|
|
ih->enabled = TRUE;
|
|
|
|
if (ih->fd >= 0)
|
2015-12-03 08:02:02 +01:00
|
|
|
SetNotifyFd(ih->fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih);
|
2008-10-13 01:08:26 +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
|
2012-03-21 20:55:09 +01:00
|
|
|
DDXRingBell(int volume, int pitch, int duration)
|
|
|
|
{
|
2006-11-01 22:10:26 +01:00
|
|
|
xf86OSRingBell(volume, pitch, duration);
|
|
|
|
}
|
2013-04-10 08:32:02 +02:00
|
|
|
|
|
|
|
Bool
|
|
|
|
xf86VTOwner(void)
|
|
|
|
{
|
|
|
|
/* at system startup xf86Screens[0] won't be set - but we will own the VT */
|
|
|
|
if (xf86NumScreens == 0)
|
|
|
|
return TRUE;
|
|
|
|
return xf86Screens[0]->vtSema;
|
|
|
|
}
|