Commit 7303a0ae authored by Martin Rudalics's avatar Martin Rudalics

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).
parent 39fa32d6
2013-12-03 Martin Rudalics <rudalics@gmx.at>
* 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).
2013-12-03 Paul Eggert <eggert@cs.ucla.edu>
Minor integer overflow fixes.
......
......@@ -940,26 +940,12 @@ xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight)
void
xg_frame_set_char_size (struct frame *f, int width, int height)
{
int pixelwidth;
int pixelwidth = FRAME_TEXT_TO_PIXEL_WIDTH (f, width);
int pixelheight = 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);
/* Do this before resize, as we don't know yet if we will be resized. */
xg_clear_under_internal_border (f);
......@@ -987,11 +973,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height)
x_wait_for_event (f, ConfigureNotify);
}
else
{
change_frame_size (f, width, height, 0, 1, 0, 1);
FRAME_PIXEL_WIDTH (f) = pixelwidth;
FRAME_PIXEL_HEIGHT (f) = pixelheight;
}
change_frame_size (f, width, height, 0, 1, 0, 1);
}
/* Handle height/width changes (i.e. add/remove/move menu/toolbar).
......@@ -1095,7 +1077,7 @@ style_changed_cb (GObject *go,
&& 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_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f));
}
}
}
......
......@@ -139,7 +139,7 @@ extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos);
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 width, int height);
extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
extern void xg_display_open (char *display_name, Display **dpy);
......
......@@ -3646,10 +3646,12 @@ Note: This function does not operate on any child windows of WINDOW. */)
(Lisp_Object window, Lisp_Object size, Lisp_Object add)
{
struct window *w = decode_valid_window (window);
EMACS_INT size_min = (max (INT_MIN, MOST_NEGATIVE_FIXNUM)
+ (NILP (add) ? 0 : XINT (w->new_pixel)));
EMACS_INT size_max = (min (INT_MAX, MOST_POSITIVE_FIXNUM)
- (NILP (add) ? 0 : XINT (w->new_pixel)));
CHECK_RANGED_INTEGER (size, 0, size_max);
CHECK_RANGED_INTEGER (size, size_min, size_max);
if (NILP (add))
wset_new_pixel (w, size);
else
......
......@@ -3069,6 +3069,20 @@ This function is an internal primitive--use `make-frame' instead. */)
happen. */
init_frame_faces (f);
/* PXW: This is a duplicate from below. We have to do it here since
otherwise x_set_tool_bar_lines will work with the character sizes
installed by init_frame_faces while the frame's pixel size is still
calculated from a character size of 1 and we subsequently hit the
eassert (height >= 0) assertion in window_box_height. The
non-pixelwise code apparently worked around this because it had one
frame line vs one toolbar line which left us with a zero root
window height which was obviously wrong as well ... */
width = FRAME_TEXT_WIDTH (f);
height = FRAME_TEXT_HEIGHT (f);
FRAME_TEXT_HEIGHT (f) = 0;
SET_FRAME_WIDTH (f, 0);
change_frame_size (f, width, height, 1, 0, 0, 1);
/* Set the menu-bar-lines and tool-bar-lines parameters. We don't
look up the X resources controlling the menu-bar and tool-bar
here; they are processed specially at startup, and reflected in
......
......@@ -8610,6 +8610,8 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
{
block_input ();
check_frame_size (f, &width, &height, pixelwise);
if (NILP (tip_frame) || XFRAME (tip_frame) != f)
{
int text_width, text_height;
......@@ -8636,14 +8638,20 @@ x_set_window_size (struct frame *f, int change_gravity, int width, int height, b
change_frame_size (f, text_width, text_height, 0, 1, 0, 1);
}
if (! pixelwise)
{
width = width * FRAME_COLUMN_WIDTH (f);
height = height * FRAME_LINE_HEIGHT (f);
}
#ifdef USE_GTK
if (FRAME_GTK_WIDGET (f))
xg_frame_set_char_size (f, width, height);
else
x_set_window_size_1 (f, change_gravity, width, height, pixelwise);
x_set_window_size_1 (f, change_gravity, width, height, 1);
#else /* not USE_GTK */
x_set_window_size_1 (f, change_gravity, width, height, pixelwise);
x_set_window_size_1 (f, change_gravity, width, height, 1);
#endif /* not USE_GTK */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment