From: martin rudalics <rudalics@gmx.at>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: 16013@debbugs.gnu.org
Subject: bug#16013: 24.3.50; Rows in height is interpreted as pixels.
Date: Sat, 30 Nov 2013 16:00:24 +0100 [thread overview]
Message-ID: <5299FD88.2090600@gmx.at> (raw)
In-Reply-To: <5579FC36-5F75-4679-87F6-048C5B7326F6@swipnet.se>
[-- Attachment #1: Type: text/plain, Size: 269 bytes --]
> 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
[-- Attachment #2: frame-height.diff --]
[-- Type: text/plain, Size: 4492 bytes --]
=== 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 */
next prev parent reply other threads:[~2013-11-30 15:00 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-30 13:08 bug#16013: 24.3.50; Rows in height is interpreted as pixels Jan Djärv
2013-11-30 15:00 ` martin rudalics [this message]
2013-11-30 18:52 ` Jan Djärv
2013-12-01 9:44 ` martin rudalics
2013-12-01 10:01 ` Jan Djärv
2013-12-01 11:24 ` martin rudalics
2013-12-01 12:02 ` Jan Djärv
2013-12-02 18:15 ` martin rudalics
2013-12-02 22:03 ` Stephen Berman
2013-12-03 7:56 ` martin rudalics
2013-12-03 9:13 ` Stephen Berman
2013-12-03 18:34 ` martin rudalics
2013-12-03 20:02 ` Stephen Berman
2013-12-03 7:53 ` Jan Djärv
2013-12-03 7:58 ` martin rudalics
2013-12-03 16:30 ` Jan Djärv
2013-12-03 18:34 ` martin rudalics
2013-12-03 19:30 ` Jan Djärv
2013-12-03 19:45 ` Jan Djärv
2013-12-04 18:06 ` martin rudalics
2013-12-07 17:53 ` Jan Djärv
2013-12-07 18:09 ` martin rudalics
2013-12-09 18:26 ` martin rudalics
2014-01-11 14:01 ` martin rudalics
2014-01-11 17:46 ` Jan Djärv
2014-01-12 9:54 ` martin rudalics
2014-01-12 11:13 ` Jan Djärv
2014-01-12 11:46 ` martin rudalics
2014-01-12 20:25 ` Stefan Monnier
2014-01-12 22:21 ` Jan Djärv
2014-01-14 17:30 ` Jan Djärv
2014-01-14 18:10 ` martin rudalics
2014-01-16 10:03 ` martin rudalics
2014-01-16 10:14 ` martin rudalics
2014-01-18 11:30 ` Jan Djärv
2014-01-18 12:07 ` martin rudalics
2014-01-29 10:14 ` martin rudalics
2020-09-09 13:07 ` Lars Ingebrigtsen
2020-09-09 14:46 ` Eli Zaretskii
2020-09-10 12:40 ` Lars Ingebrigtsen
2013-12-04 18:06 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5299FD88.2090600@gmx.at \
--to=rudalics@gmx.at \
--cc=16013@debbugs.gnu.org \
--cc=jan.h.d@swipnet.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).