Commit f403d3c3 authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(EmacsFrameSetCharSize): Take widget's border width

into account.
(set_frame_size): Use FRAME_SCROLL_BAR_COLS
to determine vertical_scroll_bar_extra.
(EmacsFrameSetCharSize): Ditto.
(EmacsFrameDestroy): Remove call to free_frame_faces;
it's also called from x_destroy_window.  Since this function is
called from X, freeing stuff allocated with xmalloc is dangerous
here, anyway.
(widget_store_internal_border): Return void.
(create_frame_gcs): Don't allocate relief GCs.
(setup_frame_gcs): Don't change relief GCs.
(setup_frame_gcs): Initialize relief GC's to line
width 1; remove references to relief_gc_line_width.
(create_frame_gcs): Create GC's for relief drawing.
(setup_frame_gcs): Initialize them.
(EmacsFrameDestroy): Free them.
(set_frame_size): Double trunc_area_extra.
(EmacsFrameSetCharSize): Ditto.
(set_frame_size): Set it.
(EmacsFrameSetCharSize): Ditto.
parent 9ee67259
......@@ -434,15 +434,20 @@ set_frame_size (ew)
Dimension pixel_width, pixel_height;
char shell_position [32];
/* Take into account the size of the scrollbar */
/* Take into account the size of the scrollbar. 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. */
? 0
* FONT_WIDTH (frame->output_data.x->font)));
change_frame_size (frame, h, w, 1, 0);
char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height);
ew->core.width = pixel_width;
......@@ -556,6 +561,8 @@ create_frame_gcs (ew)
= XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)),
(unsigned long)0, (XGCValues *)0);
s->output_data.x->black_relief.gc = 0;
s->output_data.x->white_relief.gc = 0;
static char setup_frame_cursor_bits[] =
......@@ -754,16 +761,15 @@ EmacsFrameDestroy (widget)
if (! s->output_data.x) abort ();
if (! s->output_data.x->normal_gc) abort ();
/* this would be called from Fdelete_frame() but it needs to free some
stuff after the widget has been finalized but before the widget has
been freed. */
free_frame_faces (s);
/* need to be careful that the face-freeing code doesn't free these too */
XFreeGC (XtDisplay (widget), s->output_data.x->normal_gc);
XFreeGC (XtDisplay (widget), s->output_data.x->reverse_gc);
XFreeGC (XtDisplay (widget), s->output_data.x->cursor_gc);
if (s->output_data.x->white_relief.gc)
XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc);
if (s->output_data.x->black_relief.gc)
XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc);
......@@ -903,8 +909,9 @@ EmacsFrameSetCharSize (widget, columns, rows)
Dimension pixel_width, pixel_height, granted_width, granted_height;
XtGeometryResult result;
struct frame *f = ew->emacs_frame.frame;
Arg al[2];
Arg al[10];
int ac = 0;
Dimension border_width;
if (columns < 3) columns = 3; /* no way buddy */
......@@ -912,15 +919,25 @@ EmacsFrameSetCharSize (widget, columns, rows)
? 0
: (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font)));
/* Something is really strange here wrt to the border width:
Apparently, XtNwidth and XtNheight include the border, so we have
to add it here. But the XtNborderWidth set for the widgets has
no similarity to what f->output_data.x->border_width is set to. */
char_to_pixel_size (ew, columns, rows, &pixel_width, &pixel_height);
XtVaGetValues (widget, XtNborderWidth, &border_width, NULL);
pixel_height += 2 * border_width;
pixel_width += 2 * border_width;
/* Manually change the height and width of all our widgets,
adjusting each widget by the same increments. */
if (ew->core.width != pixel_width || ew->core.height != pixel_height)
if (ew->core.width != pixel_width
|| ew->core.height != pixel_height)
int hdelta = pixel_height - ew->core.height;
int wdelta = pixel_width - ew->core.width;
......@@ -967,6 +984,7 @@ EmacsFrameSetCharSize (widget, columns, rows)
we have to make sure to do it here. */
widget_store_internal_border (widget)
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