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

Commit a95287b

Browse files
committed
[[ Bug 21122 ]] Update windowBoundingRect
This patch ensures that the windowBoundingRect is updated when the screen configurations change and when the menubar and tools palette are moved. It also ensures that script editors are resized to fit within the window when the screens change.
1 parent a98b6f6 commit a95287b

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,7 @@ on revIDEInitialiseIDELibrary
13491349
revIDEPropertyLibraryInitialise
13501350

13511351
ideSubscribe "ideExtensionsChanged"
1352+
ideSubscribe "ideDesktopChanged"
13521353
end revIDEInitialiseIDELibrary
13531354

13541355
on ideExtensionsChanged
@@ -9678,8 +9679,9 @@ command revIDESuspendDevelopmentTools
96789679
put tClosedStacksList into gREVRestore["stacks"]
96799680

96809681
-- Reset the windowBoundingRect
9681-
put the windowBoundingRect into gREVRestore["windowBoundingRect"]
9682-
set the windowBoundingRect to 0,0,item 3 to 4 of the windowBoundingRect
9682+
local tWindowRect
9683+
put revIDEStackScreenRect(the short name of the topStack, true) into tWindowRect
9684+
set the windowBoundingRect to tWindowRect
96839685

96849686
-- Show the restore dialog
96859687
lock recent
@@ -9746,7 +9748,7 @@ command revIDERestoreDevelopmentTools
97469748
set the defaultMenuBar to the long id of group "revMenuBar" of stack revIDEPaletteToStackName("menubar")
97479749
set the width of stack "revMenuBar" to the width of stack "revMenuBar" + 1 -- bug 1806
97489750
set the width of stack "revMenuBar" to the width of stack "revMenuBar" - 1
9749-
set the windowBoundingRect to gREVRestore["windowBoundingRect"]
9751+
ideSetWindowBoundingRect
97509752
choose gREVRestore["tool"]
97519753

97529754
-- Restore the script debug mode
@@ -12222,3 +12224,42 @@ end ideShouldShowUpgradeOptions
1222212224
private function hasConnection
1222312225
return url("http://google.com/") is not empty
1222412226
end hasConnection
12227+
12228+
on ideDesktopChanged
12229+
ideSetWindowBoundingRect
12230+
end ideDesktopChanged
12231+
12232+
/**
12233+
12234+
Update the window bounding rect for the current IDE palette layout
12235+
12236+
*/
12237+
12238+
command ideSetWindowBoundingRect
12239+
local tMenuBar
12240+
put revIDEPaletteToStackName("menubar") into tMenuBar
12241+
12242+
local tTools
12243+
put revIDEPaletteToStackName("tools") into tTools
12244+
12245+
local tToolsSlop
12246+
put the width of stack tTools + 50 into tToolsSlop
12247+
12248+
local tWindowRect
12249+
put revIDEStackScreenRect(tMenuBar, true) into tWindowRect
12250+
if tWindowRect is not empty then
12251+
if the screen of stack tTools is the screen of stack tMenubar then
12252+
if the right of stack tTools < (item 1 of tWindowRect + tToolsSlop) then
12253+
put the right of stack tTools + 5 into item 1 of tWindowRect
12254+
else if the left of stack tTools > (item 3 of tWindowRect - tToolsSlop) then
12255+
put the left of stack tTools - 5 into item 3 of tWindowRect
12256+
end if
12257+
end if
12258+
12259+
-- revMenubar may not be visible on macOS with text and icons off
12260+
if the visible of stack tMenubar then
12261+
put the bottom of stack tMenuBar + 5 into item 2 of tWindowRect
12262+
end if
12263+
set the windowBoundingRect to tWindowRect
12264+
end if
12265+
end ideSetWindowBoundingRect

Toolset/palettes/menubar/revmenubar.livecodescript

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ on moveStack
219219
set the topLeft of this stack to item 1 to 2 of tScreenRect
220220
end if
221221
revIDESetPaletteRectPreference the short name of me
222+
ideSetWindowBoundingRect
223+
222224
pass moveStack
223225
end moveStack
224226

@@ -282,15 +284,9 @@ on idePreferenceChanged pPreference
282284
case "cToolbarIcons"
283285
lock screen
284286
show me
285-
local tAlterBounding
286-
if abs(item 2 of the windowBoundingRect - the bottom of me) < 10 then
287-
put true into tAlterBounding
288-
end if
289287
updateMenubarPreference
290288
layoutMenu
291-
if tAlterBounding then
292-
set the windowBoundingRect to item 1 of the windowBoundingRect,the bottom of me + 25, item 3 to 4 of the windowBoundingRect
293-
end if
289+
ideSetWindowBoundingRect
294290
unlock screen
295291
break
296292
end switch
@@ -2443,8 +2439,7 @@ function revListMenuHandlers pObject, pSort, pIndentationLevel
24432439
end revListMenuHandlers
24442440

24452441
on unIconifyStack
2446-
global gREVBackDropRestore, gREVRestore
2447-
if gREVRestore["windowBoundingRect"] is empty then pass unIconifyStack
2442+
global gREVBackDropRestore
24482443
set cursor to watch
24492444
lock messages
24502445
set the iconic of stack "revMenubar" to false

Toolset/palettes/tools/revtools.livecodescript

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,3 +1251,8 @@ on revToolsConfigurePolygon pTool
12511251
end if
12521252
revToolsConfigurePaint
12531253
end revToolsConfigurePolygon
1254+
1255+
on moveStack
1256+
ideSetWindowBoundingRect
1257+
pass moveStack
1258+
end moveStack

notes/bugfix-21122.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix user stacks opening offscreen when last opened on a different monitor

0 commit comments

Comments
 (0)