Page 1 of 3

Multiple Screen Issue

Posted: Mon Sep 20, 2010 4:59 pm
by WaltBrown
Hi!
I frequently use my laptop with a second screen. When I unplug the screen, all other apps and the OS (Vista x64) recognize that and send all windows to the laptop screen when I reopen the apps. Except Rev (and LC) do not. When I open the Dictionary for example, it opens up on the second screen where I had it last, even when restarting Rev, and I can't figure out how to get it back without plugging into a second monitor and dragging it back. Anyone have any easier ways to get Rev to recognize the second screen is unplugged?
Thanks,
Walt

Re: Multiple Screen Issue

Posted: Mon Sep 20, 2010 6:58 pm
by shadowslash
Umm won't hacking into the rev's IDE scripts help? I'm just throwing a wild guess here since I haven't used multiple monitors with rev before.

EDIT:
I meant LiveCode, not rev. Image

Re: Multiple Screen Issue

Posted: Mon Sep 20, 2010 10:32 pm
by sturgis
I cheat to do this. I have things setup so that when I plug in my 2nd monitor it becomes the primary monitor, meaning the top bar moves to the 2nd mon. Then, I just leave rev/lc setup to display on the primary. This is on snow leopard, I seem to recall that leopard may have trouble remembering to move the menu bar over and that you'd have to do it manually every time which would suck. I'll check it on my other machine in a bit once I get it re-setup.

But this way, plug it in, 2nd becomes primary, menu bar and rev move over. Unplug it, laptop screen returns to being primary and again, rev moves back to the laptop. Very easy, and it works.
WaltBrown wrote:Hi!
I frequently use my laptop with a second screen. When I unplug the screen, all other apps and the OS (Vista x64) recognize that and send all windows to the laptop screen when I reopen the apps. Except Rev (and LC) do not. When I open the Dictionary for example, it opens up on the second screen where I had it last, even when restarting Rev, and I can't figure out how to get it back without plugging into a second monitor and dragging it back. Anyone have any easier ways to get Rev to recognize the second screen is unplugged?
Thanks,
Walt

Re: Multiple Screen Issue

Posted: Mon Sep 20, 2010 11:09 pm
by bn
Walt,

look at screenrect and screenrects in the dictionary. If the screenrects is only one line you have only one monitor, if it is 2 lines, you have 2 monitors. On each line are 4 items: the rect of the screen in global coordinates.
Look at the stack names with the stacks function.

Then you can adjust the location of your tools accordingly. You could even write a plugin that starts at startUp of Rev (IDE) to take care of this. A plug-in is just a stack in a special folder in your documents folder -> myRevolutionNameOfEdition.
You than configure it to be active at startUP in Rev -> Development -> Plugins -> Plugin Settings.

regards
Bernd

Re: Multiple Screen Issue

Posted: Tue Sep 21, 2010 2:18 am
by WaltBrown
Thanks guys. With only the laptop, I get a single normal rect (like 0,0,1280,960) from screenRects.

But what is interesting, if I get all open stacks and their rects, I get:

revTools, 7,136,91,595
Untitled 1, 111,145,843,698
revMenubar, 60,30,868,105
revDictionary, 598,-1005,1362,-529
revStartCentre, 291,175,990,625

So revDictionary is still at home in my basement office on the second screen :-)

Yes, I can script it to move back to the laptop screen, but would that be a bug, or am I missing a preference setting or something for it to act that way? Anyone have a pointer to where openStack is handled in the engine so I can make my own preference script?

Walt

Re: Multiple Screen Issue

Posted: Tue Sep 21, 2010 2:22 am
by WaltBrown
Or even a more useful question - since the IDE is described as modifiable (at my own risk of course), how does one unlock the revDictionary stack so it CAN be modified?
Thanks,
Walt

PS: Is there any doc that describes how to modify the IDE?

Re: Multiple Screen Issue

Posted: Tue Sep 21, 2010 3:45 am
by shadowslash
WaltBrown wrote:Or even a more useful question - since the IDE is described as modifiable (at my own risk of course), how does one unlock the revDictionary stack so it CAN be modified?
Thanks,
Walt

PS: Is there any doc that describes how to modify the IDE?
Before anything else, ensure that you copy a ackup of your rev folder somewhere else in ur hard drive so restoring would be easy later on in case you screw something up. And yes you can do that, by holding the Ctrl + Shift (Cmd + Shift on a Mac) and right clicking on whatever part of the interface you wish to edit.
Image

Re: Multiple Screen Issue

Posted: Tue Sep 21, 2010 10:36 am
by Mark
You might create a plugin with a backscript containing a desktopChanged handler. You might also add a preOpenStack handler, which compares the rect of the target stack to the rect of line 1 of the screenRects.

Best,

Mark

Re: Multiple Screen Issue

Posted: Wed Sep 22, 2010 1:45 am
by WaltBrown
Thanks Mark and Slash for the tips.

I am looking at revDictionary's backscripts using S. Pothier's old MC script reader utility script to see if I can spot the most appropriate place to mod it's process. If I discover a relatively non-klugey way to do this I'll post it.

Walt

Re: Multiple Screen Issue

Posted: Sun Sep 11, 2011 3:05 am
by WaltBrown
I'd like to return to this. Since every stack has a "preOpenStack" message, and since all stacks, including all the IDE stacks, open to their last saved screen location, how can I locate where in the IDE the core "preOpenStack" message is handled? Then I could put a hook in the IDE that does something like (I'm going to pseudo code it):

if my last location is within the screenRects then do nothing
else change my location to something that is within the screenRects.

It would be very simple, but the hard part is I am looking from the outside in. Does anyone know if there a way to see the message flow within the IDE as it opens, so I can identify the urpreLoadStack?

Thanks,
Walt

Re: Multiple Screen Issue

Posted: Sun Sep 11, 2011 4:17 am
by Mark
Hi Walt,

You might want to read this thread on the mailing lkist.

Kind regard,

Mark

Re: Multiple Screen Issue

Posted: Sun Sep 11, 2011 6:28 am
by WaltBrown
Thanks Mark. As you were answering, I wrote this kludge:

Code: Select all

case "Retrieve lost windows"
   local tCurWin, tCurScreen
   repeat for each line tCurWin in the windows
      repeat for each line tCurScreen in the screenRects
         if ((the topLeft of stack tCurWin is not within tCurScreen) and \
               (the bottomRight of stack tCurWin is not within tCurScreen)) then
            resetWin(tCurWin)
         end if
      end repeat
   end repeat
exit switch
and dropped it into the menu case statement of the menuPick handler of the View button of revMenuBar, and added "Retrieve lost windows" to the View button's list of options. I also dropped the subroutine:

Code: Select all

on resetWin pWin
   local tRestoreLoc
   put the "cREVRestoreLoc" into tRestoreLoc

   if tRestoreLoc is not empty then 
      set the location of stack pWin to tRestoreLoc
      exit resetWin
   end if
   
   if (pWin contains "revTools") then 
      set the rect of stack pWin to 34,133,118,592
      exit resetWin
   end if
   set the location of stack pWin to the location of stack "revStartCentre"
end resetWin
and of course it failed to compile as I needed some permission for a backup process LC has hidden inside it for code changes, and after that failed it lunched my entire 4.6.4 installation, so I did a clean remove and reinstall. :-)

But I did make some interesting discoveries.

Some LC stacks know about changed screen configurations when starting up, notably revMenubar and revStartCentre. revToolbar and revDictionary notably do NOT, and stay lost after going from two to one screen, if they were on the second screen.

Apparently someone at LC had started to fix this but didn't complete the process - some of the LC stacks have a custom property named "cREVRestoreLoc" oddly enough, and when started apparently look there if they can't go to their last location - revMenuToolbar and revStartCentre having the cREVRestoreLoc. I tried to put cREVRestoreLoc in revToolbar and revDictionary as a test but sadly it's not looked at from some central function.

Anyway, I'll look more at the thread you sent, thanks.

Walt

Re: Multiple Screen Issue

Posted: Tue Sep 13, 2011 5:55 pm
by mwieder
put the "cREVRestoreLoc" into tRestoreLoc
I hope that isn't real code pasted from your editor...

the "cREVRestoreLoc" is guaranteed not to work, probably cause compiler errors, and since it's in a system stack, probably also guaranteed to crash the IDE. At the very least you want something like

Code: Select all

put the cREVRestoreLoc of stack pWin

Re: Multiple Screen Issue

Posted: Tue Sep 13, 2011 6:54 pm
by WaltBrown
It did all of the above :-)

Re: Multiple Screen Issue

Posted: Tue Sep 13, 2011 7:33 pm
by sturgis
Seems like this would be a good candidate for a plugin set to open with the IDE.

Something like this pseudocode.
on openstack
check the number of screens.
if the number of screenrects is < 2 then cycle through the open windows and set them to a pre-designated spot for each for single screen default config.
If a window doesn't have a saved setting, plop it in the center of the main screen.
Otherwise return it to its "single screen" position.
otherwise if theres more than 1 screenrect listed,
confirm that all windows are in viewable locations. (IE set them to another "saved" position)
end openstack

Set up things so that configurations can be saved and reloaded, have a default 1 screen setup saved, and a default 2 screen (or whatever) setup saved, and a button to load a configuration from the plugin on demand. (with checks to make sure an impossible configuration isn't chosen?)

Just a thought.