1
0
xorg-x11-server/bug-197858_dpms.diff

96 lines
2.6 KiB
Diff

--- os/WaitFor.c.orig 2007-01-26 15:53:27.000000000 +0100
+++ os/WaitFor.c 2007-01-29 11:24:14.000000000 +0100
@@ -144,6 +144,7 @@ static OsTimerPtr timers = NULL;
* For more info on ClientsWithInput, see ReadRequestFromClient().
* pClientsReady is an array to store ready client->index values into.
*****************/
+volatile fd_set tmp_set;
int
WaitForSomething(int *pClientsReady)
@@ -298,10 +299,9 @@ WaitForSomething(int *pClientsReady)
if (expired)
return 0;
}
- }
+ }
else
- {
- fd_set tmp_set;
+ {
if (*checkForInput[0] == *checkForInput[1]) {
if (timers)
@@ -338,7 +338,8 @@ WaitForSomething(int *pClientsReady)
QueueWorkProc(EstablishNewConnections, NULL,
(pointer)&LastSelectMask);
#ifdef DPMSExtension
- if (XFD_ANYSET (&devicesReadable) && (DPMSPowerLevel != DPMSModeOn))
+ XFD_ANDSET(&tmp_set, &devicesReadable, &EnabledDevices);
+ if (XFD_ANYSET (&tmp_set) && (DPMSPowerLevel != DPMSModeOn))
DPMSSet(DPMSModeOn);
#endif
if (XFD_ANYSET (&devicesReadable) || XFD_ANYSET (&clientsReadable))
--- hw/xfree86/common/xf86Events.c.orig 2006-11-13 19:59:23.000000000 +0100
+++ hw/xfree86/common/xf86Events.c 2007-01-29 12:34:40.000000000 +0100
@@ -155,6 +155,10 @@ extern void (*xf86OSPMClose)(void);
static void xf86VTSwitch(void);
+static fd_set *inputDevices = NULL;
+static void SetEnabledDevice(int fd);
+#define UnsetEnabledDevice(x) FD_CLR(x,inputDevices)
+
/*
* Allow arbitrary drivers or other XFree86 code to register with our main
* Wakeup handler.
@@ -1664,8 +1668,10 @@ xf86AddInputHandler(int fd, InputHandler
{
IHPtr ih = addInputHandler(fd, proc, data);
- if (ih)
+ if (ih) {
AddEnabledDevice(fd);
+ SetEnabledDevice(fd);
+ }
return ih;
}
@@ -1708,8 +1714,10 @@ xf86RemoveInputHandler(pointer handler)
ih = handler;
fd = ih->fd;
- if (ih->fd >= 0)
+ if (ih->fd >= 0) {
RemoveEnabledDevice(ih->fd);
+ UnsetEnabledDevice(ih->fd);
+ }
removeInputHandler(ih);
return fd;
@@ -1772,7 +1780,7 @@ xf86EnableInputHandler(pointer handler)
ih = handler;
ih->enabled = TRUE;
- if (ih->fd >= 0)
+ if (ih->fd >= 0 && FD_ISSET(ih->fd, inputDevices))
AddEnabledDevice(ih->fd);
}
@@ -1831,6 +1839,15 @@ xf86ReloadInputDevs(int sig)
return;
}
+static void SetEnabledDevice(int x)
+{
+ if (!inputDevices) {
+ inputDevices = xcalloc(sizeof (fd_set), 1);
+ FD_ZERO(inputDevices);
+ };
+ FD_SET(x,inputDevices);
+}
+
#ifdef WSCONS_SUPPORT
/* XXX Currently XKB is mandatory. */