+2013-09-11 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Ifdef away frame tool bar code when it is not really used.
+ * frame.h (struct frame) [HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS]:
+ Move tool_bar_window, desired_tool_bar_string, current_tool_bar_string
+ and minimize_tool_bar_window_p under the above.
+ (fset_current_tool_bar_string, fset_desired_tool_bar_string)
+ (fset_tool_bar_window): Likewise.
+ * dispnew.c (clear_current_matrices, clear_desired_matrices)
+ (adjust_frame_glyphs_for_window_redisplay, free_glyphs, update_frame)
+ (change_frame_size_1):
+ * window.c (window_from_coordinates, Frecenter): Adjust users.
+ * window.h (WINDOW_TOOL_BAR_P): Define to zero when frame tool bar
+ code is not really used.
+ * xdisp.c (build_desired_tool_bar_string, display_tool_bar_line)
+ (tool_bar_lines_needed, MAX_FRAME_TOOL_BAR_HEIGHT, tool_bar_item_info)
+ (get_tool_bar_item, handle_tool_bar_click, note_tool_bar_highlight)
+ [!USE_GTK && !HAVE_NS]: Define as such.
+ (Ftool_bar_lines_needed, redisplay_tool_bar, show_mouse_face)
+ (note_mouse_highlight, expose_frame):
+ * xfns.c (x_set_tool_bar_lines):
+ * xterm.c (handle_one_xevent): Adjust users.
+
2013-09-11 Paul Eggert <eggert@cs.ucla.edu>
Fix corruption with multiple emacsclient -t instances (Bug#15222).
clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix);
#endif
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Clear the matrix of the tool-bar window, if any. */
if (WINDOWP (f->tool_bar_window))
clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
+#endif
/* Clear current window matrices. */
eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
#endif
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
if (WINDOWP (f->tool_bar_window))
clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix);
+#endif
/* Do it for window matrices. */
eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
/* Allocate/reallocate window matrices. */
allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));
-#ifdef HAVE_X_WINDOWS
+#if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
/* Allocate/ reallocate matrices of the dummy window used to display
the menu bar under X when no X toolkit support is available. */
-#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
{
/* Allocate a dummy window if not already done. */
struct window *w;
w->total_cols = FRAME_TOTAL_COLS (f);
allocate_matrices_for_window_redisplay (w);
}
-#endif /* not USE_X_TOOLKIT && not USE_GTK */
-#endif /* HAVE_X_WINDOWS */
+#endif
-#ifndef USE_GTK
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
{
/* Allocate/ reallocate matrices of the tool bar window. If we
don't have a tool bar window yet, make one. */
}
#endif
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Free the tool bar window and its glyph matrices. */
if (!NILP (f->tool_bar_window))
{
w->desired_matrix = w->current_matrix = NULL;
fset_tool_bar_window (f, Qnil);
}
+#endif
/* Release frame glyph matrices. Reset fields to zero in
case we are called a second time. */
update_window (XWINDOW (f->menu_bar_window), 1);
#endif
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Update the tool-bar window, if present. */
if (WINDOWP (f->tool_bar_window))
{
fset_desired_tool_bar_string (f, tem);
}
}
-
+#endif
/* Update windows. */
paused_p = update_window_tree (root_window, force_p);
if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
FrameCols (FRAME_TTY (f)) = newwidth;
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
if (WINDOWP (f->tool_bar_window))
XWINDOW (f->tool_bar_window)->total_cols = newwidth;
+#endif
}
FRAME_LINES (f) = newheight;
Lisp_Object menu_bar_window;
#endif
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* A window used to display the tool-bar of a frame. */
Lisp_Object tool_bar_window;
+ /* Desired and current contents displayed in that window. */
+ Lisp_Object desired_tool_bar_string;
+ Lisp_Object current_tool_bar_string;
+#endif
+
/* Desired and current tool-bar items. */
Lisp_Object tool_bar_items;
tool bar only supports top. */
Lisp_Object tool_bar_position;
- /* Desired and current contents displayed in tool_bar_window. */
- Lisp_Object desired_tool_bar_string;
- Lisp_Object current_tool_bar_string;
-
/* Beyond here, there should be no more Lisp_Object components. */
/* Cache of realized faces. */
/* Set to non-zero when current redisplay has updated frame. */
unsigned updated_p : 1;
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Set to non-zero to minimize tool-bar height even when
auto-resize-tool-bar is set to grow-only. */
unsigned minimize_tool_bar_window_p : 1;
+#endif
#if defined (USE_GTK) || defined (HAVE_NS)
/* Nonzero means using a tool bar that comes from the toolkit. */
f->condemned_scroll_bars = val;
}
FRAME_INLINE void
-fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
-{
- f->current_tool_bar_string = val;
-}
-FRAME_INLINE void
-fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
-{
- f->desired_tool_bar_string = val;
-}
-FRAME_INLINE void
fset_face_alist (struct frame *f, Lisp_Object val)
{
f->face_alist = val;
{
f->tool_bar_position = val;
}
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
FRAME_INLINE void
fset_tool_bar_window (struct frame *f, Lisp_Object val)
{
f->tool_bar_window = val;
}
+FRAME_INLINE void
+fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
+{
+ f->current_tool_bar_string = val;
+}
+FRAME_INLINE void
+fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
+{
+ f->desired_tool_bar_string = val;
+}
+#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */
#define NUMVAL(X) ((INTEGERP (X) || FLOATP (X)) ? XFLOATINT (X) : -1)
cw.window = &window, cw.x = x, cw.y = y; cw.part = part;
foreach_window (f, check_window_containing, &cw);
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* If not found above, see if it's in the tool bar window, if a tool
bar exists. */
if (NILP (window)
*part = ON_TEXT;
window = f->tool_bar_window;
}
+#endif
return window;
}
/* Invalidate pixel data calculated for all compositions. */
for (i = 0; i < n_compositions; i++)
composition_table[i]->font = NULL;
-
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1;
-
+#endif
Fredraw_frame (WINDOW_FRAME (w));
SET_FRAME_GARBAGED (WINDOW_XFRAME (w));
}
#endif
/* 1 if W is a tool bar window. */
-
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
#define WINDOW_TOOL_BAR_P(W) \
(WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
&& (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
+#else
+#define WINDOW_TOOL_BAR_P(W) (0)
+#endif
/* Return the frame y-position at which window W starts.
This includes a header line, if any. */
#ifdef HAVE_WINDOW_SYSTEM
static void x_consider_frame_title (Lisp_Object);
-static int tool_bar_lines_needed (struct frame *, int *);
static void update_tool_bar (struct frame *, int);
-static void build_desired_tool_bar_string (struct frame *f);
static int redisplay_tool_bar (struct frame *);
-static void display_tool_bar_line (struct it *, int);
static void notice_overwritten_cursor (struct window *,
enum glyph_row_area,
int, int, int, int);
}
}
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Set F->desired_tool_bar_string to a Lisp string representing frame
F's desired tool-bar contents. F->tool_bar_items must have
return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
}
+#endif /* !USE_GTK && !HAVE_NS */
DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
0, 1, 0,
If FRAME is nil or omitted, use the selected frame. */)
(Lisp_Object frame)
{
+ int nlines = 0;
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
struct frame *f = decode_any_frame (frame);
struct window *w;
- int nlines = 0;
if (WINDOWP (f->tool_bar_window)
&& (w = XWINDOW (f->tool_bar_window),
nlines = tool_bar_lines_needed (f, NULL);
}
}
-
+#endif
return make_number (nlines);
}
static int
redisplay_tool_bar (struct frame *f)
{
- struct window *w;
- struct it it;
- struct glyph_row *row;
-
#if defined (USE_GTK) || defined (HAVE_NS)
+
if (FRAME_EXTERNAL_TOOL_BAR (f))
update_frame_tool_bar (f);
return 0;
-#endif
+
+#else /* !USE_GTK && !HAVE_NS */
+
+ struct window *w;
+ struct it it;
+ struct glyph_row *row;
/* If frame hasn't a tool-bar window or if it is zero-height, don't
do anything. This means you must start with tool-bar-lines
f->minimize_tool_bar_window_p = 0;
return 0;
+
+#endif /* USE_GTK || HAVE_NS */
}
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Get information about the tool-bar item which is displayed in GLYPH
on frame F. Return in *PROP_IDX the index where tool-bar item
help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION);
}
+#endif /* !USE_GTK && !HAVE_NS */
+
#endif /* HAVE_WINDOW_SYSTEM */
/* Change the mouse cursor. */
if (FRAME_WINDOW_P (f))
{
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
if (draw == DRAW_NORMAL_TEXT
&& !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
- else if (draw == DRAW_MOUSE_FACE)
+ else
+#endif
+ if (draw == DRAW_MOUSE_FACE)
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor);
else
FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor);
w = XWINDOW (window);
frame_to_window_pixel_xy (w, &x, &y);
-#ifdef HAVE_WINDOW_SYSTEM
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* Handle tool-bar window differently since it doesn't display a
buffer. */
if (EQ (window, f->tool_bar_window))
TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height));
mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r);
+#if ! defined (USE_GTK) && ! defined (HAVE_NS)
if (WINDOWP (f->tool_bar_window))
mouse_face_overwritten_p
|= expose_window (XWINDOW (f->tool_bar_window), &r);
+#endif
#ifdef HAVE_X_WINDOWS
#ifndef MSDOS
void
x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
- int delta, nlines, root_height;
+ int nlines;
+#if ! defined (USE_GTK)
+ int delta, root_height;
Lisp_Object root_window;
+#endif
/* Treat tool bars like menu bars. */
if (FRAME_MINIBUF_ONLY_P (f))
nlines = 0;
#ifdef USE_GTK
+
FRAME_TOOL_BAR_LINES (f) = 0;
if (nlines)
{
FRAME_EXTERNAL_TOOL_BAR (f) = 0;
}
- return;
-#endif
+#else /* !USE_GTK */
/* Make sure we redisplay all windows in this frame. */
++windows_or_buffers_changed;
}
run_window_configuration_change_hook (f);
-
+#endif /* USE_GTK */
}
f = x_any_window_to_frame (dpyinfo, event.xkey.window);
+#if ! defined (USE_GTK)
/* If mouse-highlight is an integer, input clears out
mouse highlighting. */
if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
clear_mouse_face (hlinfo);
hlinfo->mouse_face_hidden = 1;
}
+#endif
#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
if (f == 0)
#endif
if (f)
{
+#if ! defined (USE_GTK)
/* Is this in the tool-bar? */
if (WINDOWP (f->tool_bar_window)
&& WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
tool_bar_p = EQ (window, f->tool_bar_window);
if (tool_bar_p && event.xbutton.button < 4)
- {
- handle_tool_bar_click (f, x, y,
- event.xbutton.type == ButtonPress,
- x_x_to_emacs_modifiers (dpyinfo,
- event.xbutton.state));
- }
+ handle_tool_bar_click
+ (f, x, y, event.xbutton.type == ButtonPress,
+ x_x_to_emacs_modifiers (dpyinfo, event.xbutton.state));
}
+#endif /* !USE_GTK */
if (!tool_bar_p)
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)