Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

Commit 035619c

Browse files
author
Monte Goulding
committed
[[ Bug ]] Fix various multiple screen issues
- Handle desktopChanged and ensure stacks are within the rect of their current screen - Bug 17755 - Ensure modals on Mac aren't moved to the main screen by setting their location to the screenLoc - Bug 17461 - Change revMenubar on Mac to modeless instead of palette so it doesn't cover fullscreen window widgets
1 parent b5c355c commit 035619c

18 files changed

Lines changed: 121 additions & 30 deletions

Toolset/home.livecodescript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ command revInternal__InitialiseMenus
15241524

15251525
if the platform is "MacOS" then
15261526
lock messages
1527-
palette stack tMenuBar
1527+
modeless stack tMenuBar
15281528
unlock messages
15291529
else
15301530
toplevel stack tMenuBar

Toolset/libraries/revfrontscriptlibrary.livecodescript

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,11 @@ on openStack
281281

282282
if revIDEStackNameIsIDEStack(tStackName) and the mode of stack tStackName is 4 and the visible of stack tStackName is false then
283283
revIDETogglePaletteView
284-
if the bottom of stack tStackName > item 4 of the screenRect or the right of stack tStackName > item 3 of the screenRect then
285-
set the bottomRight of stack tStackName to item 3 to 4 of the windowBoundingRect
284+
285+
local tScreenRect
286+
put revIDEStackScreenRect(tStackName, true) into tScreenRect
287+
if the bottom of stack tStackName > item 4 of tScreenRect or the right of stack tStackName > item 3 of tScreenRect then
288+
set the bottomRight of stack tStackName to item 3 to 4 of tScreenRect
286289
end if
287290
end if
288291
end if

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4457,6 +4457,8 @@ on revIDEEnsureOnscreen pStackName
44574457
else if the bottom of stack pStackName > item 4 of tScreenRect and the height of stack pStackName < tScreenHeight then
44584458
set the bottom of stack pStackName to item 4 of tScreenRect
44594459
end if
4460+
4461+
revIDESetPaletteRectPreference pStackName
44604462
end revIDEEnsureOnscreen
44614463

