aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog23
-rw-r--r--src/dispnew.c19
-rw-r--r--src/frame.h34
-rw-r--r--src/window.c6
-rw-r--r--src/window.h5
-rw-r--r--src/xdisp.c36
-rw-r--r--src/xfns.c11
-rw-r--r--src/xterm.c13
8 files changed, 102 insertions, 45 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 21cb47eeeaa..83e5dbcdaff 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,26 @@
12013-09-11 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Ifdef away frame tool bar code when it is not really used.
4 * frame.h (struct frame) [HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS]:
5 Move tool_bar_window, desired_tool_bar_string, current_tool_bar_string
6 and minimize_tool_bar_window_p under the above.
7 (fset_current_tool_bar_string, fset_desired_tool_bar_string)
8 (fset_tool_bar_window): Likewise.
9 * dispnew.c (clear_current_matrices, clear_desired_matrices)
10 (adjust_frame_glyphs_for_window_redisplay, free_glyphs, update_frame)
11 (change_frame_size_1):
12 * window.c (window_from_coordinates, Frecenter): Adjust users.
13 * window.h (WINDOW_TOOL_BAR_P): Define to zero when frame tool bar
14 code is not really used.
15 * xdisp.c (build_desired_tool_bar_string, display_tool_bar_line)
16 (tool_bar_lines_needed, MAX_FRAME_TOOL_BAR_HEIGHT, tool_bar_item_info)
17 (get_tool_bar_item, handle_tool_bar_click, note_tool_bar_highlight)
18 [!USE_GTK && !HAVE_NS]: Define as such.
19 (Ftool_bar_lines_needed, redisplay_tool_bar, show_mouse_face)
20 (note_mouse_highlight, expose_frame):
21 * xfns.c (x_set_tool_bar_lines):
22 * xterm.c (handle_one_xevent): Adjust users.
23
12013-09-11 Paul Eggert <eggert@cs.ucla.edu> 242013-09-11 Paul Eggert <eggert@cs.ucla.edu>
2 25
3 Fix corruption with multiple emacsclient -t instances (Bug#15222). 26 Fix corruption with multiple emacsclient -t instances (Bug#15222).
diff --git a/src/dispnew.c b/src/dispnew.c
index a42b3da5fc5..2b16e881c80 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -783,9 +783,11 @@ clear_current_matrices (register struct frame *f)
783 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix); 783 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix);
784#endif 784#endif
785 785
786#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
786 /* Clear the matrix of the tool-bar window, if any. */ 787 /* Clear the matrix of the tool-bar window, if any. */
787 if (WINDOWP (f->tool_bar_window)) 788 if (WINDOWP (f->tool_bar_window))
788 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 789 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
790#endif
789 791
790 /* Clear current window matrices. */ 792 /* Clear current window matrices. */
791 eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); 793 eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
@@ -806,8 +808,10 @@ clear_desired_matrices (register struct frame *f)
806 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix); 808 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
807#endif 809#endif
808 810
811#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
809 if (WINDOWP (f->tool_bar_window)) 812 if (WINDOWP (f->tool_bar_window))
810 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix); 813 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix);
814#endif
811 815
812 /* Do it for window matrices. */ 816 /* Do it for window matrices. */
813 eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); 817 eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
@@ -2041,10 +2045,9 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2041 /* Allocate/reallocate window matrices. */ 2045 /* Allocate/reallocate window matrices. */
2042 allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f))); 2046 allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));
2043 2047
2044#ifdef HAVE_X_WINDOWS 2048#if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
2045 /* Allocate/ reallocate matrices of the dummy window used to display 2049 /* Allocate/ reallocate matrices of the dummy window used to display
2046 the menu bar under X when no X toolkit support is available. */ 2050 the menu bar under X when no X toolkit support is available. */
2047#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
2048 { 2051 {
2049 /* Allocate a dummy window if not already done. */ 2052 /* Allocate a dummy window if not already done. */
2050 struct window *w; 2053 struct window *w;
@@ -2068,10 +2071,9 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2068 w->total_cols = FRAME_TOTAL_COLS (f); 2071 w->total_cols = FRAME_TOTAL_COLS (f);
2069 allocate_matrices_for_window_redisplay (w); 2072 allocate_matrices_for_window_redisplay (w);
2070 } 2073 }
2071#endif /* not USE_X_TOOLKIT && not USE_GTK */ 2074#endif
2072#endif /* HAVE_X_WINDOWS */
2073 2075
2074#ifndef USE_GTK 2076#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
2075 { 2077 {
2076 /* Allocate/ reallocate matrices of the tool bar window. If we 2078 /* Allocate/ reallocate matrices of the tool bar window. If we
2077 don't have a tool bar window yet, make one. */ 2079 don't have a tool bar window yet, make one. */
@@ -2145,6 +2147,7 @@ free_glyphs (struct frame *f)
2145 } 2147 }
2146#endif 2148#endif
2147 2149
2150#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
2148 /* Free the tool bar window and its glyph matrices. */ 2151 /* Free the tool bar window and its glyph matrices. */
2149 if (!NILP (f->tool_bar_window)) 2152 if (!NILP (f->tool_bar_window))
2150 { 2153 {
@@ -2154,6 +2157,7 @@ free_glyphs (struct frame *f)
2154 w->desired_matrix = w->current_matrix = NULL; 2157 w->desired_matrix = w->current_matrix = NULL;
2155 fset_tool_bar_window (f, Qnil); 2158 fset_tool_bar_window (f, Qnil);
2156 } 2159 }
2160#endif
2157 2161
2158 /* Release frame glyph matrices. Reset fields to zero in 2162 /* Release frame glyph matrices. Reset fields to zero in
2159 case we are called a second time. */ 2163 case we are called a second time. */
@@ -3036,6 +3040,7 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
3036 update_window (XWINDOW (f->menu_bar_window), 1); 3040 update_window (XWINDOW (f->menu_bar_window), 1);
3037#endif 3041#endif
3038 3042
3043#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
3039 /* Update the tool-bar window, if present. */ 3044 /* Update the tool-bar window, if present. */
3040 if (WINDOWP (f->tool_bar_window)) 3045 if (WINDOWP (f->tool_bar_window))
3041 { 3046 {
@@ -3056,7 +3061,7 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
3056 fset_desired_tool_bar_string (f, tem); 3061 fset_desired_tool_bar_string (f, tem);
3057 } 3062 }
3058 } 3063 }
3059 3064#endif
3060 3065
3061 /* Update windows. */ 3066 /* Update windows. */
3062 paused_p = update_window_tree (root_window, force_p); 3067 paused_p = update_window_tree (root_window, force_p);
@@ -5488,8 +5493,10 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
5488 if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) 5493 if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
5489 FrameCols (FRAME_TTY (f)) = newwidth; 5494 FrameCols (FRAME_TTY (f)) = newwidth;
5490 5495
5496#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
5491 if (WINDOWP (f->tool_bar_window)) 5497 if (WINDOWP (f->tool_bar_window))
5492 XWINDOW (f->tool_bar_window)->total_cols = newwidth; 5498 XWINDOW (f->tool_bar_window)->total_cols = newwidth;
5499#endif
5493 } 5500 }
5494 5501
5495 FRAME_LINES (f) = newheight; 5502 FRAME_LINES (f) = newheight;
diff --git a/src/frame.h b/src/frame.h
index 87e218ee938..3aea0cfa27c 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -145,9 +145,15 @@ struct frame
145 Lisp_Object menu_bar_window; 145 Lisp_Object menu_bar_window;
146#endif 146#endif
147 147
148#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
148 /* A window used to display the tool-bar of a frame. */ 149 /* A window used to display the tool-bar of a frame. */
149 Lisp_Object tool_bar_window; 150 Lisp_Object tool_bar_window;
150 151
152 /* Desired and current contents displayed in that window. */
153 Lisp_Object desired_tool_bar_string;
154 Lisp_Object current_tool_bar_string;
155#endif
156
151 /* Desired and current tool-bar items. */ 157 /* Desired and current tool-bar items. */
152 Lisp_Object tool_bar_items; 158 Lisp_Object tool_bar_items;
153 159
@@ -155,10 +161,6 @@ struct frame
155 tool bar only supports top. */ 161 tool bar only supports top. */
156 Lisp_Object tool_bar_position; 162 Lisp_Object tool_bar_position;
157 163
158 /* Desired and current contents displayed in tool_bar_window. */
159 Lisp_Object desired_tool_bar_string;
160 Lisp_Object current_tool_bar_string;
161
162 /* Beyond here, there should be no more Lisp_Object components. */ 164 /* Beyond here, there should be no more Lisp_Object components. */
163 165
164 /* Cache of realized faces. */ 166 /* Cache of realized faces. */
@@ -197,9 +199,11 @@ struct frame
197 /* Set to non-zero when current redisplay has updated frame. */ 199 /* Set to non-zero when current redisplay has updated frame. */
198 unsigned updated_p : 1; 200 unsigned updated_p : 1;
199 201
202#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
200 /* Set to non-zero to minimize tool-bar height even when 203 /* Set to non-zero to minimize tool-bar height even when
201 auto-resize-tool-bar is set to grow-only. */ 204 auto-resize-tool-bar is set to grow-only. */
202 unsigned minimize_tool_bar_window_p : 1; 205 unsigned minimize_tool_bar_window_p : 1;
206#endif
203 207
204#if defined (USE_GTK) || defined (HAVE_NS) 208#if defined (USE_GTK) || defined (HAVE_NS)
205 /* Nonzero means using a tool bar that comes from the toolkit. */ 209 /* Nonzero means using a tool bar that comes from the toolkit. */
@@ -455,16 +459,6 @@ fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
455 f->condemned_scroll_bars = val; 459 f->condemned_scroll_bars = val;
456} 460}
457FRAME_INLINE void 461FRAME_INLINE void
458fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
459{
460 f->current_tool_bar_string = val;
461}
462FRAME_INLINE void
463fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
464{
465 f->desired_tool_bar_string = val;
466}
467FRAME_INLINE void
468fset_face_alist (struct frame *f, Lisp_Object val) 462fset_face_alist (struct frame *f, Lisp_Object val)
469{ 463{
470 f->face_alist = val; 464 f->face_alist = val;
@@ -536,11 +530,23 @@ fset_tool_bar_position (struct frame *f, Lisp_Object val)
536{ 530{
537 f->tool_bar_position = val; 531 f->tool_bar_position = val;
538} 532}
533#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
539FRAME_INLINE void 534FRAME_INLINE void
540fset_tool_bar_window (struct frame *f, Lisp_Object val) 535fset_tool_bar_window (struct frame *f, Lisp_Object val)
541{ 536{
542 f->tool_bar_window = val; 537 f->tool_bar_window = val;
543} 538}
539FRAME_INLINE void
540fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
541{
542 f->current_tool_bar_string = val;
543}
544FRAME_INLINE void
545fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
546{
547 f->desired_tool_bar_string = val;
548}
549#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
544 550
545#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1) 551#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
546 552
diff --git a/src/window.c b/src/window.c
index 6a52ed7e166..677cb991025 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1379,6 +1379,7 @@ window_from_coordinates (struct frame *f, int x, int y,
1379 cw.window = &window, cw.x = x, cw.y = y; cw.part = part; 1379 cw.window = &window, cw.x = x, cw.y = y; cw.part = part;
1380 foreach_window (f, check_window_containing, &cw); 1380 foreach_window (f, check_window_containing, &cw);
1381 1381
1382#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
1382 /* If not found above, see if it's in the tool bar window, if a tool 1383 /* If not found above, see if it's in the tool bar window, if a tool
1383 bar exists. */ 1384 bar exists. */
1384 if (NILP (window) 1385 if (NILP (window)
@@ -1391,6 +1392,7 @@ window_from_coordinates (struct frame *f, int x, int y,
1391 *part = ON_TEXT; 1392 *part = ON_TEXT;
1392 window = f->tool_bar_window; 1393 window = f->tool_bar_window;
1393 } 1394 }
1395#endif
1394 1396
1395 return window; 1397 return window;
1396} 1398}
@@ -5112,9 +5114,9 @@ and redisplay normally--don't erase and redraw the frame. */)
5112 /* Invalidate pixel data calculated for all compositions. */ 5114 /* Invalidate pixel data calculated for all compositions. */
5113 for (i = 0; i < n_compositions; i++) 5115 for (i = 0; i < n_compositions; i++)
5114 composition_table[i]->font = NULL; 5116 composition_table[i]->font = NULL;
5115 5117#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
5116 WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1; 5118 WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1;
5117 5119#endif
5118 Fredraw_frame (WINDOW_FRAME (w)); 5120 Fredraw_frame (WINDOW_FRAME (w));
5119 SET_FRAME_GARBAGED (WINDOW_XFRAME (w)); 5121 SET_FRAME_GARBAGED (WINDOW_XFRAME (w));
5120 } 5122 }
diff --git a/src/window.h b/src/window.h
index f5ae81149b3..a419bf7e7f0 100644
--- a/src/window.h
+++ b/src/window.h
@@ -525,10 +525,13 @@ wset_next_buffers (struct window *w, Lisp_Object val)
525#endif 525#endif
526 526
527/* 1 if W is a tool bar window. */ 527/* 1 if W is a tool bar window. */
528 528#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
529#define WINDOW_TOOL_BAR_P(W) \ 529#define WINDOW_TOOL_BAR_P(W) \
530 (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \ 530 (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
531 && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window)) 531 && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
532#else
533#define WINDOW_TOOL_BAR_P(W) (0)
534#endif
532 535
533/* Return the frame y-position at which window W starts. 536/* Return the frame y-position at which window W starts.
534 This includes a header line, if any. */ 537 This includes a header line, if any. */
diff --git a/src/xdisp.c b/src/xdisp.c
index df3fa366803..484f95164fb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -913,11 +913,8 @@ static int in_ellipses_for_invisible_text_p (struct display_pos *,
913#ifdef HAVE_WINDOW_SYSTEM 913#ifdef HAVE_WINDOW_SYSTEM
914 914
915static void x_consider_frame_title (Lisp_Object); 915static void x_consider_frame_title (Lisp_Object);
916static int tool_bar_lines_needed (struct frame *, int *);
917static void update_tool_bar (struct frame *, int); 916static void update_tool_bar (struct frame *, int);
918static void build_desired_tool_bar_string (struct frame *f);
919static int redisplay_tool_bar (struct frame *); 917static int redisplay_tool_bar (struct frame *);
920static void display_tool_bar_line (struct it *, int);
921static void notice_overwritten_cursor (struct window *, 918static void notice_overwritten_cursor (struct window *,
922 enum glyph_row_area, 919 enum glyph_row_area,
923 int, int, int, int); 920 int, int, int, int);
@@ -11566,6 +11563,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11566 } 11563 }
11567} 11564}
11568 11565
11566#if ! defined (USE_GTK) && ! defined (HAVE_NS)
11569 11567
11570/* Set F->desired_tool_bar_string to a Lisp string representing frame 11568/* Set F->desired_tool_bar_string to a Lisp string representing frame
11571 F's desired tool-bar contents. F->tool_bar_items must have 11569 F's desired tool-bar contents. F->tool_bar_items must have
@@ -11903,6 +11901,7 @@ tool_bar_lines_needed (struct frame *f, int *n_rows)
11903 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); 11901 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
11904} 11902}
11905 11903
11904#endif /* !USE_GTK && !HAVE_NS */
11906 11905
11907DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, 11906DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
11908 0, 1, 0, 11907 0, 1, 0,
@@ -11910,9 +11909,10 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
11910If FRAME is nil or omitted, use the selected frame. */) 11909If FRAME is nil or omitted, use the selected frame. */)
11911 (Lisp_Object frame) 11910 (Lisp_Object frame)
11912{ 11911{
11912 int nlines = 0;
11913#if ! defined (USE_GTK) && ! defined (HAVE_NS)
11913 struct frame *f = decode_any_frame (frame); 11914 struct frame *f = decode_any_frame (frame);
11914 struct window *w; 11915 struct window *w;
11915 int nlines = 0;
11916 11916
11917 if (WINDOWP (f->tool_bar_window) 11917 if (WINDOWP (f->tool_bar_window)
11918 && (w = XWINDOW (f->tool_bar_window), 11918 && (w = XWINDOW (f->tool_bar_window),
@@ -11925,7 +11925,7 @@ If FRAME is nil or omitted, use the selected frame. */)
11925 nlines = tool_bar_lines_needed (f, NULL); 11925 nlines = tool_bar_lines_needed (f, NULL);
11926 } 11926 }
11927 } 11927 }
11928 11928#endif
11929 return make_number (nlines); 11929 return make_number (nlines);
11930} 11930}
11931 11931
@@ -11936,15 +11936,17 @@ If FRAME is nil or omitted, use the selected frame. */)
11936static int 11936static int
11937redisplay_tool_bar (struct frame *f) 11937redisplay_tool_bar (struct frame *f)
11938{ 11938{
11939 struct window *w;
11940 struct it it;
11941 struct glyph_row *row;
11942
11943#if defined (USE_GTK) || defined (HAVE_NS) 11939#if defined (USE_GTK) || defined (HAVE_NS)
11940
11944 if (FRAME_EXTERNAL_TOOL_BAR (f)) 11941 if (FRAME_EXTERNAL_TOOL_BAR (f))
11945 update_frame_tool_bar (f); 11942 update_frame_tool_bar (f);
11946 return 0; 11943 return 0;
11947#endif 11944
11945#else /* !USE_GTK && !HAVE_NS */
11946
11947 struct window *w;
11948 struct it it;
11949 struct glyph_row *row;
11948 11950
11949 /* If frame hasn't a tool-bar window or if it is zero-height, don't 11951 /* If frame hasn't a tool-bar window or if it is zero-height, don't
11950 do anything. This means you must start with tool-bar-lines 11952 do anything. This means you must start with tool-bar-lines
@@ -12100,8 +12102,11 @@ redisplay_tool_bar (struct frame *f)
12100 12102
12101 f->minimize_tool_bar_window_p = 0; 12103 f->minimize_tool_bar_window_p = 0;
12102 return 0; 12104 return 0;
12105
12106#endif /* USE_GTK || HAVE_NS */
12103} 12107}
12104 12108
12109#if ! defined (USE_GTK) && ! defined (HAVE_NS)
12105 12110
12106/* Get information about the tool-bar item which is displayed in GLYPH 12111/* Get information about the tool-bar item which is displayed in GLYPH
12107 on frame F. Return in *PROP_IDX the index where tool-bar item 12112 on frame F. Return in *PROP_IDX the index where tool-bar item
@@ -12345,6 +12350,8 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
12345 help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION); 12350 help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION);
12346} 12351}
12347 12352
12353#endif /* !USE_GTK && !HAVE_NS */
12354
12348#endif /* HAVE_WINDOW_SYSTEM */ 12355#endif /* HAVE_WINDOW_SYSTEM */
12349 12356
12350 12357
@@ -26691,10 +26698,13 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
26691 /* Change the mouse cursor. */ 26698 /* Change the mouse cursor. */
26692 if (FRAME_WINDOW_P (f)) 26699 if (FRAME_WINDOW_P (f))
26693 { 26700 {
26701#if ! defined (USE_GTK) && ! defined (HAVE_NS)
26694 if (draw == DRAW_NORMAL_TEXT 26702 if (draw == DRAW_NORMAL_TEXT
26695 && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) 26703 && !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
26696 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); 26704 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
26697 else if (draw == DRAW_MOUSE_FACE) 26705 else
26706#endif
26707 if (draw == DRAW_MOUSE_FACE)
26698 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); 26708 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
26699 else 26709 else
26700 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); 26710 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
@@ -28032,7 +28042,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
28032 w = XWINDOW (window); 28042 w = XWINDOW (window);
28033 frame_to_window_pixel_xy (w, &x, &y); 28043 frame_to_window_pixel_xy (w, &x, &y);
28034 28044
28035#ifdef HAVE_WINDOW_SYSTEM 28045#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
28036 /* Handle tool-bar window differently since it doesn't display a 28046 /* Handle tool-bar window differently since it doesn't display a
28037 buffer. */ 28047 buffer. */
28038 if (EQ (window, f->tool_bar_window)) 28048 if (EQ (window, f->tool_bar_window))
@@ -28945,9 +28955,11 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
28945 TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height)); 28955 TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height));
28946 mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r); 28956 mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r);
28947 28957
28958#if ! defined (USE_GTK) && ! defined (HAVE_NS)
28948 if (WINDOWP (f->tool_bar_window)) 28959 if (WINDOWP (f->tool_bar_window))
28949 mouse_face_overwritten_p 28960 mouse_face_overwritten_p
28950 |= expose_window (XWINDOW (f->tool_bar_window), &r); 28961 |= expose_window (XWINDOW (f->tool_bar_window), &r);
28962#endif
28951 28963
28952#ifdef HAVE_X_WINDOWS 28964#ifdef HAVE_X_WINDOWS
28953#ifndef MSDOS 28965#ifndef MSDOS
diff --git a/src/xfns.c b/src/xfns.c
index 4e8442dd3a3..1626e2177cb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1215,8 +1215,11 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1215void 1215void
1216x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) 1216x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1217{ 1217{
1218 int delta, nlines, root_height; 1218 int nlines;
1219#if ! defined (USE_GTK)
1220 int delta, root_height;
1219 Lisp_Object root_window; 1221 Lisp_Object root_window;
1222#endif
1220 1223
1221 /* Treat tool bars like menu bars. */ 1224 /* Treat tool bars like menu bars. */
1222 if (FRAME_MINIBUF_ONLY_P (f)) 1225 if (FRAME_MINIBUF_ONLY_P (f))
@@ -1229,6 +1232,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1229 nlines = 0; 1232 nlines = 0;
1230 1233
1231#ifdef USE_GTK 1234#ifdef USE_GTK
1235
1232 FRAME_TOOL_BAR_LINES (f) = 0; 1236 FRAME_TOOL_BAR_LINES (f) = 0;
1233 if (nlines) 1237 if (nlines)
1234 { 1238 {
@@ -1245,8 +1249,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1245 FRAME_EXTERNAL_TOOL_BAR (f) = 0; 1249 FRAME_EXTERNAL_TOOL_BAR (f) = 0;
1246 } 1250 }
1247 1251
1248 return; 1252#else /* !USE_GTK */
1249#endif
1250 1253
1251 /* Make sure we redisplay all windows in this frame. */ 1254 /* Make sure we redisplay all windows in this frame. */
1252 ++windows_or_buffers_changed; 1255 ++windows_or_buffers_changed;
@@ -1301,7 +1304,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1301 } 1304 }
1302 1305
1303 run_window_configuration_change_hook (f); 1306 run_window_configuration_change_hook (f);
1304 1307#endif /* USE_GTK */
1305} 1308}
1306 1309
1307 1310
diff --git a/src/xterm.c b/src/xterm.c
index d12173297e8..22671a5f168 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6225,6 +6225,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6225 6225
6226 f = x_any_window_to_frame (dpyinfo, event.xkey.window); 6226 f = x_any_window_to_frame (dpyinfo, event.xkey.window);
6227 6227
6228#if ! defined (USE_GTK)
6228 /* If mouse-highlight is an integer, input clears out 6229 /* If mouse-highlight is an integer, input clears out
6229 mouse highlighting. */ 6230 mouse highlighting. */
6230 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 6231 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
@@ -6234,6 +6235,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6234 clear_mouse_face (hlinfo); 6235 clear_mouse_face (hlinfo);
6235 hlinfo->mouse_face_hidden = 1; 6236 hlinfo->mouse_face_hidden = 1;
6236 } 6237 }
6238#endif
6237 6239
6238#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS 6240#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
6239 if (f == 0) 6241 if (f == 0)
@@ -6773,6 +6775,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6773#endif 6775#endif
6774 if (f) 6776 if (f)
6775 { 6777 {
6778#if ! defined (USE_GTK)
6776 /* Is this in the tool-bar? */ 6779 /* Is this in the tool-bar? */
6777 if (WINDOWP (f->tool_bar_window) 6780 if (WINDOWP (f->tool_bar_window)
6778 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) 6781 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
@@ -6785,13 +6788,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6785 tool_bar_p = EQ (window, f->tool_bar_window); 6788 tool_bar_p = EQ (window, f->tool_bar_window);
6786 6789
6787 if (tool_bar_p && event.xbutton.button < 4) 6790 if (tool_bar_p && event.xbutton.button < 4)
6788 { 6791 handle_tool_bar_click
6789 handle_tool_bar_click (f, x, y, 6792 (f, x, y, event.xbutton.type == ButtonPress,
6790 event.xbutton.type == ButtonPress, 6793 x_x_to_emacs_modifiers (dpyinfo, event.xbutton.state));
6791 x_x_to_emacs_modifiers (dpyinfo,
6792 event.xbutton.state));
6793 }
6794 } 6794 }
6795#endif /* !USE_GTK */
6795 6796
6796 if (!tool_bar_p) 6797 if (!tool_bar_p)
6797#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6798#if defined (USE_X_TOOLKIT) || defined (USE_GTK)