diff options
| author | Gerd Moellmann | 2001-08-15 14:31:44 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-08-15 14:31:44 +0000 |
| commit | 82f053ab598f7e2277836adc474ba8fa29ae6c9d (patch) | |
| tree | 166eb3958bcd83df9a6299a3d8c575b46f962e45 /src | |
| parent | ec69d5ec2bb5f7428545d81422a89d87326592b2 (diff) | |
| download | emacs-82f053ab598f7e2277836adc474ba8fa29ae6c9d.tar.gz emacs-82f053ab598f7e2277836adc474ba8fa29ae6c9d.zip | |
(expose_window_tree, expose_window, expose_line): Return
1 when overwriting mouse-face.
(expose_frame): If mouse-face was overwritten, redo it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/xterm.c | 87 |
2 files changed, 70 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 40af7e2f475..1718f06ee99 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2001-08-15 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-08-15 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * xterm.c (expose_window_tree, expose_window, expose_line): Return | ||
| 4 | 1 when overwriting mouse-face. | ||
| 5 | (expose_frame): If mouse-face was overwritten, redo it. | ||
| 6 | |||
| 3 | * xfaces.c (x_update_menu_appearance): Don't call | 7 | * xfaces.c (x_update_menu_appearance): Don't call |
| 4 | set_frame_menubar, let the next redisplay do it. | 8 | set_frame_menubar, let the next redisplay do it. |
| 5 | 9 | ||
diff --git a/src/xterm.c b/src/xterm.c index 577c0ff12b1..b472bde7656 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -460,11 +460,11 @@ static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int)); | |||
| 460 | static int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | 460 | static int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, |
| 461 | XRectangle *)); | 461 | XRectangle *)); |
| 462 | static void expose_frame P_ ((struct frame *, int, int, int, int)); | 462 | static void expose_frame P_ ((struct frame *, int, int, int, int)); |
| 463 | static void expose_window_tree P_ ((struct window *, XRectangle *)); | 463 | static int expose_window_tree P_ ((struct window *, XRectangle *)); |
| 464 | static int expose_window P_ ((struct window *, XRectangle *)); | 464 | static int expose_window P_ ((struct window *, XRectangle *)); |
| 465 | static void expose_area P_ ((struct window *, struct glyph_row *, | 465 | static void expose_area P_ ((struct window *, struct glyph_row *, |
| 466 | XRectangle *, enum glyph_row_area)); | 466 | XRectangle *, enum glyph_row_area)); |
| 467 | static void expose_line P_ ((struct window *, struct glyph_row *, | 467 | static int expose_line P_ ((struct window *, struct glyph_row *, |
| 468 | XRectangle *)); | 468 | XRectangle *)); |
| 469 | static void x_update_cursor_in_window_tree P_ ((struct window *, int)); | 469 | static void x_update_cursor_in_window_tree P_ ((struct window *, int)); |
| 470 | static void x_update_window_cursor P_ ((struct window *, int)); | 470 | static void x_update_window_cursor P_ ((struct window *, int)); |
| @@ -5816,6 +5816,7 @@ expose_frame (f, x, y, w, h) | |||
| 5816 | int x, y, w, h; | 5816 | int x, y, w, h; |
| 5817 | { | 5817 | { |
| 5818 | XRectangle r; | 5818 | XRectangle r; |
| 5819 | int mouse_face_overwritten_p = 0; | ||
| 5819 | 5820 | ||
| 5820 | TRACE ((stderr, "expose_frame ")); | 5821 | TRACE ((stderr, "expose_frame ")); |
| 5821 | 5822 | ||
| @@ -5851,36 +5852,69 @@ expose_frame (f, x, y, w, h) | |||
| 5851 | } | 5852 | } |
| 5852 | 5853 | ||
| 5853 | TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height)); | 5854 | TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height)); |
| 5854 | expose_window_tree (XWINDOW (f->root_window), &r); | 5855 | mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r); |
| 5855 | 5856 | ||
| 5856 | if (WINDOWP (f->tool_bar_window)) | 5857 | if (WINDOWP (f->tool_bar_window)) |
| 5857 | expose_window (XWINDOW (f->tool_bar_window), &r); | 5858 | mouse_face_overwritten_p |
| 5859 | |= expose_window (XWINDOW (f->tool_bar_window), &r); | ||
| 5858 | 5860 | ||
| 5859 | #ifndef USE_X_TOOLKIT | 5861 | #ifndef USE_X_TOOLKIT |
| 5860 | if (WINDOWP (f->menu_bar_window)) | 5862 | if (WINDOWP (f->menu_bar_window)) |
| 5861 | expose_window (XWINDOW (f->menu_bar_window), &r); | 5863 | mouse_face_overwritten_p |
| 5864 | |= expose_window (XWINDOW (f->menu_bar_window), &r); | ||
| 5862 | #endif /* not USE_X_TOOLKIT */ | 5865 | #endif /* not USE_X_TOOLKIT */ |
| 5866 | |||
| 5867 | /* Some window managers support a focus-follows-mouse style with | ||
| 5868 | delayed raising of frames. Imagine a partially obscured frame, | ||
| 5869 | and moving the mouse into partially obscured mouse-face on that | ||
| 5870 | frame. The visible part of the mouse-face will be highlighted, | ||
| 5871 | then the WM raises the obscured frame. With at least one WM, KDE | ||
| 5872 | 2.1, Emacs is not getting any event for the raising of the frame | ||
| 5873 | (even tried with SubstructureRedirectMask), only Expose events. | ||
| 5874 | These expose events will draw text normally, i.e. not | ||
| 5875 | highlighted. Which means we must redo the highlight here. | ||
| 5876 | Subsume it under ``we love X''. --gerd 2001-08-15 */ | ||
| 5877 | if (mouse_face_overwritten_p && !FRAME_GARBAGED_P (f)) | ||
| 5878 | { | ||
| 5879 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 5880 | if (f == dpyinfo->mouse_face_mouse_frame) | ||
| 5881 | { | ||
| 5882 | int x = dpyinfo->mouse_face_mouse_x; | ||
| 5883 | int y = dpyinfo->mouse_face_mouse_y; | ||
| 5884 | clear_mouse_face (dpyinfo); | ||
| 5885 | note_mouse_highlight (f, x, y); | ||
| 5886 | } | ||
| 5887 | } | ||
| 5863 | } | 5888 | } |
| 5864 | 5889 | ||
| 5865 | 5890 | ||
| 5866 | /* Redraw (parts) of all windows in the window tree rooted at W that | 5891 | /* Redraw (parts) of all windows in the window tree rooted at W that |
| 5867 | intersect R. R contains frame pixel coordinates. */ | 5892 | intersect R. R contains frame pixel coordinates. Value is |
| 5893 | non-zero if the exposure overwrites mouse-face. */ | ||
| 5868 | 5894 | ||
| 5869 | static void | 5895 | static int |
| 5870 | expose_window_tree (w, r) | 5896 | expose_window_tree (w, r) |
| 5871 | struct window *w; | 5897 | struct window *w; |
| 5872 | XRectangle *r; | 5898 | XRectangle *r; |
| 5873 | { | 5899 | { |
| 5874 | while (w) | 5900 | struct frame *f = XFRAME (w->frame); |
| 5901 | int mouse_face_overwritten_p = 0; | ||
| 5902 | |||
| 5903 | while (w && !FRAME_GARBAGED_P (f)) | ||
| 5875 | { | 5904 | { |
| 5876 | if (!NILP (w->hchild)) | 5905 | if (!NILP (w->hchild)) |
| 5877 | expose_window_tree (XWINDOW (w->hchild), r); | 5906 | mouse_face_overwritten_p |
| 5907 | |= expose_window_tree (XWINDOW (w->hchild), r); | ||
| 5878 | else if (!NILP (w->vchild)) | 5908 | else if (!NILP (w->vchild)) |
| 5879 | expose_window_tree (XWINDOW (w->vchild), r); | 5909 | mouse_face_overwritten_p |
| 5880 | else if (expose_window (w, r) == 0) | 5910 | |= expose_window_tree (XWINDOW (w->vchild), r); |
| 5881 | break; | 5911 | else |
| 5912 | mouse_face_overwritten_p |= expose_window (w, r); | ||
| 5913 | |||
| 5882 | w = NILP (w->next) ? NULL : XWINDOW (w->next); | 5914 | w = NILP (w->next) ? NULL : XWINDOW (w->next); |
| 5883 | } | 5915 | } |
| 5916 | |||
| 5917 | return mouse_face_overwritten_p; | ||
| 5884 | } | 5918 | } |
| 5885 | 5919 | ||
| 5886 | 5920 | ||
| @@ -5949,9 +5983,10 @@ expose_area (w, row, r, area) | |||
| 5949 | 5983 | ||
| 5950 | 5984 | ||
| 5951 | /* Redraw the parts of the glyph row ROW on window W intersecting | 5985 | /* Redraw the parts of the glyph row ROW on window W intersecting |
| 5952 | rectangle R. R is in window-relative coordinates. */ | 5986 | rectangle R. R is in window-relative coordinates. Value is |
| 5987 | non-zero if mouse-face was overwritten. */ | ||
| 5953 | 5988 | ||
| 5954 | static void | 5989 | static int |
| 5955 | expose_line (w, row, r) | 5990 | expose_line (w, row, r) |
| 5956 | struct window *w; | 5991 | struct window *w; |
| 5957 | struct glyph_row *row; | 5992 | struct glyph_row *row; |
| @@ -5973,6 +6008,8 @@ expose_line (w, row, r) | |||
| 5973 | expose_area (w, row, r, RIGHT_MARGIN_AREA); | 6008 | expose_area (w, row, r, RIGHT_MARGIN_AREA); |
| 5974 | x_draw_row_bitmaps (w, row); | 6009 | x_draw_row_bitmaps (w, row); |
| 5975 | } | 6010 | } |
| 6011 | |||
| 6012 | return row->mouse_face_p; | ||
| 5976 | } | 6013 | } |
| 5977 | 6014 | ||
| 5978 | 6015 | ||
| @@ -6002,7 +6039,8 @@ x_phys_cursor_in_rect_p (w, r) | |||
| 6002 | 6039 | ||
| 6003 | /* Redraw the part of window W intersection rectangle FR. Pixel | 6040 | /* Redraw the part of window W intersection rectangle FR. Pixel |
| 6004 | coordinates in FR are frame-relative. Call this function with | 6041 | coordinates in FR are frame-relative. Call this function with |
| 6005 | input blocked. */ | 6042 | input blocked. Value is non-zero if the exposure overwrites |
| 6043 | mouse-face. */ | ||
| 6006 | 6044 | ||
| 6007 | static int | 6045 | static int |
| 6008 | expose_window (w, fr) | 6046 | expose_window (w, fr) |
| @@ -6011,13 +6049,14 @@ expose_window (w, fr) | |||
| 6011 | { | 6049 | { |
| 6012 | struct frame *f = XFRAME (w->frame); | 6050 | struct frame *f = XFRAME (w->frame); |
| 6013 | XRectangle wr, r; | 6051 | XRectangle wr, r; |
| 6052 | int mouse_face_overwritten_p = 0; | ||
| 6014 | 6053 | ||
| 6015 | /* If window is not yet fully initialized, do nothing. This can | 6054 | /* If window is not yet fully initialized, do nothing. This can |
| 6016 | happen when toolkit scroll bars are used and a window is split. | 6055 | happen when toolkit scroll bars are used and a window is split. |
| 6017 | Reconfiguring the scroll bar will generate an expose for a newly | 6056 | Reconfiguring the scroll bar will generate an expose for a newly |
| 6018 | created window. */ | 6057 | created window. */ |
| 6019 | if (w->current_matrix == NULL) | 6058 | if (w->current_matrix == NULL) |
| 6020 | return 1; | 6059 | return 0; |
| 6021 | 6060 | ||
| 6022 | /* When we're currently updating the window, display and current | 6061 | /* When we're currently updating the window, display and current |
| 6023 | matrix usually don't agree. Arrange for a thorough display | 6062 | matrix usually don't agree. Arrange for a thorough display |
| @@ -6069,8 +6108,11 @@ expose_window (w, fr) | |||
| 6069 | || (y1 > r.y && y1 < r.y + r.height) | 6108 | || (y1 > r.y && y1 < r.y + r.height) |
| 6070 | || (r.y >= y0 && r.y < y1) | 6109 | || (r.y >= y0 && r.y < y1) |
| 6071 | || (r.y + r.height > y0 && r.y + r.height < y1)) | 6110 | || (r.y + r.height > y0 && r.y + r.height < y1)) |
| 6072 | expose_line (w, row, &r); | 6111 | { |
| 6073 | 6112 | if (expose_line (w, row, &r)) | |
| 6113 | mouse_face_overwritten_p = 1; | ||
| 6114 | } | ||
| 6115 | |||
| 6074 | if (y1 >= yb) | 6116 | if (y1 >= yb) |
| 6075 | break; | 6117 | break; |
| 6076 | } | 6118 | } |
| @@ -6080,7 +6122,10 @@ expose_window (w, fr) | |||
| 6080 | && (row = MATRIX_MODE_LINE_ROW (w->current_matrix), | 6122 | && (row = MATRIX_MODE_LINE_ROW (w->current_matrix), |
| 6081 | row->enabled_p) | 6123 | row->enabled_p) |
| 6082 | && row->y < r.y + r.height) | 6124 | && row->y < r.y + r.height) |
| 6083 | expose_line (w, row, &r); | 6125 | { |
| 6126 | if (expose_line (w, row, &r)) | ||
| 6127 | mouse_face_overwritten_p = 1; | ||
| 6128 | } | ||
| 6084 | 6129 | ||
| 6085 | if (!w->pseudo_window_p) | 6130 | if (!w->pseudo_window_p) |
| 6086 | { | 6131 | { |
| @@ -6092,8 +6137,8 @@ expose_window (w, fr) | |||
| 6092 | x_update_window_cursor (w, 1); | 6137 | x_update_window_cursor (w, 1); |
| 6093 | } | 6138 | } |
| 6094 | } | 6139 | } |
| 6095 | 6140 | ||
| 6096 | return 1; | 6141 | return mouse_face_overwritten_p; |
| 6097 | } | 6142 | } |
| 6098 | 6143 | ||
| 6099 | 6144 | ||