Improve deck view with multi-monitor systems

On Linux multi-monitor systems, the existing logic would create a new
window that was slightly smaller than the total combined display size.
The new logic creates a window that is slightly smaller than the monitor
Forge is currently on.

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
This commit is contained in:
Jamin W. Collins
2018-01-27 09:48:19 -07:00
parent 0aa3583412
commit c1e1b6f29a

View File

@@ -1,5 +1,6 @@
package forge.deckchooser; package forge.deckchooser;
import com.sun.prism.Graphics;
import forge.deck.CardPool; import forge.deck.CardPool;
import forge.deck.Deck; import forge.deck.Deck;
import forge.deck.DeckSection; import forge.deck.DeckSection;
@@ -123,10 +124,12 @@ public class FDeckViewer extends FDialog {
if(FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_SMALL_DECK_VIEWER)){ if(FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_SMALL_DECK_VIEWER)){
width = 800; width = 800;
height = 600; height = 600;
}else{ }
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); else {
width = (int)(screenSize.width * 0.8); GraphicsDevice gd = this.getGraphicsConfiguration().getDevice();
height = (int)(screenSize.height * 0.9);
width = (int)(gd.getDisplayMode().getWidth() * 0.8);
height = (int)(gd.getDisplayMode().getHeight() * 0.9);
} }
this.setPreferredSize(new Dimension(width, height)); this.setPreferredSize(new Dimension(width, height));