Package: emacs;
Reported by: Jan Djärv <jan.h.d <at> swipnet.se>
Date: Sat, 30 Nov 2013 13:10:01 UTC
Severity: normal
Tags: moreinfo
Found in version 24.3.50
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: martin rudalics <rudalics <at> gmx.at> To: Jan Djärv <jan.h.d <at> swipnet.se> Cc: "16013 <at> debbugs.gnu.org" <16013 <at> debbugs.gnu.org> Subject: bug#16013: 24.3.50; Rows in height is interpreted as pixels. Date: Wed, 29 Jan 2014 11:14:13 +0100
[Message part 1 (text/plain, inline)]
I would proceed as follows: For the release, apply the attached patch. This should give initial and subsequent frames the same size and thus resolve most issues you raised in this thread and also fix bug 14795. For Lucid/Motif/Windows the toolbar would remain part of the text area, hence the number of lines available for editing would be less than specified. I see no way to provide a safe fix for this without sufficient testing. We could increase the number of DEFAULT_ROWS for these builds though, so the default frames would retain their prior sizes. After the release I would try to change the behavior such that when a frame is created, the toolbar is not counted in the text height on these builds. Hence `default-frame-alist' would be interpreted as for the GTK build. Subsequent changes (adding/removing/wrapping) of the toolbar would not change the size of the frame but that of its text area, so in this case the behavior would differ from GTK but still be different from the prior behavior. I soon intend to implement horizontal scrollbars anyway so the necessary changes would mainly amount to something like defining: #define FRAME_TEXT_LINES_TO_PIXEL_HEIGHT(f, lines) \ ((lines) * FRAME_LINE_HEIGHT (f) \ + FRAME_TOOL_BAR_HEIGHT (f) \ + FRAME_SCROLL_BAR_AREA_HEIGHT (f) \ + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) WDYT? martin
[frame-text-size.diff (text/plain, inline)]
=== modified file 'src/frame.c' --- src/frame.c 2014-01-11 10:01:01 +0000 +++ src/frame.c 2014-01-28 18:21:35 +0000 @@ -4244,7 +4244,10 @@ /* This used to be done _before_ calling x_figure_window_size, but since the height is reset here, this was really a no-op. I assume that moving it here does what Gerd intended (although he - no longer can remember what that was... ++KFS, 2003-03-25. */ + no longer can remember what that was... ++KFS, 2003-03-25. + + Defined out since it makes subsequent frames larger than the + initial one. See Bug#16013. martin, 2014-01-15. */ /* Add the tool-bar height to the initial frame height so that the user gets a text display area of the size he specified with -g or @@ -4252,6 +4255,7 @@ change the frame size. This is done so that users can create tall Emacs frames without having to guess how tall the tool-bar will get. */ +#if 0 if (toolbar_p && FRAME_TOOL_BAR_HEIGHT (f)) { int margin, relief, bar_height; @@ -4272,6 +4276,7 @@ bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; FRAME_LINES (f) += (bar_height + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); } +#endif compute_fringe_widths (f, 0); === modified file 'src/widget.c' --- src/widget.c 2014-01-01 07:43:34 +0000 +++ src/widget.c 2014-01-28 18:21:35 +0000 @@ -687,12 +687,18 @@ int width, height; pixel_to_text_size (ew, ew->core.width, ew->core.height, &width, &height); - change_frame_size (f, width, height, 0, 1, 0, 1); - - update_wm_hints (ew); - update_various_frame_slots (ew); - - cancel_mouse_face (f); + if (width != FRAME_TEXT_WIDTH (f) + || height != FRAME_TEXT_HEIGHT (f) + || ew->core.width != FRAME_PIXEL_WIDTH (f) + || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f)) + { + change_frame_size (f, width, height, 0, 1, 0, 1); + + update_wm_hints (ew); + update_various_frame_slots (ew); + + cancel_mouse_face (f); + } #if 0 /* See comment above. */ } else @@ -820,12 +826,12 @@ /* Special entry points */ void -EmacsFrameSetCharSize (Widget widget, int columns, int rows) +EmacsFrameSetCharSize (Widget widget, int width, int height) { EmacsFrame ew = (EmacsFrame) widget; struct frame *f = ew->emacs_frame.frame; - x_set_window_size (f, 0, columns, rows, 0); + x_set_window_size (f, 0, width, height, 1); } === modified file 'src/xmenu.c' --- src/xmenu.c 2014-01-29 08:23:59 +0000 +++ src/xmenu.c 2014-01-29 09:09:51 +0000 @@ -682,7 +682,7 @@ xg_update_frame_menubar (f); #else struct x_output *x; - int columns, rows; + int width, height; eassert (FRAME_X_P (f)); @@ -694,8 +694,8 @@ block_input (); /* Save the size of the frame because the pane widget doesn't accept to resize itself. So force it. */ - columns = FRAME_COLS (f); - rows = FRAME_LINES (f); + width = FRAME_TEXT_WIDTH (f); + height = FRAME_TEXT_HEIGHT (f); /* Do the voodoo which means "I'm changing lots of things, don't try to refigure sizes until I'm done." */ @@ -717,7 +717,7 @@ lw_refigure_widget (x->column_widget, True); /* Force the pane widget to resize itself with the right values. */ - EmacsFrameSetCharSize (x->edit_widget, columns, rows); + EmacsFrameSetCharSize (x->edit_widget, width, height); unblock_input (); #endif } === modified file 'src/xterm.c' --- src/xterm.c 2014-01-26 12:17:55 +0000 +++ src/xterm.c 2014-01-28 18:21:35 +0000 @@ -8573,21 +8573,26 @@ compute_fringe_widths (f, 0); - pixelwidth = ((pixelwise - ? FRAME_TEXT_TO_PIXEL_WIDTH (f, width) - : FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width)) - + FRAME_TOOLBAR_WIDTH (f)); - pixelheight = ((pixelwise - ? FRAME_TEXT_TO_PIXEL_HEIGHT (f, height) - : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height)) - + FRAME_MENUBAR_HEIGHT (f) - + FRAME_TOOLBAR_HEIGHT (f)); + pixelwidth = (pixelwise + ? FRAME_TEXT_TO_PIXEL_WIDTH (f, width) + : FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, width)); + pixelheight = (pixelwise + ? FRAME_TEXT_TO_PIXEL_HEIGHT (f, height) + : FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, height)); + +#if defined (USE_LUCID) || defined (USE_MOTIF) + { + struct x_output *x = f->output_data.x; + + pixelheight += x->menubar_height; + } +#endif + if (change_gravity) f->win_gravity = NorthWestGravity; x_wm_set_size_hint (f, (long) 0, 0); XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), pixelwidth, pixelheight); - /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to receive in the ConfigureNotify event; if we get what we asked for, then the event won't cause the screen to become garbaged, so
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.