comparison lisp/term/x-win.el @ 53662:6f5e6bdd8cda

Enable clipboard on the menu bar and make Paste from the menu bar first use clipboard. For compliance with freedesktop.org.
author Jan Djärv <jan.h.d@swipnet.se>
date Wed, 21 Jan 2004 10:56:29 +0000
parents 695cf19ef79e
children ac5e37408488 82c3b4da43ca
comparison
equal deleted inserted replaced
53661:41bc433c6843 53662:6f5e6bdd8cda
2383 (new-fontset font (x-complement-fontset-spec xlfd-fields nil)) 2383 (new-fontset font (x-complement-fontset-spec xlfd-fields nil))
2384 ;; Create a fontset from FONT. The fontset name is 2384 ;; Create a fontset from FONT. The fontset name is
2385 ;; generated from FONT. 2385 ;; generated from FONT.
2386 (create-fontset-from-ascii-font font resolved-name "startup")))) 2386 (create-fontset-from-ascii-font font resolved-name "startup"))))
2387 2387
2388 ;; Sun expects the menu bar cut and paste commands to use the clipboard.
2389 ;; This has ,? to match both on Sunos and on Solaris.
2390 (if (string-match "Sun Microsystems,? Inc\\."
2391 (x-server-vendor))
2392 (menu-bar-enable-clipboard))
2393
2394 ;; Apply a geometry resource to the initial frame. Put it at the end 2388 ;; Apply a geometry resource to the initial frame. Put it at the end
2395 ;; of the alist, so that anything specified on the command line takes 2389 ;; of the alist, so that anything specified on the command line takes
2396 ;; precedence. 2390 ;; precedence.
2397 (let* ((res-geometry (x-get-resource "geometry" "Geometry")) 2391 (let* ((res-geometry (x-get-resource "geometry" "Geometry"))
2398 parsed) 2392 parsed)
2454 ;; (global-set-key [f10] 'ignore)) 2448 ;; (global-set-key [f10] 'ignore))
2455 2449
2456 ;; Turn on support for mouse wheels. 2450 ;; Turn on support for mouse wheels.
2457 (mouse-wheel-mode 1) 2451 (mouse-wheel-mode 1)
2458 2452
2453 ;; Enable CLIPBOARD copy/paste through menu bar commands.
2454 (menu-bar-enable-clipboard)
2455
2456 ;; Override Paste so it looks at CLIPBOARD first.
2457 (defun x-clipboard-yank ()
2458 "Insert the clipboard contents, or the last stretch of killed text."
2459 (interactive)
2460 (let ((clipboard-text (x-get-selection 'CLIPBOARD))
2461 (x-select-enable-clipboard t))
2462 (if (and clipboard-text (> (length clipboard-text) 0))
2463 (kill-new clipboard-text))
2464 (yank)))
2465
2466 (define-key menu-bar-edit-menu [paste]
2467 (cons "Paste" (cons "Paste text from clipboard or kill ring"
2468 'x-clipboard-yank)))
2469
2459 ;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 2470 ;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
2460 ;;; x-win.el ends here 2471 ;;; x-win.el ends here