Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
PRJ-103 Resize all opened IDE windows
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Aug 24, 2020
1 parent 0ee617b commit 80f560a
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ProjectorServer private constructor(
}

private fun calculateMainWindowShift() {
getMainWindow()?.let { window ->
getMainWindows().firstOrNull()?.let { window ->
synchronized(window.treeLock) {
var x = 0.0
var y = 0.0
Expand Down Expand Up @@ -427,10 +427,15 @@ class ProjectorServer private constructor(
ge.setSize(width, height)
}

getMainWindow()?.run {
getMainWindows().let { mainWindows ->
SwingUtilities.invokeLater {
setSize(width, height)
revalidate()
mainWindows.forEach {
it.setBounds(
PGraphicsDevice.clientShift.x, PGraphicsDevice.clientShift.y,
width, height
)
it.revalidate()
}
}
}
}
Expand Down Expand Up @@ -893,12 +898,14 @@ class ProjectorServer private constructor(
setupRepaintManager()
}

private fun getMainWindow(): Component? {
return findIdeaWindow() ?: PWindow.windows.firstOrNull()?.target
}
private fun getMainWindows(): List<Component> {
val ideWindows = PWindow.windows.filter { it.windowType == WindowType.IDEA_WINDOW }.map(PWindow::target)

if (ideWindows.isNotEmpty()) {
return ideWindows
}

private fun findIdeaWindow(): Component? {
return PWindow.windows.find { it.windowType == WindowType.IDEA_WINDOW }?.target
return PWindow.windows.firstOrNull()?.target?.let(::listOf).orEmpty()
}

private fun Component.shiftBounds(shift: AwtPoint): CommonRectangle {
Expand Down

0 comments on commit 80f560a

Please sign in to comment.