[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#421279: marked as done (x2x: error messages to stderr if 'to' display doesn't support DPMS [PATCH])



Your message dated Sun, 07 Sep 2008 16:33:03 +0000
with message-id <5574494581.20080907162730@geodispraha.cz>
and subject line Trekkie lands Entterpprise
has caused the Debian Bug report #421279,
regarding x2x: error messages to stderr if 'to' display doesn't support DPMS [PATCH]
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
421279: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=421279
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: x2x
Version: 1.27.svn.20060501-1

If you start x2x where the 'to' display doesn't support DPMS, x2x will
print a warning message to standard error every time the mouse is moved
across to the 'to' display:

zircon$ x2x -to blackrock:0.0 -resurface -west
Xlib:  extension "DPMS" missing on display "blackrock:0.0".
Xlib:  extension "DPMS" missing on display "blackrock:0.0".

(In this case the target display is a Tektronix X terminal which was
manufactured before the DPMS extension was designed...)

It shouldn't be printing this at all, since if the target display does
not support the extension x2x can simply fall back to its traditional
behaviour of doing nothing (on the assumption that the display doesn't
support blanking and unblanking).

Here's a patch to x2x.c which fixes this -- the first time we try to
do any DPMS action we use DPMSQueryExtension() to see if the display
supports it; if it doesn't we don't do anything.

This works for me. I've tried to put in code so that compiling it for
Cygwin still works, but I haven't tested that at all. I also haven't
checked that it still does the right thing if the target display is
DPMS capable, but I can't see how it could possibly be broken :-)

Hope this helps.

===begin patch===
--- x2x-1.27.svn.20060501/x2x.c	2006-04-30 16:13:50.000000000 +0100
+++ x2x-1.27.svn.20060501-patched/x2x.c	2007-04-27 15:41:21.935158688 +0100
@@ -103,6 +103,8 @@
 
 #define DPMSModeOn        0
 extern Status DPMSForceLevel(Display *, unsigned short);
+/* We always support this: */
+#define DPMSQueryExtension(DPY, EVBASE, ERBASE) TRUE
 #else
 #include <X11/extensions/dpms.h>
 #endif
@@ -139,6 +141,7 @@
 #ifndef WIN_2_X
 static int     ErrorHandler();
 #endif
+static void    DoDPMSForceLevel();
 static void    DoX2X();
 static void    InitDpyInfo();
 static void    DoConnect();
@@ -292,6 +295,7 @@
   struct _shadow *pNext;
   char    *name;
   Display *dpy;
+  int     DPMSstatus; /* -1: not queried, 0: not supported, 1: supported */
 } SHADOW, *PSHADOW;
 
 /* sticky keys */
@@ -453,6 +457,7 @@
 
   /* toDpy is always the first shadow */
   pShadow = (PSHADOW)malloc(sizeof(SHADOW));
+  pShadow->DPMSstatus = -1;
   pShadow->name = toDpyName;
   /* link into the global list */
   pShadow->pNext = shadows;
@@ -691,6 +696,7 @@
     } else if (!strcasecmp(argv[arg], "-shadow")) {
       if (++arg >= argc) Usage();
       pShadow = (PSHADOW)malloc(sizeof(SHADOW));
+      pShadow->DPMSstatus = -1;
       pShadow->name = argv[arg];
 
       /* into the global list of shadows */
@@ -1386,6 +1392,27 @@
 
 } /* END InitDpyInfo */
 
+static void DoDPMSForceLevel(pShadow, level)
+PSHADOW pShadow;
+CARD16 level;
+{
+  /* Do a DPMSForceLevel(), but only if the display supports it */
+  if (pShadow->DPMSstatus == -1) {
+    /* Need to see if this display supports the DPMS extension.
+     * If it doesn't then trying DPMSForceLevel() will display
+     * a spurious error message to stderr.
+     */
+    int t1, t2;
+    if (DPMSQueryExtension(pShadow->dpy, &t1, &t2))
+      pShadow->DPMSstatus = 1;
+    else
+      pShadow->DPMSstatus = 0;
+  }
+  
+  if (pShadow->DPMSstatus != 0)
+    DPMSForceLevel(pShadow->dpy, level);
+}
+
 static void DoConnect(pDpyInfo)
 PDPYINFO pDpyInfo;
 {
@@ -1395,7 +1422,7 @@
   PSHADOW   pShadow;
 
   for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
-    DPMSForceLevel(pShadow->dpy, DPMSModeOn);
+    DoDPMSForceLevel(pShadow, DPMSModeOn);
     XFlush(pShadow->dpy);
   }
 
@@ -1616,7 +1643,7 @@
   for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
     if (doDpmsMouse)
     {
-      DPMSForceLevel(pShadow->dpy, DPMSModeOn);
+      DoDPMSForceLevel(pShadow, DPMSModeOn);
     }
       
     XTestFakeMotionEvent(pShadow->dpy, toScreenNum,
@@ -2324,7 +2351,7 @@
   PSHADOW   pShadow;
 
   for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
-    DPMSForceLevel(pShadow->dpy, DPMSModeOn);
+    DoDPMSForceLevel(pShadow, DPMSModeOn);
     XFlush(pShadow->dpy);
   }
 
@@ -2852,7 +2879,7 @@
     for (pShadow = shadows; pShadow; pShadow = pShadow->pNext) {
       if (doDpmsMouse)
       {
-        DPMSForceLevel(pShadow->dpy, DPMSModeOn);
+        DoDPMSForceLevel(pShadow, DPMSModeOn);
       }
       XTestFakeMotionEvent(pShadow->dpy, toScreenNum, pDpyInfo->xTables[toScreenNum][x],
         pDpyInfo->yTables[toScreenNum][y], 0);
===endit===

-- PMM


--- End Message ---
--- Begin Message ---
FEM V LE 7 VI z  A u new  it
A   AGRA - yo real y!
W g .N t L A R.NH
WW O E ET


Them, he thought gloomily. Two of the passengers at that
camp for seven days after my departure. Light on mrs. Rose's
disappearance? But eva had to investigate a murder for which
her mother had household furniture, for which adam had no
end.


--- End Message ---

Reply to: