public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Confusing Cygwin X / xlaunch issue
@ 2021-10-24 11:01 Eliot Moss
  2021-10-24 11:20 ` Eliot Moss
  2021-10-26 15:02 ` Jon Turney
  0 siblings, 2 replies; 5+ messages in thread
From: Eliot Moss @ 2021-10-24 11:01 UTC (permalink / raw)
  To: cygwin

First, things work fine when I am using just my hi-res laptop display, or that
display plus a hi-res external display in "Extend these displays" mode
according to Windows 10.  At present I am using a lower resolution external
display (becaue I am on an extended trip and it's what I have) in "Extend
these displays" mode with my hi-res laptop display.  This seems to confuse X
(and also xlaunch?).  Here are the issues:

When booted with the external lo-res display as the main display:

- xterm windows come up with a very large font.
- The X menu (controlled by .XWinrc) does not come up.

If I then change to have the laptop hi-res display as the main display,
without rebooting, and without restarting X

- The xterms still have a big font (I did not restart them, so no surprise)
- The X menu works (over on the laptop screen).

I then restart X,

- The new xterms still have the large font
- The X menu still works

If I then shutdown X, make the external lo-res display the main display, and
restart X,

- The xterm fonts are big
- The X menu does not come up.

Then, if I set the laptop to be the main display, reboot Windows, and restart
X,

- The xterm windows have the right size font (but start on the laptop and need
   to be dragged over to the other display; they do resize appropriately there)
- The X menu works (but is way over on the laptop display).

Finally, if I change to have the external display to be the main one, without
restarting X,

- New xterms come up with the right size fonts
- The X menu comes up on the external screen (as desired)

If I shut down X and restart it (external display still main),

- xterm fonts have the right size
- The X menu does not come up.

It seems that, at the least, I need to *start* X when the laptop (hi-res)
display is main.  I'm less clear as to whether I need to *boot* with it main
(I can try that later).

Is there an explanation for this?  Should I be doing something differently?
Is there a bug?  Thanks for any insight you can offer!  Eliot Moss

Here are further details of my setup:

I use xlaunch to get my X windows going.  The command in the Windows short-cut
that I click reads:

==================================================
C:\cygwin64\bin\run.exe /bin/xlaunch -p /usr/bin -run /home/moss/config.xlaunch
==================================================

My config.xlaunch reads:

==================================================
<?xml version="1.0" encoding="UTF-8"?>
<XLaunch WindowMode="MultiWindow" ClientMode="StartProgram" LocalClient="True" Display="0" 
RemoteProtocol="" LocalProgram=".startxwinrc" RemoteProgram="xterm" RemoteHost="" RemoteUser="" 
XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ExtraParams="-unixkill 
-listen tcp -clipboard -resize -engine 1 -emulate3buttons 100" Wgl="False" DisableAC="True" 
XDMCPTerminate="False" SSHKeyChain="False" SSHTerminal="True" ExtraSSH=""/>
==================================================

My .startxwinrc reads:

==================================================
#!/bin/bash
#PATH="${PATH}:/usr/bin"

xrdb -merge ${HOME}/.Xdefaults
xmodmap ${HOME}/.Xmodmap

UC="${USER} console"
set > ~/set-output.txt
xterm +tb -geometry 110x62+4+0  -T "${USER}" -n "${USER}" -name "${USER}" -bg rgbi:.0/.2/.2    -ls 
-iconic &
xterm +tb -geometry 110x62-10+0 -T "${UC}"   -n "${UC}"   -name "${UC}"   -bg rgbi:.5/.0/.1    -ls 
-iconic &
emacs --chdir=${HOME} --no-splash --iconic --geometry=130x60+100+100 -T emacs &
# xemacs -iconic -geometry 110x61+0+0  -T xemacs &
wait
==================================================

My .XWinrc reads:

==================================================
MENU systray {
   elnux1     EXEC "xterm -tn xterm-256color -display %display% -ls -title elnux1     -bg 
rgbi:.1/.10/.1 -e /usr/bin/ssh moss@elnux1.cs.umass.edu"
   elnux7     EXEC "xterm -tn xterm-256color -display %display% -ls -title elnux7     -bg 
rgbi:.1/.10/.1 -e /usr/bin/ssh moss@elnux7.cs.umass.edu"
   roc        EXEC "xterm -tn xterm-256color -display %display% -ls -title roc        -bg 
rgbi:.2/.20/.0 2> /home/moss/term-start-err.txt -e /usr/bin/ssh moss@roc.cs.umass.edu"
   swarm      EXEC "xterm -tn xterm-256color -display %display% -ls -title swarm      -bg 
rgbi:.0/.20/.0 -e /usr/bin/ssh moss@swarm.cs.umass.edu"
   swarm2     EXEC "xterm -tn xterm-256color -display %display% -ls -title swarm2     -bg 
rgbi:.1/.20/.0 -e /usr/bin/ssh moss@swarm2.cs.umass.edu"
   moa        EXEC "xterm -tn xterm-256color -display %display% -ls -title moa        -bg 
rgbi:.0/.03/.0 -e /usr/bin/ssh moss@moa.cs.umass.edu"
   deepgreen  EXEC "xterm -tn xterm-256color -display %display% -ls -title deepgreen  -bg 
rgbi:.0/.03/.0 -e /usr/bin/ssh moss@deepgreen.cs.umass.edu"
   balder     EXEC "xterm -tn xterm-256color -display %display% -ls -title balder     -bg 
rgbi:.2/.00/.0 -e /usr/bin/ssh moss@balder.cs.umass.edu"
   lithos     EXEC "xterm -tn xterm-256color -display %display% -ls -title lithos     -bg 
rgbi:.1/.10/.1 -e /usr/bin/ssh moss@lithos.cs.umass.edu"
   supercloud EXEC "xterm -tn xterm-256color -display %display% -ls -title supercloud -bg 
rgbi:.1/.40/.0 -e /usr/bin/ssh emoss@supercloud"
   SEPARATOR
   console  EXEC "xterm -display %display% -ls +tb -geometry 110x62-10+0 -T 'Eliot console' -n 
'Eliot console' -name 'Eliot console' -bg rgbi:.5/.0/.1"
   login    EXEC "xterm -display %display% -ls +tb -geometry 110x62+4+0  -T 'Eliot'         -n 
'Eliot'         -name 'Eliot'         -bg rgbi:.0/.2/.2"
   xterm    EXEC "xterm -tn xterm -display %display% -ls -title xterm"
   cygwin32 EXEC "HOME=/cygdrive/c/cygwin/home/moss /cygdrive/c/cygwin/bin/xterm -display %display% 
-ls -title 'Cygwin 32' -bg rgbi:.05/.05/.05"
   SEPARATOR
   xemacs  EXEC "xemacs"
   emacs   EXEC "emacs --geometry=130x62+100+100"
   xpdf    EXEC "xpdf"
   SEPARATOR
   "Reload .XWinrc" RELOAD
}

ROOTMENU systray

STYLES {
   # console MINIMIZE  # minimization handled in .startxwinrc
   # Eliot   MINIMIZE  # minimization handled in .startxwinrc
   task    MINIMIZE
   xemacs  MINIMIZE # Note: class is emacs; default name is emacs; this matches window with title xemacs
}

SILENTEXIT
==================================================

My XWin.0.log is:

==================================================
Welcome to the XWin X Server
Vendor: The Cygwin/X Project
Release: 1.20.12.0
OS: CYGWIN_NT-10.0-19043 EM-SURFACE-2020 3.2.0-340.x86_64 2021-03-29 08:42 UTC x86_64
OS: Windows 10  [Windows NT 10.0 build 19043] (Win64)
Package: version 1.20.12-1 built 2021-07-11

XWin was started with the following command line:

XWin :0 -multiwindow -clipboard -nowgl -ac -unixkill -listen tcp
  -clipboard -resize -engine 1 -emulate3buttons 100

ddxProcessArgument - Initializing default screens
winInitializeScreenDefaults - primary monitor w 3240 h 2160
winInitializeScreenDefaults - native DPI x 192 y 192
[  1023.906] (II) xorg.conf is not supported
[  1023.906] (II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information
[  1023.906] LoadPreferences: Loading /home/moss/.XWinrc
[  1023.906] winDetectSupportedEngines - RemoteSession: no
[  1023.921] winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL
[  1023.937] winDetectSupportedEngines - Returning, supported engines 00000005
[  1023.937] winSetEngine - Multi Window or Rootless => ShadowGDI
[  1023.937] winScreenInit - Using Windows display depth of 32 bits per pixel
[  1023.953] winAllocateFBShadowGDI - Creating DIB with width: 5800 height: 2674 depth: 32
[  1023.953] winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff
[  1023.953] winInitVisualsShadowGDI - Masks 00ff0000 0000ff00 000000ff BPRGB 8 d 24 bpp 32
[  1023.953] MIT-SHM extension disabled due to lack of kernel support
[  1023.953] XFree86-Bigfont extension local-client optimization disabled due to lack of shared 
memory support in the kernel
[  1023.953] (II) IGLX: Loaded and initialized swrast
[  1023.953] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[  1024.156] winPointerWarpCursor - Discarding first warp: 2900 1337
[  1024.156] (--) 5 mouse buttons found
[  1024.156] (--) Setting autorepeat to delay=500, rate=31
[  1024.156] (--) Windows keyboard layout: "00000409" (00000409) "US", type 4
[  1024.156] (--) Found matching XKB configuration "English (USA)"
[  1024.156] (--) Model = "pc105" Layout = "us" Variant = "none" Options = "none"
[  1024.156] Rules = "base" Model = "pc105" Layout = "us" Variant = "none" Options = "none"
[  1024.156] winInitMultiWindowWM - DISPLAY=:0.0
[  1024.156] winMultiWindowXMsgProc - DISPLAY=:0.0
[  1024.171] winMultiWindowXMsgProc - xcb_connect() returned and successfully opened the display.
[  1024.171] [  1024.171] winProcEstablishConnection - winInitClipboard returned.
winClipboardThreadProc - DISPLAY=:0.0
[  1024.171] Using Composite redirection
[  1024.171] winInitMultiWindowWM - xcb_connect () returned and successfully opened the display.
[  1024.187] winClipboardProc - xcb_connect () returned and successfully opened the display.
[  1026.828] winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState
[  1026.828] winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState
[  1028.484] winMultiWindowXMsgProc - WM_CHANGE_STATE - IconicState
[  1028.531] OS has icon alpha channel support: yes
[  1035.750] winWindowProc - WM_DISPLAYCHANGE - new width: 2560 new height: 2048 new bpp: 32
[  1035.750] winWindowProc - RemoteSession: no
[  1037.140] winInitNotifyIcon - Shell_NotifyIcon Failed
==================================================

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

* Re: Confusing Cygwin X / xlaunch issue
  2021-10-24 11:01 Confusing Cygwin X / xlaunch issue Eliot Moss
@ 2021-10-24 11:20 ` Eliot Moss
  2021-10-26 15:02 ` Jon Turney
  1 sibling, 0 replies; 5+ messages in thread
From: Eliot Moss @ 2021-10-24 11:20 UTC (permalink / raw)
  To: cygwin


A follow up:

I have tried other combination of which display is main when booting and which
is main when starting X.  These seem to be the case:

- Getting xterm fonts the right size requires *booting* with the hi-res
   display being main.  X can be starting with either being main.
- Getting the menu to come up requires starting X with the hi-res display
   being main; I can then change which display is main after I have started X.

So the only way I can get my preferred behavior seems to be:

- Boot with the hi-res screen as main
- Start X
- Switch to have the lo-res screen as main (which requires switching back
   before any reboot ...)

Does this all fit the understanding of how XWin starts up and interacts with
Windows display settings?

Best wishes - Eliot Moss

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

* Re: Confusing Cygwin X / xlaunch issue
  2021-10-24 11:01 Confusing Cygwin X / xlaunch issue Eliot Moss
  2021-10-24 11:20 ` Eliot Moss
@ 2021-10-26 15:02 ` Jon Turney
  2021-10-26 15:38   ` Eliot Moss
  1 sibling, 1 reply; 5+ messages in thread
From: Jon Turney @ 2021-10-26 15:02 UTC (permalink / raw)
  To: moss, The Cygwin Mailing List

On 24/10/2021 12:01, Eliot Moss wrote:
> First, things work fine when I am using just my hi-res laptop display, 
> or that
> display plus a hi-res external display in "Extend these displays" mode
> according to Windows 10.  At present I am using a lower resolution external
> display (becaue I am on an extended trip and it's what I have) in "Extend
> these displays" mode with my hi-res laptop display.  This seems to 
> confuse X
> (and also xlaunch?).  Here are the issues:

Thanks for reporting this problem.

> When booted with the external lo-res display as the main display:
> 
> - xterm windows come up with a very large font.
> - The X menu (controlled by .XWinrc) does not come up.

This means that you're right-clicking on the notification area icon, but 
no menu appears?

If so, I guess this means that we're getting confused about where to 
place the menu, but I'm not sure how that could happen.

[...]
> It seems that, at the least, I need to *start* X when the laptop (hi-res)
> display is main.  I'm less clear as to whether I need to *boot* with it 
> main
> (I can try that later).
> 
> Is there an explanation for this?  Should I be doing something differently?
> Is there a bug?  Thanks for any insight you can offer!  Eliot Moss

wrt the font scaling issue, looking at the source, it seems that we 
don't re-consider the display dpi after a WM_DISPLAYCHANGE message, but 
keep on using the value determined at startup.  This is probably a bug.

 > winInitializeScreenDefaults - primary monitor w 3240 h 2160
 > winInitializeScreenDefaults - native DPI x 192 y 192
[...]
 > [  1035.750] winWindowProc - WM_DISPLAYCHANGE - new width: 2560 new 
height: 2048 new bpp: 32

As a workaround, you might experiment with using the xserver option 
'-dpi' to set a value corresponding to your hi-res display, so that will 
be used even if the normal-res display is Windows' primary monitor.

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

* Re: Confusing Cygwin X / xlaunch issue
  2021-10-26 15:02 ` Jon Turney
@ 2021-10-26 15:38   ` Eliot Moss
  2021-11-04 14:10     ` Jon Turney
  0 siblings, 1 reply; 5+ messages in thread
From: Eliot Moss @ 2021-10-26 15:38 UTC (permalink / raw)
  To: Jon Turney, The Cygwin Mailing List

On 10/26/2021 4:02 PM, Jon Turney wrote:
> On 24/10/2021 12:01, Eliot Moss wrote:
>> First, things work fine when I am using just my hi-res laptop display, or that
>> display plus a hi-res external display in "Extend these displays" mode
>> according to Windows 10.  At present I am using a lower resolution external
>> display (becaue I am on an extended trip and it's what I have) in "Extend
>> these displays" mode with my hi-res laptop display.  This seems to confuse X
>> (and also xlaunch?).  Here are the issues:
> 
> Thanks for reporting this problem.

>> When booted with the external lo-res display as the main display:
>>
>> - xterm windows come up with a very large font.
>> - The X menu (controlled by .XWinrc) does not come up.
> 
> This means that you're right-clicking on the notification area icon, but no menu appears?

Correct.

> If so, I guess this means that we're getting confused about where to place the menu, but I'm not 
> sure how that could happen.

> wrt the font scaling issue, looking at the source, it seems that we don't re-consider the display 
> dpi after a WM_DISPLAYCHANGE message, but keep on using the value determined at startup.  This is 
> probably a bug.
> 
>  > winInitializeScreenDefaults - primary monitor w 3240 h 2160
>  > winInitializeScreenDefaults - native DPI x 192 y 192
> [...]
>  > [  1035.750] winWindowProc - WM_DISPLAYCHANGE - new width: 2560 new height: 2048 new bpp: 32
> 
> As a workaround, you might experiment with using the xserver option '-dpi' to set a value 
> corresponding to your hi-res display, so that will be used even if the normal-res display is 
> Windows' primary monitor.

That didn't hurt at least.  I did not go to the trouble of rebooting,
but given that I had booted to the hi-res Window and then started X
with the lo-res as primary, the font scaling was right.  The menu still
did not come up, though.  That seems to require starting X with the
hi-res Window - the one that was primary when Windows was booted.

Regards - Eliot

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

* Re: Confusing Cygwin X / xlaunch issue
  2021-10-26 15:38   ` Eliot Moss
@ 2021-11-04 14:10     ` Jon Turney
  0 siblings, 0 replies; 5+ messages in thread
From: Jon Turney @ 2021-11-04 14:10 UTC (permalink / raw)
  To: moss, The Cygwin Mailing List

On 26/10/2021 16:38, Eliot Moss wrote:
> On 10/26/2021 4:02 PM, Jon Turney wrote:
>> On 24/10/2021 12:01, Eliot Moss wrote:
>>> First, things work fine when I am using just my hi-res laptop 
>>> display, or that
>>> display plus a hi-res external display in "Extend these displays" mode
>>> according to Windows 10.  At present I am using a lower resolution 
>>> external
>>> display (becaue I am on an extended trip and it's what I have) in 
>>> "Extend
>>> these displays" mode with my hi-res laptop display.  This seems to 
>>> confuse X
>>> (and also xlaunch?).  Here are the issues:
>>
>> Thanks for reporting this problem.
> 
>>> When booted with the external lo-res display as the main display:
>>>
>>> - xterm windows come up with a very large font.
>>> - The X menu (controlled by .XWinrc) does not come up.
>>
>> This means that you're right-clicking on the notification area icon, 
>> but no menu appears?
> 
> Correct.
> 
>> If so, I guess this means that we're getting confused about where to 
>> place the menu, but I'm not sure how that could happen.
> 
>> wrt the font scaling issue, looking at the source, it seems that we 
>> don't re-consider the display dpi after a WM_DISPLAYCHANGE message, 
>> but keep on using the value determined at startup.  This is probably a 
>> bug.

I've made an attempt at fixing this in the xserve 21.1.0-1 test release.

The X server should now be aware of Windows DPI changes (only on the 
primary monitor at the moment), and update the X screen information (and 
probably emit some kind of xrandr event, which X applications may take 
note of or not...)

(Advertising this awareness also stops Windows from always reporting to 
it the DPI when it started, and rescaling windows when it changes or 
they move between monitors with different DPI values (which could lead 
to some blurriness))

Perhaps you could try that, and see if it improves things for you?

-- 
Jon Turney
Volunteer Cygwin/X X Server maintainer

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

end of thread, other threads:[~2021-11-04 14:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 11:01 Confusing Cygwin X / xlaunch issue Eliot Moss
2021-10-24 11:20 ` Eliot Moss
2021-10-26 15:02 ` Jon Turney
2021-10-26 15:38   ` Eliot Moss
2021-11-04 14:10     ` 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).