diff options
| author | Jim Blandy | 1990-03-22 20:46:04 +0000 |
|---|---|---|
| committer | Jim Blandy | 1990-03-22 20:46:04 +0000 |
| commit | 63f77899fc117c96c11eb81aee77fed81f1d7290 (patch) | |
| tree | 7ae790949aec8a781c26c6dbb79667adc31beac4 | |
| parent | 80a677d9852bb4eb26c2c0bb2c119fdae0770c43 (diff) | |
| download | emacs-63f77899fc117c96c11eb81aee77fed81f1d7290.tar.gz emacs-63f77899fc117c96c11eb81aee77fed81f1d7290.zip | |
Initial revision
| -rw-r--r-- | lisp/term/x-win.el | 676 |
1 files changed, 676 insertions, 0 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el new file mode 100644 index 00000000000..6d14031918f --- /dev/null +++ b/lisp/term/x-win.el | |||
| @@ -0,0 +1,676 @@ | |||
| 1 | ;; Parse switches controlling how Emacs interfaces with X window system. | ||
| 2 | ;; Copyright (C) 1990 Free Software Foundation, Inc. | ||
| 3 | |||
| 4 | ;; This file is part of GNU Emacs. | ||
| 5 | |||
| 6 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 7 | ;; but WITHOUT ANY WARRANTY. No author or distributor | ||
| 8 | ;; accepts responsibility to anyone for the consequences of using it | ||
| 9 | ;; or for whether it serves any particular purpose or works at all, | ||
| 10 | ;; unless he says so in writing. Refer to the GNU Emacs General Public | ||
| 11 | ;; License for full details. | ||
| 12 | |||
| 13 | ;; Everyone is granted permission to copy, modify and redistribute | ||
| 14 | ;; GNU Emacs, but only under the conditions described in the | ||
| 15 | ;; GNU Emacs General Public License. A copy of this license is | ||
| 16 | ;; supposed to have been given to you along with GNU Emacs so you | ||
| 17 | ;; can know your rights and responsibilities. It should be in a | ||
| 18 | ;; file named COPYING. Among other things, the copyright notice | ||
| 19 | ;; and this notice must be preserved on all copies. | ||
| 20 | |||
| 21 | |||
| 22 | ;; X-win.el: this file is loaded from ../lisp/startup.el when it recognizes | ||
| 23 | ;; that X windows are to be used. Command line switches are parsed and those | ||
| 24 | ;; pertaining to X are processed and removed from the command line. The | ||
| 25 | ;; X display is opened and hooks are set for popping up the initial window. | ||
| 26 | |||
| 27 | ;; startup.el will then examine startup files, and eventually call the hooks | ||
| 28 | ;; which create the first window (s). | ||
| 29 | |||
| 30 | ;; These are the standard X switches from the Xt Initialize.c file of | ||
| 31 | ;; Release 4. | ||
| 32 | |||
| 33 | ;; Command line Resource Manager string | ||
| 34 | |||
| 35 | ;; +rv *reverseVideo | ||
| 36 | ;; +synchronous *synchronous | ||
| 37 | ;; -background *background | ||
| 38 | ;; -bd *borderColor | ||
| 39 | ;; -bg *background | ||
| 40 | ;; -bordercolor *borderColor | ||
| 41 | ;; -borderwidth .borderWidth | ||
| 42 | ;; -bw .borderWidth | ||
| 43 | ;; -display .display | ||
| 44 | ;; -fg *foreground | ||
| 45 | ;; -fn *font | ||
| 46 | ;; -font *font | ||
| 47 | ;; -foreground *foreground | ||
| 48 | ;; -geometry .geometry | ||
| 49 | ;; -iconic .iconic | ||
| 50 | ;; -name .name | ||
| 51 | ;; -reverse *reverseVideo | ||
| 52 | ;; -rv *reverseVideo | ||
| 53 | ;; -selectionTimeout .selectionTimeout | ||
| 54 | ;; -synchronous *synchronous | ||
| 55 | ;; -title .title | ||
| 56 | ;; -xrm | ||
| 57 | |||
| 58 | (message "X-windows...") | ||
| 59 | |||
| 60 | ;; An alist of X options and the function which handles them. See | ||
| 61 | ;; ../startup.el. | ||
| 62 | |||
| 63 | (setq command-switch-alist | ||
| 64 | (append '(("-dm" . x-establish-daemon-mode) | ||
| 65 | ("-bw" . x-handle-numeric-switch) | ||
| 66 | ("-d" . x-handle-display) | ||
| 67 | ("-display" . x-handle-display) | ||
| 68 | ("-name" . x-handle-switch) | ||
| 69 | ("-T" . x-handle-switch) | ||
| 70 | ("-r" . x-handle-switch) | ||
| 71 | ("-rv" . x-handle-switch) | ||
| 72 | ("-reverse" . x-handle-switch) | ||
| 73 | ("-fn" . x-handle-switch) | ||
| 74 | ("-font" . x-handle-switch) | ||
| 75 | ("-ib" . x-handle-switch) | ||
| 76 | ("-g" . x-handle-geometry) | ||
| 77 | ("-geometry" . x-handle-geometry) | ||
| 78 | ("-fg" . x-handle-switch) | ||
| 79 | ("-foreground" . x-handle-switch) | ||
| 80 | ("-bg" . x-handle-switch) | ||
| 81 | ("-background" . x-handle-switch) | ||
| 82 | ("-ms" . x-handle-switch) | ||
| 83 | ("-ib" . x-handle-switch) | ||
| 84 | ("-iconic" . x-handle-switch) | ||
| 85 | ("-cr" . x-handle-switch) | ||
| 86 | ("-vb" . x-handle-switch) | ||
| 87 | ("-hb" . x-handle-switch) | ||
| 88 | ("-bd" . x-handle-switch)) | ||
| 89 | command-switch-alist)) | ||
| 90 | |||
| 91 | (defvar x-switches-specified nil) | ||
| 92 | |||
| 93 | (defconst x-switch-definitions | ||
| 94 | '(("-name" name) | ||
| 95 | ("-T" name) | ||
| 96 | ("-r" lose) | ||
| 97 | ("-rv" lose) | ||
| 98 | ("-reverse" lose) | ||
| 99 | ("-fn" font) | ||
| 100 | ("-font" font) | ||
| 101 | ("-ib" internal-border-width) | ||
| 102 | ("-fg" foreground-color) | ||
| 103 | ("-foreground" foreground-color) | ||
| 104 | ("-bg" background-color) | ||
| 105 | ("-background" background-color) | ||
| 106 | ("-ms" mouse-color) | ||
| 107 | ("-cr" cursor-color) | ||
| 108 | ("-ib" icon-type t) | ||
| 109 | ("-iconic" iconic-startup t) | ||
| 110 | ("-vb" vertical-scroll-bar t) | ||
| 111 | ("-hb" horizontal-scroll-bar t) | ||
| 112 | ("-bd" border-color) | ||
| 113 | ("-bw" border-width))) | ||
| 114 | |||
| 115 | ;; Handler for switches of the form "-switch value" or "-switch". | ||
| 116 | (defun x-handle-switch (switch) | ||
| 117 | (let ((aelt (assoc switch x-switch-definitions))) | ||
| 118 | (if aelt | ||
| 119 | (if (nth 2 aelt) | ||
| 120 | (setq x-switches-specified | ||
| 121 | (cons (cons (nth 1 aelt) (nth 2 aelt)) | ||
| 122 | x-switches-specified)) | ||
| 123 | (setq x-switches-specified | ||
| 124 | (cons (cons (nth 1 aelt) | ||
| 125 | (car x-invocation-args)) | ||
| 126 | x-switches-specified) | ||
| 127 | x-invocation-args (cdr x-invocation-args)))))) | ||
| 128 | |||
| 129 | ;; Handler for switches of the form "-switch n" | ||
| 130 | (defun x-handle-numeric-switch (switch) | ||
| 131 | (let ((aelt (assoc switch x-switch-definitions))) | ||
| 132 | (if aelt | ||
| 133 | (setq x-switches-specified | ||
| 134 | (cons (cons (nth 1 aelt) | ||
| 135 | (string-to-int (car x-invocation-args))) | ||
| 136 | x-switches-specified) | ||
| 137 | x-invocation-args | ||
| 138 | (cdr x-invocation-args))))) | ||
| 139 | |||
| 140 | ;; Handle the geometry option | ||
| 141 | (defun x-handle-geometry (switch) | ||
| 142 | (setq x-switches-specified (append x-switches-specified | ||
| 143 | (x-geometry (car x-invocation-args))) | ||
| 144 | x-invocation-args (cdr x-invocation-args))) | ||
| 145 | |||
| 146 | ;; The daemon stuff isn't really useful at the moment. | ||
| 147 | (defvar x-daemon-mode nil | ||
| 148 | "When set, means initially create just a minibuffer.") | ||
| 149 | |||
| 150 | (defun x-establish-daemon-mode (switch) | ||
| 151 | (setq x-daemon-mode t)) | ||
| 152 | |||
| 153 | (defvar x-display-name nil | ||
| 154 | "The X display name specifying server and X screen.") | ||
| 155 | |||
| 156 | (defun x-handle-display (switch) | ||
| 157 | (setq x-display-name (car x-invocation-args) | ||
| 158 | x-invocation-args (cdr x-invocation-args))) | ||
| 159 | |||
| 160 | ;; Here the X-related command line options are processed, before the user's | ||
| 161 | ;; startup file is loaded. These are present in ARGS (see startup.el). | ||
| 162 | ;; They are copied to x-invocation args from which the X-related things | ||
| 163 | ;; are extracted, first the switch (e.g., "-fg") in the following code, | ||
| 164 | ;; and possible values (e.g., "black") in the option handler code | ||
| 165 | ;; (e.g., x-handle-switch). | ||
| 166 | |||
| 167 | ;; When finished, only things not pertaining to X (e.g., "-q", filenames) | ||
| 168 | ;; are left in ARGS | ||
| 169 | |||
| 170 | (defvar x-invocation-args nil) | ||
| 171 | |||
| 172 | (if (eq window-system 'x) | ||
| 173 | (progn | ||
| 174 | (setq window-setup-hook 'x-pop-initial-window | ||
| 175 | x-invocation-args args | ||
| 176 | args nil) | ||
| 177 | (require 'x-mouse) | ||
| 178 | (require 'screen) | ||
| 179 | (setq suspend-hook | ||
| 180 | '(lambda () | ||
| 181 | (error "Suspending an emacs running under X makes no sense"))) | ||
| 182 | (define-key global-map "" 'iconify-emacs) | ||
| 183 | (while x-invocation-args | ||
| 184 | (let* ((this-switch (car x-invocation-args)) | ||
| 185 | (aelt (assoc this-switch command-switch-alist))) | ||
| 186 | (setq x-invocation-args (cdr x-invocation-args)) | ||
| 187 | (if aelt | ||
| 188 | (funcall (cdr aelt) this-switch) | ||
| 189 | (setq args (cons this-switch args))))) | ||
| 190 | (setq args (nreverse args)) | ||
| 191 | (x-open-connection (or x-display-name | ||
| 192 | (setq x-display-name (getenv "DISPLAY")))) | ||
| 193 | ;; | ||
| 194 | ;; This is the place to handle Xresources | ||
| 195 | ;; | ||
| 196 | ) | ||
| 197 | (error "Loading x-win.el but not compiled for X")) | ||
| 198 | |||
| 199 | |||
| 200 | ;; This is the function which creates the first X window. It is called | ||
| 201 | ;; from startup.el after the user's init file is processed. | ||
| 202 | |||
| 203 | (defun x-pop-initial-window () | ||
| 204 | ;; xterm.c depends on using interrupt-driven input. | ||
| 205 | (set-input-mode t nil t) | ||
| 206 | (setq mouse-motion-handler 'x-track-pointer) | ||
| 207 | (setq x-switches-specified (append x-switches-specified | ||
| 208 | initial-screen-alist | ||
| 209 | screen-default-alist)) | ||
| 210 | ;; see screen.el for this function | ||
| 211 | (pop-initial-screen x-switches-specified) | ||
| 212 | (delete-screen terminal-screen)) | ||
| 213 | |||
| 214 | |||
| 215 | ;; | ||
| 216 | ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. | ||
| 217 | ;; | ||
| 218 | |||
| 219 | (defconst x-pointer-X-cursor 0) | ||
| 220 | (defconst x-pointer-arrow 2) | ||
| 221 | (defconst x-pointer-based-arrow-down 4) | ||
| 222 | (defconst x-pointer-based-arrow-up 6) | ||
| 223 | (defconst x-pointer-boat 8) | ||
| 224 | (defconst x-pointer-bogosity 10) | ||
| 225 | (defconst x-pointer-bottom-left-corner 12) | ||
| 226 | (defconst x-pointer-bottom-right-corner 14) | ||
| 227 | (defconst x-pointer-bottom-side 16) | ||
| 228 | (defconst x-pointer-bottom-tee 18) | ||
| 229 | (defconst x-pointer-box-spiral 20) | ||
| 230 | (defconst x-pointer-center-ptr 22) | ||
| 231 | (defconst x-pointer-circle 24) | ||
| 232 | (defconst x-pointer-clock 26) | ||
| 233 | (defconst x-pointer-coffee-mug 28) | ||
| 234 | (defconst x-pointer-cross 30) | ||
| 235 | (defconst x-pointer-cross-reverse 32) | ||
| 236 | (defconst x-pointer-crosshair 34) | ||
| 237 | (defconst x-pointer-diamond-cross 36) | ||
| 238 | (defconst x-pointer-dot 38) | ||
| 239 | (defconst x-pointer-dotbox 40) | ||
| 240 | (defconst x-pointer-double-arrow 42) | ||
| 241 | (defconst x-pointer-draft-large 44) | ||
| 242 | (defconst x-pointer-draft-small 46) | ||
| 243 | (defconst x-pointer-draped-box 48) | ||
| 244 | (defconst x-pointer-exchange 50) | ||
| 245 | (defconst x-pointer-fleur 52) | ||
| 246 | (defconst x-pointer-gobbler 54) | ||
| 247 | (defconst x-pointer-gumby 56) | ||
| 248 | (defconst x-pointer-hand1 58) | ||
| 249 | (defconst x-pointer-hand2 60) | ||
| 250 | (defconst x-pointer-heart 62) | ||
| 251 | (defconst x-pointer-icon 64) | ||
| 252 | (defconst x-pointer-iron-cross 66) | ||
| 253 | (defconst x-pointer-left-ptr 68) | ||
| 254 | (defconst x-pointer-left-side 70) | ||
| 255 | (defconst x-pointer-left-tee 72) | ||
| 256 | (defconst x-pointer-leftbutton 74) | ||
| 257 | (defconst x-pointer-ll-angle 76) | ||
| 258 | (defconst x-pointer-lr-angle 78) | ||
| 259 | (defconst x-pointer-man 80) | ||
| 260 | (defconst x-pointer-middlebutton 82) | ||
| 261 | (defconst x-pointer-mouse 84) | ||
| 262 | (defconst x-pointer-pencil 86) | ||
| 263 | (defconst x-pointer-pirate 88) | ||
| 264 | (defconst x-pointer-plus 90) | ||
| 265 | (defconst x-pointer-question-arrow 92) | ||
| 266 | (defconst x-pointer-right-ptr 94) | ||
| 267 | (defconst x-pointer-right-side 96) | ||
| 268 | (defconst x-pointer-right-tee 98) | ||
| 269 | (defconst x-pointer-rightbutton 100) | ||
| 270 | (defconst x-pointer-rtl-logo 102) | ||
| 271 | (defconst x-pointer-sailboat 104) | ||
| 272 | (defconst x-pointer-sb-down-arrow 106) | ||
| 273 | (defconst x-pointer-sb-h-double-arrow 108) | ||
| 274 | (defconst x-pointer-sb-left-arrow 110) | ||
| 275 | (defconst x-pointer-sb-right-arrow 112) | ||
| 276 | (defconst x-pointer-sb-up-arrow 114) | ||
| 277 | (defconst x-pointer-sb-v-double-arrow 116) | ||
| 278 | (defconst x-pointer-shuttle 118) | ||
| 279 | (defconst x-pointer-sizing 120) | ||
| 280 | (defconst x-pointer-spider 122) | ||
| 281 | (defconst x-pointer-spraycan 124) | ||
| 282 | (defconst x-pointer-star 126) | ||
| 283 | (defconst x-pointer-target 128) | ||
| 284 | (defconst x-pointer-tcross 130) | ||
| 285 | (defconst x-pointer-top-left-arrow 132) | ||
| 286 | (defconst x-pointer-top-left-corner 134) | ||
| 287 | (defconst x-pointer-top-right-corner 136) | ||
| 288 | (defconst x-pointer-top-side 138) | ||
| 289 | (defconst x-pointer-top-tee 140) | ||
| 290 | (defconst x-pointer-trek 142) | ||
| 291 | (defconst x-pointer-ul-angle 144) | ||
| 292 | (defconst x-pointer-umbrella 146) | ||
| 293 | (defconst x-pointer-ur-angle 148) | ||
| 294 | (defconst x-pointer-watch 150) | ||
| 295 | (defconst x-pointer-xterm 152) | ||
| 296 | |||
| 297 | ;; | ||
| 298 | ;; Available colors | ||
| 299 | ;; | ||
| 300 | |||
| 301 | (defvar x-colors '("aquamarine" | ||
| 302 | "Aquamarine" | ||
| 303 | "medium aquamarine" | ||
| 304 | "MediumAquamarine" | ||
| 305 | "black" | ||
| 306 | "Black" | ||
| 307 | "blue" | ||
| 308 | "Blue" | ||
| 309 | "cadet blue" | ||
| 310 | "CadetBlue" | ||
| 311 | "cornflower blue" | ||
| 312 | "CornflowerBlue" | ||
| 313 | "dark slate blue" | ||
| 314 | "DarkSlateBlue" | ||
| 315 | "light blue" | ||
| 316 | "LightBlue" | ||
| 317 | "light steel blue" | ||
| 318 | "LightSteelBlue" | ||
| 319 | "medium blue" | ||
| 320 | "MediumBlue" | ||
| 321 | "medium slate blue" | ||
| 322 | "MediumSlateBlue" | ||
| 323 | "midnight blue" | ||
| 324 | "MidnightBlue" | ||
| 325 | "navy blue" | ||
| 326 | "NavyBlue" | ||
| 327 | "navy" | ||
| 328 | "Navy" | ||
| 329 | "sky blue" | ||
| 330 | "SkyBlue" | ||
| 331 | "slate blue" | ||
| 332 | "SlateBlue" | ||
| 333 | "steel blue" | ||
| 334 | "SteelBlue" | ||
| 335 | "coral" | ||
| 336 | "Coral" | ||
| 337 | "cyan" | ||
| 338 | "Cyan" | ||
| 339 | "firebrick" | ||
| 340 | "Firebrick" | ||
| 341 | "brown" | ||
| 342 | "Brown" | ||
| 343 | "gold" | ||
| 344 | "Gold" | ||
| 345 | "goldenrod" | ||
| 346 | "Goldenrod" | ||
| 347 | "medium goldenrod" | ||
| 348 | "MediumGoldenrod" | ||
| 349 | "green" | ||
| 350 | "Green" | ||
| 351 | "dark green" | ||
| 352 | "DarkGreen" | ||
| 353 | "dark olive green" | ||
| 354 | "DarkOliveGreen" | ||
| 355 | "forest green" | ||
| 356 | "ForestGreen" | ||
| 357 | "lime green" | ||
| 358 | "LimeGreen" | ||
| 359 | "medium forest green" | ||
| 360 | "MediumForestGreen" | ||
| 361 | "medium sea green" | ||
| 362 | "MediumSeaGreen" | ||
| 363 | "medium spring green" | ||
| 364 | "MediumSpringGreen" | ||
| 365 | "pale green" | ||
| 366 | "PaleGreen" | ||
| 367 | "sea green" | ||
| 368 | "SeaGreen" | ||
| 369 | "spring green" | ||
| 370 | "SpringGreen" | ||
| 371 | "yellow green" | ||
| 372 | "YellowGreen" | ||
| 373 | "dark slate grey" | ||
| 374 | "DarkSlateGrey" | ||
| 375 | "dark slate gray" | ||
| 376 | "DarkSlateGray" | ||
| 377 | "dim grey" | ||
| 378 | "DimGrey" | ||
| 379 | "dim gray" | ||
| 380 | "DimGray" | ||
| 381 | "light grey" | ||
| 382 | "LightGrey" | ||
| 383 | "light gray" | ||
| 384 | "LightGray" | ||
| 385 | "gray" | ||
| 386 | "grey" | ||
| 387 | "Gray" | ||
| 388 | "Grey" | ||
| 389 | "khaki" | ||
| 390 | "Khaki" | ||
| 391 | "magenta" | ||
| 392 | "Magenta" | ||
| 393 | "maroon" | ||
| 394 | "Maroon" | ||
| 395 | "orange" | ||
| 396 | "Orange" | ||
| 397 | "orchid" | ||
| 398 | "Orchid" | ||
| 399 | "dark orchid" | ||
| 400 | "DarkOrchid" | ||
| 401 | "medium orchid" | ||
| 402 | "MediumOrchid" | ||
| 403 | "pink" | ||
| 404 | "Pink" | ||
| 405 | "plum" | ||
| 406 | "Plum" | ||
| 407 | "red" | ||
| 408 | "Red" | ||
| 409 | "indian red" | ||
| 410 | "IndianRed" | ||
| 411 | "medium violet red" | ||
| 412 | "MediumVioletRed" | ||
| 413 | "orange red" | ||
| 414 | "OrangeRed" | ||
| 415 | "violet red" | ||
| 416 | "VioletRed" | ||
| 417 | "salmon" | ||
| 418 | "Salmon" | ||
| 419 | "sienna" | ||
| 420 | "Sienna" | ||
| 421 | "tan" | ||
| 422 | "Tan" | ||
| 423 | "thistle" | ||
| 424 | "Thistle" | ||
| 425 | "turquoise" | ||
| 426 | "Turquoise" | ||
| 427 | "dark turquoise" | ||
| 428 | "DarkTurquoise" | ||
| 429 | "medium turquoise" | ||
| 430 | "MediumTurquoise" | ||
| 431 | "violet" | ||
| 432 | "Violet" | ||
| 433 | "blue violet" | ||
| 434 | "BlueViolet" | ||
| 435 | "wheat" | ||
| 436 | "Wheat" | ||
| 437 | "white" | ||
| 438 | "White" | ||
| 439 | "yellow" | ||
| 440 | "Yellow" | ||
| 441 | "green yellow" | ||
| 442 | "GreenYellow") | ||
| 443 | "The full list of X colors from the rgb.text file.") | ||
| 444 | |||
| 445 | (defun x-defined-colors () | ||
| 446 | "Return a list of colors supported by the current X-Display." | ||
| 447 | (let ((all-colors x-colors) | ||
| 448 | (this-color nil) | ||
| 449 | (defined-colors nil)) | ||
| 450 | (while all-colors | ||
| 451 | (setq this-color (car all-colors) | ||
| 452 | all-colors (cdr all-colors)) | ||
| 453 | (and (x-defined-color this-color) | ||
| 454 | (setq defined-colors (cons this-color defined-colors)))) | ||
| 455 | defined-colors)) | ||
| 456 | |||
| 457 | |||
| 458 | ;; | ||
| 459 | ;; Convenience functions for dynamically changing screen parameters | ||
| 460 | ;; | ||
| 461 | |||
| 462 | (defun x-set-default-font (font-name) | ||
| 463 | (interactive "sFont name: ") | ||
| 464 | (modify-screen-parameters (selected-screen) | ||
| 465 | (list (cons 'font font-name)))) | ||
| 466 | |||
| 467 | (defun x-set-background (color-name) | ||
| 468 | (interactive "sColor: ") | ||
| 469 | (modify-screen-parameters (selected-screen) | ||
| 470 | (list (cons 'background-color color-name)))) | ||
| 471 | |||
| 472 | (defun x-set-foreground (color-name) | ||
| 473 | (interactive "sColor: ") | ||
| 474 | (modify-screen-parameters (selected-screen) | ||
| 475 | (list (cons 'foreground-color color-name)))) | ||
| 476 | |||
| 477 | (defun x-set-cursor (color-name) | ||
| 478 | (interactive "sColor: ") | ||
| 479 | (modify-screen-parameters (selected-screen) | ||
| 480 | (list (cons 'cursor-color color-name)))) | ||
| 481 | |||
| 482 | (defun x-set-mouse (color-name) | ||
| 483 | (interactive "sColor: ") | ||
| 484 | (modify-screen-parameters (selected-screen) | ||
| 485 | (list (cons 'mouse-color color-name)))) | ||
| 486 | |||
| 487 | (defun x-set-mouse-shape (shape) | ||
| 488 | (interactive "sShape: ") | ||
| 489 | (setq x-pointer-shape (eval (intern shape))) | ||
| 490 | (modify-screen-parameters (selected-screen) | ||
| 491 | (list (assoc 'mouse-color (screen-parameters))))) | ||
| 492 | |||
| 493 | (defun x-set-border (color-name) | ||
| 494 | (interactive "sColor: ") | ||
| 495 | (modify-screen-parameters (selected-screen) | ||
| 496 | (list (cons 'border-color color-name)))) | ||
| 497 | |||
| 498 | (defun x-set-name (name) | ||
| 499 | (interactive "sName: ") | ||
| 500 | (modify-screen-parameters (selected-screen) | ||
| 501 | (list (cons 'name name)))) | ||
| 502 | |||
| 503 | (defun x-set-auto-raise (toggle) | ||
| 504 | (interactive "xt or nil? ") | ||
| 505 | (modify-screen-parameters (selected-screen) | ||
| 506 | (list (cons 'auto-raise toggle)))) | ||
| 507 | |||
| 508 | (defun x-set-auto-lower (toggle) | ||
| 509 | (interactive "xt or nil? ") | ||
| 510 | (modify-screen-parameters (selected-screen) | ||
| 511 | (list (cons 'auto-lower toggle)))) | ||
| 512 | |||
| 513 | (defun x-set-vertical-bar (toggle) | ||
| 514 | (interactive "xt or nil? ") | ||
| 515 | (modify-screen-parameters (selected-screen) | ||
| 516 | (list (cons 'vertical-scroll-bar toggle)))) | ||
| 517 | |||
| 518 | (defun x-set-horizontal-bar (toggle) | ||
| 519 | (interactive "xt or nil? ") | ||
| 520 | (modify-screen-parameters (selected-screen) | ||
| 521 | (list (cons 'horizontal-scroll-bar toggle)))) | ||
| 522 | |||
| 523 | ;; | ||
| 524 | ;; Function key processing under X. Function keys are received through | ||
| 525 | ;; in the input stream as Lisp symbols. | ||
| 526 | ;; | ||
| 527 | |||
| 528 | (defun define-function-key (map sym definition) | ||
| 529 | (let ((exist (assq sym (cdr map)))) | ||
| 530 | (if exist | ||
| 531 | (setcdr exist definition) | ||
| 532 | (setcdr map | ||
| 533 | (cons (cons sym definition) | ||
| 534 | (cdr map)))))) | ||
| 535 | |||
| 536 | ;; For unused keysyms. If this happens, it's probably a server or | ||
| 537 | ;; Xlib bug. | ||
| 538 | |||
| 539 | (defun weird-x-keysym () | ||
| 540 | (interactive) | ||
| 541 | (error "Bizarre X keysym received.")) | ||
| 542 | (define-function-key global-function-map 'xk-not-serious 'weird-x-keysym) | ||
| 543 | |||
| 544 | ;; Keypad type things | ||
| 545 | |||
| 546 | (define-function-key global-function-map 'xk-home 'beginning-of-line) | ||
| 547 | (define-function-key global-function-map 'xk-left 'backward-char) | ||
| 548 | (define-function-key global-function-map 'xk-up 'previous-line) | ||
| 549 | (define-function-key global-function-map 'xk-right 'forward-char) | ||
| 550 | (define-function-key global-function-map 'xk-down 'next-line) | ||
| 551 | (define-function-key global-function-map 'xk-prior 'previous-line) | ||
| 552 | (define-function-key global-function-map 'xk-next 'next-line) | ||
| 553 | (define-function-key global-function-map 'xk-end 'end-of-line) | ||
| 554 | (define-function-key global-function-map 'xk-begin 'beginning-of-line) | ||
| 555 | |||
| 556 | ;; IsMiscFunctionKey | ||
| 557 | |||
| 558 | (define-function-key global-function-map 'xk-select nil) | ||
| 559 | (define-function-key global-function-map 'xk-print nil) | ||
| 560 | (define-function-key global-function-map 'xk-execute nil) | ||
| 561 | (define-function-key global-function-map 'xk-insert nil) | ||
| 562 | (define-function-key global-function-map 'xk-undo nil) | ||
| 563 | (define-function-key global-function-map 'xk-redo nil) | ||
| 564 | (define-function-key global-function-map 'xk-menu nil) | ||
| 565 | (define-function-key global-function-map 'xk-find nil) | ||
| 566 | (define-function-key global-function-map 'xk-cancel nil) | ||
| 567 | (define-function-key global-function-map 'xk-help nil) | ||
| 568 | (define-function-key global-function-map 'xk-break nil) | ||
| 569 | |||
| 570 | ;; IsKeypadKey | ||
| 571 | |||
| 572 | (define-function-key global-function-map 'xk-kp-space | ||
| 573 | '(lambda nil (interactive) | ||
| 574 | (insert " "))) | ||
| 575 | (define-function-key global-function-map 'xk-kp-tab | ||
| 576 | '(lambda nil (interactive) | ||
| 577 | (insert "\t"))) | ||
| 578 | (define-function-key global-function-map 'xk-kp-enter | ||
| 579 | '(lambda nil (interactive) | ||
| 580 | (insert "\n"))) | ||
| 581 | |||
| 582 | (define-function-key global-function-map 'xk-kp-f1 'rmail) | ||
| 583 | (define-function-key global-function-map 'xk-kp-f2 nil) | ||
| 584 | (define-function-key global-function-map 'xk-kp-f3 nil) | ||
| 585 | (define-function-key global-function-map 'xk-kp-f4 nil) | ||
| 586 | |||
| 587 | (define-function-key global-function-map 'xk-kp-equal | ||
| 588 | '(lambda nil (interactive) | ||
| 589 | (insert "="))) | ||
| 590 | (define-function-key global-function-map 'xk-kp-multiply | ||
| 591 | '(lambda nil (interactive) | ||
| 592 | (insert "*"))) | ||
| 593 | (define-function-key global-function-map 'xk-kp-add | ||
| 594 | '(lambda nil (interactive) | ||
| 595 | (insert "+"))) | ||
| 596 | (define-function-key global-function-map 'xk-kp-separator | ||
| 597 | '(lambda nil (interactive) | ||
| 598 | (insert ";"))) | ||
| 599 | (define-function-key global-function-map 'xk-kp-subtract | ||
| 600 | '(lambda nil (interactive) | ||
| 601 | (insert "-"))) | ||
| 602 | (define-function-key global-function-map 'xk-kp-decimal | ||
| 603 | '(lambda nil (interactive) | ||
| 604 | (insert "."))) | ||
| 605 | (define-function-key global-function-map 'xk-kp-divide | ||
| 606 | '(lambda nil (interactive) | ||
| 607 | (insert "/"))) | ||
| 608 | |||
| 609 | (define-function-key global-function-map 'xk-kp-0 | ||
| 610 | '(lambda nil (interactive) | ||
| 611 | (insert "0"))) | ||
| 612 | (define-function-key global-function-map 'xk-kp-1 | ||
| 613 | '(lambda nil (interactive) | ||
| 614 | (insert "1"))) | ||
| 615 | (define-function-key global-function-map 'xk-kp-2 | ||
| 616 | '(lambda nil (interactive) | ||
| 617 | (insert "2"))) | ||
| 618 | (define-function-key global-function-map 'xk-kp-3 | ||
| 619 | '(lambda nil (interactive) | ||
| 620 | (insert "3"))) | ||
| 621 | (define-function-key global-function-map 'xk-kp-4 | ||
| 622 | '(lambda nil (interactive) | ||
| 623 | (insert "4"))) | ||
| 624 | (define-function-key global-function-map 'xk-kp-5 | ||
| 625 | '(lambda nil (interactive) | ||
| 626 | (insert "5"))) | ||
| 627 | (define-function-key global-function-map 'xk-kp-6 | ||
| 628 | '(lambda nil (interactive) | ||
| 629 | (insert "6"))) | ||
| 630 | (define-function-key global-function-map 'xk-kp-7 | ||
| 631 | '(lambda nil (interactive) | ||
| 632 | (insert "7"))) | ||
| 633 | (define-function-key global-function-map 'xk-kp-8 | ||
| 634 | '(lambda nil (interactive) | ||
| 635 | (insert "8"))) | ||
| 636 | (define-function-key global-function-map 'xk-kp-9 | ||
| 637 | '(lambda nil (interactive) | ||
| 638 | (insert "9"))) | ||
| 639 | |||
| 640 | ;; IsFunctionKey | ||
| 641 | |||
| 642 | (define-function-key global-function-map 'xk-f1 'rmail) | ||
| 643 | (define-function-key global-function-map 'xk-f2 nil) | ||
| 644 | (define-function-key global-function-map 'xk-f3 nil) | ||
| 645 | (define-function-key global-function-map 'xk-f4 nil) | ||
| 646 | (define-function-key global-function-map 'xk-f5 nil) | ||
| 647 | (define-function-key global-function-map 'xk-f6 nil) | ||
| 648 | (define-function-key global-function-map 'xk-f7 nil) | ||
| 649 | (define-function-key global-function-map 'xk-f8 nil) | ||
| 650 | (define-function-key global-function-map 'xk-f9 nil) | ||
| 651 | (define-function-key global-function-map 'xk-f10 nil) | ||
| 652 | (define-function-key global-function-map 'xk-f11 nil) | ||
| 653 | (define-function-key global-function-map 'xk-f12 nil) | ||
| 654 | (define-function-key global-function-map 'xk-f13 nil) | ||
| 655 | (define-function-key global-function-map 'xk-f14 nil) | ||
| 656 | (define-function-key global-function-map 'xk-f15 nil) | ||
| 657 | (define-function-key global-function-map 'xk-f16 nil) | ||
| 658 | (define-function-key global-function-map 'xk-f17 nil) | ||
| 659 | (define-function-key global-function-map 'xk-f18 nil) | ||
| 660 | (define-function-key global-function-map 'xk-f19 nil) | ||
| 661 | (define-function-key global-function-map 'xk-f20 nil) | ||
| 662 | (define-function-key global-function-map 'xk-f21 nil) | ||
| 663 | (define-function-key global-function-map 'xk-f22 nil) | ||
| 664 | (define-function-key global-function-map 'xk-f23 nil) | ||
| 665 | (define-function-key global-function-map 'xk-f24 nil) | ||
| 666 | (define-function-key global-function-map 'xk-f25 nil) | ||
| 667 | (define-function-key global-function-map 'xk-f26 nil) | ||
| 668 | (define-function-key global-function-map 'xk-f27 nil) | ||
| 669 | (define-function-key global-function-map 'xk-f28 nil) | ||
| 670 | (define-function-key global-function-map 'xk-f29 nil) | ||
| 671 | (define-function-key global-function-map 'xk-f30 nil) | ||
| 672 | (define-function-key global-function-map 'xk-f31 nil) | ||
| 673 | (define-function-key global-function-map 'xk-f32 nil) | ||
| 674 | (define-function-key global-function-map 'xk-f33 nil) | ||
| 675 | (define-function-key global-function-map 'xk-f34 nil) | ||
| 676 | (define-function-key global-function-map 'xk-f35 nil) | ||