emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117546: * data.c (wrong_choice): Not static any mor


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117546: * data.c (wrong_choice): Not static any more.
Date: Thu, 17 Jul 2014 10:19:48 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117546
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2014-07-17 14:18:19 +0400
message:
  * data.c (wrong_choice): Not static any more.
  * lisp.h (wrong_choice): Add prototype.
  * frame.h (struct frame) [USE_X_TOOLKIT || HAVE_NTGUI]:
  Declare namebuf as such.  Tweak comment.
  [USE_GTK]: Likewise for tool_bar_position.
  (fset_tool_bar_position) [USE_GTK]: Ditto.
  (FRAME_TOOL_BAR_POSITION): New macro.
  * frame.c (x_report_frame_params):
  * gtkutil.c (update_frame_tool_bar):
  * xfns.c (Fx_create_frame): Use it.
  (x_set_tool_bar_position): Add meaningful diagnostic messages.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/data.c                     data.c-20091113204419-o5vbwnq5f7feedwu-251
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
  src/frame.h                    frame.h-20091113204419-o5vbwnq5f7feedwu-229
  src/gtkutil.c                  gtkutil.c-20091113204419-o5vbwnq5f7feedwu-2527
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-17 09:12:51 +0000
+++ b/src/ChangeLog     2014-07-17 10:18:19 +0000
@@ -3,6 +3,18 @@
        * print.c (print_preprocess): Adjust to match changed
        sub char-table structure and avoid crash (Bug#18038).
 
+       * data.c (wrong_choice): Not static any more.
+       * lisp.h (wrong_choice): Add prototype.
+       * frame.h (struct frame) [USE_X_TOOLKIT || HAVE_NTGUI]:
+       Declare namebuf as such.  Tweak comment.
+       [USE_GTK]: Likewise for tool_bar_position.
+       (fset_tool_bar_position) [USE_GTK]: Ditto.
+       (FRAME_TOOL_BAR_POSITION): New macro.
+       * frame.c (x_report_frame_params):
+       * gtkutil.c (update_frame_tool_bar):
+       * xfns.c (Fx_create_frame): Use it.
+       (x_set_tool_bar_position): Add meaningful diagnostic messages.
+
 2014-07-16  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (decode_mode_spec): Call file-remote-p on the current

=== modified file 'src/data.c'
--- a/src/data.c        2014-07-16 08:45:22 +0000
+++ b/src/data.c        2014-07-17 10:18:19 +0000
@@ -974,7 +974,7 @@
 /* Used to signal a user-friendly error when symbol WRONG is
    not a member of CHOICE, which should be a list of symbols.  */
 
-static void
+void
 wrong_choice (Lisp_Object choice, Lisp_Object wrong)
 {
   ptrdiff_t i = 0, len = XINT (Flength (choice));

=== modified file 'src/frame.c'
--- a/src/frame.c       2014-07-16 15:39:15 +0000
+++ b/src/frame.c       2014-07-17 10:18:19 +0000
@@ -336,9 +336,11 @@
   f = allocate_frame ();
   XSETFRAME (frame, f);
 
+#ifdef USE_GTK
   /* Initialize Lisp data.  Note that allocate_frame initializes all
      Lisp data to nil, so do it only for slots which should not be nil.  */
   fset_tool_bar_position (f, Qtop);
+#endif
 
   /* Initialize non-Lisp data.  Note that allocate_frame zeroes out all
      non-Lisp data, so do it only for slots which should not be zero.
@@ -1372,7 +1374,9 @@
   fset_buried_buffer_list (f, Qnil);
 
   free_font_driver_list (f);
+#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)  
   xfree (f->namebuf);
+#endif  
   xfree (f->decode_mode_spec_buffer);
   xfree (FRAME_INSERT_COST (f));
   xfree (FRAME_DELETEN_COST (f));
@@ -3202,7 +3206,7 @@
     tem = make_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc);
   store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil));
   store_in_alist (alistptr, Qparent_id, tem);
-  store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position);
+  store_in_alist (alistptr, Qtool_bar_position, FRAME_TOOL_BAR_POSITION (f));
 }
 
 

=== modified file 'src/frame.h'
--- a/src/frame.h       2014-07-16 15:39:15 +0000
+++ b/src/frame.h       2014-07-17 10:18:19 +0000
@@ -161,9 +161,11 @@
   /* Desired and current tool-bar items.  */
   Lisp_Object tool_bar_items;
 
-  /* Where tool bar is, can be left, right, top or bottom.  The native
-     tool bar only supports top.  */
+#ifdef USE_GTK  
+  /* Where tool bar is, can be left, right, top or bottom.
+     Except with GTK, the only supported position is `top'.  */
   Lisp_Object tool_bar_position;
+#endif
 
 #if defined (HAVE_XFT) || defined (HAVE_FREETYPE)
   /* List of data specific to font-driver and frame, but common to faces.  */
@@ -183,9 +185,12 @@
   /* Number of elements in `menu_bar_vector' that have meaningful data.  */
   int menu_bar_items_used;
 
-  /* A buffer to hold the frame's name.  We can't use the Lisp
-     string's pointer (`name', above) because it might get relocated.  */
+#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)  
+  /* A buffer to hold the frame's name.  Since this is used by the
+     window system toolkit, we can't use the Lisp string's pointer
+     (`name', above) because it might get relocated.  */
   char *namebuf;
+#endif
 
   /* Glyph pool and matrix.  */
   struct glyph_pool *current_pool;
@@ -565,11 +570,13 @@
 {
   f->tool_bar_items = val;
 }
+#ifdef USE_GTK
 INLINE void
 fset_tool_bar_position (struct frame *f, Lisp_Object val)
 {
   f->tool_bar_position = val;
 }
+#endif /* USE_GTK */
 #if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
 INLINE void
 fset_tool_bar_window (struct frame *f, Lisp_Object val)
@@ -741,6 +748,13 @@
 #define FRAME_EXTERNAL_TOOL_BAR(f) false
 #endif
 
+/* This is really supported only with GTK.  */
+#ifdef USE_GTK
+#define FRAME_TOOL_BAR_POSITION(f) (f)->tool_bar_position
+#else
+#define FRAME_TOOL_BAR_POSITION(f) ((void) f, Qtop)
+#endif
+
 /* Number of lines of frame F used for the tool-bar.  */
 #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines
 

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2014-07-16 08:45:22 +0000
+++ b/src/gtkutil.c     2014-07-17 10:18:19 +0000
@@ -4865,7 +4865,7 @@
   if (f->n_tool_bar_items != 0)
     {
       if (! x->toolbar_is_packed)
-        xg_pack_tool_bar (f, f->tool_bar_position);
+        xg_pack_tool_bar (f, FRAME_TOOL_BAR_POSITION (f));
       gtk_widget_show_all (TOOLBAR_TOP_WIDGET (x));
       if (xg_update_tool_bar_sizes (f))
         xg_height_or_width_changed (f);

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-07-14 04:44:01 +0000
+++ b/src/lisp.h        2014-07-17 10:18:19 +0000
@@ -832,6 +832,7 @@
 extern Lisp_Object Qvector_or_char_table_p, Qwholenump;
 extern Lisp_Object Qwindow;
 extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
+extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object);
 
 /* Defined in emacs.c.  */
 extern bool might_dump;

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2014-07-12 17:53:29 +0000
+++ b/src/xfns.c        2014-07-17 10:18:19 +0000
@@ -457,15 +457,23 @@
                          Lisp_Object new_value,
                          Lisp_Object old_value)
 {
-  if (! EQ (new_value, Qleft) && ! EQ (new_value, Qright)
-      && ! EQ (new_value, Qbottom) && ! EQ (new_value, Qtop))
-    return;
-  if (EQ (new_value, old_value)) return;
+  Lisp_Object choice = list4 (Qleft, Qright, Qtop, Qbottom);
 
+  if (!NILP (Fmemq (new_value, choice)))
+    {
 #ifdef USE_GTK
-  xg_change_toolbar_position (f, new_value);
-  fset_tool_bar_position (f, new_value);
+      if (!EQ (new_value, old_value))
+       {
+         xg_change_toolbar_position (f, new_value);
+         fset_tool_bar_position (f, new_value);
+       }
+#else
+      if (!EQ (new_value, Qtop))
+       error ("The only supported tool bar position is top");
 #endif
+    }
+  else
+    wrong_choice (choice, new_value);
 }
 
 #ifdef USE_GTK
@@ -3182,7 +3190,7 @@
   x_default_parameter (f, parms, Qfullscreen, Qnil,
                        "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
   x_default_parameter (f, parms, Qtool_bar_position,
-                       f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL);
+                       FRAME_TOOL_BAR_POSITION (f), 0, 0, RES_TYPE_SYMBOL);
 
   /* Compute the size of the X window.  */
   window_prompting = x_figure_window_size (f, parms, 1);


reply via email to

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