summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/data.c2
-rw-r--r--src/frame.c6
-rw-r--r--src/frame.h22
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/lisp.h1
-rw-r--r--src/xfns.c22
7 files changed, 53 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d6f27edbbc6..2dde558af45 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -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
diff --git a/src/data.c b/src/data.c
index 790d0fee981..3e651414e68 100644
--- a/src/data.c
+++ b/src/data.c
@@ -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));
diff --git a/src/frame.c b/src/frame.c
index 61544c245f3..6a4aec2218d 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -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));
}
diff --git a/src/frame.h b/src/frame.h
index b0a7f29c252..6d7ee02e44f 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -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
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 75d5c5aa680..752cc8ec60e 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -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);
diff --git a/src/lisp.h b/src/lisp.h
index 85110677693..5ef0fcaecfc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -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;
diff --git a/src/xfns.c b/src/xfns.c
index 08de79596a8..cd95ea8ab72 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -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);