diff options
| author | Gerd Moellmann | 2001-05-02 13:20:15 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-05-02 13:20:15 +0000 |
| commit | a39202f60bf05f852f35f151d4357339c6ee5eaf (patch) | |
| tree | 6930bf2f0da45c50a940619ba7cbd65835bf2821 | |
| parent | 3356df6382f2698326d61d7ccf8bc9c0a4d9c458 (diff) | |
| download | emacs-a39202f60bf05f852f35f151d4357339c6ee5eaf.tar.gz emacs-a39202f60bf05f852f35f151d4357339c6ee5eaf.zip | |
(expose_window): Return int. If W is the window
currently being updated, mark the frame garbaged. Fix
computation of rows intersection the exposed rectangle.
(expose_window_tree): Stop when expose_window returns 0.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xterm.c | 128 |
2 files changed, 73 insertions, 60 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b9675a9e2fe..9171a4eb3f9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2001-05-02 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-05-02 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * xterm.c (expose_window): Return int. If W is the window | ||
| 4 | currently being updated, mark the frame garbaged. Fix | ||
| 5 | computation of rows intersecting the exposed rectangle. | ||
| 6 | (expose_window_tree): Stop when expose_window returns 0. | ||
| 7 | |||
| 3 | * xterm.c (x_draw_stretch_glyph_string): Don't draw background | 8 | * xterm.c (x_draw_stretch_glyph_string): Don't draw background |
| 4 | again if it has already been drawn. | 9 | again if it has already been drawn. |
| 5 | 10 | ||
diff --git a/src/xterm.c b/src/xterm.c index 166ffc48adc..a967774f57a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -459,7 +459,7 @@ static int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | |||
| 459 | XRectangle *)); | 459 | XRectangle *)); |
| 460 | static void expose_frame P_ ((struct frame *, int, int, int, int)); | 460 | static void expose_frame P_ ((struct frame *, int, int, int, int)); |
| 461 | static void expose_window_tree P_ ((struct window *, XRectangle *)); | 461 | static void expose_window_tree P_ ((struct window *, XRectangle *)); |
| 462 | static void expose_window P_ ((struct window *, XRectangle *)); | 462 | static int expose_window P_ ((struct window *, XRectangle *)); |
| 463 | static void expose_area P_ ((struct window *, struct glyph_row *, | 463 | static void expose_area P_ ((struct window *, struct glyph_row *, |
| 464 | XRectangle *, enum glyph_row_area)); | 464 | XRectangle *, enum glyph_row_area)); |
| 465 | static void expose_line P_ ((struct window *, struct glyph_row *, | 465 | static void expose_line P_ ((struct window *, struct glyph_row *, |
| @@ -5864,8 +5864,8 @@ expose_window_tree (w, r) | |||
| 5864 | expose_window_tree (XWINDOW (w->hchild), r); | 5864 | expose_window_tree (XWINDOW (w->hchild), r); |
| 5865 | else if (!NILP (w->vchild)) | 5865 | else if (!NILP (w->vchild)) |
| 5866 | expose_window_tree (XWINDOW (w->vchild), r); | 5866 | expose_window_tree (XWINDOW (w->vchild), r); |
| 5867 | else | 5867 | else if (expose_window (w, r) == 0) |
| 5868 | expose_window (w, r); | 5868 | break; |
| 5869 | w = NILP (w->next) ? NULL : XWINDOW (w->next); | 5869 | w = NILP (w->next) ? NULL : XWINDOW (w->next); |
| 5870 | } | 5870 | } |
| 5871 | } | 5871 | } |
| @@ -5991,88 +5991,96 @@ x_phys_cursor_in_rect_p (w, r) | |||
| 5991 | coordinates in FR are frame-relative. Call this function with | 5991 | coordinates in FR are frame-relative. Call this function with |
| 5992 | input blocked. */ | 5992 | input blocked. */ |
| 5993 | 5993 | ||
| 5994 | static void | 5994 | static int |
| 5995 | expose_window (w, fr) | 5995 | expose_window (w, fr) |
| 5996 | struct window *w; | 5996 | struct window *w; |
| 5997 | XRectangle *fr; | 5997 | XRectangle *fr; |
| 5998 | { | 5998 | { |
| 5999 | struct frame *f = XFRAME (w->frame); | 5999 | struct frame *f = XFRAME (w->frame); |
| 6000 | struct glyph_row *row; | ||
| 6001 | int y, yb, cursor_cleared_p; | ||
| 6002 | XRectangle wr, r; | 6000 | XRectangle wr, r; |
| 6003 | 6001 | ||
| 6004 | /* If window is not yet fully initialized, do nothing. This can | 6002 | /* If window is not yet fully initialized, do nothing. This can |
| 6005 | happen when toolkit scroll bars are used and a window is split. | 6003 | happen when toolkit scroll bars are used and a window is split. |
| 6006 | Reconfiguring the scroll bar will generate an expose for a newly | 6004 | Reconfiguring the scroll bar will generate an expose for a newly |
| 6007 | created window. */ | 6005 | created window. */ |
| 6008 | if (w->current_matrix == NULL || w == updated_window) | 6006 | if (w->current_matrix == NULL) |
| 6009 | return; | 6007 | return 1; |
| 6010 | 6008 | ||
| 6011 | /* Frame-relative pixel rectangle of W. */ | 6009 | /* When we're currently updating the window, display and current |
| 6010 | matrix usually don't agree. Arrange for a thorough display | ||
| 6011 | later. */ | ||
| 6012 | if (w == updated_window) | ||
| 6013 | { | ||
| 6014 | SET_FRAME_GARBAGED (f); | ||
| 6015 | return 0; | ||
| 6016 | } | ||
| 6017 | |||
| 6018 | /* Frame-relative pixel rectangle of W. */ | ||
| 6012 | wr.x = XFASTINT (w->left) * CANON_X_UNIT (f); | 6019 | wr.x = XFASTINT (w->left) * CANON_X_UNIT (f); |
| 6013 | wr.y = XFASTINT (w->top) * CANON_Y_UNIT (f); | 6020 | wr.y = XFASTINT (w->top) * CANON_Y_UNIT (f); |
| 6014 | wr.width = XFASTINT (w->width) * CANON_X_UNIT (f); | 6021 | wr.width = XFASTINT (w->width) * CANON_X_UNIT (f); |
| 6015 | wr.height = XFASTINT (w->height) * CANON_Y_UNIT (f); | 6022 | wr.height = XFASTINT (w->height) * CANON_Y_UNIT (f); |
| 6016 | 6023 | ||
| 6017 | if (!x_intersect_rectangles (fr, &wr, &r)) | 6024 | if (x_intersect_rectangles (fr, &wr, &r)) |
| 6018 | return; | 6025 | { |
| 6019 | 6026 | int yb = window_text_bottom_y (w); | |
| 6020 | yb = window_text_bottom_y (w); | 6027 | struct glyph_row *row; |
| 6028 | int cursor_cleared_p; | ||
| 6021 | 6029 | ||
| 6022 | TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", | 6030 | TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", |
| 6023 | r.x, r.y, r.width, r.height)); | 6031 | r.x, r.y, r.width, r.height)); |
| 6024 | 6032 | ||
| 6025 | /* Convert to window coordinates. */ | 6033 | /* Convert to window coordinates. */ |
| 6026 | r.x = FRAME_TO_WINDOW_PIXEL_X (w, r.x); | 6034 | r.x = FRAME_TO_WINDOW_PIXEL_X (w, r.x); |
| 6027 | r.y = FRAME_TO_WINDOW_PIXEL_Y (w, r.y); | 6035 | r.y = FRAME_TO_WINDOW_PIXEL_Y (w, r.y); |
| 6028 | 6036 | ||
| 6029 | /* Turn off the cursor. */ | 6037 | /* Turn off the cursor. */ |
| 6030 | if (!w->pseudo_window_p | 6038 | if (!w->pseudo_window_p |
| 6031 | && x_phys_cursor_in_rect_p (w, &r)) | 6039 | && x_phys_cursor_in_rect_p (w, &r)) |
| 6032 | { | 6040 | { |
| 6033 | x_clear_cursor (w); | 6041 | x_clear_cursor (w); |
| 6034 | cursor_cleared_p = 1; | 6042 | cursor_cleared_p = 1; |
| 6035 | } | 6043 | } |
| 6036 | else | 6044 | else |
| 6037 | cursor_cleared_p = 0; | 6045 | cursor_cleared_p = 0; |
| 6038 | 6046 | ||
| 6039 | /* Find the first row intersecting the rectangle R. */ | 6047 | /* Find the first row intersecting the rectangle R. */ |
| 6040 | row = w->current_matrix->rows; | 6048 | for (row = w->current_matrix->rows; |
| 6041 | y = 0; | 6049 | row->enabled_p; |
| 6042 | while (row->enabled_p | 6050 | ++row) |
| 6043 | && y < yb | 6051 | { |
| 6044 | && y + row->height < r.y) | 6052 | int y0 = row->y; |
| 6045 | { | 6053 | int y1 = MATRIX_ROW_BOTTOM_Y (row); |
| 6046 | y += row->height; | 6054 | |
| 6047 | ++row; | 6055 | if ((y0 >= r.y && y0 < r.y + r.height) |
| 6048 | } | 6056 | || (y1 > r.y && y1 < r.y + r.height) |
| 6049 | 6057 | || (r.y >= y0 && r.y < y1) | |
| 6050 | /* Display the text in the rectangle, one text line at a time. */ | 6058 | || (r.y + r.height > y0 && r.y + r.height < y1)) |
| 6051 | while (row->enabled_p | 6059 | expose_line (w, row, &r); |
| 6052 | && y < yb | ||
| 6053 | && y < r.y + r.height) | ||
| 6054 | { | ||
| 6055 | expose_line (w, row, &r); | ||
| 6056 | y += row->height; | ||
| 6057 | ++row; | ||
| 6058 | } | ||
| 6059 | 6060 | ||
| 6060 | /* Display the mode line if there is one. */ | 6061 | if (y1 >= yb) |
| 6061 | if (WINDOW_WANTS_MODELINE_P (w) | 6062 | break; |
| 6062 | && (row = MATRIX_MODE_LINE_ROW (w->current_matrix), | 6063 | } |
| 6063 | row->enabled_p) | ||
| 6064 | && row->y < r.y + r.height) | ||
| 6065 | expose_line (w, row, &r); | ||
| 6066 | 6064 | ||
| 6067 | if (!w->pseudo_window_p) | 6065 | /* Display the mode line if there is one. */ |
| 6068 | { | 6066 | if (WINDOW_WANTS_MODELINE_P (w) |
| 6069 | /* Draw border between windows. */ | 6067 | && (row = MATRIX_MODE_LINE_ROW (w->current_matrix), |
| 6070 | x_draw_vertical_border (w); | 6068 | row->enabled_p) |
| 6069 | && row->y < r.y + r.height) | ||
| 6070 | expose_line (w, row, &r); | ||
| 6071 | |||
| 6072 | if (!w->pseudo_window_p) | ||
| 6073 | { | ||
| 6074 | /* Draw border between windows. */ | ||
| 6075 | x_draw_vertical_border (w); | ||
| 6071 | 6076 | ||
| 6072 | /* Turn the cursor on again. */ | 6077 | /* Turn the cursor on again. */ |
| 6073 | if (cursor_cleared_p) | 6078 | if (cursor_cleared_p) |
| 6074 | x_update_window_cursor (w, 1); | 6079 | x_update_window_cursor (w, 1); |
| 6080 | } | ||
| 6075 | } | 6081 | } |
| 6082 | |||
| 6083 | return 1; | ||
| 6076 | } | 6084 | } |
| 6077 | 6085 | ||
| 6078 | 6086 | ||