public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* [PATCH] Fix command line arguments for multiple monitors
@ 2012-04-14 15:29 Jörg Mensmann
  2012-04-17 10:02 ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Jörg Mensmann @ 2012-04-14 15:29 UTC (permalink / raw)
  To: cygwin-xfree

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

Hi,

placing the X server on a specific monitor using something like 
"-screen 0 @2" is broken since November. The attached patch restores the
old behaviour.

ciao
  Jörg

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xwin-multi-monitor-fix.patch --]
[-- Type: text/x-patch, Size: 1090 bytes --]

[PATCH] hw/xwin: Fix command line arguments for multiple monitors.

Moving Xwin to a certain monitor using "-screen 0 @2" would fail,
printing "ddxProcessArgument - screen - Querying monitors failed".

This happened since commit 3ead1d810b0e157078db39712e02ea6dc85216d8,
because EnumDisplayMonitor() returns FALSE if its callback function
returns FALSE (which is not clearly documented), and QueryMonitor()
would then also return FALSE.

Moving back to the old behaviour, where the return value of
EnumDisplayMonitors() is ignored.
---
 hw/xwin/winmonitors.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c
index 26e20b7..7baa3a1 100644
--- a/hw/xwin/winmonitors.c
+++ b/hw/xwin/winmonitors.c
@@ -63,6 +63,7 @@ QueryMonitor(int index, struct GetMonitorInfoData *data)
     data->requestedMonitor = index;
 
     /* query information */
-    return EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+    EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data);
+
+    return TRUE;
 }
-- 
1.7.9



[-- Attachment #3: Type: text/plain, Size: 223 bytes --]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix command line arguments for multiple monitors
  2012-04-14 15:29 [PATCH] Fix command line arguments for multiple monitors Jörg Mensmann
@ 2012-04-17 10:02 ` Jon TURNEY
  2012-04-17 20:09   ` Jörg Mensmann
  0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2012-04-17 10:02 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: joerg_ml

On 14/04/2012 16:28, Jörg Mensmann wrote:
> placing the X server on a specific monitor using something like 
> "-screen 0 @2" is broken since November. The attached patch restores the
> old behaviour.

Thanks very much for investigating this issue and for the patch.

I'll include this in the next X server build.

> This happened since commit 3ead1d810b0e157078db39712e02ea6dc85216d8,
> because EnumDisplayMonitor() returns FALSE if its callback function
> returns FALSE (which is not clearly documented), and QueryMonitor()
> would then also return FALSE.

I don't observe this behaviour on my test machine, EnumDisplayMonitor()
returns TRUE, so I'd be interested to know what version of Windows you are using.

I am a little concerned that I can't find any evidence using google of anyone
else reporting having the MonitorEnumProc callback function return FALSE to
terminate the enumeration causes EnumDisplayMonitor() to return 0, indicating
failure, so maybe there is something else going on here...

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix command line arguments for multiple monitors
  2012-04-17 10:02 ` Jon TURNEY
@ 2012-04-17 20:09   ` Jörg Mensmann
  2012-04-18 18:49     ` Jörg Mensmann
  0 siblings, 1 reply; 5+ messages in thread
From: Jörg Mensmann @ 2012-04-17 20:09 UTC (permalink / raw)
  To: cygwin-xfree

Jon TURNEY wrote:
> I'll include this in the next X server build.

Thanks!

> I don't observe this behaviour on my test machine, EnumDisplayMonitor()
> returns TRUE, so I'd be interested to know what version of Windows you are using.

The problem appeared on a Windows 7 machine with two monitors connected.

I will run some additional tests to find out what exactly makes the
function return FALSE in this case.

ciao
  Jörg

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix command line arguments for multiple monitors
  2012-04-17 20:09   ` Jörg Mensmann
@ 2012-04-18 18:49     ` Jörg Mensmann
  2012-04-23 12:22       ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Jörg Mensmann @ 2012-04-18 18:49 UTC (permalink / raw)
  To: cygwin-xfree

Hi,

I've now completed some additional tests, and it seems that the return
value of EnumDisplayMonitors() really depends on the return value of its
callback on my system. Here is the minimal test case:

static wBOOL CALLBACK
getMonitorInfoTestTRUE(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
{
    return TRUE;
}

static wBOOL CALLBACK
getMonitorInfoTestFALSE(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
{
    return FALSE;
}

Inserted into QueryMonitor():
  wBOOL result;
  result = EnumDisplayMonitors(NULL, NULL, getMonitorInfoTestTRUE, (LPARAM) data);
  ErrorF("getMonitorInfoTestTRUE returns: %d\n", (int)result);

  result = EnumDisplayMonitors(NULL, NULL, getMonitorInfoTestFALSE, (LPARAM) data);
  ErrorF("getMonitorInfoTestFALSE returns: %d\n", (int)result);

When running "Xwin.exe :0 -screen 0 @1" this prints:
  getMonitorInfoTestTRUE returns: 1
  getMonitorInfoTestFALSE returns: 0

I get the same results even when only one monitor is connected.

If you can't reproduce this on your machine, then maybe it is related to
the graphics driver. My configuration is NVIDIA 285.62 on Windows 7
(64-bit).

ciao
  Jörg

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix command line arguments for multiple monitors
  2012-04-18 18:49     ` Jörg Mensmann
@ 2012-04-23 12:22       ` Jon TURNEY
  0 siblings, 0 replies; 5+ messages in thread
From: Jon TURNEY @ 2012-04-23 12:22 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: joerg_ml

On 18/04/2012 19:48, Jörg Mensmann wrote:
> I've now completed some additional tests, and it seems that the return
> value of EnumDisplayMonitors() really depends on the return value of its
> callback on my system. Here is the minimal test case:

Thanks for the test case.

Yes, you are quite correct.  I wasn't testing what I thought I was testing,
so, in fact, I do see the same behaviour as you.  Mystery solved :-)

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-23 12:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-14 15:29 [PATCH] Fix command line arguments for multiple monitors Jörg Mensmann
2012-04-17 10:02 ` Jon TURNEY
2012-04-17 20:09   ` Jörg Mensmann
2012-04-18 18:49     ` Jörg Mensmann
2012-04-23 12:22       ` Jon TURNEY

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).