public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* Wine creating windows offscreen when "multiwindow" is used?
@ 2014-07-03 22:47 Matt D.
  2014-07-06 16:27 ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Matt D. @ 2014-07-03 22:47 UTC (permalink / raw)
  To: cygwin-xfree

I have a monitor configuration with three 1920x1080 monitors aligned 
side-by-side horizontally with a fourth above the center. The primary 
monitor is the center one at the bottom. xinit generates a single screen 
5760x2160 to cover the area. The root window is hidden and all windows 
in the buffer are drawn with native Windows decorations.

When an X window is created at 0,0, it is visible on the primary 
monitor, despite 0,0 in the buffer being offscreen. This is great. 
However, when Wine creates a window at 0,0, it is aligned to 0,0 in the 
buffer (-1920x-1080 screen coordinates on Windows) and is not visible.

Is there a solution for this? This is a discrepancy between what regular 
X windows do and where Wine positions its windows.

I also noticed that when creating a window with XCreateSimpleWindow, the 
x and y coordinates are ignored. For example, I would expect a window 
created at 0,0 in the X buffer to be visible at 0,0 screen coordinates; 
but instead it's just somewhere offset slightly from the top left of the 
primary monitor. Any x/y coordinates specified do not seem to affect 
where it goes.

The behavior I would expect is for 0,0 in the buffer to be mapped to 0,0 
in screen coordinates, 1920x, 1080y in my configuration.

To clarify my use of Wine, I connected to a remote CentOS 6.5 machine 
via ssh with x forwarding for testing.

Can anyone provide some insight on this?


Matt D.

--
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: Wine creating windows offscreen when "multiwindow" is used?
  2014-07-03 22:47 Wine creating windows offscreen when "multiwindow" is used? Matt D.
@ 2014-07-06 16:27 ` Jon TURNEY
  2014-07-09 16:10   ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2014-07-06 16:27 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: matt

On 03/07/2014 23:46, Matt D. wrote:
> I have a monitor configuration with three 1920x1080 monitors aligned
> side-by-side horizontally with a fourth above the center. The primary
> monitor is the center one at the bottom. xinit generates a single screen
> 5760x2160 to cover the area. The root window is hidden and all windows
> in the buffer are drawn with native Windows decorations.
>
> When an X window is created at 0,0, it is visible on the primary
> monitor, despite 0,0 in the buffer being offscreen. This is great.
> However, when Wine creates a window at 0,0, it is aligned to 0,0 in the
> buffer (-1920x-1080 screen coordinates on Windows) and is not visible.
>
> Is there a solution for this? This is a discrepancy between what regular
> X windows do and where Wine positions its windows.
>
> I also noticed that when creating a window with XCreateSimpleWindow, the
> x and y coordinates are ignored. For example, I would expect a window
> created at 0,0 in the X buffer to be visible at 0,0 screen coordinates;
> but instead it's just somewhere offset slightly from the top left of the
> primary monitor. Any x/y coordinates specified do not seem to affect
> where it goes.

Normally, an X window manager ignores the x,y position specified for the 
window when it's created, and places the window according to some 
heuristic (for example, try to ensure that windows don't completely overlap)

The -multiwindow mode window manager defers to Windows native window 
placement (which appears to be something like placing the ith window 
created at x=y=30+26*(i%9))

But, if the PPosition or USPosition flags in WM_NORMAL_HINTS are set, 
the -multiwindow mode window manager places the window as requested.

(Most toolkits will set USPosition if you explicitly specify a window 
position e.g. using a -geometry option)

I guess that Wine is setting one of these flags so it can emulate 
Windows window placement.

> The behavior I would expect is for 0,0 in the buffer to be mapped to 0,0
> in screen coordinates, 1920x, 1080y in my configuration.

Unfortunately, X window coordinates are defined to be positive, with 0,0 
being the top-left of the desktop.

So, while you could do this with the -screen option (e.g -screen 0 @1), 
to move the origin to your primary monitor, windows which are moved to 
the left or above of that probably won't render correctly.

If you can't turn off the placement behaviour in Wine, perhaps the best 
compromise might be to use something like '-screen 0 5760x1080+0+1080' 
so you have an X desktop which covers the bottom 3 screens, and avoid 
moving X windows into the 4th screen?

> To clarify my use of Wine, I connected to a remote CentOS 6.5 machine
> via ssh with x forwarding for testing.
>
> Can anyone provide some insight on this?

There is some code in XWin which attempts to ensure that the window is 
placed somewhere visible, but that assumes that the Window virtual 
desktop is a rectangle of size GetSystemMetrics(SM_CXVIRTUALSCREEN) x 
GetSystemMetrics(SM_CYVIRTUALSCREEN).

I think it should be pretty straightforward to change this, perhaps to 
use MonitorFromPoint() to determine if the window will be visible on a 
non-rectangular virtual desktop.

-- 
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

* Re: Wine creating windows offscreen when "multiwindow" is used?
  2014-07-06 16:27 ` Jon TURNEY
@ 2014-07-09 16:10   ` Jon TURNEY
  2014-07-09 22:22     ` Matt D.
  0 siblings, 1 reply; 5+ messages in thread
From: Jon TURNEY @ 2014-07-09 16:10 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: matt

