From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#21415: 25.0.50; Emacs Trunk -- pixelwise width/height for x-create-frame Date: Sat, 12 Sep 2015 13:12:11 +0200 Message-ID: <55F4088B.5050901@gmx.at> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080601020900020203080806" X-Trace: ger.gmane.org 1442056403 28702 80.91.229.3 (12 Sep 2015 11:13:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Sep 2015 11:13:23 +0000 (UTC) Cc: 21415@debbugs.gnu.org To: Keith David Bershatsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 12 13:13:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zaik4-0000Ot-Ff for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Sep 2015 13:13:12 +0200 Original-Received: from localhost ([::1]:60262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zaik3-00076r-KQ for geb-bug-gnu-emacs@m.gmane.org; Sat, 12 Sep 2015 07:13:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zaijy-00072a-Pq for bug-gnu-emacs@gnu.org; Sat, 12 Sep 2015 07:13:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zaiju-0001ZQ-NE for bug-gnu-emacs@gnu.org; Sat, 12 Sep 2015 07:13:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zaiju-0001Z9-Jp for bug-gnu-emacs@gnu.org; Sat, 12 Sep 2015 07:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zaiju-0006pL-7h for bug-gnu-emacs@gnu.org; Sat, 12 Sep 2015 07:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Sep 2015 11:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21415 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21415-submit@debbugs.gnu.org id=B21415.144205634726200 (code B ref 21415); Sat, 12 Sep 2015 11:13:02 +0000 Original-Received: (at 21415) by debbugs.gnu.org; 12 Sep 2015 11:12:27 +0000 Original-Received: from localhost ([127.0.0.1]:57665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZaijK-0006oW-Eh for submit@debbugs.gnu.org; Sat, 12 Sep 2015 07:12:27 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:55805) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZaijH-0006oN-CY for 21415@debbugs.gnu.org; Sat, 12 Sep 2015 07:12:24 -0400 Original-Received: from [88.117.83.192] ([88.117.83.192]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0MTeVY-1ZAQS42NGq-00QRjS; Sat, 12 Sep 2015 13:12:20 +0200 In-Reply-To: X-Provags-ID: V03:K0:WaaY99WLzVjWIR4VrYj1Eb16+1so1J7rKTL3ix22L2hYYmuCL0O irtON7j4Uc+RTTDt0Ev2/fBd+LmUxrHKbXxmcl+5CP877S0iIgJcKUmZ+aV5RAk5oUakx2K 4d8LFYhxkqzM3LN8USwOY3zLafrHkX4tZldO+kL+IgYMtdLFaqp4mu9Pkk0wThpGqZ4gHOY aH62r0x5FKOqmKSUlVNVg== X-UI-Out-Filterresults: notjunk:1;V01:K0:N0aac18Fx78=:kOTI7Sfl105tg48OzEdXXW 203eQD0uwJPwu22euxpMXXzBW5Io5qPspDhAXzvDEHeuKP8x1KttPIv2H3YQSymDHU0P5SMEm cM5hoUyIfJAWSNqu0Qo1W2fyrMbeBHFQiCf/WOCAU77u7bU25jv+xP9fCXvErIjC2Tnwjn/3Q Glo/7zzmoIaE0OYgRBUPfkoTKdMgR3ZZ+EPV/+UMAAsTkwivr8k7BROydoqJH/m2tcnAXHJOI J51XP4GlWbYd0C11oXiv/5UHY1It1S3rSicPnArOvV6gNrRuxl0TMwSQUb1CK4MtysJ2Mw7+V 2UTAYmn4FjSpVNOoduvWqqReqgIjtbFFbnzIyKFLujqn3pLwe7OLZgztAmnW1eHRdaCutoBT2 o0hfBTFZKPTVBf3a4yY+pLG8XuYH5K9fqzNlpO/FZapquPMAuuQGeZDsbrTB9GTXxv0pFNEDe IrReuyYIwqR1eaFaJYWQOw2bySGrdf5lQwAg+sybDVbTAKHJe6GtCjFQX+2Dcyf6o3AYTwkZJ CZMvGxdPrRMaw7TkczWjbmgtwUnPxiYy2KTED2+JMk1BBW6mOP2ruw9T9hhe11zAZ961O4Toe FR+c+9d05hnVoyJ6Q5AYUQqToPU5BN/ICqA0Zzm3tuchiA2J6EVH4t0N+l1xVKSMRR9NWTD7t 29EHFIpXNcFizuJ/RnKl2E2Ic2xUDHgs40y37+xdJ1/3DWSAmG+KJpGFbRCiTh6QWl1IZJQ1Y zVBHi/XRWU9c3gc9 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106449 Archived-At: This is a multi-part message in MIME format. --------------080601020900020203080806 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > I had previously thought that the above-mentioned problem (now fixed) > was responsible for the frame increasing in size with the example > labeled BROKEN. I see now that the difference between the WORKING > example and the BROKEN example is caused by the fact that > `frame-after-make-frame` has already run in the WORKING example before > `set-face-attribute` is called with the `font` parameter. If we > modify `x-create-frame-with-faces` by commenting out > `(face-set-after-frame-default frame parameters)` and move that over > to `make-frame` following `(frame-after-make-frame frame t)`, then > both examples work as expected. > > I understand that may not be the preferred solution, but at least we > know for sure that calling `frame-after-make-frame` BEFORE > `set-face-attribute` fixes the problem with the frame expanding even > though `frame-inhibit-implied-resize` is set to `t`. Yes. I forgot that we try to keep the number of lines and faces constant when making the initial frame. Try the attached patch. It should cover everything we have investigated so far. Unfortunately, it won't work with an internal tool bar like we have on Lucid, Motif, and Windows. There's something I haven't fathomed yet :-( martin --------------080601020900020203080806 Content-Type: text/plain; charset=windows-1252; name="Keith.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Keith.diff" diff --git a/src/frame.c b/src/frame.c index 6debcb8..01c7166 100644 --- a/src/frame.c +++ b/src/frame.c @@ -428,13 +428,15 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, within the limits and either frame_inhibit_resize tells us to do so or INHIBIT equals 4. */ { - inhibit_horizontal = ((windows_width >= min_windows_width - && (inhibit == 4 - || frame_inhibit_resize (f, true, parameter))) + inhibit_horizontal = ((f->inhibit_implied_resize + || (windows_width >= min_windows_width + && (inhibit == 4 + || frame_inhibit_resize (f, true, parameter)))) ? true : false); - inhibit_vertical = ((windows_height >= min_windows_height - && (inhibit == 4 - || frame_inhibit_resize (f, false, parameter))) + inhibit_vertical = ((f->inhibit_implied_resize + || (windows_height >= min_windows_height + && (inhibit == 4 + || frame_inhibit_resize (f, false, parameter)))) ? true : false); } else @@ -634,6 +636,7 @@ make_frame (bool mini_p) f->garbaged = true; f->can_x_set_window_size = false; f->after_make_frame = false; + f->inhibit_implied_resize = false; f->tool_bar_redisplayed_once = false; f->column_width = 1; /* !FRAME_WINDOW_P value. */ f->line_height = 1; /* !FRAME_WINDOW_P value. */ @@ -2304,6 +2307,7 @@ otherwise used with utter care to avoid that running functions on { struct frame *f = decode_live_frame (frame); f->after_make_frame = !NILP (made); + f->inhibit_implied_resize = false; return made; } @@ -3167,15 +3171,25 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) prop = parms[i]; val = values[i]; - if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX)) + if (EQ (prop, Qwidth)) { width_change = 1; - width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ; + if (RANGED_INTEGERP (0, val, INT_MAX)) + width = XFASTINT (val) * FRAME_COLUMN_WIDTH (f) ; + else if (FLOATP (val) + && XFLOAT_DATA (val) >= 0 + && (int) XFLOAT_DATA (val) <= INT_MAX) + width = (int) XFLOAT_DATA (val); } - else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) + else if (EQ (prop, Qheight)) { height_change = 1; - height = XFASTINT (val) * FRAME_LINE_HEIGHT (f); + if (RANGED_INTEGERP (0, val, INT_MAX)) + height = XFASTINT (val) * FRAME_LINE_HEIGHT (f); + else if (FLOATP (val) + && XFLOAT_DATA (val) >= 0 + && (int) XFLOAT_DATA (val) <= INT_MAX) + height = (int) XFLOAT_DATA (val); } else if (EQ (prop, Qtop)) top = val; @@ -4582,20 +4596,50 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p) { if (!EQ (width, Qunbound)) { - CHECK_NUMBER (width); - if (! (0 <= XINT (width) && XINT (width) <= INT_MAX)) - xsignal1 (Qargs_out_of_range, width); + if (FLOATP (width)) + { + if ((int) XFLOAT_DATA (width) < (FRAME_SCROLL_BAR_AREA_WIDTH (f) + + FRAME_TOTAL_FRINGE_WIDTH (f) + + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) + || (int) XFLOAT_DATA (width) > INT_MAX) + xsignal1 (Qargs_out_of_range, width); + else + SET_FRAME_WIDTH (f, (int) XFLOAT_DATA (width)); - SET_FRAME_WIDTH (f, XINT (width) * FRAME_COLUMN_WIDTH (f)); + f->inhibit_implied_resize = true; + } + else + { + CHECK_NUMBER (width); + if (! (0 <= XINT (width) && XINT (width) <= INT_MAX)) + xsignal1 (Qargs_out_of_range, width); + + SET_FRAME_WIDTH (f, XINT (width) * FRAME_COLUMN_WIDTH (f)); + } } if (!EQ (height, Qunbound)) { - CHECK_NUMBER (height); - if (! (0 <= XINT (height) && XINT (height) <= INT_MAX)) - xsignal1 (Qargs_out_of_range, height); + if (FLOATP (height)) + { + if ((int) XFLOAT_DATA (height) < (FRAME_TOP_MARGIN_HEIGHT (f) + + FRAME_SCROLL_BAR_AREA_HEIGHT (f) + + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) + || (int) XFLOAT_DATA (height) > INT_MAX) + xsignal1 (Qargs_out_of_range, height); + else + SET_FRAME_HEIGHT (f, (int) XFLOAT_DATA (height)); - SET_FRAME_HEIGHT (f, XINT (height) * FRAME_LINE_HEIGHT (f)); + f->inhibit_implied_resize = true; + } + else + { + CHECK_NUMBER (height); + if (! (0 <= XINT (height) && XINT (height) <= INT_MAX)) + xsignal1 (Qargs_out_of_range, height); + + SET_FRAME_HEIGHT (f, XINT (height) * FRAME_LINE_HEIGHT (f)); + } } user_size = x_get_arg (dpyinfo, parms, Quser_size, 0, 0, RES_TYPE_NUMBER); diff --git a/src/frame.h b/src/frame.h index 17e356d..21918ba 100644 --- a/src/frame.h +++ b/src/frame.h @@ -335,6 +335,9 @@ struct frame /* Set to true after this frame was made by `make-frame'. */ bool_bf after_make_frame : 1; + /* Inhibit implied resize before after_make_frame is set. */ + bool_bf inhibit_implied_resize : 1; + /* True means tool bar has been redisplayed at least once in current session. */ bool_bf tool_bar_redisplayed_once : 1; diff --git a/src/nsfns.m b/src/nsfns.m index 9c805ac..e589929 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -679,7 +679,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) } } - x_set_window_size (f, 0, f->text_cols, f->text_lines, 0); + frame_size_history_add (f, Qupdate_frame_tool_bar, 0, 0, Qnil); + adjust_frame_size (f, -1, -1, 2, 0, Qtool_bar_lines); } diff --git a/src/nsterm.m b/src/nsterm.m index 2806f31..48b88e1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -7196,8 +7196,8 @@ if (cols > 0 && rows > 0) NSTRACE (constrainFrameRect); NSTRACE_RECT ("input", frameRect); - if (ns_menu_bar_should_be_hidden ()) - return frameRect; +/// if (ns_menu_bar_should_be_hidden ()) +/// return frameRect; if (nr_screens == 1) return [super constrainFrameRect:frameRect toScreen:screen]; @@ -7738,8 +7738,9 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) /* Now make the frame display the given font. */ if (FRAME_NS_WINDOW (f) != 0 && ! [view isFullscreen]) - x_set_window_size (f, false, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), - FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), true); + adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), + FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 3, + false, Qfont); return font_object; } --------------080601020900020203080806--