@@ -53,6 +53,27 @@ ImageViewer::ImageViewer(
53
53
// At this point we no longer need the standalone console (if it exists).
54
54
toggleConsole ();
55
55
56
+ // Get monitor configuration to figure out how large the tev window may
57
+ // maximally become.
58
+ {
59
+ int monitorCount;
60
+ auto ** monitors = glfwGetMonitors (&monitorCount);
61
+ if (monitors && monitorCount > 0 ) {
62
+ nanogui::Vector2i
63
+ monitorMin{numeric_limits<int >::max (), numeric_limits<int >::max ()},
64
+ monitorMax{numeric_limits<int >::min (), numeric_limits<int >::min ()};
65
+
66
+ for (int i = 0 ; i < monitorCount; ++i) {
67
+ nanogui::Vector2i pos, size;
68
+ glfwGetMonitorWorkarea (monitors[i], &pos.x (), &pos.y (), &size.x (), &size.y ());
69
+ monitorMin = min (monitorMin, pos);
70
+ monitorMax = max (monitorMax, pos + size);
71
+ }
72
+
73
+ mMaxSize = min (mMaxSize , max (monitorMax - monitorMin, nanogui::Vector2i{1024 , 800 }));
74
+ }
75
+ }
76
+
56
77
m_background = Color{0 .23f , 1 .0f };
57
78
58
79
mVerticalScreenSplit = new Widget{this };
@@ -1730,7 +1751,7 @@ void ImageViewer::resizeToFit(nanogui::Vector2i targetSize) {
1730
1751
1731
1752
// For sanity, don't make us larger than 8192x8192 to ensure that we
1732
1753
// don't break any texture size limitations of the user's GPU.
1733
- targetSize = min (targetSize, nanogui::Vector2i{ 8192 , 8192 } );
1754
+ targetSize = min (targetSize, mMaxSize );
1734
1755
set_size (targetSize);
1735
1756
}
1736
1757
0 commit comments