On 06/07/2014 17:27, Jon TURNEY wrote:
> There is some code in XWin which attempts to ensure that the window is
> placed somewhere visible, but that assumes that the Window virtual
> desktop is a rectangle of size GetSystemMetrics(SM_CXVIRTUALSCREEN) x
> GetSystemMetrics(SM_CYVIRTUALSCREEN).
>
> I think it should be pretty straightforward to change this, perhaps to
> use MonitorFromPoint() to determine if the window will be visible on a
> non-rectangular virtual desktop.

I've built a snapshot with this change.  Perhaps you could try that and 
see if it improves things for you?

ftp://cygwin.com/pub/cygwinx/x86/XWin.20140709-git-2e9c13ea41c51df7.exe.bz2
ftp://cygwin.com/pub/cygwinx/x86_64/XWin.20140709-git-2e9c13ea41c51df7.exe.bz2

-- 
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

* Re: Wine creating windows offscreen when "multiwindow" is used?
  2014-07-09 16:10   ` Jon TURNEY
@ 2014-07-09 22:22     ` Matt D.
  2014-07-21 15:58       ` Jon TURNEY
  0 siblings, 1 reply; 5+ messages in thread
From: Matt D. @ 2014-07-09 22:22 UTC (permalink / raw)
  To: cygwin-xfree

Jon,

Yes! That fixed it. Windows from Wine open up just as regular X windows 
on the primary monitor.

To achieve this is appears as though you're ignoring the Window's 
requested x/y position entirely and favoring the placement heuristics, 
as these coordinates are being ignored.

I do have a use-case where I want windows from Wine to be created at a 
designated position for testing, so I don't have to test on a Windows 
machine for placement as well. Is it at all possible to have these 
windows map their coordinates strictly, as in 0,0 on the primary monitor 
would be 1920x1080 in my case.

For example, I may want a child window which is a custom dialog aligned 
to the center of its parent, or a newly created window to be 
center-aligned to the screen.

You've done a great job with this, Jon. I'm not complaining, as this 
will allow me to begin writing code immediately (I can finally see the 
window!).

Thanks so much for your help. :)


Matt D.

On 7/9/2014 12:10 PM, Jon TURNEY wrote:
> On 06/07/2014 17:27, Jon TURNEY wrote:
>> There is some code in XWin which attempts to ensure that the window is
>> placed somewhere visible, but that assumes that the Window virtual
>> desktop is a rectangle of size GetSystemMetrics(SM_CXVIRTUALSCREEN) x
>> GetSystemMetrics(SM_CYVIRTUALSCREEN).
>>
>> I think it should be pretty straightforward to change this, perhaps to
>> use MonitorFromPoint() to determine if the window will be visible on a
>> non-rectangular virtual desktop.
>
> I've built a snapshot with this change.  Perhaps you could try that and
> see if it improves things for you?
>
> ftp://cygwin.com/pub/cygwinx/x86/XWin.20140709-git-2e9c13ea41c51df7.exe.bz2
> ftp://cygwin.com/pub/cygwinx/x86_64/XWin.20140709-git-2e9c13ea41c51df7.exe.bz2
>
>

--
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: Wine creating windows offscreen when "multiwindow" is used?
  2014-07-09 22:22     ` Matt D.
@ 2014-07-21 15:58       ` Jon TURNEY
  0 siblings, 0 replies; 5+ messages in thread
From: Jon TURNEY @ 2014-07-21 15:58 UTC (permalink / raw)
  To: cygwin-xfree, matt

On 09/07/2014 23:22, Matt D. wrote:
> Yes! That fixed it. Windows from Wine open up just as regular X
> windows on the primary monitor.

Thanks for testing.

This change is included in 1.14.1-4

> To achieve this is appears as though you're ignoring the Window's
> requested x/y position entirely and favoring the placement
> heuristics, as these coordinates are being ignored.

When the requested position isn't on a monitor, yes.

> I do have a use-case where I want windows from Wine to be created at
> a designated position for testing, so I don't have to test on a
> Windows machine for placement as well. Is it at all possible to have
> these windows map their coordinates strictly, as in 0,0 on the
> primary monitor would be 1920x1080 in my case.

This is a bit more work.

Firstly, it seems there are some bugs in the way we transform between X
and Windows coordinates, so it's only done correctly when the top-left
of the X screen is at the top-left of the Windows virtual desktop.

Secondly, I'm not sure how we can have X coordinates 0,0 not at the
top-left and have things work correctly.  X windows with negative
coordinates are by definition off-screen, so may not render correctly.

Or we could adjust the placement of all windows by the required offset, 
but I'm not sure that is a good idea.

> For example, I may want a child window which is a custom dialog
> aligned to the center of its parent, or a newly created window to be
> center-aligned to the screen.

You might find running wine in 'virtual desktop' mode helpful, as I 
don't think it has enough knowledge of the Xinerama monitor layout to 
place windows centered on a monitor.

-- 
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:[~2014-07-21 15:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03 22:47 Wine creating windows offscreen when "multiwindow" is used? Matt D.
2014-07-06 16:27 ` Jon TURNEY
2014-07-09 16:10   ` Jon TURNEY
2014-07-09 22:22     ` Matt D.
2014-07-21 15:58       ` 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).