xfree86: add general handler, port ACPI to it (bug #5665)
Add 'general' handler registration, which will not trigger DPMS when an event comes in. Make ACPI use this.
This commit is contained in:
parent
b5438f7fb2
commit
809e2841aa
@ -222,6 +222,10 @@ pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
|
||||
int xf86RemoveInputHandler(pointer handler);
|
||||
void xf86DisableInputHandler(pointer handler);
|
||||
void xf86EnableInputHandler(pointer handler);
|
||||
pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
|
||||
int xf86RemoveGeneralHandler(pointer handler);
|
||||
void xf86DisableGeneralHandler(pointer handler);
|
||||
void xf86EnableGeneralHandler(pointer handler);
|
||||
void xf86InterceptSignals(int *signo);
|
||||
void xf86InterceptSigIll(void (*sigillhandler)(void));
|
||||
Bool xf86EnableVTSwitch(Bool new);
|
||||
|
@ -1014,8 +1014,8 @@ xf86VTSwitch()
|
||||
|
||||
/* Input handler registration */
|
||||
|
||||
_X_EXPORT pointer
|
||||
xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
|
||||
static pointer
|
||||
addInputHandler(int fd, InputHandlerProc proc, pointer data)
|
||||
{
|
||||
IHPtr ih;
|
||||
|
||||
@ -1034,25 +1034,33 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
|
||||
ih->next = InputHandlers;
|
||||
InputHandlers = ih;
|
||||
|
||||
AddEnabledDevice(fd);
|
||||
|
||||
return ih;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
xf86RemoveInputHandler(pointer handler)
|
||||
_X_EXPORT pointer
|
||||
xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
|
||||
{
|
||||
IHPtr ih, p;
|
||||
int fd;
|
||||
IHPtr ih = addInputHandler(fd, proc, data);
|
||||
|
||||
if (!handler)
|
||||
return -1;
|
||||
if (ih)
|
||||
AddEnabledDevice(fd);
|
||||
return ih;
|
||||
}
|
||||
|
||||
ih = handler;
|
||||
fd = ih->fd;
|
||||
_X_EXPORT pointer
|
||||
xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
|
||||
{
|
||||
IHPtr ih = addInputHandler(fd, proc, data);
|
||||
|
||||
if (ih->fd >= 0)
|
||||
RemoveEnabledDevice(ih->fd);
|
||||
if (ih)
|
||||
AddGeneralSocket(fd);
|
||||
return ih;
|
||||
}
|
||||
|
||||
static void
|
||||
removeInputHandler(IHPtr ih)
|
||||
{
|
||||
IHPtr p;
|
||||
|
||||
if (ih == InputHandlers)
|
||||
InputHandlers = ih->next;
|
||||
@ -1064,6 +1072,43 @@ xf86RemoveInputHandler(pointer handler)
|
||||
p->next = ih->next;
|
||||
}
|
||||
xfree(ih);
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
xf86RemoveInputHandler(pointer handler)
|
||||
{
|
||||
IHPtr ih;
|
||||
int fd;
|
||||
|
||||
if (!handler)
|
||||
return -1;
|
||||
|
||||
ih = handler;
|
||||
fd = ih->fd;
|
||||
|
||||
if (ih->fd >= 0)
|
||||
RemoveEnabledDevice(ih->fd);
|
||||
removeInputHandler(ih);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
_X_EXPORT int
|
||||
xf86RemoveGeneralHandler(pointer handler)
|
||||
{
|
||||
IHPtr ih;
|
||||
int fd;
|
||||
|
||||
if (!handler)
|
||||
return -1;
|
||||
|
||||
ih = handler;
|
||||
fd = ih->fd;
|
||||
|
||||
if (ih->fd >= 0)
|
||||
RemoveGeneralSocket(ih->fd);
|
||||
removeInputHandler(ih);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
@ -1081,6 +1126,20 @@ xf86DisableInputHandler(pointer handler)
|
||||
RemoveEnabledDevice(ih->fd);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
xf86DisableGeneralHandler(pointer handler)
|
||||
{
|
||||
IHPtr ih;
|
||||
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
ih = handler;
|
||||
ih->enabled = FALSE;
|
||||
if (ih->fd >= 0)
|
||||
RemoveGeneralSocket(ih->fd);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
xf86EnableInputHandler(pointer handler)
|
||||
{
|
||||
@ -1095,6 +1154,20 @@ xf86EnableInputHandler(pointer handler)
|
||||
AddEnabledDevice(ih->fd);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
xf86EnableGeneralHandler(pointer handler)
|
||||
{
|
||||
IHPtr ih;
|
||||
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
ih = handler;
|
||||
ih->enabled = TRUE;
|
||||
if (ih->fd >= 0)
|
||||
AddGeneralSocket(ih->fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* As used currently by the DRI, the return value is ignored.
|
||||
*/
|
||||
|
@ -163,7 +163,7 @@ lnxACPIOpen(void)
|
||||
|
||||
xf86PMGetEventFromOs = lnxACPIGetEventFromOs;
|
||||
xf86PMConfirmEventToOs = lnxACPIConfirmEventToOs;
|
||||
ACPIihPtr = xf86AddInputHandler(fd,xf86HandlePMEvents,NULL);
|
||||
ACPIihPtr = xf86AddGeneralHandler(fd,xf86HandlePMEvents,NULL);
|
||||
xf86MsgVerb(X_INFO,3,"Open ACPI successful (%s)\n", ACPI_SOCKET);
|
||||
|
||||
return lnxCloseACPI;
|
||||
@ -178,7 +178,7 @@ lnxCloseACPI(void)
|
||||
ErrorF("ACPI: Closing device\n");
|
||||
#endif
|
||||
if (ACPIihPtr) {
|
||||
fd = xf86RemoveInputHandler(ACPIihPtr);
|
||||
fd = xf86RemoveGeneralHandler(ACPIihPtr);
|
||||
shutdown(fd, 2);
|
||||
close(fd);
|
||||
ACPIihPtr = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user