+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.
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);
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).
&& 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));
}
}
}
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);
(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
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
{
block_input ();
+ check_frame_size (f, &width, &height, pixelwise);
+
if (NILP (tip_frame) || XFRAME (tip_frame) != f)
{
int text_width, text_height;
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 */