From: Martin Rudalics Date: Sun, 30 Mar 2014 13:31:45 +0000 (+0200) Subject: In x_set_window_size postpone calculation of default frame sizes (Bug#17142). X-Git-Tag: emacs-24.3.90~69 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=632e91a6452ee7b56f2153746ad17fa643d512b8;p=emacs.git In x_set_window_size postpone calculation of default frame sizes (Bug#17142). * frame.c (x_set_frame_parameters): Calculate default values of new frame sizes only after all other frame parameters have been processed (Bug#17142). --- diff --git a/src/ChangeLog b/src/ChangeLog index d67b7513e37..4a761249376 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-03-30 Martin Rudalics + + * frame.c (x_set_frame_parameters): Calculate default values of + new frame sizes only after all other frame parameters have been + processed (Bug#17142). + 2014-03-28 Ken Brown * conf_post.h (SYSTEM_PURESIZE_EXTRA) [CYGWIN]: Set to 10000. diff --git a/src/frame.c b/src/frame.c index 055ce36ff4f..c5a2f6ab245 100644 --- a/src/frame.c +++ b/src/frame.c @@ -2795,6 +2795,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) set them both at once. So we wait until we've looked at the entire list before we set them. */ int width, height; + bool width_change = 0, height_change = 0; /* Same here. */ Lisp_Object left, top; @@ -2810,7 +2811,6 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) #ifdef HAVE_X_WINDOWS bool icon_left_no_change = 0, icon_top_no_change = 0; #endif - bool size_changed = 0; struct gcpro gcpro1, gcpro2; i = 0; @@ -2844,18 +2844,6 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) top = left = Qunbound; icon_left = icon_top = Qunbound; - /* Provide default values for HEIGHT and WIDTH. */ - width = (f->new_width - ? (f->new_pixelwise - ? f->new_width - : (f->new_width * FRAME_COLUMN_WIDTH (f))) - : FRAME_TEXT_WIDTH (f)); - height = (f->new_height - ? (f->new_pixelwise - ? f->new_height - : (f->new_height * FRAME_LINE_HEIGHT (f))) - : FRAME_TEXT_HEIGHT (f)); - /* Process foreground_color and background_color before anything else. They are independent of other properties, but other properties (e.g., cursor_color) are dependent upon them. */ @@ -2897,12 +2885,12 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX)) { - size_changed = 1; + width_change = 1; width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ; } else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) { - size_changed = 1; + height_change = 1; height = XFASTINT (val) * FRAME_LINE_HEIGHT (f); } else if (EQ (prop, Qtop)) @@ -2989,11 +2977,30 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) XSETFRAME (frame, f); - if (size_changed + if ((width_change || height_change) && (width != FRAME_TEXT_WIDTH (f) || height != FRAME_TEXT_HEIGHT (f) || f->new_height || f->new_width)) - Fset_frame_size (frame, make_number (width), make_number (height), Qt); + { + /* If necessary provide default values for HEIGHT and WIDTH. Do + that here since otherwise a size change implied by an + intermittent font change may get lost as in Bug#17142. */ + if (!width_change) + width = (f->new_width + ? (f->new_pixelwise + ? f->new_width + : (f->new_width * FRAME_COLUMN_WIDTH (f))) + : FRAME_TEXT_WIDTH (f)); + + if (!height_change) + height = (f->new_height + ? (f->new_pixelwise + ? f->new_height + : (f->new_height * FRAME_LINE_HEIGHT (f))) + : FRAME_TEXT_HEIGHT (f)); + + Fset_frame_size (frame, make_number (width), make_number (height), Qt); + } if ((!NILP (left) || !NILP (top)) && ! (left_no_change && top_no_change)