Package org.rstudio.core.client.dom

Examples of org.rstudio.core.client.dom.NativeScreen


public class ScreenUtils
{
   public static Size getAdjustedWindowSize(Size preferredSize)
   {
      // compute available height (trim to max)
      NativeScreen screen = NativeScreen.get();
      int height = Math.min(screen.getAvailHeight(), preferredSize.height);
     
      // trim height for large monitors
      if (screen.getAvailHeight() >= (preferredSize.height-100))
      {
         if (BrowseCap.isMacintosh())
            height = height - 107;
         else if (BrowseCap.isWindows())
            height = height - 89;
         else
            height = height - 80;
      }
      else
      {
         // adjust for window framing, etc.
         if (Desktop.isDesktop())
            height = height - 40;
         else
            height = height - 60;

         // extra adjustment for firefox on windows (extra chrome in url bar)
         if (BrowseCap.isWindows() && BrowseCap.isFirefox())
            height = height - 25;
      }
     
      // extra adjustment for chrome on linux (which misreports the
      // available height, excluding the menubar/taskbar)
      if (BrowseCap.isLinux() && BrowseCap.isChrome())
         height = height - 50;

      // compute width (trim to max)
      int width = Math.min(preferredSize.width, screen.getAvailWidth() - 20);
     
      // return size
      return new Size(width, height);
   }
View Full Code Here


   {
      int width, height;
      if (defaultSize != null)
      {
         // trim based on available screen size
         NativeScreen screen = NativeScreen.get();
         width = Math.min(screen.getAvailWidth(), defaultSize.width);
         height = Math.min(screen.getAvailHeight(), defaultSize.height);
      }
      else
      {
         final int PADDING = 20;
  
View Full Code Here

TOP

Related Classes of org.rstudio.core.client.dom.NativeScreen

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.