I just started using two monitors with Windows XP and a laptop. I found this can lead to interesting problems. My secondary monitor is arranged to the left of my primary monitor. This results in the X value of all screen coordinates on the secondary monitor being negative.

When I use the laptop without the second monitor, all windows that have saved positions using the second monitor (that is, with negative X values) are undisplayable when not maximized.

Some applications handle this better than others. J has problems with the saved noun WINPOS:

  WINPOS_j_
+-----------+-----------------+
|jfiw       |_859 593 482 164 |
+-----------+-----------------+
|projectform|330 147 384 498  |
+-----------+-----------------+
|fif        |_1028 12 1032 776|
+-----------+-----------------+
|plot       |431 73 492 402   |
+-----------+-----------------+
|jdebug     |15 313 1160 390  |
+-----------+-----------------+

Opening Find in Files or just Find on a single monitor configuration after using them on the secondary monitor of a multiple monitor configuration has no visible result.

Here is a sketch of a fix. This only addresses one of the issues with multiple monitor support. I'm sure that there are more.

NB. Fix WINPOS

NB. Issue:  J does not support multiple monitors well.
NB. Simple fix, force WINPOS xy to screen xy when WINPOS is less than screen

require 'dll winapi'

GetSystemMetrics=: >@{.@('User32 GetSystemMetrics i i'&cd)

SM_CMONITORS=:80
SM_XVIRTUALSCREEN =:76
SM_YVIRTUALSCREEN =:77
SM_CXVIRTUALSCREEN =:78
SM_CYVIRTUALSCREEN =:79

fixWINPOS=: 3 : 0
NB. get x and y of virtual screen
sm=.GetSystemMetrics"0 SM_XVIRTUALSCREEN,SM_YVIRTUALSCREEN
NB. get x and y from WINPOS
q=.0 1{"1 >1{"1 WINPOS_j_
NB. find where x or y of WINPOS are less than the screen x or y
f=.q<"1 sm
NB. replace WINPOS x y with screen x y where less
rp=.(f*"1 sm)+q*"1 -.f
qq=.(<"1 rp) (0 1)}&.> ]1{"1 WINPOS_j_
WINPOS_j_=:qq 1}"0 1 WINPOS_j_
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to