44624464
/*
@@ -4517,13 +4519,14 @@ end revIDEPositionPalette
45174519
constant kToolsMenubarGap = 25
45184520
on revIDEPositionPaletteDefault pStackName
45194521
# No previous rect was found for stack to calculate the appropriate position for the stack
4520-
local tScreenHeight, tScreenWidth
4521-
put item 4 of the screenrect - item 2 of the screenrect into tScreenHeight
4522-
put item 3 of the screenrect - item 1 of the screenrect into tScreenWidth
4522+
local tScreenHeight, tScreenWidth, tScreenRect
4523+
put revIDEStackScreenRect(pStackName, true) into tScreenRect
4524+
put item 4 of tScreenRect - item 2 of tScreenRect into tScreenHeight
4525+
put item 3 of tScreenRect - item 1 of tScreenRect into tScreenWidth
45234526

45244527
switch pStackName
45254528
case "revMenuBar"
4526-
set the topleft of stack pStackName to 0,0
4529+
set the topleft of stack pStackName to item 1 to 2 of tScreenRect
45274530
break
45284531
case "revTools"
45294532
local tMenuBar
@@ -4534,20 +4537,20 @@ on revIDEPositionPaletteDefault pStackName
45344537
set the topleft of stack pStackName to the left of stack tMenuBar,tTop
45354538
break
45364539
case "message box"
4537-
set rect of stack pStackName to 0,tScreenHeight * 0.75, tScreenWidth * 0.3, tScreenHeight
4540+
set rect of stack pStackName to item 1 of tScreenRect,item 2 of tScreenRect+tScreenHeight * 0.75, item 1 of tScreenRect+tScreenWidth * 0.3,item 2 of tScreenRect+ tScreenHeight
45384541
break
45394542
case "revDictionary"
4540-
set the rect of stack pStackName to tScreenWidth * 0.5, 100, tScreenWidth * 0.9, tScreenHeight * 0.9
4543+
set the rect of stack pStackName to item 1 of tScreenRect+tScreenWidth * 0.5, item 2 of tScreenRect+100, item 1 of tScreenRect+tScreenWidth * 0.9, item 2 of tScreenRect+tScreenHeight * 0.9
45414544
break
45424545
default
45434546
# If no sizing information can be found position the stack in the center of the
45444547
# default screen
45454548

45464549
## If the stack is a Script Editor ensure it will fit on screen
45474550
if pStackName begins with revIDEScriptEditorPrefix() then
4548-
set the rect of stack pStackName to tScreenWidth * 0.3, tScreenHeight * 0.2, tScreenWidth * 0.7, tScreenHeight * 0.8
4551+
set the rect of stack pStackName to item 1 of tScreenRect+ tScreenWidth * 0.3, item 2 of tScreenRect+tScreenHeight * 0.2,item 1 of tScreenRect+ tScreenWidth * 0.7, item 2 of tScreenRect+tScreenHeight * 0.8
45494552
else
4550-
set the loc of stack pStackName to the screenloc
4553+
set the loc of stack pStackName to item 1 of tScreenRect+ tScreenWidth * 0.5, item 2 of tScreenRect+tScreenHeight * 0.5
45514554
end if
45524555
break
45534556
end switch
@@ -6322,9 +6325,10 @@ on revIDENewMainstack pWidth, pHeight
63226325
local tToolsRight
63236326
put the right of stack revIDEPaletteToStackName("tools") into tToolsRight
63246327

6325-
local tLeft
6326-
if tToolsRight < (item 3 of the screenRect / 2) then put tToolsRight + 20 into tLeft
6327-
else put item 1 of the windowBoundingRect + 20 into tLeft
6328+
local tLeft, tScreenRect
6329+
put revIDEStackScreenRect(revIDEPaletteToStackName("tools"), true) into tScreenRect
6330+
if tToolsRight < (item 3 of tScreenRect / 2) then put tToolsRight + 20 into tLeft
6331+
else put item 1 of tScreenRect + 20 into tLeft
63286332
set the topLeft of the templateStack to tLeft,(the bottom of stack revIDEPaletteToStackName("menubar") + 40)
63296333

63306334
# Create the new stack
@@ -6346,6 +6350,45 @@ on revIDENewMainstack pWidth, pHeight
63466350
return it
63476351
end revIDENewMainstack
63486352

6353+
/*
6354+
Summary: Get the screenLoc for a stack based on the screen the stack is on
6355+
6356+
Parameters:
6357+
pStackName (string): The name of a stack
6358+
pWorking (boolean): If true return the loc relative to OS screen furniture rather than the full screen
6359+
6360+
Returns: The screenLoc of the screen the stack is on
6361+
*/
6362+
function revIDEStackScreenLoc pStackName, pWorking
6363+
local tScreenRect
6364+
put revIDEStackScreenRect(pStackName, pWorking) into tScreenRect
6365+
6366+
local tScreenWidth
6367+
put item 3 of tScreenRect - item 1 of tScreenRect into tScreenWidth
6368+
6369+
local tScreenHeight
6370+
put item 4 of tScreenRect - item 2 of tScreenRect into tScreenHeight
6371+
6372+
return item 1 of tScreenRect + (tScreenWidth div 2),item 2 of tScreenRect + (tScreenHeight div 2)
6373+
end revIDEStackScreenLoc
6374+
6375+
/*
6376+
Summary: Get the screenRect for a stack based on the screen the stack is on
6377+
6378+
Parameters:
6379+
pStackName (string): The name of a stack
6380+
pWorking (boolean): If true return the loc relative to OS screen furniture rather than the full screen
6381+
6382+
Returns: The screenRect of the screen the stack is on
6383+
*/
6384+
function revIDEStackScreenRect pStackName, pWorking
6385+
if pWorking then
6386+
return line (the screen of stack pStackName) of the working screenRects
6387+
else
6388+
return line (the screen of stack pStackName) of the screenRects
6389+
end if
6390+
end revIDEStackScreenRect
6391+
63496392
on revIDEActionNewMainstack pStackType
63506393
if pStackType is "default" then
63516394
revIDENewMainstack

Toolset/palettes/behaviors/revpalettebehavior.livecodescript

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@ after resizeStack
530530
end if
531531
end resizeStack
532532

533+
on desktopChanged
534+
revIDEEnsureOnScreen the short name of this stack
535+
end desktopChanged
536+
533537
after openCard
534538
generateFrame
535539
end openCard
@@ -568,6 +572,12 @@ after closeStack
568572
revIDESetPaletteRectPreference the short name of me
569573
end closeStack
570574

575+
# Description
576+
# Sent when the script editor is moved. Saves the new size in the preferences.
577+
after moveStack
578+
revIDESetPaletteRectPreference the short name of me
579+
end moveStack
580+
571581
private on __doCallback pDataIndex
572582
local tData
573583
put sData[pDataIndex] into tData

Toolset/palettes/inspector/revinspector.livecodescript

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ on inspectorPositionPalette pIndex, pSelObj
126126
set the topleft of stack tStackName to \
127127
the left of stack tPrevInspector + kNewInspectorOffset, the top of stack tPrevInspector + kNewInspectorOffset
128128
else
129-
local tScreenWidth
130-
put item 3 of the screenrect - item 1 of the screenrect into tScreenWidth
129+
local tScreenWidth, tScreenRect
130+
put revIDEStackScreenRect(tStackName, true) into tScreenRect
131+
put item 3 of tScreenRect - item 1 of tScreenRect into tScreenWidth
131132
set the top of stack tStackName to the top of the topstack
132133
# AL-2015-09-09: [[ Bug 15745 ]] Try and place PI to left of stack if it doesn't fit on the right
133134
if the right of the topstack + kNewInspectorOffset + the width of stack tStackName < tScreenWidth then

