emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117823: Add and use function horizontal-scroll-bars


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r117823: Add and use function horizontal-scroll-bars-available-p.
Date: Fri, 05 Sep 2014 10:29:58 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117823
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Fri 2014-09-05 12:29:34 +0200
message:
  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.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/menu-bar.el               menubar.el-20091113204419-o5vbwnq5f7feedwu-546
  lisp/scroll-bar.el             
scrollbar.el-20091113204419-o5vbwnq5f7feedwu-535
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2014-09-05 01:20:51 +0000
+++ b/etc/NEWS  2014-09-05 10:29:34 +0000
@@ -240,6 +240,8 @@
 ** 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

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-05 01:20:51 +0000
+++ b/lisp/ChangeLog    2014-09-05 10:29:34 +0000
@@ -1,3 +1,12 @@
+2014-09-05  Martin Rudalics  <address@hidden>
+
+       * 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  <address@hidden>
 
        * subr.el (call-process-shell-command, process-file-shell-command):

=== modified file 'lisp/menu-bar.el'
--- a/lisp/menu-bar.el  2014-07-29 14:21:11 +0000
+++ b/lisp/menu-bar.el  2014-09-05 10:29:34 +0000
@@ -903,19 +903,17 @@
       '(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"

=== modified file 'lisp/scroll-bar.el'
--- a/lisp/scroll-bar.el        2014-09-03 15:10:29 +0000
+++ b/lisp/scroll-bar.el        2014-09-05 10:29:34 +0000
@@ -144,6 +144,13 @@
                            (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 @@
   :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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]