1370N/A# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
371N/A#
371N/A# Permission is hereby granted, free of charge, to any person obtaining a
919N/A# copy of this software and associated documentation files (the "Software"),
919N/A# to deal in the Software without restriction, including without limitation
919N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A# and/or sell copies of the Software, and to permit persons to whom the
919N/A# Software is furnished to do so, subject to the following conditions:
919N/A#
919N/A# The above copyright notice and this permission notice (including the next
919N/A# paragraph) shall be included in all copies or substantial portions of the
919N/A# Software.
919N/A#
919N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A# DEALINGS IN THE SOFTWARE.
1179N/A
1179N/AAdds support for Solaris's Frame Buffer Power Management (fbpm) extension
371N/A
1179N/Adiff --git a/man/xset.man b/man/xset.man
1370N/Aindex e9f1c5e..2c81c5e 100644
1179N/A--- a/man/xset.man
1179N/A+++ b/man/xset.man
1179N/A@@ -1,4 +1,5 @@
1179N/A .\" Copyright 1988, 1998 The Open Group
1179N/A+.\" Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
1179N/A .\"
1179N/A .\" Permission to use, copy, modify, distribute, and sell this software and its
1179N/A .\" documentation for any purpose is hereby granted without fee, provided that
1179N/A@@ -40,6 +41,10 @@ xset - user preference utility for X
1179N/A [dpms \fIstandby\fP [\fI suspend\fP [\fI off\fP]]]
1179N/A [dpms force {standby|suspend|off|on}]
1179N/A .br
1179N/A+[+fbpm] [-fbpm]
1179N/A+.br
1179N/A+ [fbpm force {standby|suspend|off|on}]
1179N/A+.br
1179N/A [fp=\fIpathlist\fP]
1179N/A [-fp=\fIpathlist\fP]
1179N/A [+fp=\fIpathlist\fP]
1370N/A@@ -138,6 +143,32 @@ The first value given is for the `standby' mode, the second is for the
1179N/A `suspend' mode, and the third is for the `off' mode. Setting these
1179N/A values implicitly enables the DPMS features. A value of zero disables
1179N/A a particular mode.
1179N/A+Note that standby is less than suspend is less than off, if this condition is not met, an error is produced.
1179N/A+.PP
1179N/A+.TP 8
1179N/A+.B +fbpm
1179N/A+Enable frame buffer power management. NOTE: FBPM timing is linked to DPMS, See DPMS for default timeout values.
1179N/A+.PP
1179N/A+.TP 8
1179N/A+.B -fbpm
1179N/A+Disable frame buffer power management. NOTE: Does not affect DPMS timeouts.
1179N/A+.PP
1179N/A+.TP 8
1179N/A+.B fbpm force standby
1179N/A+Force to standby power level.
1179N/A+.PP
1179N/A+.TP 8
1179N/A+.B fbpm force suspend
1179N/A+Force to suspend power level.
1179N/A+.PP
1179N/A+.TP 8
1179N/A+.B fbpm force off
1179N/A+Force power to off.
1179N/A+.PP
1179N/A+.TP 8
1179N/A+.B fbpm force on
1179N/A+Force power to on.
1179N/A+.PP
1179N/A .TP 8
1179N/A .B fp= \fIpath,...\fP
1179N/A The \fBfp=\fP sets the font path to the entries given in the path argument.
1179N/Adiff --git a/xset.c b/xset.c
1370N/Aindex f461d4b..1629a72 100644
1179N/A--- a/xset.c
1179N/A+++ b/xset.c
1179N/A@@ -65,6 +65,10 @@ in this Software without prior written authorization from The Open Group.
277N/A #endif
277N/A #ifdef DPMSExtension
371N/A # include <X11/extensions/dpms.h>
371N/A+# define FBPM /* need to check for fbpm.h in autoconf if we push upstream */
371N/A+# ifdef FBPM
371N/A+# include <X11/extensions/fbpm.h>
371N/A+# endif
1370N/A #endif /* DPMSExtension */
1370N/A
1370N/A #ifdef XF86MISC
1370N/A@@ -593,6 +597,62 @@ main(int argc, char *argv[])
371N/A }
371N/A }
277N/A #endif /* DPMSExtension */
277N/A+#ifdef FBPM
371N/A+ else if (strcmp(arg, "+fbpm") == 0) { /* turn on FBPM */
371N/A+ int dummy;
277N/A+
371N/A+ if (FBPMQueryExtension(dpy, &dummy, &dummy)) {
371N/A+ FBPMEnable(dpy, 0);
371N/A+ } else {
371N/A+ fprintf(stderr,
371N/A+ "server does not have extension for +fbpm option\n");
371N/A+ }
371N/A+ } else if (strcmp(arg, "-fbpm") == 0) { /* shut off FBPM */
371N/A+ int dummy;
371N/A+
371N/A+ if (FBPMQueryExtension(dpy, &dummy, &dummy)) {
371N/A+ FBPMDisable(dpy);
371N/A+ } else {
371N/A+ fprintf(stderr,
371N/A+ "server does not have extension for -fbpm option\n");
371N/A+ }
371N/A+ } else if (strcmp(arg, "fbpm") == 0) { /* planing for force fbpm */
371N/A+ int dummy;
277N/A+
371N/A+ if ((i + 1) >= argc) {
371N/A+ usage("missing arguments to -fpbm", NULL);
371N/A+ } else {
371N/A+ /*
371N/A+ * we are skipping the word 'force'... just
371N/A+ * check to make sure its there
371N/A+ */
371N/A+ arg = nextarg(i, argv);
371N/A+ if (strcmp(arg, "force") != 0) { /* ack ! */
371N/A+ fprintf(stderr, "bad parameter %s [needs force]\n", arg);
371N/A+ break;
277N/A+ }
371N/A+ }
371N/A+ i++;
371N/A+ arg = nextarg(i, argv);
371N/A+ i++;
371N/A+ if (FBPMQueryExtension(dpy, &dummy, &dummy)) {
371N/A+ if (strcmp(arg, "on") == 0) {
371N/A+ FBPMEnable(dpy, FBPMModeOn);
371N/A+ } else if (strcmp(arg, "standby") == 0) {
371N/A+ FBPMEnable(dpy, FBPMModeStandby);
371N/A+ } else if (strcmp(arg, "suspend") == 0) {
371N/A+ FBPMEnable(dpy, FBPMModeSuspend);
371N/A+ } else if (strcmp(arg, "off") == 0) {
371N/A+ FBPMEnable(dpy, FBPMModeOff);
371N/A+ } else {
371N/A+ fprintf(stderr, "bad parameter %s\n", arg);
371N/A+ }
371N/A+ } else {
371N/A+ fprintf(stderr,
371N/A+ "server does not have extension for fbpm option\n");
371N/A+ }
371N/A+ }
277N/A+#endif
371N/A else if (strcmp(arg, "s") == 0) {
371N/A if (i >= argc) {
371N/A set_saver(dpy, ALL, 0); /* Set everything to default */
1370N/A@@ -1483,6 +1543,46 @@ query(Display *dpy)
371N/A }
371N/A }
277N/A #endif
277N/A+#ifdef FBPM
371N/A+ {
371N/A+ int dummy;
371N/A+ CARD16 standby, suspend, off;
371N/A+ BOOL onoff;
371N/A+ CARD16 state;
277N/A+
371N/A+ printf("FBPM (Frame Buffer Power Management):\n");
371N/A+ if (FBPMQueryExtension(dpy, &dummy, &dummy)) {
371N/A+ if (FBPMCapable(dpy)) {
371N/A+ FBPMInfo(dpy, &state, &onoff);
371N/A+ if (onoff) {
371N/A+ printf(" FBPM is enabled\n");
371N/A+ switch (state) {
371N/A+ case FBPMModeOn:
371N/A+ printf(" Frame Buffer is on\n");
371N/A+ break;
371N/A+ case FBPMModeStandby:
371N/A+ printf(" Frame Buffer is in standby\n");
371N/A+ break;
371N/A+ case FBPMModeSuspend:
371N/A+ printf(" Frame Buffer is in suspend\n");
371N/A+ break;
371N/A+ case FBPMModeOff:
371N/A+ printf(" Frame Buffer is off\n");
371N/A+ break;
371N/A+ default:
371N/A+ printf(" Unrecognized response from server\n");
371N/A+ }
277N/A+ } else {
371N/A+ printf(" FBPM is disabled\n");
277N/A+ }
371N/A+ } else {
371N/A+ printf(" System is not capable of FBPM\n");
371N/A+ }
371N/A+ } else {
371N/A+ printf(" Server does not have the FBPM Extension\n");
277N/A+ }
371N/A+ }
371N/A+#endif
277N/A #ifdef FONTCACHE
371N/A {
371N/A int dummy;
1370N/A@@ -1613,6 +1713,16 @@ usage(const char *fmt, ...)
1370N/A "\t (also implicitly enables DPMS features) \n"
1370N/A "\t a timeout value of zero disables the mode \n"
371N/A #endif
277N/A+#ifdef FBPM
1370N/A+ " To control Frame Buffer Power Management (FBPM) features:\n"
1370N/A+ "\t-fbpm Frame Buffer Power Management features off\n"
1370N/A+ "\t+fbpm Frame Buffer Power Management features on\n"
1370N/A+ "\t fbpm force on \n"
1370N/A+ "\t force standby \n"
1370N/A+ "\t force suspend \n"
1370N/A+ "\t force off \n"
1370N/A+ "\t (also implicitly enables FBPM features) \n"
371N/A+#endif
277N/A #ifdef FONTCACHE
1370N/A " To control font cache:\n"
1370N/A "\t fc [hi-mark [low-mark [balance]]]\n"