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#16013: 24.3.50; Rows in height is interpreted as pixels. Date: Sat, 30 Nov 2013 16:00:24 +0100 Message-ID: <5299FD88.2090600@gmx.at> References: <5579FC36-5F75-4679-87F6-048C5B7326F6@swipnet.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080006030101030409050302" X-Trace: ger.gmane.org 1385823679 29974 80.91.229.3 (30 Nov 2013 15:01:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Nov 2013 15:01:19 +0000 (UTC) Cc: 16013@debbugs.gnu.org To: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 30 16:01:24 2013 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 1Vmm2r-0004Ww-WF for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Nov 2013 16:01:22 +0100 Original-Received: from localhost ([::1]:52255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vmm2r-00066I-Ca for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Nov 2013 10:01:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vmm2h-00066B-2S for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2013 10:01:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vmm2Z-0002f0-OA for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2013 10:01:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vmm2Z-0002ew-Ka for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2013 10:01:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Vmm2Y-0005ul-TH for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2013 10:01:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Nov 2013 15:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16013 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16013-submit@debbugs.gnu.org id=B16013.138582364222700 (code B ref 16013); Sat, 30 Nov 2013 15:01:02 +0000 Original-Received: (at 16013) by debbugs.gnu.org; 30 Nov 2013 15:00:42 +0000 Original-Received: from localhost ([127.0.0.1]:51877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vmm2D-0005u3-72 for submit@debbugs.gnu.org; Sat, 30 Nov 2013 10:00:41 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:56030) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Vmm26-0005tl-HF for 16013@debbugs.gnu.org; Sat, 30 Nov 2013 10:00:36 -0500 Original-Received: from [62.47.52.182] ([62.47.52.182]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MN1Gu-1Vg9GF2tLs-006eBp for <16013@debbugs.gnu.org>; Sat, 30 Nov 2013 16:00:27 +0100 In-Reply-To: <5579FC36-5F75-4679-87F6-048C5B7326F6@swipnet.se> X-Provags-ID: V03:K0:xtlMVKv3beWeE+lRY8Pu7o4ZNdHJPUhOiPD1FyuZNqQXEjDJNk0 fetUazDWHIq5bQbv1tGjdf1pfFpzEdglWLt8hIf81HB9mFEdNOogJ10aJAughUHcm2IRFkD bhX2DJgfk9K3JcCoVo69sBkUiqLKxuTuf8iv5UOwVKr8m1OnwaOF1U+R/uXHERyZh08yu47 PES80FuDsSmkYhHhXTOIQ== 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: 140.186.70.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:81147 Archived-At: This is a multi-part message in MIME format. --------------080006030101030409050302 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > Can't do this from -Q, but with a minimal .emacs: > > (custom-set-variables > '(default-frame-alist (quote ((height . 50)))) > ) > > start emacs and it won't be 50 rows, but 50 pixels. Bad luck. Please try the attached, pretty unripe patch. Thanks, martin --------------080006030101030409050302 Content-Type: text/plain; name="frame-height.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="frame-height.diff" === modified file 'src/gtkutil.c' --- src/gtkutil.c 2013-11-30 09:25:31 +0000 +++ src/gtkutil.c 2013-11-30 14:44:13 +0000 @@ -938,27 +938,30 @@ COLUMNS/ROWS is the size the edit area shall have after the resize. */ void -xg_frame_set_char_size (struct frame *f, int width, int height) +xg_frame_set_char_size (struct frame *f, int width, int height, bool pixelwise) { - int pixelwidth; - int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); + int pixelwidth = pixelwise ? width : 0; + int pixelheight = pixelwise ? height : FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); if (FRAME_PIXEL_HEIGHT (f) == 0) return; - /* Take into account the size of the scroll bar. Always use the - number of columns occupied by the scroll bar here otherwise we - might end up with a frame width that is not a multiple of the - frame's character width which is bad for vertically split - windows. */ - f->scroll_bar_actual_width - = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); - - compute_fringe_widths (f, 0); - - /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it - after calculating that value. */ - pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); + if (! pixelwise) + { + /* Take into account the size of the scroll bar. Always use the + number of columns occupied by the scroll bar here otherwise we + might end up with a frame width that is not a multiple of the + frame's character width which is bad for vertically split + windows. */ + f->scroll_bar_actual_width + = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); + + compute_fringe_widths (f, 0); + + /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it + after calculating that value. */ + pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); + } /* Do this before resize, as we don't know yet if we will be resized. */ xg_clear_under_internal_border (f); @@ -988,7 +991,7 @@ } else { - change_frame_size (f, width, height, 0, 1, 0, 1); + change_frame_size (f, pixelwidth, pixelheight, 0, 1, 0, 1); FRAME_PIXEL_WIDTH (f) = pixelwidth; FRAME_PIXEL_HEIGHT (f) = pixelheight; } @@ -1095,7 +1098,7 @@ && FRAME_X_DISPLAY (f) == dpy) { x_set_scroll_bar_default_width (f); - xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f)); + xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f), 0); } } } === modified file 'src/gtkutil.h' --- src/gtkutil.h 2013-09-17 07:06:42 +0000 +++ src/gtkutil.h 2013-11-30 14:43:32 +0000 @@ -139,7 +139,7 @@ extern void xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight); -extern void xg_frame_set_char_size (struct frame *f, int cols, int rows); +extern void xg_frame_set_char_size (struct frame *f, int cols, int rows, bool pixelwise); extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc); extern void xg_display_open (char *display_name, Display **dpy); === modified file 'src/xterm.c' --- src/xterm.c 2013-11-30 09:25:31 +0000 +++ src/xterm.c 2013-11-30 14:42:43 +0000 @@ -8743,8 +8743,12 @@ void x_set_window_size (struct frame *f, int change_gravity, int width, int height, bool pixelwise) { + int pixelwidth, pixelheight; + block_input (); + check_frame_size (f, &width, &height, pixelwise); + if (NILP (tip_frame) || XFRAME (tip_frame) != f) { int r, c, text_width, text_height; @@ -8773,14 +8777,25 @@ change_frame_size (f, text_width, text_height, 0, 1, 0, 1); } + if (pixelwise) + { + pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); + pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); + } + else + { + pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width); + pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height); + } + #ifdef USE_GTK if (FRAME_GTK_WIDGET (f)) - xg_frame_set_char_size (f, width, height); + xg_frame_set_char_size (f, pixelwidth, pixelheight, 1); else - x_set_window_size_1 (f, change_gravity, width, height, pixelwise); + x_set_window_size_1 (f, change_gravity, pixelwidth, pixelheight, 1); #else /* not USE_GTK */ - x_set_window_size_1 (f, change_gravity, width, height, pixelwise); + x_set_window_size_1 (f, change_gravity, pixelwidth, pixelheight, 1); #endif /* not USE_GTK */ --------------080006030101030409050302--