]> git.eshelyaron.com Git - emacs.git/commitdiff
Ifdef away frame tool bar code when it is not really used.
authorDmitry Antipov <dmantipov@yandex.ru>
Wed, 11 Sep 2013 08:56:33 +0000 (12:56 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Wed, 11 Sep 2013 08:56:33 +0000 (12:56 +0400)
* 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.

src/ChangeLog
src/dispnew.c
src/frame.h
src/window.c
src/window.h
src/xdisp.c
src/xfns.c
src/xterm.c

index 21cb47eeeaafe5e8c9653882a5f40bea1efe3b90..83e5dbcdaffaba8e8a04e2e4c120bf27995d1bec 100644 (file)
@@ -1,3 +1,26 @@
+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).
index a42b3da5fc57f6af6ef5960959de297ef7b2bb89..2b16e881c809bc067ce02ef5f0a496b71db98a99 100644 (file)
@@ -783,9 +783,11 @@ clear_current_matrices (register struct frame *f)
     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)));
@@ -806,8 +808,10 @@ clear_desired_matrices (register struct frame *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)));
@@ -2041,10 +2045,9 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *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;
@@ -2068,10 +2071,9 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
     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.  */
@@ -2145,6 +2147,7 @@ free_glyphs (struct frame *f)
        }
 #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))
        {
@@ -2154,6 +2157,7 @@ free_glyphs (struct frame *f)
          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.  */
@@ -3036,6 +3040,7 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
        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))
        {
@@ -3056,7 +3061,7 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
              fset_desired_tool_bar_string (f, tem);
            }
        }
-
+#endif
 
       /* Update windows.  */
       paused_p = update_window_tree (root_window, force_p);
@@ -5488,8 +5493,10 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
       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;
index 87e218ee938cdf61977103dbe700c2ae77a3b7de..3aea0cfa27ca9c17f3343348c7443529b5bae5b6 100644 (file)
@@ -145,9 +145,15 @@ struct frame
   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;
 
@@ -155,10 +161,6 @@ struct frame
      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.  */
@@ -197,9 +199,11 @@ struct frame
   /* 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.  */
@@ -455,16 +459,6 @@ fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
   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;
@@ -536,11 +530,23 @@ fset_tool_bar_position (struct frame *f, Lisp_Object 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)
 
index 6a52ed7e166ac8725899f873ce3d4709d4ce3117..677cb991025b23420a28eb70e81fb9a35b904f9a 100644 (file)
@@ -1379,6 +1379,7 @@ window_from_coordinates (struct frame *f, int x, int y,
   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)
@@ -1391,6 +1392,7 @@ window_from_coordinates (struct frame *f, int x, int y,
       *part = ON_TEXT;
       window = f->tool_bar_window;
     }
+#endif
 
   return window;
 }
@@ -5112,9 +5114,9 @@ and redisplay normally--don't erase and redraw the frame.  */)
          /* 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));
        }
index f5ae81149b3decd0637fadfc5a5b8d08718fa0ca..a419bf7e7f0612d5ae729a8def5dfc6c5f84c596 100644 (file)
@@ -525,10 +525,13 @@ wset_next_buffers (struct window *w, Lisp_Object val)
 #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.  */
index df3fa3668036c981d2f07e3e119d35890e76eea9..484f95164fb86a3a244f4105ff3ce06b4ae6f625 100644 (file)
@@ -913,11 +913,8 @@ static int in_ellipses_for_invisible_text_p (struct display_pos *,
 #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);
@@ -11566,6 +11563,7 @@ update_tool_bar (struct frame *f, int save_match_data)
     }
 }
 
+#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
@@ -11903,6 +11901,7 @@ tool_bar_lines_needed (struct frame *f, int *n_rows)
   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,
@@ -11910,9 +11909,10 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
 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),
@@ -11925,7 +11925,7 @@ If FRAME is nil or omitted, use the selected frame.  */)
          nlines = tool_bar_lines_needed (f, NULL);
        }
     }
-
+#endif
   return make_number (nlines);
 }
 
@@ -11936,15 +11936,17 @@ If FRAME is nil or omitted, use the selected frame.  */)
 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
@@ -12100,8 +12102,11 @@ redisplay_tool_bar (struct frame *f)
 
   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
@@ -12345,6 +12350,8 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
     help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION);
 }
 
+#endif /* !USE_GTK && !HAVE_NS */
+
 #endif /* HAVE_WINDOW_SYSTEM */
 
 
@@ -26691,10 +26698,13 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
   /* 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);
@@ -28032,7 +28042,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
   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))
@@ -28945,9 +28955,11 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
   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
index 4e8442dd3a38fb6028b630e8e871e78e34e27bea..1626e2177cb8079fb390d0125fd4c7783997094a 100644 (file)
@@ -1215,8 +1215,11 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 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))
@@ -1229,6 +1232,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
     nlines = 0;
 
 #ifdef USE_GTK
+
   FRAME_TOOL_BAR_LINES (f) = 0;
   if (nlines)
     {
@@ -1245,8 +1249,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
       FRAME_EXTERNAL_TOOL_BAR (f) = 0;
     }
 
-  return;
-#endif
+#else /* !USE_GTK */
 
      /* Make sure we redisplay all windows in this frame.  */
   ++windows_or_buffers_changed;
@@ -1301,7 +1304,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
     }
 
     run_window_configuration_change_hook (f);
-
+#endif /* USE_GTK */
 }
 
 
index d12173297e827f85c8782f78e0f734196cd78435..22671a5f168bf5c6390ebb5c7a5da1748fb049c2 100644 (file)
@@ -6225,6 +6225,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
 
       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)
@@ -6234,6 +6235,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
           clear_mouse_face (hlinfo);
           hlinfo->mouse_face_hidden = 1;
         }
+#endif
 
 #if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
       if (f == 0)
@@ -6773,6 +6775,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
 #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)))
@@ -6785,13 +6788,11 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
                 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)