]> code.delx.au - gnu-emacs/blobdiff - lisp/term/x-win.el
(read_char): After read_char_minibuf_menu_prompt,
[gnu-emacs] / lisp / term / x-win.el
index 7b7d1b94d4d38c722fbaf93a41696f237c7e2008..344715afe8985d9187153913d85fb4ac56b7d4f9 100644 (file)
@@ -1,5 +1,5 @@
 ;;; x-win.el --- parse switches controlling interface with X window system
-;; Copyright (C) 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
 
 ;; Handle the geometry option
 (defun x-handle-geometry (switch)
-  (setq initial-frame-alist
-       (append initial-frame-alist
-               (x-parse-geometry (car x-invocation-args)))
-       x-invocation-args (cdr x-invocation-args)))
+  (let ((geo (x-parse-geometry (car x-invocation-args))))
+    (setq initial-frame-alist
+         (append initial-frame-alist
+                 (if (or (assq 'left geo) (assq 'top geo))
+                     '((user-position . t)))
+                 (if (or (assq 'height geo) (assq 'width geo))
+                     '((user-size . t)))
+                 geo)
+         x-invocation-args (cdr x-invocation-args))))
 
 ;; Handle the -name and -rn options.  Set the variable x-resource-name
 ;; to the option's operand; if the switch was `-name', set the name of
 (defvar x-invocation-args nil)
 
 (defun x-handle-args (args)
-  "Here the X-related command line options in ARGS are processed,
-before the user's startup file is loaded.  They are copied to
+  "Process the X-related command line options in ARGS.
+This is done before the user's startup file is loaded.  They are copied to
 x-invocation args from which the X-related things are extracted, first
 the switch (e.g., \"-fg\") in the following code, and possible values
-(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
+\(e.g., \"black\") in the option handler code (e.g., x-handle-switch).
 This returns ARGS with the arguments that have been processed removed."
   (setq x-invocation-args args
        args nil)
@@ -528,6 +533,13 @@ This returns ARGS with the arguments that have been processed removed."
        (392976 . f35)
        (392977 . f36)
        (393056 . req)
+       ;; These are for Sun under X11R6
+       (393072 . props)
+       (393073 . front)
+       (393074 . copy)
+       (393075 . open)
+       (393076 . paste)
+       (393077 . cut)
        ))
 \f
 ;;;; Selections and cut buffers
@@ -542,6 +554,10 @@ This returns ARGS with the arguments that have been processed removed."
 (defvar x-cut-buffer-max 20000
   "Max number of characters to put in the cut buffer.")
 
+(defvar x-select-enable-clipboard nil
+  "Non-nil means cutting and pasting uses the clipboard.
+This is in addition to the primary selection.")
+
 ;;; Make TEXT, a string, the primary X selection.
 ;;; Also, set the value of X cut buffer 0, for backward compatibility
 ;;; with older X applications.
@@ -554,17 +570,26 @@ This returns ARGS with the arguments that have been processed removed."
       (x-set-cut-buffer text push)
     (x-set-cut-buffer "" push))
   (x-set-selection 'PRIMARY text)
+  (if x-select-enable-clipboard
+      (x-set-selection 'CLIPBOARD text))
   (setq x-last-selected-text text))
 
-;;; Return the value of the current X selection.  For compatibility
-;;; with older X applications, this checks cut buffer 0 before
-;;; retrieving the value of the primary selection.
+;;; Return the value of the current X selection.
+;;; Consult the selection, then the cut buffer.  Treat empty strings
+;;; as if they were unset.
 (defun x-cut-buffer-or-selection-value ()
   (let (text)
 
-    ;; Consult the selection, then the cut buffer.  Treat empty strings
-    ;; as if they were unset.
-    (setq text (x-get-selection 'PRIMARY))
+    ;; Don't die if x-get-selection signals an error.
+    (condition-case c
+       (setq text (x-get-selection 'PRIMARY))
+      (error (message "%s" c)))
+    (if (string= text "") (setq text nil))
+
+    (if x-select-enable-clipboard
+       (condition-case c
+           (setq text (x-get-selection 'CLIPBOARD))
+         (error (message "%s" c))))
     (if (string= text "") (setq text nil))
     (or text (setq text (x-get-cut-buffer 0)))
     (if (string= text "") (setq text nil))
@@ -606,6 +631,11 @@ This returns ARGS with the arguments that have been processed removed."
 (setq x-cut-buffer-max (min (- (/ (x-server-max-request-size) 2) 100)
                            x-cut-buffer-max))
 
+;; Sun expects the menu bar cut and paste commands to use the clipboard.
+(if (string-match "X11/NeWS - Sun Microsystems Inc\\."
+                 (x-server-vendor))
+    (menu-bar-enable-clipboard))
+
 ;; Apply a geometry resource to the initial frame.  Put it at the end
 ;; of the alist, so that anything specified on the command line takes
 ;; precedence.