emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99383: * xfns.c (Fx_create_frame): I


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99383: * xfns.c (Fx_create_frame): If frame height is too big, try
Date: Mon, 25 Jan 2010 08:46:15 +0100
User-agent: Bazaar (2.0.2)

------------------------------------------------------------
revno: 99383 [merge]
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Mon 2010-01-25 08:46:15 +0100
message:
  * xfns.c (Fx_create_frame): If frame height is too big, try
  sizes 24 and 10. Bug #3643.
modified:
  src/ChangeLog
  src/xfns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-01-25 02:52:03 +0000
+++ b/src/ChangeLog     2010-01-25 07:45:12 +0000
@@ -1,3 +1,8 @@
+2010-01-25  Jan Djärv  <address@hidden>
+
+       * xfns.c (Fx_create_frame): If frame height is too big, try
+       sizes 24 and 10. Bug #3643.
+
 2010-01-24  Stefan Monnier  <address@hidden>
 
        Try and fix bug#788, hopefully for real this time.

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2010-01-15 17:04:14 +0000
+++ b/src/xfns.c        2010-01-25 07:43:10 +0000
@@ -3518,27 +3518,35 @@
   window_prompting = x_figure_window_size (f, parms, 1);
 
   /* Don't make height higher than display height unless the user asked
-     for it.  */
+     for it.  Try sizes 24 and 10 if current is too large.  */
   height = FRAME_LINES (f);
   tem = x_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER);
   if (EQ (tem, Qunbound))
     {
-      int ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f));
+      int h = FRAME_LINES (f) + FRAME_TOOL_BAR_LINES (f)
+        + FRAME_MENU_BAR_LINES (f) + 2;
+      int ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, h);
       int dph = DisplayHeight (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f));
+      static int tryheight[] = { 24, 10, 0 } ;
+      int i;
+
+      ph += (FRAME_EXTERNAL_TOOL_BAR (f) ? 32 : 0) /* Gtk toolbar size */
+        + (FRAME_EXTERNAL_MENU_BAR (f) ? 24 : 0); /* Arbitrary */
+
       /* Some desktops have fixed menus above and/or panels below.  Try to
          figure out the usable size we have for emacs.  */
       current_desktop = x_get_current_desktop (f);
       x_get_desktop_workarea (f, current_desktop, &deskw, &deskh);
       if (deskh > 0 && deskh < dph) dph = deskh;
       
-      if (ph > dph)
+      /* Allow 40 pixels for manager decorations.  */
+      for (i = 0; ph+40 > dph && tryheight[i] != 0; ++i)
         {
-          height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, dph) -
-            FRAME_TOOL_BAR_LINES (f) - FRAME_MENU_BAR_LINES (f);
-          if (FRAME_EXTERNAL_TOOL_BAR (f))
-            height -= 2; /* We can't know how big it will be.  */
-          if (FRAME_EXTERNAL_MENU_BAR (f))
-            height -= 2; /* We can't know how big it will be.  */
+          height = tryheight[i];
+          h = height + FRAME_TOOL_BAR_LINES (f) + FRAME_MENU_BAR_LINES (f) + 2;
+          ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, h)
+            + (FRAME_EXTERNAL_TOOL_BAR (f) ? 32 : 0)
+            + (FRAME_EXTERNAL_MENU_BAR (f) ? 24 : 0);
         }
     }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]