RE: Patch for multiple monitors
Nick, I am merging your patch right now. However, I have a few questions. In winshaddd.c/winAllocateFBShadowDD () (etc.) you load the height and width (dwHeight, dwWidth) of either the screen or the virtual screen, depending upon whether we are using multiple monitors or not. You then use the equality or non-equality of the height and width of the screen or virtual screen versus the size specified on the command-line to determine whether or not to switch the display mode of only the primary display. That doesn't make much sense. We really can't be switching modes of any of the multiple monitors when the size of the virtual screen does not match the requested size. I mean, how would we know which monitor to change the resolution of, and by how much, without some extensive logic that is simply not present? I suggest that we leave out the changes in winAllocateFBShadowDD and its cousins. Am I simply misunderstanding things, or does this make sense to you too? Harold -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Nick Crabtree Sent: Friday, January 10, 2003 11:24 AM To: [EMAIL PROTECTED] Subject: Patch for multiple monitors Hi, I attach a patch for multiple monitors, diffed against xwin-20021107-0015. I have added a command-line flag -multiplemonitors which activates the extra code. This works on my machine in both windowed and rootless modes for engines 1, 2 and 4. It does not work in fullscreen mode because the defaults for the fullscreen dimensions are calculated before the command line parameters are parsed (as far as I could figure out). It should be possible to make this behaviour the default (SM_CXSCREEN == SM_CXVIRTUALSCREEN etc. if there is only one monitor), which would remove many of the if {} else {} blocks, and also might make fullscreen mode work My machine is running Windows 2000. Both my graphics cards are set at 1600x1200 32bit colour. It's great - I'm running KDE in rootless mode, and I get the kicker across the bottom of both monitors, and I can drag X windows from one monitor to the other ... Comments? Nick diff -uw ./InitOutput.c ../../x-devel/build/opt/programs/Xserver/hw/xwin/InitOutput.c --- ./InitOutput.c 2002-11-07 05:21:18.0 + +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/InitOutput.c 2003-01-09 16:51:10.0 + @@ -114,7 +114,8 @@ /* Zero the memory used for storing the screen info */ ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); - /* Get default width and height */ + /* Get default width and height. These will just be for the primary + monitor in the case that we have multiple monitors. */ dwWidth = GetSystemMetrics (SM_CXSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN); @@ -139,6 +140,7 @@ g_ScreenInfo[i].fFullScreen = FALSE; g_ScreenInfo[i].fDecoration = TRUE; g_ScreenInfo[i].fRootless = FALSE; + g_ScreenInfo[i].fMultiplemonitors = FALSE; g_ScreenInfo[i].fLessPointer = FALSE; g_ScreenInfo[i].fScrollbars = FALSE; g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; @@ -303,6 +305,10 @@ ErrorF (-rootless\n \tEXPERIMENTAL: Run the server in pseudo-rootless mode.\n); + ErrorF (-multiplemonitors\n + \tEXPERIMENTAL: Use the entire virtual screen if multiple\n + \tmonitors are present.\n); + ErrorF (-scrollbars\n \tIn windowed mode, allow screens bigger than the Windows desktop.\n \tMoreover, if the window has decorations, one can now resize\n @@ -653,6 +659,32 @@ } /* + * Look for the '-multiplemonitors' argument + */ + if (strcmp (argv[i], -multiplemonitors) == 0) +{ + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j MAXSCREENS; j++) + { + g_ScreenInfo[j].fMultiplemonitors = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultiplemonitors = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; +} + + /* * Look for the '-scrollbars' argument */ if (strcmp (argv[i], -scrollbars) == 0) diff -uw ./win.h ../../x-devel/build/opt/programs/Xserver/hw/xwin/win.h --- ./win.h 2002-11-07 05:33:17.0 + +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/win.h 2003-01-09 16:51:38.0 + @@ -390,6 +390,7 @@ Bool fFullScreen; Bool fDecoration; Bool fRootless; + Bool fMultiplemonitors; Bool fLessPointer; Bool fScrollbars; int iE3BTimeout; diff -uw ./wincreatewnd.c ../../x-devel/build/opt/programs/Xserver/hw/xwin/wincreatewnd.c --- ./wincreatewnd.c2002-10-19 04:56
RE: Patch for multiple monitors
Nick, Before I make an official multi-monitor test release, I want to have you (and brave others) take a look at this executable and let me know if it doesn't work as expected: http://www.msu.edu/~huntharo/xwin/shadow/XWin-MultiMonitors.exe.bz2 Thanks, Harold
Patch for multiple monitors
Hi, I attach a patch for multiple monitors, diffed against xwin-20021107-0015. I have added a command-line flag -multiplemonitors which activates the extra code. This works on my machine in both windowed and rootless modes for engines 1, 2 and 4. It does not work in fullscreen mode because the defaults for the fullscreen dimensions are calculated before the command line parameters are parsed (as far as I could figure out). It should be possible to make this behaviour the default (SM_CXSCREEN == SM_CXVIRTUALSCREEN etc. if there is only one monitor), which would remove many of the if {} else {} blocks, and also might make fullscreen mode work My machine is running Windows 2000. Both my graphics cards are set at 1600x1200 32bit colour. It's great - I'm running KDE in rootless mode, and I get the kicker across the bottom of both monitors, and I can drag X windows from one monitor to the other ... Comments? Nick diff -uw ./InitOutput.c ../../x-devel/build/opt/programs/Xserver/hw/xwin/InitOutput.c --- ./InitOutput.c 2002-11-07 05:21:18.0 + +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/InitOutput.c 2003-01-09 16:51:10.0 + @@ -114,7 +114,8 @@ /* Zero the memory used for storing the screen info */ ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); - /* Get default width and height */ + /* Get default width and height. These will just be for the primary + monitor in the case that we have multiple monitors. */ dwWidth = GetSystemMetrics (SM_CXSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN); @@ -139,6 +140,7 @@ g_ScreenInfo[i].fFullScreen = FALSE; g_ScreenInfo[i].fDecoration = TRUE; g_ScreenInfo[i].fRootless = FALSE; + g_ScreenInfo[i].fMultiplemonitors = FALSE; g_ScreenInfo[i].fLessPointer = FALSE; g_ScreenInfo[i].fScrollbars = FALSE; g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; @@ -303,6 +305,10 @@ ErrorF (-rootless\n \tEXPERIMENTAL: Run the server in pseudo-rootless mode.\n); + ErrorF (-multiplemonitors\n + \tEXPERIMENTAL: Use the entire virtual screen if multiple\n + \tmonitors are present.\n); + ErrorF (-scrollbars\n \tIn windowed mode, allow screens bigger than the Windows desktop.\n \tMoreover, if the window has decorations, one can now resize\n @@ -653,6 +659,32 @@ } /* + * Look for the '-multiplemonitors' argument + */ + if (strcmp (argv[i], -multiplemonitors) == 0) +{ + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j MAXSCREENS; j++) + { + g_ScreenInfo[j].fMultiplemonitors = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultiplemonitors = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; +} + + /* * Look for the '-scrollbars' argument */ if (strcmp (argv[i], -scrollbars) == 0) diff -uw ./win.h ../../x-devel/build/opt/programs/Xserver/hw/xwin/win.h --- ./win.h 2002-11-07 05:33:17.0 + +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/win.h 2003-01-09 16:51:38.0 + @@ -390,6 +390,7 @@ Bool fFullScreen; Bool fDecoration; Bool fRootless; + Bool fMultiplemonitors; Bool fLessPointer; Bool fScrollbars; int iE3BTimeout; diff -uw ./wincreatewnd.c ../../x-devel/build/opt/programs/Xserver/hw/xwin/wincreatewnd.c --- ./wincreatewnd.c2002-10-19 04:56:52.0 +0100 +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/wincreatewnd.c 2003-01-10 15:11:26.0 + @@ -31,16 +31,17 @@ #include win.h #include shellapi.h /* * Local function prototypes */ static Bool +winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo); +static Bool winAdjustForAutoHide (RECT *prcWorkArea); - /* * Create a full screen window */ @@ -155,7 +156,7 @@ RegisterClass (wc); /* Get size of work area */ - SystemParametersInfo (SPI_GETWORKAREA, 0, rcWorkArea, 0); + winGetWorkArea (rcWorkArea, pScreenInfo); /* Adjust for auto-hide taskbars */ winAdjustForAutoHide (rcWorkArea); @@ -206,10 +207,18 @@ * In this case we have to ignore the requested width and height * and instead use the largest possible window that we can. */ + if (pScreenInfo-fMultiplemonitors) + { + iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + } + else + { iWidth = GetSystemMetrics (SM_CXSCREEN); iHeight = GetSystemMetrics (SM_CYSCREEN
Re: Patch for multiple monitors
Nick, Wow! I like it alot! I am currently trying to get a build of Kensuke's latest multiwindow patch posted and a patch to xwinclip to handle the -display parameter. Once I get those done I will start merging your patch. Or, I may merge them both at once, but it would probably be wiser to wait so we have two versions to assign bug blame :) Thanks for the patch, Harold Nick Crabtree wrote: Hi, I attach a patch for multiple monitors, diffed against xwin-20021107-0015. I have added a command-line flag -multiplemonitors which activates the extra code. This works on my machine in both windowed and rootless modes for engines 1, 2 and 4. It does not work in fullscreen mode because the defaults for the fullscreen dimensions are calculated before the command line parameters are parsed (as far as I could figure out). It should be possible to make this behaviour the default (SM_CXSCREEN == SM_CXVIRTUALSCREEN etc. if there is only one monitor), which would remove many of the if {} else {} blocks, and also might make fullscreen mode work My machine is running Windows 2000. Both my graphics cards are set at 1600x1200 32bit colour. It's great - I'm running KDE in rootless mode, and I get the kicker across the bottom of both monitors, and I can drag X windows from one monitor to the other ... Comments? Nick diff -uw ./InitOutput.c ../../x-devel/build/opt/programs/Xserver/hw/xwin/InitOutput.c --- ./InitOutput.c 2002-11-07 05:21:18.0 + +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/InitOutput.c 2003-01-09 16:51:10.0 + @@ -114,7 +114,8 @@ /* Zero the memory used for storing the screen info */ ZeroMemory (g_ScreenInfo, MAXSCREENS * sizeof (winScreenInfo)); - /* Get default width and height */ + /* Get default width and height. These will just be for the primary + monitor in the case that we have multiple monitors. */ dwWidth = GetSystemMetrics (SM_CXSCREEN); dwHeight = GetSystemMetrics (SM_CYSCREEN); @@ -139,6 +140,7 @@ g_ScreenInfo[i].fFullScreen = FALSE; g_ScreenInfo[i].fDecoration = TRUE; g_ScreenInfo[i].fRootless = FALSE; + g_ScreenInfo[i].fMultiplemonitors = FALSE; g_ScreenInfo[i].fLessPointer = FALSE; g_ScreenInfo[i].fScrollbars = FALSE; g_ScreenInfo[i].iE3BTimeout = WIN_E3B_OFF; @@ -303,6 +305,10 @@ ErrorF (-rootless\n \tEXPERIMENTAL: Run the server in pseudo-rootless mode.\n); + ErrorF (-multiplemonitors\n + \tEXPERIMENTAL: Use the entire virtual screen if multiple\n + \tmonitors are present.\n); + ErrorF (-scrollbars\n \tIn windowed mode, allow screens bigger than the Windows desktop.\n \tMoreover, if the window has decorations, one can now resize\n @@ -653,6 +659,32 @@ } /* + * Look for the '-multiplemonitors' argument + */ + if (strcmp (argv[i], -multiplemonitors) == 0) +{ + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_iLastScreen) + { + int j; + + /* Parameter is for all screens */ + for (j = 0; j MAXSCREENS; j++) + { + g_ScreenInfo[j].fMultiplemonitors = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_ScreenInfo[g_iLastScreen].fMultiplemonitors = TRUE; + } + + /* Indicate that we have processed this argument */ + return 1; +} + + /* * Look for the '-scrollbars' argument */ if (strcmp (argv[i], -scrollbars) == 0) diff -uw ./win.h ../../x-devel/build/opt/programs/Xserver/hw/xwin/win.h --- ./win.h 2002-11-07 05:33:17.0 + +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/win.h 2003-01-09 16:51:38.0 + @@ -390,6 +390,7 @@ Bool fFullScreen; Bool fDecoration; Bool fRootless; + Bool fMultiplemonitors; Bool fLessPointer; Bool fScrollbars; int iE3BTimeout; diff -uw ./wincreatewnd.c ../../x-devel/build/opt/programs/Xserver/hw/xwin/wincreatewnd.c --- ./wincreatewnd.c 2002-10-19 04:56:52.0 +0100 +++ ../../x-devel/build/opt/programs/Xserver/hw/xwin/wincreatewnd.c 2003-01-10 15:11:26.0 + @@ -31,16 +31,17 @@ #include win.h #include shellapi.h /* * Local function prototypes */ static Bool +winGetWorkArea (RECT *prcWorkArea, winScreenInfo *pScreenInfo); +static Bool winAdjustForAutoHide (RECT *prcWorkArea); - /* * Create a full screen window */ @@ -155,7 +156,7 @@ RegisterClass (wc); /* Get size of work area */ - SystemParametersInfo (SPI_GETWORKAREA, 0, rcWorkArea, 0); + winGetWorkArea (rcWorkArea, pScreenInfo); /* Adjust for auto-hide taskbars */ winAdjustForAutoHide (rcWorkArea); @@ -206,10 +207,18 @@ * In this case we have to ignore the requested width and height * and instead use the largest possible window that we can. */ + if (pScreenInfo-fMultiplemonitors) + { + iWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); + iHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); + } + else + { iWidth = GetSystemMetrics (SM_CXSCREEN