Commit 510a4a4e authored by Martin Rudalics's avatar Martin Rudalics

Add and use function horizontal-scroll-bars-available-p.

* scroll-bar.el (horizontal-scroll-bars-available-p): New
function.
(horizontal-scroll-bar-mode): Rewrite using
horizontal-scroll-bars-available-p.
* menu-bar.el (menu-bar-showhide-scroll-bar-menu): Rewrite using
horizontal-scroll-bars-available-p.
parent 04b134e1
......@@ -240,6 +240,8 @@ optional repeat-count argument.
** Emacs can now draw horizontal scroll bars on some platforms that
provide toolkit scroll bars, namely Gtk, Lucid, Motif and Windows.
Horizontal scroll bars are turned off by default.
*** New function `horizontal-scroll-bars-available-p' telling whether
horizontal scroll bars are available on the underlying system.
*** New mode `horizontal-scroll-bar-mode' to toggle horizontal scroll
bars on all existing and future frames.
*** New frame parameters `horizontal-scroll-bars' and
......
2014-09-05 Martin Rudalics <rudalics@gmx.at>
* scroll-bar.el (horizontal-scroll-bars-available-p): New
function.
(horizontal-scroll-bar-mode): Rewrite using
horizontal-scroll-bars-available-p.
* menu-bar.el (menu-bar-showhide-scroll-bar-menu): Rewrite using
horizontal-scroll-bars-available-p.
2014-09-05 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (call-process-shell-command, process-file-shell-command):
......
......@@ -903,19 +903,17 @@ by \"Save Options\" in Custom buffers.")
'(menu-item "Horizontal"
menu-bar-horizontal-scroll-bar
:help "Horizontal scroll bar"
:visible (display-graphic-p)
:button (:radio . (eq (cdr (assq 'horizontal-scroll-bars
(frame-parameters)))
t))))
:visible (horizontal-scroll-bars-available-p)
:button (:radio . (cdr (assq 'horizontal-scroll-bars
(frame-parameters))))))
(bindings--define-key menu [none-horizontal]
'(menu-item "None-horizontal"
menu-bar-no-horizontal-scroll-bar
:help "Turn off horizontal scroll bars"
:visible (display-graphic-p)
:button (:radio . (eq (cdr (assq 'horizontal-scroll-bars
(frame-parameters)))
nil))))
:visible (horizontal-scroll-bars-available-p)
:button (:radio . (not (cdr (assq 'horizontal-scroll-bars
(frame-parameters)))))))
(bindings--define-key menu [right]
'(menu-item "On the Right"
......
......@@ -144,6 +144,13 @@ created in the future."
(if v (or previous-scroll-bar-mode
default-frame-scroll-bars))))))
(defun horizontal-scroll-bars-available-p ()
"Return non-nil when horizontal scroll bars are available on this system."
(and (display-graphic-p)
(boundp 'x-toolkit-scroll-bars)
x-toolkit-scroll-bars
(not (eq (window-system) 'ns))))
(define-minor-mode horizontal-scroll-bar-mode
"Toggle horizontal scroll bars on all frames (Horizontal Scroll Bar mode).
With a prefix argument ARG, enable Horizontal Scroll Bar mode if
......@@ -155,14 +162,19 @@ created in the future."
:init-value nil
:global t
:group 'frames
(dolist (frame (frame-list))
(set-frame-parameter
frame 'horizontal-scroll-bars horizontal-scroll-bar-mode))
;; Handle `default-frame-alist' entry.
(setq default-frame-alist
(cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode)
(assq-delete-all 'horizontal-scroll-bars
default-frame-alist))))
(if (and horizontal-scroll-bar-mode
(not (horizontal-scroll-bars-available-p)))
(progn
(setq horizontal-scroll-bar-mode nil)
(message "Horizontal scroll bars are not implemented on this system"))
(dolist (frame (frame-list))
(set-frame-parameter
frame 'horizontal-scroll-bars horizontal-scroll-bar-mode))
;; Handle `default-frame-alist' entry.
(setq default-frame-alist
(cons (cons 'horizontal-scroll-bars horizontal-scroll-bar-mode)
(assq-delete-all 'horizontal-scroll-bars
default-frame-alist)))))
(defun toggle-scroll-bar (arg)
"Toggle whether or not the selected frame has vertical scroll bars.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment