xsetfbpm.patch revision 371
371N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
371N/A# Use subject to license terms.
371N/A#
371N/A# Permission is hereby granted, free of charge, to any person obtaining a
371N/A# copy of this software and associated documentation files (the
371N/A# "Software"), to deal in the Software without restriction, including
371N/A# without limitation the rights to use, copy, modify, merge, publish,
371N/A# distribute, and/or sell copies of the Software, and to permit persons
371N/A# to whom the Software is furnished to do so, provided that the above
371N/A# copyright notice(s) and this permission notice appear in all copies of
371N/A# the Software and that both the above copyright notice(s) and this
371N/A# permission notice appear in supporting documentation.
371N/A#
371N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
371N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
371N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
371N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
371N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
371N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
371N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
371N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
371N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
371N/A#
371N/A# Except as contained in this notice, the name of a copyright holder
371N/A# shall not be used in advertising or otherwise to promote the sale, use
371N/A# or other dealings in this Software without prior written authorization
371N/A# of the copyright holder.
371N/A
371N/AAdds support for Sun's Frame Buffer Power Management (fbpm) extension
371N/A
371N/Adiff -urp -x '*~' -x '*.orig' xset.c xset.c
371N/A--- xset.c 2008-03-06 14:28:40.000000000 -0800
371N/A+++ xset.c 2008-03-19 09:53:30.880805000 -0700
371N/A@@ -74,6 +74,10 @@ in this Software without prior written a
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
371N/A # ifdef WIN32
371N/A # define BOOL wBOOL
371N/A # ifdef Status
371N/A@@ -650,6 +654,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 */
371N/A@@ -1421,6 +1481,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;
371N/A@@ -1551,6 +1651,16 @@ usage(char *fmt, ...)
371N/A fprintf(stderr, "\t (also implicitly enables DPMS features) \n");
371N/A fprintf(stderr, "\t a timeout value of zero disables the mode \n");
371N/A #endif
277N/A+#ifdef FBPM
371N/A+ fprintf(stderr, " To control Frame Buffer Power Management (FBPM) features:\n");
371N/A+ fprintf(stderr, "\t-fbpm Frame Buffer Power Management features off\n");
371N/A+ fprintf(stderr, "\t+fbpm Frame Buffer Power Management features on\n");
371N/A+ fprintf(stderr, "\t fbpm force on \n");
371N/A+ fprintf(stderr, "\t force standby \n");
371N/A+ fprintf(stderr, "\t force suspend \n");
371N/A+ fprintf(stderr, "\t force off \n");
371N/A+ fprintf(stderr, "\t (also implicitly enables FBPM features) \n");
371N/A+#endif
277N/A #ifdef FONTCACHE
371N/A fprintf(stderr, " To control font cache:\n");
371N/A fprintf(stderr, "\t fc [hi-mark [low-mark [balance]]]\n");