diff options
| author | Gerd Moellmann | 1999-07-21 21:43:52 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-07-21 21:43:52 +0000 |
| commit | f403d3c379daa17497f8fd6ec8fe9331d14a35f1 (patch) | |
| tree | efe3e1a3efe3c4184fcbfbee8655c83da5e55c3a /src/widget.c | |
| parent | 9ee67259dbef91702b82b938bc9e07891d408d57 (diff) | |
| download | emacs-f403d3c379daa17497f8fd6ec8fe9331d14a35f1.tar.gz emacs-f403d3c379daa17497f8fd6ec8fe9331d14a35f1.zip | |
(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.
Diffstat (limited to 'src/widget.c')
| -rw-r--r-- | src/widget.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/src/widget.c b/src/widget.c index b7d17547c41..1d0cf995177 100644 --- a/src/widget.c +++ b/src/widget.c | |||
| @@ -434,15 +434,20 @@ set_frame_size (ew) | |||
| 434 | Dimension pixel_width, pixel_height; | 434 | Dimension pixel_width, pixel_height; |
| 435 | char shell_position [32]; | 435 | char shell_position [32]; |
| 436 | 436 | ||
| 437 | /* Take into account the size of the scrollbar */ | 437 | /* Take into account the size of the scrollbar. Always use the |
| 438 | number of columns occupied by the scroll bar here otherwise we | ||
| 439 | might end up with a frame width that is not a multiple of the | ||
| 440 | frame's character width which is bad for vertically split | ||
| 441 | windows. */ | ||
| 438 | frame->output_data.x->vertical_scroll_bar_extra | 442 | frame->output_data.x->vertical_scroll_bar_extra |
| 439 | = (!FRAME_HAS_VERTICAL_SCROLL_BARS (frame) | 443 | = (!FRAME_HAS_VERTICAL_SCROLL_BARS (frame) |
| 440 | ? 0 | 444 | ? 0 |
| 441 | : FRAME_SCROLL_BAR_PIXEL_WIDTH (frame) > 0 | ||
| 442 | ? FRAME_SCROLL_BAR_PIXEL_WIDTH (frame) | ||
| 443 | : (FRAME_SCROLL_BAR_COLS (frame) | 445 | : (FRAME_SCROLL_BAR_COLS (frame) |
| 444 | * FONT_WIDTH (frame->output_data.x->font))); | 446 | * FONT_WIDTH (frame->output_data.x->font))); |
| 445 | 447 | ||
| 448 | frame->output_data.x->flags_areas_extra | ||
| 449 | = 2 * FRAME_FLAGS_AREA_WIDTH (frame); | ||
| 450 | |||
| 446 | change_frame_size (frame, h, w, 1, 0); | 451 | change_frame_size (frame, h, w, 1, 0); |
| 447 | char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height); | 452 | char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height); |
| 448 | ew->core.width = pixel_width; | 453 | ew->core.width = pixel_width; |
| @@ -556,6 +561,8 @@ create_frame_gcs (ew) | |||
| 556 | s->output_data.x->cursor_gc | 561 | s->output_data.x->cursor_gc |
| 557 | = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), | 562 | = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), |
| 558 | (unsigned long)0, (XGCValues *)0); | 563 | (unsigned long)0, (XGCValues *)0); |
| 564 | s->output_data.x->black_relief.gc = 0; | ||
| 565 | s->output_data.x->white_relief.gc = 0; | ||
| 559 | } | 566 | } |
| 560 | 567 | ||
| 561 | static char setup_frame_cursor_bits[] = | 568 | static char setup_frame_cursor_bits[] = |
| @@ -754,16 +761,15 @@ EmacsFrameDestroy (widget) | |||
| 754 | if (! s->output_data.x) abort (); | 761 | if (! s->output_data.x) abort (); |
| 755 | if (! s->output_data.x->normal_gc) abort (); | 762 | if (! s->output_data.x->normal_gc) abort (); |
| 756 | 763 | ||
| 757 | /* this would be called from Fdelete_frame() but it needs to free some | ||
| 758 | stuff after the widget has been finalized but before the widget has | ||
| 759 | been freed. */ | ||
| 760 | free_frame_faces (s); | ||
| 761 | |||
| 762 | BLOCK_INPUT; | 764 | BLOCK_INPUT; |
| 763 | /* need to be careful that the face-freeing code doesn't free these too */ | 765 | /* need to be careful that the face-freeing code doesn't free these too */ |
| 764 | XFreeGC (XtDisplay (widget), s->output_data.x->normal_gc); | 766 | XFreeGC (XtDisplay (widget), s->output_data.x->normal_gc); |
| 765 | XFreeGC (XtDisplay (widget), s->output_data.x->reverse_gc); | 767 | XFreeGC (XtDisplay (widget), s->output_data.x->reverse_gc); |
| 766 | XFreeGC (XtDisplay (widget), s->output_data.x->cursor_gc); | 768 | XFreeGC (XtDisplay (widget), s->output_data.x->cursor_gc); |
| 769 | if (s->output_data.x->white_relief.gc) | ||
| 770 | XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); | ||
| 771 | if (s->output_data.x->black_relief.gc) | ||
| 772 | XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); | ||
| 767 | UNBLOCK_INPUT; | 773 | UNBLOCK_INPUT; |
| 768 | } | 774 | } |
| 769 | 775 | ||
| @@ -903,8 +909,9 @@ EmacsFrameSetCharSize (widget, columns, rows) | |||
| 903 | Dimension pixel_width, pixel_height, granted_width, granted_height; | 909 | Dimension pixel_width, pixel_height, granted_width, granted_height; |
| 904 | XtGeometryResult result; | 910 | XtGeometryResult result; |
| 905 | struct frame *f = ew->emacs_frame.frame; | 911 | struct frame *f = ew->emacs_frame.frame; |
| 906 | Arg al[2]; | 912 | Arg al[10]; |
| 907 | int ac = 0; | 913 | int ac = 0; |
| 914 | Dimension border_width; | ||
| 908 | 915 | ||
| 909 | if (columns < 3) columns = 3; /* no way buddy */ | 916 | if (columns < 3) columns = 3; /* no way buddy */ |
| 910 | 917 | ||
| @@ -912,15 +919,25 @@ EmacsFrameSetCharSize (widget, columns, rows) | |||
| 912 | f->output_data.x->vertical_scroll_bar_extra | 919 | f->output_data.x->vertical_scroll_bar_extra |
| 913 | = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) | 920 | = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
| 914 | ? 0 | 921 | ? 0 |
| 915 | : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | ||
| 916 | ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | ||
| 917 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); | 922 | : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); |
| 918 | 923 | ||
| 924 | f->output_data.x->flags_areas_extra | ||
| 925 | = 2 * FRAME_FLAGS_AREA_WIDTH (f); | ||
| 926 | |||
| 927 | /* Something is really strange here wrt to the border width: | ||
| 928 | Apparently, XtNwidth and XtNheight include the border, so we have | ||
| 929 | to add it here. But the XtNborderWidth set for the widgets has | ||
| 930 | no similarity to what f->output_data.x->border_width is set to. */ | ||
| 919 | char_to_pixel_size (ew, columns, rows, &pixel_width, &pixel_height); | 931 | char_to_pixel_size (ew, columns, rows, &pixel_width, &pixel_height); |
| 920 | 932 | ||
| 933 | XtVaGetValues (widget, XtNborderWidth, &border_width, NULL); | ||
| 934 | pixel_height += 2 * border_width; | ||
| 935 | pixel_width += 2 * border_width; | ||
| 936 | |||
| 921 | /* Manually change the height and width of all our widgets, | 937 | /* Manually change the height and width of all our widgets, |
| 922 | adjusting each widget by the same increments. */ | 938 | adjusting each widget by the same increments. */ |
| 923 | if (ew->core.width != pixel_width || ew->core.height != pixel_height) | 939 | if (ew->core.width != pixel_width |
| 940 | || ew->core.height != pixel_height) | ||
| 924 | { | 941 | { |
| 925 | int hdelta = pixel_height - ew->core.height; | 942 | int hdelta = pixel_height - ew->core.height; |
| 926 | int wdelta = pixel_width - ew->core.width; | 943 | int wdelta = pixel_width - ew->core.width; |
| @@ -967,6 +984,7 @@ EmacsFrameSetCharSize (widget, columns, rows) | |||
| 967 | we have to make sure to do it here. */ | 984 | we have to make sure to do it here. */ |
| 968 | SET_FRAME_GARBAGED (f); | 985 | SET_FRAME_GARBAGED (f); |
| 969 | } | 986 | } |
| 987 | |||
| 970 | 988 | ||
| 971 | void | 989 | void |
| 972 | widget_store_internal_border (widget) | 990 | widget_store_internal_border (widget) |