diff options
author | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-23 10:05:55 +0100 |
commit | 0f834b91a4768673833ab4917e87d86c237bb1a6 (patch) | |
tree | 363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c | |
parent | fc72edebf875378459368c5383d9023730cbca54 (diff) | |
download | vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2 vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip |
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c')
-rw-r--r-- | xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c | 96 |
1 files changed, 49 insertions, 47 deletions
diff --git a/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c b/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c index 73c88dca3..a8a4164e0 100644 --- a/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c +++ b/xorg-server/hw/xfree86/os-support/bsd/bsd_apm.c @@ -20,20 +20,22 @@ static void bsdCloseAPM(void); static struct { u_int apmBsd; pmEvent xf86; -} bsdToXF86Array [] = { - { APM_STANDBY_REQ, XF86_APM_SYS_STANDBY }, - { APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND }, - { APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME }, - { APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME }, - { APM_BATTERY_LOW, XF86_APM_LOW_BATTERY }, - { APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE }, - { APM_UPDATE_TIME, XF86_APM_UPDATE_TIME }, - { APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND }, - { APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY }, - { APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND }, - { APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME }, +} bsdToXF86Array[] = { + { + APM_STANDBY_REQ, XF86_APM_SYS_STANDBY}, { + APM_SUSPEND_REQ, XF86_APM_SYS_SUSPEND}, { + APM_NORMAL_RESUME, XF86_APM_NORMAL_RESUME}, { + APM_CRIT_RESUME, XF86_APM_CRITICAL_RESUME}, { + APM_BATTERY_LOW, XF86_APM_LOW_BATTERY}, { + APM_POWER_CHANGE, XF86_APM_POWER_STATUS_CHANGE}, { + APM_UPDATE_TIME, XF86_APM_UPDATE_TIME}, { + APM_CRIT_SUSPEND_REQ, XF86_APM_CRITICAL_SUSPEND}, { + APM_USER_STANDBY_REQ, XF86_APM_USER_STANDBY}, { + APM_USER_SUSPEND_REQ, XF86_APM_USER_SUSPEND}, { + APM_SYS_STANDBY_RESUME, XF86_APM_STANDBY_RESUME}, #ifdef APM_CAPABILITY_CHANGE - { APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED }, + { + APM_CAPABILITY_CHANGE, XF86_APM_CAPABILITY_CHANGED}, #endif }; @@ -45,9 +47,9 @@ bsdToXF86(int type) int i; for (i = 0; i < numApmEvents; i++) { - if (type == bsdToXF86Array[i].apmBsd) { - return bsdToXF86Array[i].xf86; - } + if (type == bsdToXF86Array[i].apmBsd) { + return bsdToXF86Array[i].xf86; + } } return XF86_APM_UNKNOWN; } @@ -55,22 +57,22 @@ bsdToXF86(int type) /* * APM events can be requested direclty from /dev/apm */ -static int -bsdPMGetEventFromOS(int fd, pmEvent *events, int num) +static int +bsdPMGetEventFromOS(int fd, pmEvent * events, int num) { struct apm_event_info bsdEvent; int i; for (i = 0; i < num; i++) { - - if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) { - if (errno != EAGAIN) { - xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT" - " %s\n", strerror(errno)); - } - break; - } - events[i] = bsdToXF86(bsdEvent.type); + + if (ioctl(fd, APM_IOC_NEXTEVENT, &bsdEvent) < 0) { + if (errno != EAGAIN) { + xf86Msg(X_WARNING, "bsdPMGetEventFromOS: APM_IOC_NEXTEVENT" + " %s\n", strerror(errno)); + } + break; + } + events[i] = bsdToXF86(bsdEvent.type); } return i; } @@ -84,27 +86,27 @@ static pmWait bsdPMConfirmEventToOs(int fd, pmEvent event) { switch (event) { - case XF86_APM_SYS_STANDBY: - case XF86_APM_USER_STANDBY: - if (ioctl( fd, APM_IOC_STANDBY, NULL ) == 0) - return PM_WAIT; /* should we stop the Xserver in standby, too? */ + case XF86_APM_SYS_STANDBY: + case XF86_APM_USER_STANDBY: + if (ioctl(fd, APM_IOC_STANDBY, NULL) == 0) + return PM_WAIT; /* should we stop the Xserver in standby, too? */ else return PM_NONE; - case XF86_APM_SYS_SUSPEND: - case XF86_APM_CRITICAL_SUSPEND: - case XF86_APM_USER_SUSPEND: - if (ioctl( fd, APM_IOC_SUSPEND, NULL ) == 0) + case XF86_APM_SYS_SUSPEND: + case XF86_APM_CRITICAL_SUSPEND: + case XF86_APM_USER_SUSPEND: + if (ioctl(fd, APM_IOC_SUSPEND, NULL) == 0) return PM_WAIT; else return PM_NONE; - case XF86_APM_STANDBY_RESUME: - case XF86_APM_NORMAL_RESUME: - case XF86_APM_CRITICAL_RESUME: - case XF86_APM_STANDBY_FAILED: - case XF86_APM_SUSPEND_FAILED: + case XF86_APM_STANDBY_RESUME: + case XF86_APM_NORMAL_RESUME: + case XF86_APM_CRITICAL_RESUME: + case XF86_APM_STANDBY_FAILED: + case XF86_APM_SUSPEND_FAILED: return PM_CONTINUE; - default: - return PM_NONE; + default: + return PM_NONE; } } @@ -114,11 +116,11 @@ xf86OSPMOpen(void) int fd; if (APMihPtr || !xf86Info.pmFlag) { - return NULL; + return NULL; } if ((fd = open(APM_DEVICE, O_RDWR)) == -1) { - return NULL; + return NULL; } xf86PMGetEventFromOs = bsdPMGetEventFromOS; xf86PMConfirmEventToOs = bsdPMConfirmEventToOs; @@ -132,8 +134,8 @@ bsdCloseAPM(void) int fd; if (APMihPtr) { - fd = xf86RemoveGeneralHandler(APMihPtr); - close(fd); - APMihPtr = NULL; + fd = xf86RemoveGeneralHandler(APMihPtr); + close(fd); + APMihPtr = NULL; } } |