emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114205: Ifdef away frame tool bar code when it is n


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114205: Ifdef away frame tool bar code when it is not really used.
Date: Wed, 11 Sep 2013 08:57:02 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114205
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2013-09-11 12:56:33 +0400
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/dispnew.c                  dispnew.c-20091113204419-o5vbwnq5f7feedwu-258
  src/frame.h                    frame.h-20091113204419-o5vbwnq5f7feedwu-229
  src/window.c                   window.c-20091113204419-o5vbwnq5f7feedwu-231
  src/window.h                   window.h-20091113204419-o5vbwnq5f7feedwu-271
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-09-11 08:24:05 +0000
+++ b/src/ChangeLog     2013-09-11 08:56:33 +0000
@@ -1,3 +1,26 @@
+2013-09-11  Dmitry Antipov  <address@hidden>
+
+       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  <address@hidden>
 
        Fix corruption with multiple emacsclient -t instances (Bug#15222).

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2013-09-09 16:47:43 +0000
+++ b/src/dispnew.c     2013-09-11 08:56:33 +0000
@@ -783,9 +783,11 @@
     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_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 @@
   /* 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 @@
     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 @@
        }
 #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 @@
          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_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 @@
              fset_desired_tool_bar_string (f, tem);
            }
        }
-
+#endif
 
       /* Update windows.  */
       paused_p = update_window_tree (root_window, force_p);
@@ -5488,8 +5493,10 @@
       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;

=== modified file 'src/frame.h'
--- a/src/frame.h       2013-09-09 16:47:43 +0000
+++ b/src/frame.h       2013-09-11 08:56:33 +0000
@@ -145,9 +145,15 @@
   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 @@
      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 @@
   /* 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 @@
   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 @@
 {
   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)
 

=== modified file 'src/window.c'
--- a/src/window.c      2013-09-06 07:00:29 +0000
+++ b/src/window.c      2013-09-11 08:56:33 +0000
@@ -1379,6 +1379,7 @@
   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 @@
       *part = ON_TEXT;
       window = f->tool_bar_window;
     }
+#endif
 
   return window;
 }
@@ -5112,9 +5114,9 @@
          /* 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));
        }

=== modified file 'src/window.h'
--- a/src/window.h      2013-09-05 16:25:20 +0000
+++ b/src/window.h      2013-09-11 08:56:33 +0000
@@ -525,10 +525,13 @@
 #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.  */

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-09-09 16:47:43 +0000
+++ b/src/xdisp.c       2013-09-11 08:56:33 +0000
@@ -913,11 +913,8 @@
 #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 @@
     }
 }
 
+#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 @@
   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 @@
 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 @@
          nlines = tool_bar_lines_needed (f, NULL);
        }
     }
-
+#endif
   return make_number (nlines);
 }
 
@@ -11936,15 +11936,17 @@
 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 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 @@
 
   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 @@
     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 @@
   /* 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 @@
   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 @@
   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

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2013-09-06 07:00:29 +0000
+++ b/src/xfns.c        2013-09-11 08:56:33 +0000
@@ -1215,8 +1215,11 @@
 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 @@
     nlines = 0;
 
 #ifdef USE_GTK
+
   FRAME_TOOL_BAR_LINES (f) = 0;
   if (nlines)
     {
@@ -1245,8 +1249,7 @@
       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 @@
     }
 
     run_window_configuration_change_hook (f);
-
+#endif /* USE_GTK */
 }
 
 

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2013-09-09 12:15:45 +0000
+++ b/src/xterm.c       2013-09-11 08:56:33 +0000
@@ -6225,6 +6225,7 @@
 
       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 @@
           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 @@
 #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 @@
                 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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]