aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2013-12-26 12:31:42 +0100
committerMartin Rudalics2013-12-26 12:31:42 +0100
commit0cbab19e6e5147fda4c89dcadd2826a35857b5ce (patch)
treea76904f11f07268a412df3037e8f677213e7baae /src
parente76119d7542b19eb03f8d725480cbf98f7fa03d9 (diff)
downloademacs-0cbab19e6e5147fda4c89dcadd2826a35857b5ce.tar.gz
emacs-0cbab19e6e5147fda4c89dcadd2826a35857b5ce.zip
Some more tinkering with Bug#16051.
* window.c (resize_frame_windows): Don't let the size of the root window drop below the frame's default character size. Never ever delete any subwindows - let the window manager do the clipping. * w32fns.c (x_set_tool_bar_lines): Rewrite calculation of number of toolbar lines needed when they exceed the height of the root window. (unwind_create_frame_1): New function. (Fx_create_frame): Generally inhibit calling the window configuration change hook here. Remove extra call to change_frame_size - it's not needed when we don't run the configuration change hook.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/w32fns.c43
-rw-r--r--src/window.c43
3 files changed, 64 insertions, 39 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 70df9cd3641..053a498392c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,20 @@
12013-12-26 Martin Rudalics <rudalics@gmx.at>
2
3 Some more tinkering with Bug#16051.
4 * window.c (resize_frame_windows): Don't let the size of the
5 root window drop below the frame's default character size.
6 Never ever delete any subwindows - let the window manager do the
7 clipping.
8
9 * w32fns.c (x_set_tool_bar_lines): Rewrite calculation of number
10 of toolbar lines needed when they exceed the height of the root
11 window.
12 (unwind_create_frame_1): New function.
13 (Fx_create_frame): Generally inhibit calling the window
14 configuration change hook here. Remove extra call to
15 change_frame_size - it's not needed when we don't run the
16 configuration change hook.
17
12013-12-26 Paul Eggert <eggert@cs.ucla.edu> 182013-12-26 Paul Eggert <eggert@cs.ucla.edu>
2 19
3 Fix core dumps with gcc -fsanitize=address and GNU/Linux. 20 Fix core dumps with gcc -fsanitize=address and GNU/Linux.
diff --git a/src/w32fns.c b/src/w32fns.c
index 02850d8954d..9536b146535 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1683,15 +1683,19 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1683 /* DELTA is in pixels now. */ 1683 /* DELTA is in pixels now. */
1684 delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit; 1684 delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit;
1685 1685
1686 /* Don't resize the tool-bar to more than we have room for. FIXME: 1686 /* Don't resize the tool-bar to more than we have room for. Note: The
1687 This must use window_sizable eventually !!!!!!!!!!!! */ 1687 calculations below and the subsequent call to resize_frame_windows
1688 are inherently flawed because they can make the toolbar higher than
1689 the containing frame. */
1688 if (delta > 0) 1690 if (delta > 0)
1689 { 1691 {
1690 root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f))); 1692 root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f)));
1691 if (root_height - delta < unit) 1693 if (root_height - delta < unit)
1692 { 1694 {
1693 delta = root_height - unit; 1695 delta = root_height - unit;
1694 nlines = (root_height / unit) + min (1, (root_height % unit)); 1696 /* When creating a new frame and toolbar mode is enabled, we
1697 need at least one toolbar line. */
1698 nlines = max (FRAME_TOOL_BAR_LINES (f) + delta / unit, 1);
1695 } 1699 }
1696 } 1700 }
1697 1701
@@ -4271,6 +4275,12 @@ do_unwind_create_frame (Lisp_Object frame)
4271} 4275}
4272 4276
4273static void 4277static void
4278unwind_create_frame_1 (Lisp_Object val)
4279{
4280 inhibit_lisp_code = val;
4281}
4282
4283static void
4274x_default_font_parameter (struct frame *f, Lisp_Object parms) 4284x_default_font_parameter (struct frame *f, Lisp_Object parms)
4275{ 4285{
4276 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); 4286 struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
@@ -4377,7 +4387,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4377 frame = Qnil; 4387 frame = Qnil;
4378 GCPRO4 (parameters, parent, name, frame); 4388 GCPRO4 (parameters, parent, name, frame);
4379 tem = x_get_arg (dpyinfo, parameters, Qminibuffer, "minibuffer", "Minibuffer", 4389 tem = x_get_arg (dpyinfo, parameters, Qminibuffer, "minibuffer", "Minibuffer",
4380 RES_TYPE_SYMBOL); 4390 RES_TYPE_SYMBOL);
4381 if (EQ (tem, Qnone) || NILP (tem)) 4391 if (EQ (tem, Qnone) || NILP (tem))
4382 f = make_frame_without_minibuffer (Qnil, kb, display); 4392 f = make_frame_without_minibuffer (Qnil, kb, display);
4383 else if (EQ (tem, Qonly)) 4393 else if (EQ (tem, Qonly))
@@ -4407,10 +4417,17 @@ This function is an internal primitive--use `make-frame' instead. */)
4407 if (! STRINGP (f->icon_name)) 4417 if (! STRINGP (f->icon_name))
4408 fset_icon_name (f, Qnil); 4418 fset_icon_name (f, Qnil);
4409 4419
4410/* FRAME_DISPLAY_INFO (f) = dpyinfo; */ 4420 /* FRAME_DISPLAY_INFO (f) = dpyinfo; */
4411 4421
4412 /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe. */ 4422 /* With FRAME_DISPLAY_INFO set up, this unwind-protect is safe. */
4413 record_unwind_protect (do_unwind_create_frame, frame); 4423 record_unwind_protect (do_unwind_create_frame, frame);
4424
4425 /* Avoid calling window-configuration-change-hook; otherwise we could
4426 get into all kinds of nasty things like an infloop in next_frame or
4427 violating a (height >= 0) assertion in window_box_height. */
4428 record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code);
4429 inhibit_lisp_code = Qt;
4430
4414#ifdef GLYPH_DEBUG 4431#ifdef GLYPH_DEBUG
4415 image_cache_refcount = 4432 image_cache_refcount =
4416 FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; 4433 FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
@@ -4464,7 +4481,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4464 Lisp_Object value; 4481 Lisp_Object value;
4465 4482
4466 value = x_get_arg (dpyinfo, parameters, Qinternal_border_width, 4483 value = x_get_arg (dpyinfo, parameters, Qinternal_border_width,
4467 "internalBorder", "InternalBorder", RES_TYPE_NUMBER); 4484 "internalBorder", "InternalBorder", RES_TYPE_NUMBER);
4468 if (! EQ (value, Qunbound)) 4485 if (! EQ (value, Qunbound))
4469 parameters = Fcons (Fcons (Qinternal_border_width, value), 4486 parameters = Fcons (Fcons (Qinternal_border_width, value),
4470 parameters); 4487 parameters);
@@ -4505,20 +4522,6 @@ This function is an internal primitive--use `make-frame' instead. */)
4505 happen. */ 4522 happen. */
4506 init_frame_faces (f); 4523 init_frame_faces (f);
4507 4524
4508 /* PXW: This is a duplicate from below. We have to do it here since
4509 otherwise x_set_tool_bar_lines will work with the character sizes
4510 installed by init_frame_faces while the frame's pixel size is still
4511 calculated from a character size of 1 and we subsequently hit the
4512 eassert (height >= 0) assertion in window_box_height. The
4513 non-pixelwise code apparently worked around this because it had one
4514 frame line vs one toolbar line which left us with a zero root
4515 window height which was obviously wrong as well ... */
4516 width = FRAME_TEXT_WIDTH (f);
4517 height = FRAME_TEXT_HEIGHT (f);
4518 FRAME_TEXT_HEIGHT (f) = 0;
4519 SET_FRAME_WIDTH (f, 0);
4520 change_frame_size (f, width, height, 1, 0, 0, 1);
4521
4522 /* The X resources controlling the menu-bar and tool-bar are 4525 /* The X resources controlling the menu-bar and tool-bar are
4523 processed specially at startup, and reflected in the mode 4526 processed specially at startup, and reflected in the mode
4524 variables; ignore them here. */ 4527 variables; ignore them here. */
diff --git a/src/window.c b/src/window.c
index 9939ec1d8fc..9bc95224f7c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4040,31 +4040,34 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
4040 int old_pixel_size = horflag ? r->pixel_width : r->pixel_height; 4040 int old_pixel_size = horflag ? r->pixel_width : r->pixel_height;
4041 /* new_size is the new size of the frame's root window. */ 4041 /* new_size is the new size of the frame's root window. */
4042 int new_size, new_pixel_size; 4042 int new_size, new_pixel_size;
4043 int unit = horflag ? FRAME_COLUMN_WIDTH (f) : FRAME_LINE_HEIGHT (f);
4043 4044
4045 /* Don't let the size drop below one unit. This is more comforting
4046 when we are called from x_set_tool_bar_lines since the latter may
4047 have implicitly given us a zero or negative height. */
4044 if (pixelwise) 4048 if (pixelwise)
4045 { 4049 {
4046 new_pixel_size 4050 new_pixel_size = max (horflag
4047 = (horflag 4051 ? size
4048 ? size 4052 : (size
4049 : (size 4053 - FRAME_TOP_MARGIN_HEIGHT (f)
4050 - FRAME_TOP_MARGIN_HEIGHT (f) 4054 - ((FRAME_HAS_MINIBUF_P (f)
4051 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 4055 && !FRAME_MINIBUF_ONLY_P (f))
4052 ? FRAME_LINE_HEIGHT (f) : 0))); 4056 ? FRAME_LINE_HEIGHT (f) : 0)),
4053 new_size = new_pixel_size / (horflag 4057 unit);
4054 ? FRAME_COLUMN_WIDTH (f) 4058 new_size = new_pixel_size / unit;
4055 : FRAME_LINE_HEIGHT (f));
4056 } 4059 }
4057 else 4060 else
4058 { 4061 {
4059 new_size= (horflag 4062 new_size = max (horflag
4060 ? size 4063 ? size
4061 : (size 4064 : (size
4062 - FRAME_TOP_MARGIN (f) 4065 - FRAME_TOP_MARGIN (f)
4063 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 4066 - ((FRAME_HAS_MINIBUF_P (f)
4064 ? 1 : 0))); 4067 && !FRAME_MINIBUF_ONLY_P (f))
4065 new_pixel_size = new_size * (horflag 4068 ? 1 : 0)),
4066 ? FRAME_COLUMN_WIDTH (f) 4069 1);
4067 : FRAME_LINE_HEIGHT (f)); 4070 new_pixel_size = new_size * unit;
4068 } 4071 }
4069 4072
4070 r->top_line = FRAME_TOP_MARGIN (f); 4073 r->top_line = FRAME_TOP_MARGIN (f);
@@ -4124,6 +4127,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
4124 window_resize_apply (r, horflag); 4127 window_resize_apply (r, horflag);
4125 window_pixel_to_total (r->frame, horflag ? Qt : Qnil); 4128 window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
4126 } 4129 }
4130#if 0 /* Let's try without killing other windows. */
4127 else 4131 else
4128 { 4132 {
4129 /* We lost. Delete all windows but the frame's 4133 /* We lost. Delete all windows but the frame's
@@ -4141,6 +4145,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
4141 XWINDOW (root)->pixel_height = new_pixel_size; 4145 XWINDOW (root)->pixel_height = new_pixel_size;
4142 } 4146 }
4143 } 4147 }
4148#endif /* 0 */
4144 } 4149 }
4145 } 4150 }
4146 } 4151 }