comparison lisp/term/x-win.el @ 4306:2e51ffb537a8

(x-handle-iconic): New function. (command-switch-alist): Use that. (x-switch-definitions): Delete elt for `-iconic'. (x-selection-timeout): Use 20000 as default. (x-select-text): Never set the CLIPBOARD selection. (x-cut-buffer-or-selection-value): Try PRIMARY before cut buffer. (x-cut-buffer-max): Set based on x-server-max-request-size.
author Richard M. Stallman <rms@gnu.org>
date Tue, 27 Jul 1993 08:38:00 +0000
parents fcc66d1d9289
children 87472f1eb031
comparison
equal deleted inserted replaced
4305:a39dcf68a29c 4306:2e51ffb537a8
98 ("-bg" . x-handle-switch) 98 ("-bg" . x-handle-switch)
99 ("-background". x-handle-switch) 99 ("-background". x-handle-switch)
100 ("-ms" . x-handle-switch) 100 ("-ms" . x-handle-switch)
101 ("-itype" . x-handle-switch) 101 ("-itype" . x-handle-switch)
102 ("-i" . x-handle-switch) 102 ("-i" . x-handle-switch)
103 ("-iconic" . x-handle-switch) 103 ("-iconic" . x-handle-iconic)
104 ("-xrm" . x-handle-xrm-switch) 104 ("-xrm" . x-handle-xrm-switch)
105 ("-cr" . x-handle-switch) 105 ("-cr" . x-handle-switch)
106 ("-vb" . x-handle-switch) 106 ("-vb" . x-handle-switch)
107 ("-hb" . x-handle-switch) 107 ("-hb" . x-handle-switch)
108 ("-bd" . x-handle-switch)) 108 ("-bd" . x-handle-switch))
123 ("-background" background-color) 123 ("-background" background-color)
124 ("-ms" mouse-color) 124 ("-ms" mouse-color)
125 ("-cr" cursor-color) 125 ("-cr" cursor-color)
126 ("-itype" icon-type t) 126 ("-itype" icon-type t)
127 ("-i" icon-type t) 127 ("-i" icon-type t)
128 ("-iconic" visibility icon)
129 ("-vb" vertical-scroll-bars t) 128 ("-vb" vertical-scroll-bars t)
130 ("-hb" horizontal-scroll-bars t) 129 ("-hb" horizontal-scroll-bars t)
131 ("-bd" border-color) 130 ("-bd" border-color)
132 ("-bw" border-width))) 131 ("-bw" border-width)))
133 132
142 (setq default-frame-alist 141 (setq default-frame-alist
143 (cons (cons (nth 1 aelt) 142 (cons (cons (nth 1 aelt)
144 (car x-invocation-args)) 143 (car x-invocation-args))
145 default-frame-alist) 144 default-frame-alist)
146 x-invocation-args (cdr x-invocation-args)))))) 145 x-invocation-args (cdr x-invocation-args))))))
146
147 ;; Make -iconic apply only to the initial frame!
148 (defun x-handle-iconic (switch)
149 (setq initial-frame-alist
150 (cons '(visibility . icon) initial-frame-alist)))
147 151
148 ;; Handler for switches of the form "-switch n" 152 ;; Handler for switches of the form "-switch n"
149 (defun x-handle-numeric-switch (switch) 153 (defun x-handle-numeric-switch (switch)
150 (let ((aelt (assoc switch x-switch-definitions))) 154 (let ((aelt (assoc switch x-switch-definitions)))
151 (if aelt 155 (if aelt
490 ;;; current selection against it, and avoid passing back our own text 494 ;;; current selection against it, and avoid passing back our own text
491 ;;; from x-cut-buffer-or-selection-value. 495 ;;; from x-cut-buffer-or-selection-value.
492 (defvar x-last-selected-text nil) 496 (defvar x-last-selected-text nil)
493 497
494 ;;; It is said that overlarge strings are slow to put into the cut buffer. 498 ;;; It is said that overlarge strings are slow to put into the cut buffer.
495 (defvar x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100) 499 ;;; Note this value is overridden below.
496 20000) 500 (defvar x-cut-buffer-max 20000
497 "Max number of characters to put in the cut buffer.") 501 "Max number of characters to put in the cut buffer.")
498 502
499 ;;; Make TEXT, a string, the primary X selection. 503 ;;; Make TEXT, a string, the primary X selection.
500 ;;; Also, set the value of X cut buffer 0, for backward compatibility 504 ;;; Also, set the value of X cut buffer 0, for backward compatibility
501 ;;; with older X applications. 505 ;;; with older X applications.
516 (defun x-cut-buffer-or-selection-value () 520 (defun x-cut-buffer-or-selection-value ()
517 (let (text) 521 (let (text)
518 522
519 ;; Consult the selection, then the cut buffer. Treat empty strings 523 ;; Consult the selection, then the cut buffer. Treat empty strings
520 ;; as if they were unset. 524 ;; as if they were unset.
521 (or text (setq text (x-get-selection 'PRIMARY))) 525 (setq text (x-get-selection 'PRIMARY))
522 (if (string= text "") (setq text nil)) 526 (if (string= text "") (setq text nil))
523 (setq text (x-get-cut-buffer 0)) 527 (or text (setq text (x-get-cut-buffer 0)))
524 (if (string= text "") (setq text nil)) 528 (if (string= text "") (setq text nil))
525 529
526 (cond 530 (cond
527 ((not text) nil) 531 ((not text) nil)
528 ((eq text x-last-selected-text) nil) 532 ((eq text x-last-selected-text) nil)
553 (setq x-display-name (getenv "DISPLAY"))) 557 (setq x-display-name (getenv "DISPLAY")))
554 x-command-line-resources) 558 x-command-line-resources)
555 559
556 (setq frame-creation-function 'x-create-frame-with-faces) 560 (setq frame-creation-function 'x-create-frame-with-faces)
557 561
562 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
563 x-cut-buffer-max))
564
558 ;; Apply a geometry resource to the initial frame. Put it at the end 565 ;; Apply a geometry resource to the initial frame. Put it at the end
559 ;; of the alist, so that anything specified on the command line takes 566 ;; of the alist, so that anything specified on the command line takes
560 ;; precedence. 567 ;; precedence.
561 (let ((res-geometry (x-get-resource "geometry" "Geometry"))) 568 (let ((res-geometry (x-get-resource "geometry" "Geometry")))
562 (if res-geometry 569 (if res-geometry