Mercurial > emacs
annotate lisp/term/x-win.el @ 1717:aa7d6d57504b
* frame.h (struct frame): New fields `can_have_scrollbars' and
`has_vertical_scrollbars'.
(FRAME_CAN_HAVE_SCROLLBARS, FRAME_HAS_VERTICAL_SCROLLBARS): New
accessors, for both the MULTI_FRAME and non-MULTI_FRAME.
(VERTICAL_SCROLLBAR_WIDTH, WINDOW_VERTICAL_SCROLLBAR,
WINDOW_VERTICAL_SCROLLBAR_COLUMN,
WINDOW_VERTICAL_SCROLLBAR_HEIGHT): New macros.
* window.h (struct window): New field `vertical_scrollbar'.
* xterm.h (struct x_display): vertical_scrollbars,
judge_timestamp, vertical_scrollbar_extra: New fields.
(struct scrollbar): New struct.
(VERTICAL_SCROLLBAR_PIXEL_WIDTH, VERTICAL_SCROLLBAR_PIXEL_HEIGHT,
VERTICAL_SCROLLBAR_LEFT_BORDER, VERTICAL_SCROLLBAR_RIGHT_BORDER,
VERTICAL_SCROLLBAR_TOP_BORDER, VERTICAL_SCROLLBAR_BOTTOM_BORDER,
CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH,
PIXEL_TO_CHAR_HEIGHT): New accessors and macros.
* frame.c (make_frame): Initialize the `can_have_scrollbars' and
`has_vertical_scrollbars' fields of the frame.
* term.c (term_init): Note that TERMCAP terminals don't support
scrollbars.
(mouse_position_hook): Document new args.
(set_vertical_scrollbar_hook, condemn_scrollbars_hook,
redeem_scrollbar_hook, judge_scrollbars_hook): New hooks.
* termhooks.h: Declare and document them.
(enum scrollbar_part): New type.
(struct input_event): Describe the new form of the scrollbar_click
event type. Change `part' from a Lisp_Object to an enum
scrollbar_part. Add a new field `scrollbar'.
* keyboard.c (kbd_buffer_get_event): Pass appropriate new
parameters to *mouse_position_hook, and make_lispy_movement.
* xfns.c (x_set_vertical_scrollbar): New function.
(x_figure_window_size): Use new macros to calculate frame size.
(Fx_create_frame): Note that X Windows frames do support scroll
bars. Default to "yes".
* xterm.c: #include <X11/cursorfont.h> and "window.h".
(x_vertical_scrollbar_cursor): New variable.
(x_term_init): Initialize it.
(last_mouse_bar, last_mouse_bar_frame, last_mouse_part,
last_mouse_scroll_range_start, last_mouse_scroll_range_end): New
variables.
(XTmouse_position): Use them to return scrollbar movement events.
Take new arguments, for that purpose.
(x_window_to_scrollbar, x_scrollbar_create,
x_scrollbar_set_handle, x_scrollbar_remove, x_scrollbar_move,
XTset_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar,
XTjudge_scrollbars, x_scrollbar_expose,
x_scrollbar_background_expose, x_scrollbar_handle_click,
x_scrollbar_handle_motion): New functions to implement scrollbars.
(x_term_init): Set the termhooks.h hooks to point to them.
(x_set_window_size): Use new macros to calculate frame size. Set
vertical_scrollbar_extra field.
(x_make_frame_visible): Use the frame accessor
FRAME_HAS_VERTICAL_SCROLLBARS to decide if we need to map the
frame's subwindows as well.
(XTread_socket): Use new size-calculation macros from xterm.h when
processing ConfigureNotify events.
(x_wm_set_size_hint): Use PIXEL_TO_CHAR_WIDTH and
PIXEL_TO_CHAR_HEIGHT macros.
* ymakefile (xdisp.o): This now depends on termhooks.h.
(xterm.o): This now depends on window.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Thu, 24 Dec 1992 06:17:18 +0000 |
| parents | 2754d53edf5d |
| children | 86f58433c8aa |
| rev | line source |
|---|---|
| 54 | 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 ;; An alist of X options and the function which handles them. See | |
| 59 ;; ../startup.el. | |
| 60 | |
| 273 | 61 (if (not (eq window-system 'x)) |
| 62 (error "Loading x-win.el but not compiled for X")) | |
| 63 | |
| 779 | 64 (require 'frame) |
| 467 | 65 (require 'mouse) |
| 273 | 66 |
| 54 | 67 (setq command-switch-alist |
| 380 | 68 (append '(("-bw" . x-handle-numeric-switch) |
| 273 | 69 ("-d" . x-handle-display) |
| 70 ("-display" . x-handle-display) | |
| 71 ("-name" . x-handle-switch) | |
| 72 ("-T" . x-handle-switch) | |
| 73 ("-r" . x-handle-switch) | |
| 74 ("-rv" . x-handle-switch) | |
| 75 ("-reverse" . x-handle-switch) | |
| 76 ("-fn" . x-handle-switch) | |
| 77 ("-font" . x-handle-switch) | |
| 78 ("-ib" . x-handle-switch) | |
| 79 ("-g" . x-handle-geometry) | |
| 80 ("-geometry" . x-handle-geometry) | |
| 81 ("-fg" . x-handle-switch) | |
| 82 ("-foreground". x-handle-switch) | |
| 83 ("-bg" . x-handle-switch) | |
| 84 ("-background". x-handle-switch) | |
| 85 ("-ms" . x-handle-switch) | |
|
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
86 ("-itype" . x-handle-switch) |
| 273 | 87 ("-iconic" . x-handle-switch) |
| 88 ("-cr" . x-handle-switch) | |
| 89 ("-vb" . x-handle-switch) | |
| 90 ("-hb" . x-handle-switch) | |
| 91 ("-bd" . x-handle-switch)) | |
| 54 | 92 command-switch-alist)) |
| 93 | |
| 94 (defconst x-switch-definitions | |
| 95 '(("-name" name) | |
| 96 ("-T" name) | |
| 97 ("-r" lose) | |
| 98 ("-rv" lose) | |
| 99 ("-reverse" lose) | |
| 100 ("-fn" font) | |
| 101 ("-font" font) | |
| 102 ("-ib" internal-border-width) | |
| 103 ("-fg" foreground-color) | |
| 104 ("-foreground" foreground-color) | |
| 105 ("-bg" background-color) | |
| 106 ("-background" background-color) | |
| 107 ("-ms" mouse-color) | |
| 108 ("-cr" cursor-color) | |
|
1547
2754d53edf5d
(command-switch-alist, x-switch-definitions):
Richard M. Stallman <rms@gnu.org>
parents:
1546
diff
changeset
|
109 ("-itype" icon-type t) |
| 54 | 110 ("-iconic" iconic-startup t) |
| 111 ("-vb" vertical-scroll-bar t) | |
| 112 ("-hb" horizontal-scroll-bar t) | |
| 113 ("-bd" border-color) | |
| 114 ("-bw" border-width))) | |
| 115 | |
| 116 ;; Handler for switches of the form "-switch value" or "-switch". | |
| 117 (defun x-handle-switch (switch) | |
| 118 (let ((aelt (assoc switch x-switch-definitions))) | |
| 119 (if aelt | |
| 120 (if (nth 2 aelt) | |
| 779 | 121 (setq default-frame-alist |
| 54 | 122 (cons (cons (nth 1 aelt) (nth 2 aelt)) |
| 779 | 123 default-frame-alist)) |
| 124 (setq default-frame-alist | |
| 54 | 125 (cons (cons (nth 1 aelt) |
| 126 (car x-invocation-args)) | |
| 779 | 127 default-frame-alist) |
| 54 | 128 x-invocation-args (cdr x-invocation-args)))))) |
| 129 | |
| 130 ;; Handler for switches of the form "-switch n" | |
| 131 (defun x-handle-numeric-switch (switch) | |
| 132 (let ((aelt (assoc switch x-switch-definitions))) | |
| 133 (if aelt | |
| 779 | 134 (setq default-frame-alist |
| 54 | 135 (cons (cons (nth 1 aelt) |
| 136 (string-to-int (car x-invocation-args))) | |
| 779 | 137 default-frame-alist) |
| 54 | 138 x-invocation-args |
| 139 (cdr x-invocation-args))))) | |
| 140 | |
| 141 ;; Handle the geometry option | |
| 142 (defun x-handle-geometry (switch) | |
| 779 | 143 (setq initial-frame-alist (append initial-frame-alist |
| 54 | 144 (x-geometry (car x-invocation-args))) |
| 145 x-invocation-args (cdr x-invocation-args))) | |
| 146 | |
| 147 (defvar x-display-name nil | |
| 779 | 148 "The X display name specifying server and X frame.") |
| 54 | 149 |
| 150 (defun x-handle-display (switch) | |
| 151 (setq x-display-name (car x-invocation-args) | |
| 152 x-invocation-args (cdr x-invocation-args))) | |
| 153 | |
| 154 (defvar x-invocation-args nil) | |
| 155 | |
| 321 | 156 (defun x-handle-args (args) |
| 157 "Here the X-related command line options in ARGS are processed, | |
| 158 before the user's startup file is loaded. They are copied to | |
| 159 x-invocation args from which the X-related things are extracted, first | |
| 160 the switch (e.g., \"-fg\") in the following code, and possible values | |
| 161 (e.g., \"black\") in the option handler code (e.g., x-handle-switch). | |
| 162 This returns ARGS with the arguments that have been processed removed." | |
| 273 | 163 (setq x-invocation-args args |
| 164 args nil) | |
| 165 (while x-invocation-args | |
| 166 (let* ((this-switch (car x-invocation-args)) | |
| 167 (aelt (assoc this-switch command-switch-alist))) | |
| 168 (setq x-invocation-args (cdr x-invocation-args)) | |
| 169 (if aelt | |
| 170 (funcall (cdr aelt) this-switch) | |
| 171 (setq args (cons this-switch args))))) | |
| 172 (setq args (nreverse args))) | |
| 173 | |
| 279 | 174 |
| 54 | 175 |
| 176 ;; | |
| 177 ;; Standard X cursor shapes, courtesy of Mr. Fox, who wanted ALL of them. | |
| 178 ;; | |
| 179 | |
| 180 (defconst x-pointer-X-cursor 0) | |
| 181 (defconst x-pointer-arrow 2) | |
| 182 (defconst x-pointer-based-arrow-down 4) | |
| 183 (defconst x-pointer-based-arrow-up 6) | |
| 184 (defconst x-pointer-boat 8) | |
| 185 (defconst x-pointer-bogosity 10) | |
| 186 (defconst x-pointer-bottom-left-corner 12) | |
| 187 (defconst x-pointer-bottom-right-corner 14) | |
| 188 (defconst x-pointer-bottom-side 16) | |
| 189 (defconst x-pointer-bottom-tee 18) | |
| 190 (defconst x-pointer-box-spiral 20) | |
| 191 (defconst x-pointer-center-ptr 22) | |
| 192 (defconst x-pointer-circle 24) | |
| 193 (defconst x-pointer-clock 26) | |
| 194 (defconst x-pointer-coffee-mug 28) | |
| 195 (defconst x-pointer-cross 30) | |
| 196 (defconst x-pointer-cross-reverse 32) | |
| 197 (defconst x-pointer-crosshair 34) | |
| 198 (defconst x-pointer-diamond-cross 36) | |
| 199 (defconst x-pointer-dot 38) | |
| 200 (defconst x-pointer-dotbox 40) | |
| 201 (defconst x-pointer-double-arrow 42) | |
| 202 (defconst x-pointer-draft-large 44) | |
| 203 (defconst x-pointer-draft-small 46) | |
| 204 (defconst x-pointer-draped-box 48) | |
| 205 (defconst x-pointer-exchange 50) | |
| 206 (defconst x-pointer-fleur 52) | |
| 207 (defconst x-pointer-gobbler 54) | |
| 208 (defconst x-pointer-gumby 56) | |
| 209 (defconst x-pointer-hand1 58) | |
| 210 (defconst x-pointer-hand2 60) | |
| 211 (defconst x-pointer-heart 62) | |
| 212 (defconst x-pointer-icon 64) | |
| 213 (defconst x-pointer-iron-cross 66) | |
| 214 (defconst x-pointer-left-ptr 68) | |
| 215 (defconst x-pointer-left-side 70) | |
| 216 (defconst x-pointer-left-tee 72) | |
| 217 (defconst x-pointer-leftbutton 74) | |
| 218 (defconst x-pointer-ll-angle 76) | |
| 219 (defconst x-pointer-lr-angle 78) | |
| 220 (defconst x-pointer-man 80) | |
| 221 (defconst x-pointer-middlebutton 82) | |
| 222 (defconst x-pointer-mouse 84) | |
| 223 (defconst x-pointer-pencil 86) | |
| 224 (defconst x-pointer-pirate 88) | |
| 225 (defconst x-pointer-plus 90) | |
| 226 (defconst x-pointer-question-arrow 92) | |
| 227 (defconst x-pointer-right-ptr 94) | |
| 228 (defconst x-pointer-right-side 96) | |
| 229 (defconst x-pointer-right-tee 98) | |
| 230 (defconst x-pointer-rightbutton 100) | |
| 231 (defconst x-pointer-rtl-logo 102) | |
| 232 (defconst x-pointer-sailboat 104) | |
| 233 (defconst x-pointer-sb-down-arrow 106) | |
| 234 (defconst x-pointer-sb-h-double-arrow 108) | |
| 235 (defconst x-pointer-sb-left-arrow 110) | |
| 236 (defconst x-pointer-sb-right-arrow 112) | |
| 237 (defconst x-pointer-sb-up-arrow 114) | |
| 238 (defconst x-pointer-sb-v-double-arrow 116) | |
| 239 (defconst x-pointer-shuttle 118) | |
| 240 (defconst x-pointer-sizing 120) | |
| 241 (defconst x-pointer-spider 122) | |
| 242 (defconst x-pointer-spraycan 124) | |
| 243 (defconst x-pointer-star 126) | |
| 244 (defconst x-pointer-target 128) | |
| 245 (defconst x-pointer-tcross 130) | |
| 246 (defconst x-pointer-top-left-arrow 132) | |
| 247 (defconst x-pointer-top-left-corner 134) | |
| 248 (defconst x-pointer-top-right-corner 136) | |
| 249 (defconst x-pointer-top-side 138) | |
| 250 (defconst x-pointer-top-tee 140) | |
| 251 (defconst x-pointer-trek 142) | |
| 252 (defconst x-pointer-ul-angle 144) | |
| 253 (defconst x-pointer-umbrella 146) | |
| 254 (defconst x-pointer-ur-angle 148) | |
| 255 (defconst x-pointer-watch 150) | |
| 256 (defconst x-pointer-xterm 152) | |
| 257 | |
| 258 ;; | |
| 259 ;; Available colors | |
| 260 ;; | |
| 261 | |
| 262 (defvar x-colors '("aquamarine" | |
| 263 "Aquamarine" | |
| 264 "medium aquamarine" | |
| 265 "MediumAquamarine" | |
| 266 "black" | |
| 267 "Black" | |
| 268 "blue" | |
| 269 "Blue" | |
| 270 "cadet blue" | |
| 271 "CadetBlue" | |
| 272 "cornflower blue" | |
| 273 "CornflowerBlue" | |
| 274 "dark slate blue" | |
| 275 "DarkSlateBlue" | |
| 276 "light blue" | |
| 277 "LightBlue" | |
| 278 "light steel blue" | |
| 279 "LightSteelBlue" | |
| 280 "medium blue" | |
| 281 "MediumBlue" | |
| 282 "medium slate blue" | |
| 283 "MediumSlateBlue" | |
| 284 "midnight blue" | |
| 285 "MidnightBlue" | |
| 286 "navy blue" | |
| 287 "NavyBlue" | |
| 288 "navy" | |
| 289 "Navy" | |
| 290 "sky blue" | |
| 291 "SkyBlue" | |
| 292 "slate blue" | |
| 293 "SlateBlue" | |
| 294 "steel blue" | |
| 295 "SteelBlue" | |
| 296 "coral" | |
| 297 "Coral" | |
| 298 "cyan" | |
| 299 "Cyan" | |
| 300 "firebrick" | |
| 301 "Firebrick" | |
| 302 "brown" | |
| 303 "Brown" | |
| 304 "gold" | |
| 305 "Gold" | |
| 306 "goldenrod" | |
| 307 "Goldenrod" | |
| 308 "medium goldenrod" | |
| 309 "MediumGoldenrod" | |
| 310 "green" | |
| 311 "Green" | |
| 312 "dark green" | |
| 313 "DarkGreen" | |
| 314 "dark olive green" | |
| 315 "DarkOliveGreen" | |
| 316 "forest green" | |
| 317 "ForestGreen" | |
| 318 "lime green" | |
| 319 "LimeGreen" | |
| 320 "medium forest green" | |
| 321 "MediumForestGreen" | |
| 322 "medium sea green" | |
| 323 "MediumSeaGreen" | |
| 324 "medium spring green" | |
| 325 "MediumSpringGreen" | |
| 326 "pale green" | |
| 327 "PaleGreen" | |
| 328 "sea green" | |
| 329 "SeaGreen" | |
| 330 "spring green" | |
| 331 "SpringGreen" | |
| 332 "yellow green" | |
| 333 "YellowGreen" | |
| 334 "dark slate grey" | |
| 335 "DarkSlateGrey" | |
| 336 "dark slate gray" | |
| 337 "DarkSlateGray" | |
| 338 "dim grey" | |
| 339 "DimGrey" | |
| 340 "dim gray" | |
| 341 "DimGray" | |
| 342 "light grey" | |
| 343 "LightGrey" | |
| 344 "light gray" | |
| 345 "LightGray" | |
| 346 "gray" | |
| 347 "grey" | |
| 348 "Gray" | |
| 349 "Grey" | |
| 350 "khaki" | |
| 351 "Khaki" | |
| 352 "magenta" | |
| 353 "Magenta" | |
| 354 "maroon" | |
| 355 "Maroon" | |
| 356 "orange" | |
| 357 "Orange" | |
| 358 "orchid" | |
| 359 "Orchid" | |
| 360 "dark orchid" | |
| 361 "DarkOrchid" | |
| 362 "medium orchid" | |
| 363 "MediumOrchid" | |
| 364 "pink" | |
| 365 "Pink" | |
| 366 "plum" | |
| 367 "Plum" | |
| 368 "red" | |
| 369 "Red" | |
| 370 "indian red" | |
| 371 "IndianRed" | |
| 372 "medium violet red" | |
| 373 "MediumVioletRed" | |
| 374 "orange red" | |
| 375 "OrangeRed" | |
| 376 "violet red" | |
| 377 "VioletRed" | |
| 378 "salmon" | |
| 379 "Salmon" | |
| 380 "sienna" | |
| 381 "Sienna" | |
| 382 "tan" | |
| 383 "Tan" | |
| 384 "thistle" | |
| 385 "Thistle" | |
| 386 "turquoise" | |
| 387 "Turquoise" | |
| 388 "dark turquoise" | |
| 389 "DarkTurquoise" | |
| 390 "medium turquoise" | |
| 391 "MediumTurquoise" | |
| 392 "violet" | |
| 393 "Violet" | |
| 394 "blue violet" | |
| 395 "BlueViolet" | |
| 396 "wheat" | |
| 397 "Wheat" | |
| 398 "white" | |
| 399 "White" | |
| 400 "yellow" | |
| 401 "Yellow" | |
| 402 "green yellow" | |
| 403 "GreenYellow") | |
| 404 "The full list of X colors from the rgb.text file.") | |
| 405 | |
| 406 (defun x-defined-colors () | |
| 407 "Return a list of colors supported by the current X-Display." | |
| 408 (let ((all-colors x-colors) | |
| 409 (this-color nil) | |
| 410 (defined-colors nil)) | |
| 411 (while all-colors | |
| 412 (setq this-color (car all-colors) | |
| 413 all-colors (cdr all-colors)) | |
| 414 (and (x-defined-color this-color) | |
| 415 (setq defined-colors (cons this-color defined-colors)))) | |
| 416 defined-colors)) | |
| 396 | 417 |
| 1099 | 418 (defvar scroll-bar-mode nil) |
| 419 | |
| 420 ;;; ??? x-create-screen needs to be changed to use scroll-bar-mode | |
| 421 ;;; to decide (by default) whether to make a scroll bar. | |
| 422 (defun scroll-bar-mode (flag) | |
| 423 "Toggle display of vertical scroll bars on each frame. | |
| 424 This command applies to all frames that exist and frames to be | |
| 425 created in the future. | |
| 426 With a numeric argument, if the argument is negative, | |
| 427 turn off scroll bars; otherwise, turn on scroll bars." | |
| 428 (interactive "P") | |
| 429 (setq scroll-bar-mode (if (null flag) (not scroll-bar-mode) | |
| 430 (or (not (numberp flag)) (>= flag 0)))) | |
| 431 (let ((frames (frame-list))) | |
| 432 (while frames | |
| 433 (modify-frame-parameters (car frames) | |
| 434 (list (cons 'vertical-scrollbar scroll-bar-mode))) | |
| 435 (setq frames (cdr frames))))) | |
| 436 | |
| 396 | 437 ;;;; Function keys |
| 438 | |
| 439 ;;; Give some common function keys reasonable definitions. | |
| 440 (define-key global-map [home] 'beginning-of-line) | |
| 441 (define-key global-map [left] 'backward-char) | |
| 442 (define-key global-map [up] 'previous-line) | |
| 443 (define-key global-map [right] 'forward-char) | |
| 444 (define-key global-map [down] 'next-line) | |
| 445 (define-key global-map [prior] 'scroll-down) | |
| 446 (define-key global-map [next] 'scroll-up) | |
| 1153 | 447 (define-key global-map [M-next] 'scroll-other-window) |
| 396 | 448 (define-key global-map [begin] 'beginning-of-buffer) |
| 449 (define-key global-map [end] 'end-of-buffer) | |
| 54 | 450 |
| 872 | 451 (define-key global-map "\C-z" 'iconify-frame) |
| 1546 | 452 |
| 54 | 453 |
| 1546 | 454 ;;;; Selections and cut buffers |
| 707 | 455 |
| 727 | 456 ;;; We keep track of the last text selected here, so we can check the |
| 457 ;;; current selection against it, and avoid passing back our own text | |
| 458 ;;; from x-cut-buffer-or-selection-value. | |
| 459 (defvar x-last-selected-text nil) | |
| 460 | |
| 707 | 461 ;;; Make TEXT, a string, the primary and clipboard X selections. |
| 462 ;;; If you are running xclipboard, this means you can effectively | |
| 463 ;;; have a window on a copy of the kill-ring. | |
| 464 ;;; Also, set the value of X cut buffer 0, for backward compatibility | |
| 465 ;;; with older X application. | |
| 466 (defun x-select-text (text) | |
| 1265 | 467 (x-set-cut-buffer 0 text) |
| 707 | 468 (x-own-selection text 'clipboard) |
| 727 | 469 (x-own-selection text) |
| 470 (setq x-last-selected-text text)) | |
| 643 | 471 |
| 707 | 472 ;;; Return the value of the current X selection. For compatibility |
| 473 ;;; with older X applications, this checks cut buffer 0 before | |
| 474 ;;; retrieving the value of the primary selection. | |
| 475 (defun x-cut-buffer-or-selection-value () | |
| 1266 | 476 (let (text) |
| 477 | |
| 478 ;; Consult the cut buffer, then the selection. Treat empty strings | |
| 479 ;; as if they were unset. | |
| 480 (setq text (x-get-cut-buffer 0)) | |
| 481 (if (string= text "") (setq text nil)) | |
| 482 (or text (setq text (x-get-cut-buffer 0))) | |
| 483 (if (string= text "") (setq text nil)) | |
| 484 | |
| 485 (cond | |
| 486 ((not text) nil) | |
| 487 ((eq text x-last-selected-text) nil) | |
| 488 ((string= text x-last-selected-text) | |
| 489 ;; Record the newer string, so subsequent calls can use the `eq' test. | |
| 490 (setq x-last-selected-text text) | |
| 491 nil) | |
| 492 (t | |
| 493 (setq x-last-selected-text text))))) | |
| 707 | 494 |
| 1546 | 495 |
| 496 ;;; Do the actual X Windows setup here; the above code just defines | |
| 497 ;;; functions and variables that we use now. | |
| 498 | |
| 499 (setq command-line-args (x-handle-args command-line-args)) | |
| 500 (x-open-connection (or x-display-name | |
| 501 (setq x-display-name (getenv "DISPLAY")))) | |
| 502 | |
| 503 (setq frame-creation-function 'x-create-frame) | |
| 504 (setq suspend-hook | |
| 505 '(lambda () | |
| 506 (error "Suspending an emacs running under X makes no sense"))) | |
| 507 | |
| 707 | 508 ;;; Arrange for the kill and yank functions to set and check the clipboard. |
| 509 (setq interprogram-cut-function 'x-select-text) | |
| 510 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) | |
| 273 | 511 |
| 383 | 512 ;;; Turn off window-splitting optimization; X is usually fast enough |
| 513 ;;; that this is only annoying. | |
| 514 (setq split-window-keep-point t) |
