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.
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 monitorsleftandright:MonitorNames left rightNow 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 leftand 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.
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$
$<monitor name>Left$ $<monitor name>Top$ $<monitor name>Right$ $<monitor name>Bottom$
Note that some of these may be negative. Any module that uses GetRCCoordinate
can be forced to use negative values with 0%+$position$.
Currently, three of the core modules have been patched: taskbar, shortcut2, and systray2.
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 namedsecondary, you could use:TaskbarOnMonitor secondary
SystrayOnMonitor is now available, use this to specify
which monitor you want the tray to be on.
*shortcut lines,
right before the x position:
*Shortcut "desktop" 100 0 desktop.bmp .none .none #2TH "desktop"could be placed on the monitorrightwith:*Shortcut "desktop" right 100 0 desktop.bmp .none .none #2TH "desktop"
30%-12
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:
LSMONITOR Monitor; RECT rMonitor
GetRCString("ModuleOnMonitor",buffer,"",MAX_PATH_LENGTH);
Monitor = LSGetMonitor(buffer);
LSGetMonitorScreenRect(Monitor,&rMonitor);
SCREEN_WIDTH with
rMonitor.right-rMonitor.left and SCREEN_HEIGHT
with rMonitor.bottom-rMonitor.top.
You might want to just define the macros to those, if possible.LSConvertCoords before passing the coordinates
to windows:
int x=ModuleXPos,y=ModuleYPos; if (!bInBoxOrWharf) LSConvertCoords(Monitor,bIsOnTop,&x,&y); MoveWindow(hMainWnd,x,y,ModuleWidth,ModuleHeight,TRUE);
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.