comparison src/xterm.c @ 35581:3a46a6389078

(x_after_update_window_line): Don't clear if frame's internal border width is zero. (x_clear_area): New function. (x_after_update_window_line, x_clear_end_of_line) (x_scroll_bar_create, x_scroll_bar_set_handle) (XTset_vertical_scroll_bar, x_erase_phys_cursor): Use x_clear_area instead of XClearArea.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 25 Jan 2001 20:26:52 +0000
parents 1a9a88614b73
children 02652537e9d2
comparison
equal deleted inserted replaced
35580:ff5045d1af58 35581:3a46a6389078
768 768
769 xassert (w); 769 xassert (w);
770 770
771 if (!desired_row->mode_line_p && !w->pseudo_window_p) 771 if (!desired_row->mode_line_p && !w->pseudo_window_p)
772 { 772 {
773 struct frame *f;
774 int width;
775
773 BLOCK_INPUT; 776 BLOCK_INPUT;
774 x_draw_row_bitmaps (w, desired_row); 777 x_draw_row_bitmaps (w, desired_row);
775 778
776 /* When a window has disappeared, make sure that no rest of 779 /* When a window has disappeared, make sure that no rest of
777 full-width rows stays visible in the internal border. */ 780 full-width rows stays visible in the internal border. */
778 if (windows_or_buffers_changed) 781 if (windows_or_buffers_changed
782 && (f = XFRAME (w->frame),
783 width = FRAME_INTERNAL_BORDER_WIDTH (f),
784 width != 0))
779 { 785 {
780 struct frame *f = XFRAME (w->frame);
781 int width = FRAME_INTERNAL_BORDER_WIDTH (f);
782 int height = desired_row->visible_height; 786 int height = desired_row->visible_height;
783 int x = (window_box_right (w, -1) 787 int x = (window_box_right (w, -1)
784 + FRAME_X_RIGHT_FLAGS_AREA_WIDTH (f)); 788 + FRAME_X_RIGHT_FLAGS_AREA_WIDTH (f));
785 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 789 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
786 790
787 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 791 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
788 x, y, width, height, False); 792 x, y, width, height, False);
789 } 793 }
790 794
791 UNBLOCK_INPUT; 795 UNBLOCK_INPUT;
792 } 796 }
793 } 797 }
5150 { 5154 {
5151 abort (); 5155 abort ();
5152 } 5156 }
5153 5157
5154 5158
5159 /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable.
5160 If they are <= 0, this is probably an error. */
5161
5162 void
5163 x_clear_area (dpy, window, x, y, width, height, exposures)
5164 Display *dpy;
5165 Window window;
5166 int x, y;
5167 int width, height;
5168 int exposures;
5169 {
5170 xassert (width > 0 && height > 0);
5171 XClearArea (dpy, window, x, y, width, height, exposures);
5172 }
5173
5174
5155 /* Erase the current text line from the nominal cursor position 5175 /* Erase the current text line from the nominal cursor position
5156 (inclusive) to pixel column TO_X (exclusive). The idea is that 5176 (inclusive) to pixel column TO_X (exclusive). The idea is that
5157 everything from TO_X onward is already erased. 5177 everything from TO_X onward is already erased.
5158 5178
5159 TO_X is a pixel position relative to updated_area of 5179 TO_X is a pixel position relative to updated_area of
5217 5237
5218 /* Prevent inadvertently clearing to end of the X window. */ 5238 /* Prevent inadvertently clearing to end of the X window. */
5219 if (to_x > from_x && to_y > from_y) 5239 if (to_x > from_x && to_y > from_y)
5220 { 5240 {
5221 BLOCK_INPUT; 5241 BLOCK_INPUT;
5222 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5242 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5223 from_x, from_y, to_x - from_x, to_y - from_y, 5243 from_x, from_y, to_x - from_x, to_y - from_y,
5224 False); 5244 False);
5225 UNBLOCK_INPUT; 5245 UNBLOCK_INPUT;
5226 } 5246 }
5227 } 5247 }
5228 5248
5229 5249
8331 mask = (CWBackPixel | CWEventMask | CWCursor); 8351 mask = (CWBackPixel | CWEventMask | CWCursor);
8332 8352
8333 /* Clear the area of W that will serve as a scroll bar. This is 8353 /* Clear the area of W that will serve as a scroll bar. This is
8334 for the case that a window has been split horizontally. In 8354 for the case that a window has been split horizontally. In
8335 this case, no clear_frame is generated to reduce flickering. */ 8355 this case, no clear_frame is generated to reduce flickering. */
8336 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8356 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8337 left, top, width, 8357 left, top, width,
8338 window_box_height (w), False); 8358 window_box_height (w), False);
8339 8359
8340 window = XCreateWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8360 window = XCreateWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8341 /* Position and size of scroll bar. */ 8361 /* Position and size of scroll bar. */
8342 left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 8362 left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
8343 top, 8363 top,
8460 end += VERTICAL_SCROLL_BAR_MIN_HANDLE; 8480 end += VERTICAL_SCROLL_BAR_MIN_HANDLE;
8461 8481
8462 /* Draw the empty space above the handle. Note that we can't clear 8482 /* Draw the empty space above the handle. Note that we can't clear
8463 zero-height areas; that means "clear to end of window." */ 8483 zero-height areas; that means "clear to end of window." */
8464 if (0 < start) 8484 if (0 < start)
8465 XClearArea (FRAME_X_DISPLAY (f), w, 8485 x_clear_area (FRAME_X_DISPLAY (f), w,
8466 8486 /* x, y, width, height, and exposures. */
8467 /* x, y, width, height, and exposures. */ 8487 VERTICAL_SCROLL_BAR_LEFT_BORDER,
8468 VERTICAL_SCROLL_BAR_LEFT_BORDER, 8488 VERTICAL_SCROLL_BAR_TOP_BORDER,
8469 VERTICAL_SCROLL_BAR_TOP_BORDER, 8489 inside_width, start,
8470 inside_width, start, 8490 False);
8471 False);
8472 8491
8473 /* Change to proper foreground color if one is specified. */ 8492 /* Change to proper foreground color if one is specified. */
8474 if (f->output_data.x->scroll_bar_foreground_pixel != -1) 8493 if (f->output_data.x->scroll_bar_foreground_pixel != -1)
8475 XSetForeground (FRAME_X_DISPLAY (f), gc, 8494 XSetForeground (FRAME_X_DISPLAY (f), gc,
8476 f->output_data.x->scroll_bar_foreground_pixel); 8495 f->output_data.x->scroll_bar_foreground_pixel);
8489 f->output_data.x->foreground_pixel); 8508 f->output_data.x->foreground_pixel);
8490 8509
8491 /* Draw the empty space below the handle. Note that we can't 8510 /* Draw the empty space below the handle. Note that we can't
8492 clear zero-height areas; that means "clear to end of window." */ 8511 clear zero-height areas; that means "clear to end of window." */
8493 if (end < inside_height) 8512 if (end < inside_height)
8494 XClearArea (FRAME_X_DISPLAY (f), w, 8513 x_clear_area (FRAME_X_DISPLAY (f), w,
8495 8514 /* x, y, width, height, and exposures. */
8496 /* x, y, width, height, and exposures. */ 8515 VERTICAL_SCROLL_BAR_LEFT_BORDER,
8497 VERTICAL_SCROLL_BAR_LEFT_BORDER, 8516 VERTICAL_SCROLL_BAR_TOP_BORDER + end,
8498 VERTICAL_SCROLL_BAR_TOP_BORDER + end, 8517 inside_width, inside_height - end,
8499 inside_width, inside_height - end, 8518 False);
8500 False);
8501 8519
8502 } 8520 }
8503 8521
8504 UNBLOCK_INPUT; 8522 UNBLOCK_INPUT;
8505 } 8523 }
8580 8598
8581 /* Does the scroll bar exist yet? */ 8599 /* Does the scroll bar exist yet? */
8582 if (NILP (w->vertical_scroll_bar)) 8600 if (NILP (w->vertical_scroll_bar))
8583 { 8601 {
8584 BLOCK_INPUT; 8602 BLOCK_INPUT;
8585 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8603 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8586 left, top, width, height, False); 8604 left, top, width, height, False);
8587 UNBLOCK_INPUT; 8605 UNBLOCK_INPUT;
8588 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); 8606 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
8589 } 8607 }
8590 else 8608 else
8591 { 8609 {
8607 8625
8608 #ifdef USE_TOOLKIT_SCROLL_BARS 8626 #ifdef USE_TOOLKIT_SCROLL_BARS
8609 8627
8610 /* Since toolkit scroll bars are smaller than the space reserved 8628 /* Since toolkit scroll bars are smaller than the space reserved
8611 for them on the frame, we have to clear "under" them. */ 8629 for them on the frame, we have to clear "under" them. */
8612 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8630 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8613 left, top, width, height, False); 8631 left, top, width, height, False);
8614 8632
8615 /* Move/size the scroll bar widget. */ 8633 /* Move/size the scroll bar widget. */
8616 if (mask) 8634 if (mask)
8617 XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar), 8635 XtConfigureWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar),
8618 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, 8636 sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM,
8626 { 8644 {
8627 /* Clear areas not covered by the scroll bar. This makes sure a 8645 /* Clear areas not covered by the scroll bar. This makes sure a
8628 previous mode line display is cleared after C-x 2 C-x 1, for 8646 previous mode line display is cleared after C-x 2 C-x 1, for
8629 example. Non-toolkit scroll bars are as wide as the area 8647 example. Non-toolkit scroll bars are as wide as the area
8630 reserved for scroll bars - trim at both sides. */ 8648 reserved for scroll bars - trim at both sides. */
8631 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8649 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8632 left, top, VERTICAL_SCROLL_BAR_WIDTH_TRIM, 8650 left, top, VERTICAL_SCROLL_BAR_WIDTH_TRIM,
8633 height, False); 8651 height, False);
8634 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8652 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8635 left + width - VERTICAL_SCROLL_BAR_WIDTH_TRIM, 8653 left + width - VERTICAL_SCROLL_BAR_WIDTH_TRIM,
8636 top, VERTICAL_SCROLL_BAR_WIDTH_TRIM, 8654 top, VERTICAL_SCROLL_BAR_WIDTH_TRIM,
8637 height, False); 8655 height, False);
8638 } 8656 }
8639 8657
8640 /* Move/size the scroll bar window. */ 8658 /* Move/size the scroll bar window. */
8641 if (mask) 8659 if (mask)
8642 { 8660 {
9043 if we just turned off scroll bar mode. 9061 if we just turned off scroll bar mode.
9044 But in that case we should not clear them. */ 9062 But in that case we should not clear them. */
9045 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) 9063 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))
9046 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); 9064 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar);
9047 bar = XSCROLL_BAR (bar)->next) 9065 bar = XSCROLL_BAR (bar)->next)
9048 XClearArea (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)), 9066 XClearArea (FRAME_X_DISPLAY (f),
9067 SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)),
9049 0, 0, 0, 0, True); 9068 0, 0, 0, 0, True);
9050 #endif /* not USE_TOOLKIT_SCROLL_BARS */ 9069 #endif /* not USE_TOOLKIT_SCROLL_BARS */
9051 } 9070 }
9052 9071
9053 /* This processes Expose events from the menu-bar specific X event 9072 /* This processes Expose events from the menu-bar specific X event
10770 if (cursor_glyph == NULL) 10789 if (cursor_glyph == NULL)
10771 goto mark_cursor_off; 10790 goto mark_cursor_off;
10772 10791
10773 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), 10792 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
10774 10793
10775 XClearArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 10794 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
10776 x, 10795 x,
10777 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, 10796 WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height,
10778 cursor_row->y)), 10797 cursor_row->y)),
10779 cursor_glyph->pixel_width, 10798 cursor_glyph->pixel_width,
10780 cursor_row->visible_height, 10799 cursor_row->visible_height,
10781 False); 10800 False);
10782 } 10801 }
10783 10802
10784 /* Erase the cursor by redrawing the character underneath it. */ 10803 /* Erase the cursor by redrawing the character underneath it. */
10785 if (mouse_face_here_p) 10804 if (mouse_face_here_p)
10786 hl = DRAW_MOUSE_FACE; 10805 hl = DRAW_MOUSE_FACE;