annotate lisp/x11/x-misc.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 376386a54a3c
children 4be1180a9e89
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 0
diff changeset
23 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 (defun x-bogosity-check-resource (name class type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 "Check for a bogus resource specification."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (let ((bogus (x-get-resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (concat "__no-such-friggin-locale__." name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 (concat "__No-such-friggin-widget__." class)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 type 'global nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (if bogus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 (display-warning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 'resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 (format "Bad resource specification encountered: something like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 Emacs*%s: %s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 You should replace the * with a . in order to get proper behavior when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 you use the specifier and/or `set-face-*' functions." name bogus)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defun x-init-specifier-from-resources (specifier type locale
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 &rest resource-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 "Initialize a specifier from the resource database.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 LOCALE specifies the locale that is to be initialized and should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 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
44 should be one of 'string, 'boolean, 'integer, or 'natnum. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 remaining args should be conses of names and classes of resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 to be examined. The first resource with a value specified becomes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 the spec for SPECIFIER in LOCALE. (However, if SPECIFIER already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 has a spec in LOCALE, nothing is done.) Finally, if LOCALE is 'global,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 a check is done for bogus resource specifications."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (if (eq locale 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (mapcar #'(lambda (x)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (x-bogosity-check-resource (car x) (cdr x) type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 resource-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (if (not (specifier-spec-list specifier locale))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (catch 'done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (while resource-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (let* ((name (caar resource-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (class (cdar resource-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (x-get-resource name class type locale nil t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (if resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (add-spec-to-specifier specifier resource locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (throw 'done t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (setq resource-list (cdr resource-list))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defun x-get-resource-and-bogosity-check (name class type &optional locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (x-bogosity-check-resource name class type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (x-get-resource name class type locale nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; #### this function is not necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun x-get-resource-and-maybe-bogosity-check (name class type &optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 locale)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (if (eq locale 'global)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (x-bogosity-check-resource name class type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (x-get-resource name class type locale nil t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79