aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86Events.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
committermarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
commita915739887477b28d924ecc8417ee107d125bd6c (patch)
treec02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/hw/xfree86/common/xf86Events.c
parent6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff)
downloadvcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86Events.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86Events.c213
1 files changed, 67 insertions, 146 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c
index d6ef93a1b..9487fe7b2 100644
--- a/xorg-server/hw/xfree86/common/xf86Events.c
+++ b/xorg-server/hw/xfree86/common/xf86Events.c
@@ -76,24 +76,15 @@
#include "mi.h"
#include "mipointer.h"
-#ifdef XF86BIGFONT
-#define _XF86BIGFONT_SERVER_
-#include <X11/extensions/xf86bigfont.h>
-#endif
+#include "xkbsrv.h"
+#include "xkbstr.h"
#ifdef DPMSExtension
-#define DPMS_SERVER
-#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
/*
- * The first of many hacks to get VT switching to work under
- * Solaris 2.1 for x86. The basic problem is that Solaris is supposed
- * to be SVR4. It is for the most part, except where the video interface
- * is concerned. These hacks work around those problems.
- * See the comments for Linux, and SCO.
- *
* This is a toggling variable:
* FALSE = No VT switching keys have been pressed last time around
* TRUE = Possible VT switch Pending
@@ -102,7 +93,7 @@
* This has been generalised to work with Linux and *BSD+syscons (DHD)
*/
-_X_EXPORT Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
+Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
*BSD and for avoiding VT
switches when using the DRI
automatic full screen mode.*/
@@ -142,7 +133,7 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
* time in milliseconds since there last was any input.
*/
int
-TimeSinceLastInputEvent()
+TimeSinceLastInputEvent(void)
{
if (xf86Info.lastEventTime == 0) {
xf86Info.lastEventTime = GetTimeInMillis();
@@ -154,8 +145,8 @@ TimeSinceLastInputEvent()
* SetTimeSinceLastInputEvent --
* Set the lastEventTime to now.
*/
-_X_EXPORT void
-SetTimeSinceLastInputEvent()
+void
+SetTimeSinceLastInputEvent(void)
{
xf86Info.lastEventTime = GetTimeInMillis();
}
@@ -167,7 +158,7 @@ SetTimeSinceLastInputEvent()
* and keyboard.
*/
void
-ProcessInputEvents ()
+ProcessInputEvents (void)
{
int x, y;
@@ -185,9 +176,7 @@ ProcessInputEvents ()
void
xf86ProcessActionEvent(ActionEvent action, void *arg)
{
-#ifdef DEBUG
- ErrorF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
-#endif
+ DebugF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
switch (action) {
case ACTION_TERMINATE:
if (!xf86Info.dontZap) {
@@ -205,21 +194,27 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
if (!xf86Info.dontZoom)
xf86ZoomViewport(xf86Info.currentScreen, -1);
break;
-#if !defined(__SOL8__) && \
- (!defined(sun) || defined(__i386__)) && defined(VT_ACTIVATE)
+#if defined(VT_ACTIVATE)
case ACTION_SWITCHSCREEN:
if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
int vtno = *((int *) arg);
#if defined(__SCO__) || defined(__UNIXWARE__)
vtno--;
#endif
+#if defined(sun)
+ if (vtno == xf86Info.vtno)
+ break;
+
+ xf86Info.vtRequestsPending = TRUE;
+ xf86Info.vtPendingNum = vtno;
+#else
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0)
ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+#endif
}
break;
case ACTION_SWITCHSCREEN_NEXT:
if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
-/* Shouldn't this be true for (sun) && (i386) && (SVR4) ? */
#if defined(__SCO__) || defined(__UNIXWARE__)
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
#else
@@ -301,16 +296,13 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
* signal handler for the SIGIO signal.
*/
static void
-xf86SigioReadInput(int fd,
- void *closure)
+xf86SigioReadInput(int fd, void *closure)
{
int errno_save = errno;
- int sigstate = xf86BlockSIGIO();
- InputInfoPtr pInfo = (InputInfoPtr) closure;
+ InputInfoPtr pInfo = closure;
pInfo->read_input(pInfo);
- xf86UnblockSIGIO(sigstate);
errno = errno_save;
}
@@ -318,7 +310,7 @@ xf86SigioReadInput(int fd,
* xf86AddEnabledDevice --
*
*/
-_X_EXPORT void
+void
xf86AddEnabledDevice(InputInfoPtr pInfo)
{
if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {
@@ -330,7 +322,7 @@ xf86AddEnabledDevice(InputInfoPtr pInfo)
* xf86RemoveEnabledDevice --
*
*/
-_X_EXPORT void
+void
xf86RemoveEnabledDevice(InputInfoPtr pInfo)
{
if (!xf86RemoveSIGIOHandler (pInfo->fd)) {
@@ -340,7 +332,7 @@ xf86RemoveEnabledDevice(InputInfoPtr pInfo)
static int *xf86SignalIntercept = NULL;
-_X_EXPORT void
+void
xf86InterceptSignals(int *signo)
{
if ((xf86SignalIntercept = signo))
@@ -349,70 +341,55 @@ xf86InterceptSignals(int *signo)
static void (*xf86SigIllHandler)(void) = NULL;
-_X_EXPORT void
+void
xf86InterceptSigIll(void (*sigillhandler)(void))
{
xf86SigIllHandler = sigillhandler;
}
/*
- * xf86SigHandler --
+ * xf86SigWrapper --
* Catch unexpected signals and exit or continue cleanly.
*/
-void
-xf86SigHandler(int signo)
+int
+xf86SigWrapper(int signo)
{
if ((signo == SIGILL) && xf86SigIllHandler) {
(*xf86SigIllHandler)();
- /* Re-arm handler just in case we unexpectedly return here */
- (void) signal(signo, xf86SigHandler);
- return;
+ return 0; /* continue */
}
if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
*xf86SignalIntercept = signo;
- /* Re-arm handler just in case */
- (void) signal(signo, xf86SigHandler);
- return;
+ return 0; /* continue */
}
- signal(signo,SIG_IGN);
xf86Info.caughtSignal = TRUE;
-#ifdef XF86BIGFONT
- XF86BigfontCleanup();
-#endif
-
- xorg_backtrace();
-
- FatalError("Caught signal %d. Server aborting\n", signo);
+ return 1; /* abort */
}
/*
* xf86PrintBacktrace --
* Print a stack backtrace for debugging purposes.
*/
-_X_EXPORT void
+void
xf86PrintBacktrace(void)
{
xorg_backtrace();
}
#define KeyPressed(k) (keyc->postdown[k >> 3] & (1 << (k & 7)))
-#define ModifierDown(k) ((keyc->state & (k)) == (k))
static void
xf86ReleaseKeys(DeviceIntPtr pDev)
{
- KeyClassPtr keyc = NULL;
- KeySym *map = NULL;
- xEvent ke;
- int i = 0, j = 0, nevents = 0;
+ KeyClassPtr keyc;
+ int i, j, nevents, sigstate;
if (!pDev || !pDev->key)
return;
keyc = pDev->key;
- map = keyc->curKeySyms.map;
/*
* Hmm... here is the biggest hack of every time !
@@ -425,36 +402,15 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
* are reenabled.
*/
- for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
- i < keyc->curKeySyms.maxKeyCode;
- i++, map += keyc->curKeySyms.mapWidth) {
+ for (i = keyc->xkbInfo->desc->min_key_code;
+ i < keyc->xkbInfo->desc->max_key_code;
+ i++) {
if (KeyPressed(i)) {
- switch (*map) {
- /* Don't release the lock keys */
- case XK_Caps_Lock:
- case XK_Shift_Lock:
- case XK_Num_Lock:
- case XK_Scroll_Lock:
- case XK_Kana_Lock:
- break;
- default:
- if (pDev == inputInfo.keyboard) {
- ke.u.keyButtonPointer.time = GetTimeInMillis();
- ke.u.keyButtonPointer.rootX = 0;
- ke.u.keyButtonPointer.rootY = 0;
- ke.u.u.type = KeyRelease;
- ke.u.u.detail = i;
- (*pDev->public.processInputProc) (&ke, pDev, 1);
- }
- else {
- int sigstate = xf86BlockSIGIO ();
- nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
- for (j = 0; j < nevents; j++)
- mieqEnqueue(pDev, (xf86Events + j)->event);
- xf86UnblockSIGIO(sigstate);
- }
- break;
- }
+ sigstate = xf86BlockSIGIO ();
+ nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
+ for (j = 0; j < nevents; j++)
+ mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event);
+ xf86UnblockSIGIO(sigstate);
}
}
}
@@ -464,15 +420,13 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
* Handle requests for switching the vt.
*/
static void
-xf86VTSwitch()
+xf86VTSwitch(void)
{
int i, prevSIGIO;
InputInfoPtr pInfo;
IHPtr ih;
-#ifdef DEBUG
- ErrorF("xf86VTSwitch()\n");
-#endif
+ DebugF("xf86VTSwitch()\n");
#ifdef XFreeXDGA
if(!DGAVTSwitch())
@@ -485,10 +439,8 @@ xf86VTSwitch()
*/
if (xf86Screens[0]->vtSema) {
-#ifdef DEBUG
- ErrorF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
+ DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
-#endif
#ifdef DPMSExtension
if (DPMSPowerLevel != DPMSModeOn)
DPMSSet(serverClient, DPMSModeOn);
@@ -503,29 +455,27 @@ xf86VTSwitch()
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev)
- DisableDevice(pInfo->dev);
- pInfo = pInfo->next;
+ for (ih = InputHandlers; ih; ih = ih->next)
+ xf86DisableInputHandler(ih);
+ for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
+ if (pInfo->dev) {
+ xf86ReleaseKeys(pInfo->dev);
+ ProcessInputEvents();
+ DisableDevice(pInfo->dev, TRUE);
+ }
}
xf86EnterServerState(SETUP);
for (i = 0; i < xf86NumScreens; i++)
xf86Screens[i]->LeaveVT(i, 0);
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86DisableInputHandler(ih);
xf86AccessLeave(); /* We need this here, otherwise */
- xf86AccessLeaveState(); /* console won't be restored */
if (!xf86VTSwitchAway()) {
/*
* switch failed
*/
-#ifdef DEBUG
- ErrorF("xf86VTSwitch: Leave failed\n");
-#endif
+ DebugF("xf86VTSwitch: Leave failed\n");
prevSIGIO = xf86BlockSIGIO();
xf86AccessEnter();
xf86EnterServerState(SETUP);
@@ -544,14 +494,10 @@ xf86VTSwitch()
pInfo = xf86InputDevs;
while (pInfo) {
- if (pInfo->dev) {
- xf86ReleaseKeys(pInfo->dev);
- EnableDevice(pInfo->dev);
- }
+ if (pInfo->dev)
+ EnableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
- /* XXX HACK */
- xf86ReleaseKeys(inputInfo.keyboard);
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -570,17 +516,13 @@ xf86VTSwitch()
* trap calls when switched away.
*/
xf86Screens[i]->vtSema = FALSE;
- xf86Screens[i]->access = NULL;
- xf86Screens[i]->busAccess = NULL;
}
if (xorgHWAccess)
xf86DisableIO();
}
} else {
-#ifdef DEBUG
- ErrorF("xf86VTSwitch: Entering\n");
-#endif
+ DebugF("xf86VTSwitch: Entering\n");
if (!xf86VTSwitchTo()) return;
prevSIGIO = xf86BlockSIGIO();
@@ -608,14 +550,10 @@ xf86VTSwitch()
pInfo = xf86InputDevs;
while (pInfo) {
- if (pInfo->dev) {
- xf86ReleaseKeys(pInfo->dev);
- EnableDevice(pInfo->dev);
- }
+ if (pInfo->dev)
+ EnableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
- /* XXX HACK */
- xf86ReleaseKeys(inputInfo.keyboard);
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@@ -650,7 +588,7 @@ addInputHandler(int fd, InputHandlerProc proc, pointer data)
return ih;
}
-_X_EXPORT pointer
+pointer
xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
{
IHPtr ih = addInputHandler(fd, proc, data);
@@ -660,7 +598,7 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
return ih;
}
-_X_EXPORT pointer
+pointer
xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
{
IHPtr ih = addInputHandler(fd, proc, data);
@@ -687,7 +625,7 @@ removeInputHandler(IHPtr ih)
xfree(ih);
}
-_X_EXPORT int
+int
xf86RemoveInputHandler(pointer handler)
{
IHPtr ih;
@@ -706,7 +644,7 @@ xf86RemoveInputHandler(pointer handler)
return fd;
}
-_X_EXPORT int
+int
xf86RemoveGeneralHandler(pointer handler)
{
IHPtr ih;
@@ -725,7 +663,7 @@ xf86RemoveGeneralHandler(pointer handler)
return fd;
}
-_X_EXPORT void
+void
xf86DisableInputHandler(pointer handler)
{
IHPtr ih;
@@ -739,7 +677,7 @@ xf86DisableInputHandler(pointer handler)
RemoveEnabledDevice(ih->fd);
}
-_X_EXPORT void
+void
xf86DisableGeneralHandler(pointer handler)
{
IHPtr ih;
@@ -753,7 +691,7 @@ xf86DisableGeneralHandler(pointer handler)
RemoveGeneralSocket(ih->fd);
}
-_X_EXPORT void
+void
xf86EnableInputHandler(pointer handler)
{
IHPtr ih;
@@ -767,7 +705,7 @@ xf86EnableInputHandler(pointer handler)
AddEnabledDevice(ih->fd);
}
-_X_EXPORT void
+void
xf86EnableGeneralHandler(pointer handler)
{
IHPtr ih;
@@ -784,7 +722,7 @@ xf86EnableGeneralHandler(pointer handler)
/*
* As used currently by the DRI, the return value is ignored.
*/
-_X_EXPORT Bool
+Bool
xf86EnableVTSwitch(Bool new)
{
static Bool def = TRUE;
@@ -803,23 +741,6 @@ xf86EnableVTSwitch(Bool new)
}
void
-xf86ReloadInputDevs(int sig)
-{
- InputInfoPtr pInfo;
-
- signal(sig, (void(*)(int))xf86ReloadInputDevs);
-
- pInfo = xf86InputDevs;
- while (pInfo) {
- DisableDevice(pInfo->dev);
- EnableDevice(pInfo->dev);
- pInfo = pInfo->next;
- }
-
- return;
-}
-
-_X_EXPORT void
DDXRingBell(int volume, int pitch, int duration) {
xf86OSRingBell(volume, pitch, duration);
}