+2014-08-04 Martin Rudalics <rudalics@gmx.at>
+
+ * frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS): Condition
+ correctly according to toolkit used.
+ * frame.c (make_initial_frame, make_terminal_frame)
+ (x_set_horizontal_scroll_bars, x_set_scroll_bar_height)
+ (Vdefault_frame_horizontal_scroll_bars): Correctly condition
+ assignments according to presence of toolkit scrollbars.
+ * window.h (WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Condition
+ correctly according to toolkit used.
+ * window.c (set_window_scroll_bars): Set horizontal scroll bar
+ only if toolkit supports it.
+ * w32term.c (w32_redeem_scroll_bar): Always redeem scroll bar if
+ present.
+ * xterm.c (x_scroll_bar_create): Initialize horizontal slot for
+ non-toolkit builds.
+ (XTredeem_scroll_bar): Always redeem scroll bar if present.
+
2014-08-04 Dmitry Antipov <dmantipov@yandex.ru>
* keyboard.c (safe_run_hook_funcall): Avoid consing around
#ifdef HAVE_WINDOW_SYSTEM
f->vertical_scroll_bar_type = vertical_scroll_bar_none;
- FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) = false;
+ f->horizontal_scroll_bars = false;
#endif
/* The default value of menu-bar-mode is t. */
#ifdef HAVE_WINDOW_SYSTEM
f->vertical_scroll_bar_type = vertical_scroll_bar_none;
- FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) = false;
+ f->horizontal_scroll_bars = false;
#endif
FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1;
void
x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI)
+#if (defined (HAVE_WINDOW_SYSTEM) \
+ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
+ || defined (HAVE_NTGUI)))
if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))
|| (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)))
{
- FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)
- = NILP (arg) ? false : true;
+ f->horizontal_scroll_bars = NILP (arg) ? false : true;
/* We set this parameter before creating the X window for the
frame, so we can get the geometry right from the start.
void
x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI)
+#if (defined (HAVE_WINDOW_SYSTEM) \
+ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
+ || defined (HAVE_NTGUI)))
int unit = FRAME_LINE_HEIGHT (f);
if (NILP (arg))
DEFVAR_LISP ("default-frame-horizontal-scroll-bars", Vdefault_frame_horizontal_scroll_bars,
doc: /* Default value for horizontal scroll bars on this window-system. */);
-#ifdef HAVE_WINDOW_SYSTEM
+#if (defined (HAVE_WINDOW_SYSTEM) \
+ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
+ || defined (HAVE_NTGUI)))
Vdefault_frame_horizontal_scroll_bars = Qt;
#else
Vdefault_frame_horizontal_scroll_bars = Qnil;
#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
-#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
- ((f)->horizontal_scroll_bars)
#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) f, 0)
#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0)
#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0)
-#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) ((void) f, 0)
#endif /* HAVE_WINDOW_SYSTEM */
+/* Whether horizontal scroll bars are currently enabled for frame F. */
+#if (defined (HAVE_WINDOW_SYSTEM) \
+ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
+ || defined (HAVE_NTGUI)))
+#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
+ ((f)->horizontal_scroll_bars)
+#else
+#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) ((void) f, 0)
+#endif
+
/* Width that a scroll bar in frame F should have, if there is one.
Measured in pixels.
If scroll bars are turned off, this is still nonzero. */
if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar))
emacs_abort ();
- if (!NILP (w->vertical_scroll_bar) && WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
+ if (!NILP (w->vertical_scroll_bar))
{
bar = XSCROLL_BAR (w->vertical_scroll_bar);
/* Unlink it from the condemned list. */
}
horizontal:
- if (!NILP (w->horizontal_scroll_bar) && WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w))
+ if (!NILP (w->horizontal_scroll_bar))
{
bar = XSCROLL_BAR (w->horizontal_scroll_bar);
/* Unlink it from the condemned list. */
Lisp_Object horizontal_type)
{
int iwidth = (NILP (width) ? -1 : (CHECK_NATNUM (width), XINT (width)));
- int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
bool changed = 0;
if (iwidth == 0)
}
}
- if (MINI_WINDOW_P (w) || iheight == 0)
- horizontal_type = Qnil;
+#if (defined (HAVE_WINDOW_SYSTEM) \
+ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
+ || defined (HAVE_NTGUI)))
+ {
+ int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
- if (!(NILP (horizontal_type)
- || EQ (horizontal_type, Qbottom)
- || EQ (horizontal_type, Qt)))
- error ("Invalid type of horizontal scroll bar");
+ if (MINI_WINDOW_P (w) || iheight == 0)
+ horizontal_type = Qnil;
- if (w->scroll_bar_height != iheight
- || !EQ (w->horizontal_scroll_bar_type, horizontal_type))
- {
- /* Don't change anything if new scroll bar won't fit. */
- if ((WINDOW_PIXEL_HEIGHT (w)
- - WINDOW_HEADER_LINE_HEIGHT (w)
- - WINDOW_MODE_LINE_HEIGHT (w)
- - max (iheight, 0))
- >= MIN_SAFE_WINDOW_PIXEL_HEIGHT (w))
- {
- w->scroll_bar_height = iheight;
- wset_horizontal_scroll_bar_type (w, horizontal_type);
- changed = 1;
- }
- }
+ if (!(NILP (horizontal_type)
+ || EQ (horizontal_type, Qbottom)
+ || EQ (horizontal_type, Qt)))
+ error ("Invalid type of horizontal scroll bar");
+
+ if (w->scroll_bar_height != iheight
+ || !EQ (w->horizontal_scroll_bar_type, horizontal_type))
+ {
+ /* Don't change anything if new scroll bar won't fit. */
+ if ((WINDOW_PIXEL_HEIGHT (w)
+ - WINDOW_HEADER_LINE_HEIGHT (w)
+ - WINDOW_MODE_LINE_HEIGHT (w)
+ - max (iheight, 0))
+ >= MIN_SAFE_WINDOW_PIXEL_HEIGHT (w))
+ {
+ w->scroll_bar_height = iheight;
+ wset_horizontal_scroll_bar_type (w, horizontal_type);
+ changed = 1;
+ }
+ }
+ }
+#else
+ wset_horizontal_scroll_bar_type (w, Qnil);
+#endif
return changed ? w : NULL;
}
/* Say whether horizontal scroll bars are currently enabled for window
W. Horizontal scrollbars exist for toolkit versions only. */
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI)
+#if (defined (HAVE_WINDOW_SYSTEM) \
+ && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
+ || defined (HAVE_NTGUI)))
#define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \
((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \
? false \
bar->start = 0;
bar->end = 0;
bar->dragging = -1;
+ bar->horizontal = horizontal;
#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
bar->last_seen_part = scroll_bar_nowhere;
#endif
if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar))
emacs_abort ();
- if (!NILP (w->vertical_scroll_bar) && WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
+ if (!NILP (w->vertical_scroll_bar))
{
bar = XSCROLL_BAR (w->vertical_scroll_bar);
/* Unlink it from the condemned list. */
}
horizontal:
- if (!NILP (w->horizontal_scroll_bar) && WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w))
+ if (!NILP (w->horizontal_scroll_bar))
{
bar = XSCROLL_BAR (w->horizontal_scroll_bar);
/* Unlink it from the condemned list. */