aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
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/window.c
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/window.c')
-rw-r--r--src/window.c53
1 files changed, 31 insertions, 22 deletions
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}