Mercurial > hg > xemacs-beta
annotate lisp/x-mouse.el @ 5556:a142ad1a9140
Use dlsym() in preference to NSLookupSymbolInModule() on Darwin, if available.
ChangeLog addition:
2011-08-24 Aidan Kehoe <kehoea@parhasard.net>
* configure.ac:
On OS X, if dlopen() is available in dlfcn.h, use it in preference
to dyld; the latter API is deprecated.
Move DLSYM_NEEDS_UNDERSCORE together with HAVE_DLYD, it's not
needed if the dlsym() and dlopen() APIs are being used.
Define REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE in
this file, don't define them in terms of HAVE_DYLD in
src/config.h.in.
* configure: Regenerate.
src/ChangeLog addition:
2011-08-24 Aidan Kehoe <kehoea@parhasard.net>
* config.h.in:
Move REALPATH_CORRECTS_CASE, DEFAULT_FILE_SYSTEM_IGNORE_CASE to
../configure.ac rather than implementing them in terms of
HAVE_DYLD here.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 24 Aug 2011 23:41:29 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
428 | 1 ;;; x-mouse.el --- Mouse support for X window system. |
2 | |
3 ;; Copyright (C) 1985, 1992-4, 1997 Free Software Foundation, Inc. | |
4 ;; Copyright (C) 1995, 1996 Ben Wing. | |
5 | |
6 ;; Maintainer: XEmacs Development Team | |
7 ;; Keywords: mouse, dumped | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
11 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
12 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
13 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
14 ;; option) any later version. |
428 | 15 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
19 ;; for more details. |
428 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
502
diff
changeset
|
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
428 | 23 |
24 ;;; Synched up with: Not synched. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; This file is dumped with XEmacs (when X support is compiled in). | |
29 | |
30 ;;; Code: | |
31 | |
502 | 32 (globally-declare-fboundp |
33 '(x-store-cutbuffer x-get-resource)) | |
34 | |
428 | 35 ;;(define-key global-map 'button2 'x-set-point-and-insert-selection) |
36 ;; This is reserved for use by Hyperbole. | |
37 ;;(define-key global-map '(shift button2) 'x-mouse-kill) | |
38 (define-key global-map '(control button2) 'x-set-point-and-move-selection) | |
39 | |
40 (define-obsolete-function-alias 'x-insert-selection 'insert-selection) | |
41 | |
42 (defun x-mouse-kill (event) | |
43 "Kill the text between the point and mouse and copy it to the clipboard and | |
444 | 44 to the cut buffer." |
428 | 45 (interactive "@e") |
46 (let ((old-point (point))) | |
47 (mouse-set-point event) | |
48 (let ((s (buffer-substring old-point (point)))) | |
49 (own-clipboard s) | |
50 (x-store-cutbuffer s)) | |
51 (kill-region old-point (point)))) | |
52 | |
53 (make-obsolete 'x-set-point-and-insert-selection 'mouse-yank) | |
54 (defun x-set-point-and-insert-selection (event) | |
55 "Set point where clicked and insert the primary selection or the cut buffer." | |
56 (interactive "e") | |
57 (let ((mouse-yank-at-point nil)) | |
58 (mouse-yank event))) | |
59 | |
60 (defun x-set-point-and-move-selection (event) | |
61 "Set point where clicked and move the selected text to that location." | |
62 (interactive "e") | |
63 ;; Don't try to move the selection if x-kill-primary-selection if going | |
64 ;; to fail; just let the appropriate error message get issued. (We need | |
65 ;; to insert the selection and set point first, or the selection may | |
66 ;; get inserted at the wrong place.) | |
67 (and (selection-owner-p) | |
68 primary-selection-extent | |
69 (insert-selection t event)) | |
70 (kill-primary-selection)) | |
71 | |
72 (defun mouse-track-and-copy-to-cutbuffer (event) | |
73 "Make a selection like `mouse-track', but also copy it to the cutbuffer." | |
74 (interactive "e") | |
75 (mouse-track event) | |
76 (cond | |
77 ((null primary-selection-extent) | |
78 nil) | |
79 ((consp primary-selection-extent) | |
80 (save-excursion | |
81 (set-buffer (extent-object (car primary-selection-extent))) | |
82 (x-store-cutbuffer | |
83 (mapconcat | |
84 #'identity | |
85 (extract-rectangle | |
86 (extent-start-position (car primary-selection-extent)) | |
87 (extent-end-position (car (reverse primary-selection-extent)))) | |
88 "\n")))) | |
89 (t | |
90 (save-excursion | |
91 (set-buffer (extent-object primary-selection-extent)) | |
92 (x-store-cutbuffer | |
93 (buffer-substring (extent-start-position primary-selection-extent) | |
94 (extent-end-position primary-selection-extent))))))) | |
95 | |
96 | |
97 (defvar x-pointers-initialized nil) | |
98 | |
99 (defun x-init-pointer-shape (device) | |
100 "Initialize the mouse-pointers of DEVICE from the X resource database." | |
101 (if x-pointers-initialized ; only do it when the first device is created | |
102 nil | |
103 (set-glyph-image text-pointer-glyph | |
442 | 104 (or (x-get-resource "textPointer" "Cursor" 'string device nil 'warn) |
446 | 105 [cursor-font :data "xterm"])) |
428 | 106 (set-glyph-image selection-pointer-glyph |
442 | 107 (or (x-get-resource "selectionPointer" "Cursor" 'string device |
108 nil 'warn) | |
446 | 109 [cursor-font :data "top_left_arrow"])) |
428 | 110 (set-glyph-image nontext-pointer-glyph |
442 | 111 (or (x-get-resource "spacePointer" "Cursor" 'string device nil 'warn) |
446 | 112 [cursor-font :data "xterm"])) ; was "crosshair" |
428 | 113 (set-glyph-image modeline-pointer-glyph |
442 | 114 (or (x-get-resource "modeLinePointer" "Cursor" 'string device |
115 nil 'warn) | |
428 | 116 ;; "fleur")) |
446 | 117 [cursor-font :data "sb_v_double_arrow"])) |
428 | 118 (set-glyph-image gc-pointer-glyph |
442 | 119 (or (x-get-resource "gcPointer" "Cursor" 'string device nil 'warn) |
446 | 120 [cursor-font :data "watch"])) |
428 | 121 (when (featurep 'scrollbar) |
122 (set-glyph-image | |
123 scrollbar-pointer-glyph | |
442 | 124 (or (x-get-resource "scrollbarPointer" "Cursor" 'string device |
125 nil 'warn) | |
446 | 126 ;; bizarrely if we don't specify the specific locale (x) this |
127 ;; gets instantiated on the stream device. Bad puppy. | |
128 [cursor-font :data "top_left_arrow"]) 'global '(default x))) | |
428 | 129 (set-glyph-image busy-pointer-glyph |
442 | 130 (or (x-get-resource "busyPointer" "Cursor" 'string device nil 'warn) |
446 | 131 [cursor-font :data "watch"])) |
428 | 132 (set-glyph-image toolbar-pointer-glyph |
442 | 133 (or (x-get-resource "toolBarPointer" "Cursor" 'string device |
134 nil 'warn) | |
446 | 135 [cursor-font :data "left_ptr"])) |
428 | 136 (set-glyph-image divider-pointer-glyph |
442 | 137 (or (x-get-resource "dividerPointer" "Cursor" 'string device |
138 nil 'warn) | |
446 | 139 [cursor-font :data "sb_h_double_arrow"])) |
428 | 140 (let ((fg |
442 | 141 (x-get-resource "pointerColor" "Foreground" 'string device |
142 nil 'warn))) | |
428 | 143 (and fg |
144 (set-face-foreground 'pointer fg))) | |
145 (let ((bg | |
442 | 146 (x-get-resource "pointerBackground" "Background" 'string device |
147 nil 'warn))) | |
428 | 148 (and bg |
149 (set-face-background 'pointer bg))) | |
150 (setq x-pointers-initialized t)) | |
151 nil) | |
152 | |
153 ;;; x-mouse.el ends here |