]> git.eshelyaron.com Git - emacs.git/commitdiff
* data.c (wrong_choice): Not static any more.
authorDmitry Antipov <dmantipov@yandex.ru>
Thu, 17 Jul 2014 10:18:19 +0000 (14:18 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Thu, 17 Jul 2014 10:18:19 +0000 (14:18 +0400)
* 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.

src/ChangeLog
src/data.c
src/frame.c
src/frame.h
src/gtkutil.c
src/lisp.h
src/xfns.c

index d6f27edbbc62b76da5f4687c6722a957cec52fcf..2dde558af4570b40c8417822f95dfcf3cf120043 100644 (file)
@@ -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  <eliz@gnu.org>
 
        * xdisp.c (decode_mode_spec): Call file-remote-p on the current
index 790d0fee9813886ee1fbf8b64d433f81eec57a20..3e651414e6888c5786cec3ae4159a0f633ffa3ce 100644 (file)
@@ -974,7 +974,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
 /* 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));
index 61544c245f383ccdacafdbf786fcb7cef4c18203..6a4aec2218d4de0fb53db5efabd7450cf3ae2ebd 100644 (file)
@@ -336,9 +336,11 @@ make_frame (bool mini_p)
   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 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
   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 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
     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));
 }
 
 
index b0a7f29c252f133eeba72358592fa406f48f63e3..6d7ee02e44f57fe25664125d5f519c5d1ae7c7d7 100644 (file)
@@ -161,9 +161,11 @@ struct frame
   /* 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 @@ struct frame
   /* 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 @@ fset_tool_bar_items (struct frame *f, Lisp_Object val)
 {
   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 @@ default_pixels_per_inch_y (void)
 #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
 
index 75d5c5aa680943c8ce12316a4061ee68aeb8792b..752cc8ec60eafbc9abdbeeec3448646c45f50fbe 100644 (file)
@@ -4865,7 +4865,7 @@ update_frame_tool_bar (struct frame *f)
   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);
index 85110677693a8e33d72dfd01dc06c4139dc6cb4a..5ef0fcaecfcc66fa333a08f81cf6c0d69911df34 100644 (file)
@@ -832,6 +832,7 @@ extern Lisp_Object Qbool_vector_p;
 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;
index 08de79596a8ad7cf577744c6a700633ad0feb6de..cd95ea8ab7245e5e4231371f1840ce47ac603cc3 100644 (file)
@@ -457,15 +457,23 @@ x_set_tool_bar_position (struct frame *f,
                          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 @@ This function is an internal primitive--use `make-frame' instead.  */)
   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);