annotate lisp/x11/x-misc.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; x-misc.el --- miscellaneous X functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; Copyright (C) 1995 Sun Microsystems.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;; Copyright (C) 1995, 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Author: Ben Wing <wing@666.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 (defun x-bogosity-check-resource (name class type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 "Check for a bogus resource specification."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 (let ((bogus (x-get-resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (concat "__no-such-friggin-locale__." name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (concat "__No-such-friggin-widget__." class)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 type 'global nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 (if bogus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (display-warning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 'resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (format "Bad resource specification encountered: something like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 Emacs*%s: %s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 You should replace the * with a . in order to get proper behavior when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 you use the specifier and/or `set-face-*' functions." name bogus)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defun x-init-specifier-from-resources (specifier type locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 &rest resource-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "Initialize a specifier from the resource database.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 LOCALE specifies the locale that is to be initialized and should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 a frame, a device, or 'global. TYPE is the type of the resource and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 should be one of 'string, 'boolean, 'integer, or 'natnum. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 remaining args should be conses of names and classes of resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 to be examined. The first resource with a value specified becomes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 the spec for SPECIFIER in LOCALE. (However, if SPECIFIER already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 has a spec in LOCALE, nothing is done.) Finally, if LOCALE is 'global,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 a check is done for bogus resource specifications."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (if (eq locale 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (mapcar #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (x-bogosity-check-resource (car x) (cdr x) type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 resource-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (if (not (specifier-spec-list specifier locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (catch 'done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (while resource-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (let* ((name (caar resource-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (class (cdar resource-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (x-get-resource name class type locale nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (if resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (add-spec-to-specifier specifier resource locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (throw 'done t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (setq resource-list (cdr resource-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (defun x-get-resource-and-bogosity-check (name class type &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (x-bogosity-check-resource name class type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (x-get-resource name class type locale nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; #### this function is not necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (defun x-get-resource-and-maybe-bogosity-check (name class type &optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (if (eq locale 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (x-bogosity-check-resource name class type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (x-get-resource name class type locale nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78