Multi-Monitor Patch - Core Changes

Ok, here's how it works: Each monitor in the system is given a name with MonitorNames. To position a module, you give it the name of the monitor you want it to be on (or not, to use the default), then set its usualy X and Y position relative to that monitor.

Really old modules that have no multimonitor support should work fine for the most part, although it is impossible to place them anywhere outside the primary monitor. Earlier multimonitor compatible modules can be placed with the $<monitor name>Left$ and related variables.

Configuration



MonitorNames <list of monitor names>

This is where you list the names of all your monitor, separated by spaces. Monitor names should begin with a letter. The first name listed will be the primary monitor, the rest are all the other monitors, in the same order as they are in Control Panel. (skipping the primary one, of course)

Say you're creating a dual monitor theme that has a left and right part to it. It would be natural to name your monitors left and right:
MonitorNames left right
Now if someone else wanted to use your theme, but their primary monitor is on the right, they could simply change this line to:
MonitorNames right left
and all the properly modified modules would be in the right place.

Variables will be created for each monitor in case you need to use their size or position somewhere.

MonitorDefault <monitor name>

If no monitor is specified for a module, it will usually use the primary monitor. If you set a DefaultMonitor, they will use that one instead.

Variables



For each monitor, six variables are created, prefixed with the monitor's name. The old $resolutionX$ and $resolutionY$ always refer to the primary monitor for compatibility with non-multimonitor modules.

$<monitor name>resolutionX$
$<monitor name>resolutionY$
the width and height of the monitor
$<monitor name>Left$
$<monitor name>Top$
$<monitor name>Right$
$<monitor name>Bottom$
the coordinates for the edges of the monitor.

Note that some of these may be negative. Any module that uses GetRCCoordinate can be forced to use negative values with 0%+$position$.

Modules



Currently, three of the core modules have been patched: taskbar, shortcut2, and systray2.

taskbar
The command TaskbarOnMonitor is now available, use this to specify which monitor you want the taskbar to be on. Currently it will still adjust the work area of the primary monitor if you have that set.
If you have a monitor named secondary, you could use:
TaskbarOnMonitor secondary
systray2
The command SystrayOnMonitor is now available, use this to specify which monitor you want the tray to be on.
shortcut2
You may now add an optional monitor name to any *shortcut lines, right before the x position:
*Shortcut "desktop" 100 0 desktop.bmp .none .none #2TH "desktop"
could be placed on the monitor right with:
*Shortcut "desktop" right 100 0 desktop.bmp .none .none #2TH "desktop"

Other Changes



For the Coders



Unfortunatly, most modules will need to be modified to use these settings. (although using variables, most of the multimonitor compatible modules should be workable) Just using the SCREEN_WIDTH and SCREEN_HEIGHT macros is not enough. Be sure to check the comments in multimonitor.h.

The most important thing with multimonitors is that the upper left corner of the screen is not 0,0 nor is the upper left corner of the desktop. (unless you're using the desktop window as a parent) The easiest way to deal with this is to pretend that it is, but use LSConvertCoords just before passing the coordinates to SetWindowPos or MoveWindow. Of course, if you do that, you have to remember that coordinates in WM_WINDOWPOSCHANGING and the like need to be adjusted if you're using them.

Suggested modifications for a simple position:

For a VWM, you'll want to use the screen rect of LSMONITOR_ALL for the desktop area. For a desktop module, you'll want to use that as your window rect, and you might want to use LSForEachMonitor to paint the background. Also, for "fake" transparency and anywhere else you need the desktop bitmap, there is now a LSPaintDesktop that will paint to any device context (it's essentially the same as Maduin's PaintDesktopEx) and will be correct for all monitors.