aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Rudalics2014-08-04 18:47:27 +0200
committerMartin Rudalics2014-08-04 18:47:27 +0200
commit4a75c94d14f7a3c50014d1cc12ee519eb955c1ed (patch)
tree73a26f58dc3568e35872b33dcd88aa411ef9c56a /src
parent44a651f0f2e1668bdbbacca3bf5d405c34e67ff2 (diff)
downloademacs-4a75c94d14f7a3c50014d1cc12ee519eb955c1ed.tar.gz
emacs-4a75c94d14f7a3c50014d1cc12ee519eb955c1ed.zip
Fix scroll bar handling for non-toolkit builds.
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/frame.c19
-rw-r--r--src/frame.h13
-rw-r--r--src/w32term.c4
-rw-r--r--src/window.c53
-rw-r--r--src/window.h4
-rw-r--r--src/xterm.c5
7 files changed, 79 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ab0ba1b6758..e936863ce1d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12014-08-04 Martin Rudalics <rudalics@gmx.at>
2
3 * frame.h (FRAME_HAS_HORIZONTAL_SCROLL_BARS): Condition
4 correctly according to toolkit used.
5 * frame.c (make_initial_frame, make_terminal_frame)
6 (x_set_horizontal_scroll_bars, x_set_scroll_bar_height)
7 (Vdefault_frame_horizontal_scroll_bars): Correctly condition
8 assignments according to presence of toolkit scrollbars.
9 * window.h (WINDOW_HAS_HORIZONTAL_SCROLL_BAR): Condition
10 correctly according to toolkit used.
11 * window.c (set_window_scroll_bars): Set horizontal scroll bar
12 only if toolkit supports it.
13 * w32term.c (w32_redeem_scroll_bar): Always redeem scroll bar if
14 present.
15 * xterm.c (x_scroll_bar_create): Initialize horizontal slot for
16 non-toolkit builds.
17 (XTredeem_scroll_bar): Always redeem scroll bar if present.
18
12014-08-04 Dmitry Antipov <dmantipov@yandex.ru> 192014-08-04 Dmitry Antipov <dmantipov@yandex.ru>
2 20
3 * keyboard.c (safe_run_hook_funcall): Avoid consing around 21 * keyboard.c (safe_run_hook_funcall): Avoid consing around
diff --git a/src/frame.c b/src/frame.c
index 457024f3ca2..c72b474512f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -860,7 +860,7 @@ make_initial_frame (void)
860 860
861#ifdef HAVE_WINDOW_SYSTEM 861#ifdef HAVE_WINDOW_SYSTEM
862 f->vertical_scroll_bar_type = vertical_scroll_bar_none; 862 f->vertical_scroll_bar_type = vertical_scroll_bar_none;
863 FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) = false; 863 f->horizontal_scroll_bars = false;
864#endif 864#endif
865 865
866 /* The default value of menu-bar-mode is t. */ 866 /* The default value of menu-bar-mode is t. */
@@ -913,7 +913,7 @@ make_terminal_frame (struct terminal *terminal)
913 913
914#ifdef HAVE_WINDOW_SYSTEM 914#ifdef HAVE_WINDOW_SYSTEM
915 f->vertical_scroll_bar_type = vertical_scroll_bar_none; 915 f->vertical_scroll_bar_type = vertical_scroll_bar_none;
916 FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) = false; 916 f->horizontal_scroll_bars = false;
917#endif 917#endif
918 918
919 FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; 919 FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1;
@@ -3793,12 +3793,13 @@ x_set_vertical_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval
3793void 3793void
3794x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 3794x_set_horizontal_scroll_bars (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3795{ 3795{
3796#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) 3796#if (defined (HAVE_WINDOW_SYSTEM) \
3797 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
3798 || defined (HAVE_NTGUI)))
3797 if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)) 3799 if ((NILP (arg) && FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))
3798 || (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f))) 3800 || (!NILP (arg) && !FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)))
3799 { 3801 {
3800 FRAME_HAS_HORIZONTAL_SCROLL_BARS (f) 3802 f->horizontal_scroll_bars = NILP (arg) ? false : true;
3801 = NILP (arg) ? false : true;
3802 3803
3803 /* We set this parameter before creating the X window for the 3804 /* We set this parameter before creating the X window for the
3804 frame, so we can get the geometry right from the start. 3805 frame, so we can get the geometry right from the start.
@@ -3844,7 +3845,9 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3844void 3845void
3845x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 3846x_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3846{ 3847{
3847#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) 3848#if (defined (HAVE_WINDOW_SYSTEM) \
3849 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
3850 || defined (HAVE_NTGUI)))
3848 int unit = FRAME_LINE_HEIGHT (f); 3851 int unit = FRAME_LINE_HEIGHT (f);
3849 3852
3850 if (NILP (arg)) 3853 if (NILP (arg))
@@ -4891,7 +4894,9 @@ Setting this variable does not affect existing frames, only new ones. */);
4891 4894
4892 DEFVAR_LISP ("default-frame-horizontal-scroll-bars", Vdefault_frame_horizontal_scroll_bars, 4895 DEFVAR_LISP ("default-frame-horizontal-scroll-bars", Vdefault_frame_horizontal_scroll_bars,
4893 doc: /* Default value for horizontal scroll bars on this window-system. */); 4896 doc: /* Default value for horizontal scroll bars on this window-system. */);
4894#ifdef HAVE_WINDOW_SYSTEM 4897#if (defined (HAVE_WINDOW_SYSTEM) \
4898 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
4899 || defined (HAVE_NTGUI)))
4895 Vdefault_frame_horizontal_scroll_bars = Qt; 4900 Vdefault_frame_horizontal_scroll_bars = Qt;
4896#else 4901#else
4897 Vdefault_frame_horizontal_scroll_bars = Qnil; 4902 Vdefault_frame_horizontal_scroll_bars = Qnil;
diff --git a/src/frame.h b/src/frame.h
index 5d45dbfb268..0f34770d9b4 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -852,8 +852,6 @@ default_pixels_per_inch_y (void)
852#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type) 852#define FRAME_VERTICAL_SCROLL_BAR_TYPE(f) ((f)->vertical_scroll_bar_type)
853#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \ 853#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) \
854 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none) 854 ((f)->vertical_scroll_bar_type != vertical_scroll_bar_none)
855#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
856 ((f)->horizontal_scroll_bars)
857#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \ 855#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) \
858 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left) 856 ((f)->vertical_scroll_bar_type == vertical_scroll_bar_left)
859#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \ 857#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) \
@@ -866,10 +864,19 @@ default_pixels_per_inch_y (void)
866#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) f, 0) 864#define FRAME_HAS_VERTICAL_SCROLL_BARS(f) ((void) f, 0)
867#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0) 865#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT(f) ((void) f, 0)
868#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0) 866#define FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT(f) ((void) f, 0)
869#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) ((void) f, 0)
870 867
871#endif /* HAVE_WINDOW_SYSTEM */ 868#endif /* HAVE_WINDOW_SYSTEM */
872 869
870/* Whether horizontal scroll bars are currently enabled for frame F. */
871#if (defined (HAVE_WINDOW_SYSTEM) \
872 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
873 || defined (HAVE_NTGUI)))
874#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) \
875 ((f)->horizontal_scroll_bars)
876#else
877#define FRAME_HAS_HORIZONTAL_SCROLL_BARS(f) ((void) f, 0)
878#endif
879
873/* Width that a scroll bar in frame F should have, if there is one. 880/* Width that a scroll bar in frame F should have, if there is one.
874 Measured in pixels. 881 Measured in pixels.
875 If scroll bars are turned off, this is still nonzero. */ 882 If scroll bars are turned off, this is still nonzero. */
diff --git a/src/w32term.c b/src/w32term.c
index dfda29fb903..0ded4398949 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4041,7 +4041,7 @@ w32_redeem_scroll_bar (struct window *w)
4041 if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar)) 4041 if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar))
4042 emacs_abort (); 4042 emacs_abort ();
4043 4043
4044 if (!NILP (w->vertical_scroll_bar) && WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) 4044 if (!NILP (w->vertical_scroll_bar))
4045 { 4045 {
4046 bar = XSCROLL_BAR (w->vertical_scroll_bar); 4046 bar = XSCROLL_BAR (w->vertical_scroll_bar);
4047 /* Unlink it from the condemned list. */ 4047 /* Unlink it from the condemned list. */
@@ -4076,7 +4076,7 @@ w32_redeem_scroll_bar (struct window *w)
4076 } 4076 }
4077 4077
4078 horizontal: 4078 horizontal:
4079 if (!NILP (w->horizontal_scroll_bar) && WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w)) 4079 if (!NILP (w->horizontal_scroll_bar))
4080 { 4080 {
4081 bar = XSCROLL_BAR (w->horizontal_scroll_bar); 4081 bar = XSCROLL_BAR (w->horizontal_scroll_bar);
4082 /* Unlink it from the condemned list. */ 4082 /* Unlink it from the condemned list. */
diff --git a/src/window.c b/src/window.c
index e3554ea032e..049c0d122a3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -7299,7 +7299,6 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
7299 Lisp_Object horizontal_type) 7299 Lisp_Object horizontal_type)
7300{ 7300{
7301 int iwidth = (NILP (width) ? -1 : (CHECK_NATNUM (width), XINT (width))); 7301 int iwidth = (NILP (width) ? -1 : (CHECK_NATNUM (width), XINT (width)));
7302 int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
7303 bool changed = 0; 7302 bool changed = 0;
7304 7303
7305 if (iwidth == 0) 7304 if (iwidth == 0)
@@ -7327,29 +7326,39 @@ set_window_scroll_bars (struct window *w, Lisp_Object width,
7327 } 7326 }
7328 } 7327 }
7329 7328
7330 if (MINI_WINDOW_P (w) || iheight == 0) 7329#if (defined (HAVE_WINDOW_SYSTEM) \
7331 horizontal_type = Qnil; 7330 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
7331 || defined (HAVE_NTGUI)))
7332 {
7333 int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height)));
7332 7334
7333 if (!(NILP (horizontal_type) 7335 if (MINI_WINDOW_P (w) || iheight == 0)
7334 || EQ (horizontal_type, Qbottom) 7336 horizontal_type = Qnil;
7335 || EQ (horizontal_type, Qt)))
7336 error ("Invalid type of horizontal scroll bar");
7337 7337
7338 if (w->scroll_bar_height != iheight 7338 if (!(NILP (horizontal_type)
7339 || !EQ (w->horizontal_scroll_bar_type, horizontal_type)) 7339 || EQ (horizontal_type, Qbottom)
7340 { 7340 || EQ (horizontal_type, Qt)))
7341 /* Don't change anything if new scroll bar won't fit. */ 7341 error ("Invalid type of horizontal scroll bar");
7342 if ((WINDOW_PIXEL_HEIGHT (w) 7342
7343 - WINDOW_HEADER_LINE_HEIGHT (w) 7343 if (w->scroll_bar_height != iheight
7344 - WINDOW_MODE_LINE_HEIGHT (w) 7344 || !EQ (w->horizontal_scroll_bar_type, horizontal_type))
7345 - max (iheight, 0)) 7345 {
7346 >= MIN_SAFE_WINDOW_PIXEL_HEIGHT (w)) 7346 /* Don't change anything if new scroll bar won't fit. */
7347 { 7347 if ((WINDOW_PIXEL_HEIGHT (w)
7348 w->scroll_bar_height = iheight; 7348 - WINDOW_HEADER_LINE_HEIGHT (w)
7349 wset_horizontal_scroll_bar_type (w, horizontal_type); 7349 - WINDOW_MODE_LINE_HEIGHT (w)
7350 changed = 1; 7350 - max (iheight, 0))
7351 } 7351 >= MIN_SAFE_WINDOW_PIXEL_HEIGHT (w))
7352 } 7352 {
7353 w->scroll_bar_height = iheight;
7354 wset_horizontal_scroll_bar_type (w, horizontal_type);
7355 changed = 1;
7356 }
7357 }
7358 }
7359#else
7360 wset_horizontal_scroll_bar_type (w, Qnil);
7361#endif
7353 7362
7354 return changed ? w : NULL; 7363 return changed ? w : NULL;
7355} 7364}
diff --git a/src/window.h b/src/window.h
index cdf8da93138..7e1c7d619b9 100644
--- a/src/window.h
+++ b/src/window.h
@@ -787,7 +787,9 @@ wset_next_buffers (struct window *w, Lisp_Object val)
787 787
788/* Say whether horizontal scroll bars are currently enabled for window 788/* Say whether horizontal scroll bars are currently enabled for window
789 W. Horizontal scrollbars exist for toolkit versions only. */ 789 W. Horizontal scrollbars exist for toolkit versions only. */
790#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) 790#if (defined (HAVE_WINDOW_SYSTEM) \
791 && ((defined (USE_TOOLKIT_SCROLL_BARS) && !defined (HAVE_NS)) \
792 || defined (HAVE_NTGUI)))
791#define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \ 793#define WINDOW_HAS_HORIZONTAL_SCROLL_BAR(W) \
792 ((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \ 794 ((WINDOW_PSEUDO_P (W) || MINI_NON_ONLY_WINDOW_P (W)) \
793 ? false \ 795 ? false \
diff --git a/src/xterm.c b/src/xterm.c
index 4fa4b7ab02b..b106c51c01c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5474,6 +5474,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height,
5474 bar->start = 0; 5474 bar->start = 0;
5475 bar->end = 0; 5475 bar->end = 0;
5476 bar->dragging = -1; 5476 bar->dragging = -1;
5477 bar->horizontal = horizontal;
5477#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID) 5478#if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
5478 bar->last_seen_part = scroll_bar_nowhere; 5479 bar->last_seen_part = scroll_bar_nowhere;
5479#endif 5480#endif
@@ -5947,7 +5948,7 @@ XTredeem_scroll_bar (struct window *w)
5947 if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar)) 5948 if (NILP (w->vertical_scroll_bar) && NILP (w->horizontal_scroll_bar))
5948 emacs_abort (); 5949 emacs_abort ();
5949 5950
5950 if (!NILP (w->vertical_scroll_bar) && WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) 5951 if (!NILP (w->vertical_scroll_bar))
5951 { 5952 {
5952 bar = XSCROLL_BAR (w->vertical_scroll_bar); 5953 bar = XSCROLL_BAR (w->vertical_scroll_bar);
5953 /* Unlink it from the condemned list. */ 5954 /* Unlink it from the condemned list. */
@@ -5982,7 +5983,7 @@ XTredeem_scroll_bar (struct window *w)
5982 } 5983 }
5983 5984
5984 horizontal: 5985 horizontal:
5985 if (!NILP (w->horizontal_scroll_bar) && WINDOW_HAS_HORIZONTAL_SCROLL_BAR (w)) 5986 if (!NILP (w->horizontal_scroll_bar))
5986 { 5987 {
5987 bar = XSCROLL_BAR (w->horizontal_scroll_bar); 5988 bar = XSCROLL_BAR (w->horizontal_scroll_bar);
5988 /* Unlink it from the condemned list. */ 5989 /* Unlink it from the condemned list. */