diff options
| author | Martin Rudalics | 2013-12-03 08:45:54 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2013-12-03 08:45:54 +0100 |
| commit | 7303a0aefc1fbabfea1b6b7711a6da2289aecdb2 (patch) | |
| tree | 3d00b2cab57dac461a9810a9a77f7bdeefd4fbf1 /src | |
| parent | 39fa32d6359c8292dd91ce1c58da1aa3f8668bd8 (diff) | |
| download | emacs-7303a0aefc1fbabfea1b6b7711a6da2289aecdb2.tar.gz emacs-7303a0aefc1fbabfea1b6b7711a6da2289aecdb2.zip | |
Fix issues related to pixelwise resizing. (Bug#16013) (Bug#16033)
* window.c (Fset_window_new_pixel): Don't choke at negative
argument value (Bug#16033).
* xfns.c (Fx_create_frame): Add another call to change_frame_size
to avoid crash in window_box_height.
* gtkutil.h: Fix external declaration of xg_frame_set_char_size.
* gtkutil.c (xg_frame_set_char_size, style_changed_cb): Fix size
calculation.
* xterm.c (x_set_window_size): Fix size calculation (Bug#16013).
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/gtkutil.c | 24 | ||||
| -rw-r--r-- | src/gtkutil.h | 2 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xfns.c | 14 | ||||
| -rw-r--r-- | src/xterm.c | 12 |
6 files changed, 44 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d26a3798b09..bdd111f5083 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2013-12-03 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.c (Fset_window_new_pixel): Don't choke at negative | ||
| 4 | argument value (Bug#16033). | ||
| 5 | |||
| 6 | * xfns.c (Fx_create_frame): Add another call to change_frame_size | ||
| 7 | to avoid crash in window_box_height. | ||
| 8 | |||
| 9 | * gtkutil.h: Fix external declaration of xg_frame_set_char_size. | ||
| 10 | * gtkutil.c (xg_frame_set_char_size, style_changed_cb): Fix size | ||
| 11 | calculation. | ||
| 12 | * xterm.c (x_set_window_size): Fix size calculation (Bug#16013). | ||
| 13 | |||
| 1 | 2013-12-03 Paul Eggert <eggert@cs.ucla.edu> | 14 | 2013-12-03 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 15 | ||
| 3 | Minor integer overflow fixes. | 16 | Minor integer overflow fixes. |
diff --git a/src/gtkutil.c b/src/gtkutil.c index d30a68a4193..4ecdd18aeb2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -940,26 +940,12 @@ xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight) | |||
| 940 | void | 940 | void |
| 941 | xg_frame_set_char_size (struct frame *f, int width, int height) | 941 | xg_frame_set_char_size (struct frame *f, int width, int height) |
| 942 | { | 942 | { |
| 943 | int pixelwidth; | 943 | int pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); |
| 944 | int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); | 944 | int pixelheight = FRAME_TEXT_TO_PIXEL_HEIGHT (f, height); |
| 945 | 945 | ||
| 946 | if (FRAME_PIXEL_HEIGHT (f) == 0) | 946 | if (FRAME_PIXEL_HEIGHT (f) == 0) |
| 947 | return; | 947 | return; |
| 948 | 948 | ||
| 949 | /* Take into account the size of the scroll bar. Always use the | ||
| 950 | number of columns occupied by the scroll bar here otherwise we | ||
| 951 | might end up with a frame width that is not a multiple of the | ||
| 952 | frame's character width which is bad for vertically split | ||
| 953 | windows. */ | ||
| 954 | f->scroll_bar_actual_width | ||
| 955 | = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); | ||
| 956 | |||
| 957 | compute_fringe_widths (f, 0); | ||
| 958 | |||
| 959 | /* FRAME_TEXT_COLS_TO_PIXEL_WIDTH uses scroll_bar_actual_width, so call it | ||
| 960 | after calculating that value. */ | ||
| 961 | pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width); | ||
| 962 | |||
| 963 | /* Do this before resize, as we don't know yet if we will be resized. */ | 949 | /* Do this before resize, as we don't know yet if we will be resized. */ |
| 964 | xg_clear_under_internal_border (f); | 950 | xg_clear_under_internal_border (f); |
| 965 | 951 | ||
| @@ -987,11 +973,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) | |||
| 987 | x_wait_for_event (f, ConfigureNotify); | 973 | x_wait_for_event (f, ConfigureNotify); |
| 988 | } | 974 | } |
| 989 | else | 975 | else |
| 990 | { | 976 | change_frame_size (f, width, height, 0, 1, 0, 1); |
| 991 | change_frame_size (f, width, height, 0, 1, 0, 1); | ||
| 992 | FRAME_PIXEL_WIDTH (f) = pixelwidth; | ||
| 993 | FRAME_PIXEL_HEIGHT (f) = pixelheight; | ||
| 994 | } | ||
| 995 | } | 977 | } |
| 996 | 978 | ||
| 997 | /* Handle height/width changes (i.e. add/remove/move menu/toolbar). | 979 | /* Handle height/width changes (i.e. add/remove/move menu/toolbar). |
| @@ -1095,7 +1077,7 @@ style_changed_cb (GObject *go, | |||
| 1095 | && FRAME_X_DISPLAY (f) == dpy) | 1077 | && FRAME_X_DISPLAY (f) == dpy) |
| 1096 | { | 1078 | { |
| 1097 | x_set_scroll_bar_default_width (f); | 1079 | x_set_scroll_bar_default_width (f); |
| 1098 | xg_frame_set_char_size (f, FRAME_COLS (f), FRAME_LINES (f)); | 1080 | xg_frame_set_char_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f)); |
| 1099 | } | 1081 | } |
| 1100 | } | 1082 | } |
| 1101 | } | 1083 | } |
diff --git a/src/gtkutil.h b/src/gtkutil.h index 1c26d2aa44b..a2c5bb3ee76 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -139,7 +139,7 @@ extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos); | |||
| 139 | extern void xg_frame_resized (struct frame *f, | 139 | extern void xg_frame_resized (struct frame *f, |
| 140 | int pixelwidth, | 140 | int pixelwidth, |
| 141 | int pixelheight); | 141 | int pixelheight); |
| 142 | extern void xg_frame_set_char_size (struct frame *f, int cols, int rows); | 142 | extern void xg_frame_set_char_size (struct frame *f, int width, int height); |
| 143 | extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc); | 143 | extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc); |
| 144 | 144 | ||
| 145 | extern void xg_display_open (char *display_name, Display **dpy); | 145 | extern void xg_display_open (char *display_name, Display **dpy); |
diff --git a/src/window.c b/src/window.c index e2770410bce..1ef2b4a0e38 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3646,10 +3646,12 @@ Note: This function does not operate on any child windows of WINDOW. */) | |||
| 3646 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) | 3646 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) |
| 3647 | { | 3647 | { |
| 3648 | struct window *w = decode_valid_window (window); | 3648 | struct window *w = decode_valid_window (window); |
| 3649 | EMACS_INT size_min = (max (INT_MIN, MOST_NEGATIVE_FIXNUM) | ||
| 3650 | + (NILP (add) ? 0 : XINT (w->new_pixel))); | ||
| 3649 | EMACS_INT size_max = (min (INT_MAX, MOST_POSITIVE_FIXNUM) | 3651 | EMACS_INT size_max = (min (INT_MAX, MOST_POSITIVE_FIXNUM) |
| 3650 | - (NILP (add) ? 0 : XINT (w->new_pixel))); | 3652 | - (NILP (add) ? 0 : XINT (w->new_pixel))); |
| 3651 | 3653 | ||
| 3652 | CHECK_RANGED_INTEGER (size, 0, size_max); | 3654 | CHECK_RANGED_INTEGER (size, size_min, size_max); |
| 3653 | if (NILP (add)) | 3655 | if (NILP (add)) |
| 3654 | wset_new_pixel (w, size); | 3656 | wset_new_pixel (w, size); |
| 3655 | else | 3657 | else |
diff --git a/src/xfns.c b/src/xfns.c index 2830a79972c..2222eee6097 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3069,6 +3069,20 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3069 | happen. */ | 3069 | happen. */ |
| 3070 | init_frame_faces (f); | 3070 | init_frame_faces (f); |
| 3071 | 3071 | ||
| 3072 | /* PXW: This is a duplicate from below. We have to do it here since | ||
| 3073 | otherwise x_set_tool_bar_lines will work with the character sizes | ||
| 3074 | installed by init_frame_faces while the frame's pixel size is still | ||
| 3075 | calculated from a character size of 1 and we subsequently hit the | ||
| 3076 | eassert (height >= 0) assertion in window_box_height. The | ||
| 3077 | non-pixelwise code apparently worked around this because it had one | ||
| 3078 | frame line vs one toolbar line which left us with a zero root | ||
| 3079 | window height which was obviously wrong as well ... */ | ||
| 3080 | width = FRAME_TEXT_WIDTH (f); | ||
| 3081 | height = FRAME_TEXT_HEIGHT (f); | ||
| 3082 | FRAME_TEXT_HEIGHT (f) = 0; | ||
| 3083 | SET_FRAME_WIDTH (f, 0); | ||
| 3084 | change_frame_size (f, width, height, 1, 0, 0, 1); | ||
| 3085 | |||
| 3072 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't | 3086 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't |
| 3073 | look up the X resources controlling the menu-bar and tool-bar | 3087 | look up the X resources controlling the menu-bar and tool-bar |
| 3074 | here; they are processed specially at startup, and reflected in | 3088 | here; they are processed specially at startup, and reflected in |
diff --git a/src/xterm.c b/src/xterm.c index 35f7facc80e..60db9e107fe 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8610,6 +8610,8 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b | |||
| 8610 | { | 8610 | { |
| 8611 | block_input (); | 8611 | block_input (); |
| 8612 | 8612 | ||
| 8613 | check_frame_size (f, &width, &height, pixelwise); | ||
| 8614 | |||
| 8613 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) | 8615 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 8614 | { | 8616 | { |
| 8615 | int text_width, text_height; | 8617 | int text_width, text_height; |
| @@ -8636,14 +8638,20 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b | |||
| 8636 | change_frame_size (f, text_width, text_height, 0, 1, 0, 1); | 8638 | change_frame_size (f, text_width, text_height, 0, 1, 0, 1); |
| 8637 | } | 8639 | } |
| 8638 | 8640 | ||
| 8641 | if (! pixelwise) | ||
| 8642 | { | ||
| 8643 | width = width * FRAME_COLUMN_WIDTH (f); | ||
| 8644 | height = height * FRAME_LINE_HEIGHT (f); | ||
| 8645 | } | ||
| 8646 | |||
| 8639 | #ifdef USE_GTK | 8647 | #ifdef USE_GTK |
| 8640 | if (FRAME_GTK_WIDGET (f)) | 8648 | if (FRAME_GTK_WIDGET (f)) |
| 8641 | xg_frame_set_char_size (f, width, height); | 8649 | xg_frame_set_char_size (f, width, height); |
| 8642 | else | 8650 | else |
| 8643 | x_set_window_size_1 (f, change_gravity, width, height, pixelwise); | 8651 | x_set_window_size_1 (f, change_gravity, width, height, 1); |
| 8644 | #else /* not USE_GTK */ | 8652 | #else /* not USE_GTK */ |
| 8645 | 8653 | ||
| 8646 | x_set_window_size_1 (f, change_gravity, width, height, pixelwise); | 8654 | x_set_window_size_1 (f, change_gravity, width, height, 1); |
| 8647 | 8655 | ||
| 8648 | #endif /* not USE_GTK */ | 8656 | #endif /* not USE_GTK */ |
| 8649 | 8657 | ||