Toolset/palettes/menubar/revmenubar.livecodescript

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,15 @@ function revMenuBarRecentFiles
210210
return tMenu
211211
end revMenuBarRecentFiles
212212

213+
on moveStack
214+
if the platform is "MacOS" then
215+
local tScreenRect
216+
put revIDEStackScreenRect(the short name of this stack, true) into tScreenRect
217+
set the topLeft of this stack to item 1 to 2 of tScreenRect
218+
end if
219+
pass moveStack
220+
end moveStack
221+
213222
on setMenuProperties
214223
set the height of me to 47
215224
set the resizable of me to false
@@ -231,20 +240,23 @@ on setMenuProperties
231240
set the itemDelimiter to comma
232241
set the title of me to tTitle
233242

243+
local tScreenRect
244+
put revIDEStackScreenRect(the short name of this stack, true) into tScreenRect
245+
234246
if the platform is not "MacOS" then
235247
if item 3 of the screenRect is 800 then
236-
set the topLeft of me to item 1 to 2 of the windowBoundingRect
248+
set the topLeft of me to item 1 to 2 of tScreenRect
237249
else
238250
--screen rect > 800 by 600
239-
if the cREVMenuBarTopLeft of stack "revPreferences" is empty
240-
then set the loc of me to item 1 of the screenLoc, 54
241-
else set the topLeft of me to the cREVMenuBarTopLeft of stack "revPreferences"
251+
if revIDEGetPreference("cREVMenuBarTopLeft") is empty
252+
then set the loc of me to item 1 of revIDEStackScreenLoc(the short name of this stack), 54
253+
else set the topLeft of me to revIDEGetPreference("cREVMenuBarTopLeft")
242254
end if
243255
end if
244256

245257
if the platform is "MacOS" then
246258
set the decorations of me to empty
247-
set the topLeft of me to item 1 of the windowBoundingRect,20
259+
set the topLeft of me to item 1 to 2 of tScreenRect
248260
else
249261
set the decorations of me to "default"
250262
end if
-545 Bytes
Binary file not shown.

Toolset/palettes/revaskdialog.rev

-967 Bytes
Binary file not shown.

Toolset/palettes/reverrordisplay.livecodescript

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# AL-2015-07-07: Ensure LCB error code matches that of the engine.
33
local sLCBErrorCode
44

5+
on moveStack
6+
updateStoredRect
7+
end moveStack
8+
9+
on desktopChanged
10+
revIDEEnsureOnScreen the short name of this stack
11+
end desktopChanged
12+
513
on resizeStack
614
revUpdateGeometry
715
updateStoredRect
@@ -15,8 +23,8 @@ end resizeStack
1523

1624
# OK-2007-07-02: Bug 5203
1725
private command updateStoredRect
18-
set the cErrorDisplayRect of stack "revPreferences" to the rect of me
19-
set the cErrorDisplayScreenRect of stack "revPreferences" to the screenRect
26+
revIDESetPreference "cErrorDisplayRect", the rect of me
27+
revIDESetPreference "cErrorDisplayScreenRect", revIDEStackScreenRect(the short name of this stack)
2028
end updateStoredRect
2129

2230
# OK-2007-07-02: Bug 5203
@@ -33,6 +41,9 @@ on preOpenStack
3341
local tStoredScreenRect
3442
put revIDEGetPreference("cErrorDisplayScreenRect") into tStoredScreenRect
3543

44+
local tScreenRect
45+
put revIDEStackScreenRect(the short name of this stack) into tScreenRect
46+
3647
lock messages
3748
if tStoredRect is not empty then
3849

@@ -41,10 +52,10 @@ on preOpenStack
4152
put item 1 of tStoredRect into tLeft
4253
put item 2 of tStoredRect into tTop
4354

44-
local tRight, tBottom
45-
put round(item 3 of tStoredRect * (item 3 of the screenRect \
55+
local tRight, tBottom
56+
put round(item 3 of tStoredRect * (item 3 of tScreenRect \
4657
/ item 3 of tStoredScreenRect)) into tRight
47-
put round(item 4 of tStoredRect * (item 4 of the screenRect \
58+
put round(item 4 of tStoredRect * (item 4 of tScreenRect \
4859
/ item 4 of tStoredScreenRect)) into tBottom
4960

5061
set the rect of me to tLeft, tTop, tRight, tBottom
@@ -56,7 +67,7 @@ on preOpenStack
5667
set the width of me to 512
5768
set the height of me to 277
5869

59-
set the loc of me to the screenLoc
70+
set the loc of me to (item 3 of tScreenRect - item 1 of tScreenRect) * 0.5, (item 4 of tScreenRect - item 2 of tScreenRect) * 0.5
6071
end if
6172

6273
if there is a group "errordisplay" of me then
352 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)