Commit f403d3c3 authored by Gerd Moellmann's avatar Gerd Moellmann

(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) ...@@ -434,15 +434,20 @@ set_frame_size (ew)
Dimension pixel_width, pixel_height; Dimension pixel_width, pixel_height;
char shell_position [32]; 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. */
frame->output_data.x->vertical_scroll_bar_extra frame->output_data.x->vertical_scroll_bar_extra
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (frame) = (!FRAME_HAS_VERTICAL_SCROLL_BARS (frame)
? 0 ? 0
: FRAME_SCROLL_BAR_PIXEL_WIDTH (frame) > 0
? FRAME_SCROLL_BAR_PIXEL_WIDTH (frame)
: (FRAME_SCROLL_BAR_COLS (frame) : (FRAME_SCROLL_BAR_COLS (frame)
* FONT_WIDTH (frame->output_data.x->font))); * FONT_WIDTH (frame->output_data.x->font)));
frame->output_data.x->flags_areas_extra
= 2 * FRAME_FLAGS_AREA_WIDTH (frame);
change_frame_size (frame, h, w, 1, 0); change_frame_size (frame, h, w, 1, 0);
char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height); char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height);
ew->core.width = pixel_width; ew->core.width = pixel_width;
...@@ -556,6 +561,8 @@ create_frame_gcs (ew) ...@@ -556,6 +561,8 @@ create_frame_gcs (ew)
s->output_data.x->cursor_gc s->output_data.x->cursor_gc
= XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)),
(unsigned long)0, (XGCValues *)0); (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[] = static char setup_frame_cursor_bits[] =
...@@ -754,16 +761,15 @@ EmacsFrameDestroy (widget) ...@@ -754,16 +761,15 @@ EmacsFrameDestroy (widget)
if (! s->output_data.x) abort (); if (! s->output_data.x) abort ();
if (! s->output_data.x->normal_gc) 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);
BLOCK_INPUT; BLOCK_INPUT;
/* need to be careful that the face-freeing code doesn't free these too */ /* 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->normal_gc);
XFreeGC (XtDisplay (widget), s->output_data.x->reverse_gc); XFreeGC (XtDisplay (widget), s->output_data.x->reverse_gc);
XFreeGC (XtDisplay (widget), s->output_data.x->cursor_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);
UNBLOCK_INPUT; UNBLOCK_INPUT;
} }
...@@ -903,8 +909,9 @@ EmacsFrameSetCharSize (widget, columns, rows) ...@@ -903,8 +909,9 @@ EmacsFrameSetCharSize (widget, columns, rows)
Dimension pixel_width, pixel_height, granted_width, granted_height; Dimension pixel_width, pixel_height, granted_width, granted_height;
XtGeometryResult result; XtGeometryResult result;
struct frame *f = ew->emacs_frame.frame; struct frame *f = ew->emacs_frame.frame;
Arg al[2]; Arg al[10];
int ac = 0; int ac = 0;
Dimension border_width;
if (columns < 3) columns = 3; /* no way buddy */ if (columns < 3) columns = 3; /* no way buddy */
...@@ -912,15 +919,25 @@ EmacsFrameSetCharSize (widget, columns, rows) ...@@ -912,15 +919,25 @@ EmacsFrameSetCharSize (widget, columns, rows)
f->output_data.x->vertical_scroll_bar_extra f->output_data.x->vertical_scroll_bar_extra
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
? 0 ? 0
: FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
: (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font)));
f->output_data.x->flags_areas_extra
= 2 * FRAME_FLAGS_AREA_WIDTH (f);
/* 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); 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, /* Manually change the height and width of all our widgets,
adjusting each widget by the same increments. */ 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 hdelta = pixel_height - ew->core.height;
int wdelta = pixel_width - ew->core.width; int wdelta = pixel_width - ew->core.width;
...@@ -967,6 +984,7 @@ EmacsFrameSetCharSize (widget, columns, rows) ...@@ -967,6 +984,7 @@ EmacsFrameSetCharSize (widget, columns, rows)
we have to make sure to do it here. */ we have to make sure to do it here. */
SET_FRAME_GARBAGED (f); SET_FRAME_GARBAGED (f);
} }
void void
widget_store_internal_border (widget) 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