Mercurial > emacs
annotate src/xfns.c @ 44048:a821e85866cd
*** empty log message ***
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Wed, 20 Mar 2002 21:19:26 +0000 |
parents | ea6530f23937 |
children | 85388a495f68 |
rev | line source |
---|---|
389 | 1 /* Functions for the X window system. |
35068 | 2 Copyright (C) 1989, 92, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3 Free Software Foundation. |
389 | 4 |
5 This file is part of GNU Emacs. | |
6 | |
7 GNU Emacs is free software; you can redistribute it and/or modify | |
8 it under the terms of the GNU General Public License as published by | |
708 | 9 the Free Software Foundation; either version 2, or (at your option) |
389 | 10 any later version. |
11 | |
12 GNU Emacs is distributed in the hope that it will be useful, | |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 GNU General Public License for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13867
diff
changeset
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13867
diff
changeset
|
20 Boston, MA 02111-1307, USA. */ |
389 | 21 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26032
diff
changeset
|
22 #include <config.h> |
7899 | 23 #include <signal.h> |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
24 #include <stdio.h> |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
25 #include <math.h> |
7899 | 26 |
40700
6f6287da52d1
Include unistd.h, if it exists.
Richard M. Stallman <rms@gnu.org>
parents:
40656
diff
changeset
|
27 #ifdef HAVE_UNISTD_H |
6f6287da52d1
Include unistd.h, if it exists.
Richard M. Stallman <rms@gnu.org>
parents:
40656
diff
changeset
|
28 #include <unistd.h> |
6f6287da52d1
Include unistd.h, if it exists.
Richard M. Stallman <rms@gnu.org>
parents:
40656
diff
changeset
|
29 #endif |
6f6287da52d1
Include unistd.h, if it exists.
Richard M. Stallman <rms@gnu.org>
parents:
40656
diff
changeset
|
30 |
8091
f40cbe50c74f
(XLIB_ILLEGAL_ACCESS): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
8090
diff
changeset
|
31 /* This makes the fields of a Display accessible, in Xlib header files. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
32 |
8091
f40cbe50c74f
(XLIB_ILLEGAL_ACCESS): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
8090
diff
changeset
|
33 #define XLIB_ILLEGAL_ACCESS |
f40cbe50c74f
(XLIB_ILLEGAL_ACCESS): Defined.
Richard M. Stallman <rms@gnu.org>
parents:
8090
diff
changeset
|
34 |
389 | 35 #include "lisp.h" |
36 #include "xterm.h" | |
771 | 37 #include "frame.h" |
389 | 38 #include "window.h" |
39 #include "buffer.h" | |
26876 | 40 #include "intervals.h" |
389 | 41 #include "dispextern.h" |
515 | 42 #include "keyboard.h" |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2355
diff
changeset
|
43 #include "blockinput.h" |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
24170
diff
changeset
|
44 #include <epaths.h> |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
45 #include "charset.h" |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
46 #include "coding.h" |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
47 #include "fontset.h" |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
48 #include "systime.h" |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
49 #include "termhooks.h" |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
50 #include "atimer.h" |
389 | 51 |
52 #ifdef HAVE_X_WINDOWS | |
25451
786ab5197e4b
Include <stdlib.h> if available, and declare abort only if not. Include
Andreas Schwab <schwab@suse.de>
parents:
25390
diff
changeset
|
53 |
786ab5197e4b
Include <stdlib.h> if available, and declare abort only if not. Include
Andreas Schwab <schwab@suse.de>
parents:
25390
diff
changeset
|
54 #include <ctype.h> |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
55 #include <sys/types.h> |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
56 #include <sys/stat.h> |
389 | 57 |
2355
cec8c9490d8a
* xfns.c [VMS]: Get the gray_bits from [.bitmaps]gray.xbm.
Jim Blandy <jimb@redhat.com>
parents:
2341
diff
changeset
|
58 #ifndef VMS |
3821
8f353c2491d0
* xfns.c: Always #include "bitmaps/gray.xbm"; the bitmaps seem to
Jim Blandy <jimb@redhat.com>
parents:
3692
diff
changeset
|
59 #if 1 /* Used to be #ifdef EMACS_BITMAP_FILES, but this should always work. */ |
3512
2657b04dd324
[EMACS_BIT_MAPS]: Include gray.xbm from ./bitmaps.
Richard M. Stallman <rms@gnu.org>
parents:
3507
diff
changeset
|
60 #include "bitmaps/gray.xbm" |
2657b04dd324
[EMACS_BIT_MAPS]: Include gray.xbm from ./bitmaps.
Richard M. Stallman <rms@gnu.org>
parents:
3507
diff
changeset
|
61 #else |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
62 #include <X11/bitmaps/gray> |
3512
2657b04dd324
[EMACS_BIT_MAPS]: Include gray.xbm from ./bitmaps.
Richard M. Stallman <rms@gnu.org>
parents:
3507
diff
changeset
|
63 #endif |
2355
cec8c9490d8a
* xfns.c [VMS]: Get the gray_bits from [.bitmaps]gray.xbm.
Jim Blandy <jimb@redhat.com>
parents:
2341
diff
changeset
|
64 #else |
cec8c9490d8a
* xfns.c [VMS]: Get the gray_bits from [.bitmaps]gray.xbm.
Jim Blandy <jimb@redhat.com>
parents:
2341
diff
changeset
|
65 #include "[.bitmaps]gray.xbm" |
cec8c9490d8a
* xfns.c [VMS]: Get the gray_bits from [.bitmaps]gray.xbm.
Jim Blandy <jimb@redhat.com>
parents:
2341
diff
changeset
|
66 #endif |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
67 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
68 #ifdef USE_X_TOOLKIT |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
69 #include <X11/Shell.h> |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
70 |
12616
ca170048a679
[USE_MOTIF]: Don't include X11/Xaw/Paned.h, X11/Xaw/Label.h.
Richard M. Stallman <rms@gnu.org>
parents:
12546
diff
changeset
|
71 #ifndef USE_MOTIF |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
72 #include <X11/Xaw/Paned.h> |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
73 #include <X11/Xaw/Label.h> |
12616
ca170048a679
[USE_MOTIF]: Don't include X11/Xaw/Paned.h, X11/Xaw/Label.h.
Richard M. Stallman <rms@gnu.org>
parents:
12546
diff
changeset
|
74 #endif /* USE_MOTIF */ |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
75 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
76 #ifdef USG |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
77 #undef USG /* ####KLUDGE for Solaris 2.2 and up */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
78 #include <X11/Xos.h> |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
79 #define USG |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
80 #else |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
81 #include <X11/Xos.h> |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
82 #endif |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
83 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
84 #include "widget.h" |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
85 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
86 #include "../lwlib/lwlib.h" |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
87 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
88 #ifdef USE_MOTIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
89 #include <Xm/Xm.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
90 #include <Xm/DialogS.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
91 #include <Xm/FileSB.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
92 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
93 |
13508
b64345cf1ee9
(HACK_EDITRES): Don't define if NO_EDITRES is defined.
Richard M. Stallman <rms@gnu.org>
parents:
13227
diff
changeset
|
94 /* Do the EDITRES protocol if running X11R5 |
b64345cf1ee9
(HACK_EDITRES): Don't define if NO_EDITRES is defined.
Richard M. Stallman <rms@gnu.org>
parents:
13227
diff
changeset
|
95 Exception: HP-UX (at least version A.09.05) has X11R5 without EditRes */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
96 |
13508
b64345cf1ee9
(HACK_EDITRES): Don't define if NO_EDITRES is defined.
Richard M. Stallman <rms@gnu.org>
parents:
13227
diff
changeset
|
97 #if (XtSpecificationRelease >= 5) && !defined(NO_EDITRES) |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
98 #define HACK_EDITRES |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
99 extern void _XEditResCheckMessages (); |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
100 #endif /* R5 + Athena */ |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
101 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
102 /* Unique id counter for widgets created by the Lucid Widget Library. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
103 |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
104 extern LWLIB_ID widget_id_tick; |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
105 |
15720
f1549b7501af
(Fx_create_frame): Do xlwmenu hack only if USE_LUCID.
Karl Heuer <kwzh@gnu.org>
parents:
15706
diff
changeset
|
106 #ifdef USE_LUCID |
9742
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
107 /* This is part of a kludge--see lwlib/xlwmenu.c. */ |
15706
bf891f379d9f
(xlwmenu_default_font): Declare, but don't define.
Karl Heuer <kwzh@gnu.org>
parents:
15704
diff
changeset
|
108 extern XFontStruct *xlwmenu_default_font; |
15720
f1549b7501af
(Fx_create_frame): Do xlwmenu hack only if USE_LUCID.
Karl Heuer <kwzh@gnu.org>
parents:
15706
diff
changeset
|
109 #endif |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
110 |
5900
284c0d70a50a
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: Dont Call XtDestroyWidget but
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5899
diff
changeset
|
111 extern void free_frame_menubar (); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
112 extern double atof (); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
113 |
37210
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
114 #ifdef USE_MOTIF |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
115 |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
116 /* LessTif/Motif version info. */ |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
117 |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
118 static Lisp_Object Vmotif_version_string; |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
119 |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
120 #endif /* USE_MOTIF */ |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
121 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
122 #endif /* USE_X_TOOLKIT */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
123 |
4279 | 124 #ifdef HAVE_X11R4 |
125 #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) | |
126 #else | |
127 #define MAXREQUEST(dpy) ((dpy)->max_request_size) | |
128 #endif | |
129 | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
130 /* The gray bitmap `bitmaps/gray'. This is done because xterm.c uses |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
131 it, and including `bitmaps/gray' more than once is a problem when |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
132 config.h defines `static' as an empty replacement string. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
133 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
134 int gray_bitmap_width = gray_width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
135 int gray_bitmap_height = gray_height; |
34512
d069886667e6
(gray_bitmap_bits): Declare `char *'.
Gerd Moellmann <gerd@gnu.org>
parents:
34476
diff
changeset
|
136 char *gray_bitmap_bits = gray_bits; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
137 |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
138 /* The name we're using in resource queries. Most often "emacs". */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
139 |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
140 Lisp_Object Vx_resource_name; |
3170
647229114f47
* xfns.c: Make resource manager work correctly even when
Jim Blandy <jimb@redhat.com>
parents:
3141
diff
changeset
|
141 |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
142 /* The application class we're using in resource queries. |
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
143 Normally "Emacs". */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
144 |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
145 Lisp_Object Vx_resource_class; |
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
146 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
147 /* Non-zero means we're allowed to display an hourglass cursor. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
148 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
149 int display_hourglass_p; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
150 |
389 | 151 /* The background and shape of the mouse pointer, and shape when not |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
152 over text or in the modeline. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
153 |
389 | 154 Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
155 Lisp_Object Vx_hourglass_pointer_shape; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
156 |
7683
be3423efbdce
(Vx_sensitive_text_pointer_shape):
Richard M. Stallman <rms@gnu.org>
parents:
7599
diff
changeset
|
157 /* The shape when over mouse-sensitive text. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
158 |
7683
be3423efbdce
(Vx_sensitive_text_pointer_shape):
Richard M. Stallman <rms@gnu.org>
parents:
7599
diff
changeset
|
159 Lisp_Object Vx_sensitive_text_pointer_shape; |
389 | 160 |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
161 /* If non-nil, the pointer shape to indicate that windows can be |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
162 dragged horizontally. */ |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
163 |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
164 Lisp_Object Vx_window_horizontal_drag_shape; |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
165 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
166 /* Color of chars displayed in cursor box. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
167 |
389 | 168 Lisp_Object Vx_cursor_fore_pixel; |
169 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
170 /* Nonzero if using X. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
171 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
172 static int x_in_use; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
173 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
174 /* Non nil if no window manager is in use. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
175 |
389 | 176 Lisp_Object Vx_no_window_manager; |
177 | |
9563 | 178 /* Search path for bitmap files. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
179 |
9563 | 180 Lisp_Object Vx_bitmap_file_path; |
181 | |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
182 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
183 |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
184 Lisp_Object Vx_pixel_size_width_font_regexp; |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
185 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
186 Lisp_Object Qauto_raise; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
187 Lisp_Object Qauto_lower; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
188 Lisp_Object Qbar; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
189 Lisp_Object Qborder_color; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
190 Lisp_Object Qborder_width; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
191 Lisp_Object Qbox; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
192 Lisp_Object Qcursor_color; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
193 Lisp_Object Qcursor_type; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
194 Lisp_Object Qgeometry; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
195 Lisp_Object Qicon_left; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
196 Lisp_Object Qicon_top; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
197 Lisp_Object Qicon_type; |
12073 | 198 Lisp_Object Qicon_name; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
199 Lisp_Object Qinternal_border_width; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
200 Lisp_Object Qleft; |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
201 Lisp_Object Qright; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
202 Lisp_Object Qmouse_color; |
1874
19cf50641d6c
* frame.c (Fframe_parameters): Report the `minibuffer' parameter of
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
203 Lisp_Object Qnone; |
23793
3f48dda0547a
(Qouter_window_id): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23411
diff
changeset
|
204 Lisp_Object Qouter_window_id; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
205 Lisp_Object Qparent_id; |
8942
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
206 Lisp_Object Qscroll_bar_width; |
2328
82e4fed9cdd6
* xfns.c (Fx_parse_geometry): Renamed from Fx_geometry.
Jim Blandy <jimb@redhat.com>
parents:
2295
diff
changeset
|
207 Lisp_Object Qsuppress_icon; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
208 extern Lisp_Object Qtop; |
389 | 209 Lisp_Object Qundefined_color; |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1932
diff
changeset
|
210 Lisp_Object Qvertical_scroll_bars; |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
211 Lisp_Object Qvisibility; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
212 Lisp_Object Qwindow_id; |
771 | 213 Lisp_Object Qx_frame_parameter; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
214 Lisp_Object Qx_resource_name; |
7251
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
215 Lisp_Object Quser_position; |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
216 Lisp_Object Quser_size; |
26571
bc95d8e47cb9
Don't duplicate Qdisplay definition done elsewhere.
Dave Love <fx@gnu.org>
parents:
26526
diff
changeset
|
217 extern Lisp_Object Qdisplay; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
218 Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; |
28787 | 219 Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter; |
35402
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
220 Lisp_Object Qcompound_text, Qcancel_timer; |
38183
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
221 Lisp_Object Qwait_for_wm; |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
222 Lisp_Object Qfullscreen; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
223 Lisp_Object Qfullwidth; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
224 Lisp_Object Qfullheight; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
225 Lisp_Object Qfullboth; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
226 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
227 /* The below are defined in frame.c. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
228 |
1874
19cf50641d6c
* frame.c (Fframe_parameters): Report the `minibuffer' parameter of
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
229 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; |
14381 | 230 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; |
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25528
diff
changeset
|
231 extern Lisp_Object Qtool_bar_lines; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
232 |
389 | 233 extern Lisp_Object Vwindow_system_version; |
234 | |
18631
62bcc6aff013
(x_set_font): Funcall Qface_set_after_frame_default.
Richard M. Stallman <rms@gnu.org>
parents:
18612
diff
changeset
|
235 Lisp_Object Qface_set_after_frame_default; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
236 |
34895
53e52b3525bf
Use #if GLYPH_DEBUG instead of #ifdef GLYPH_DEBUG.
Gerd Moellmann <gerd@gnu.org>
parents:
34662
diff
changeset
|
237 #if GLYPH_DEBUG |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
238 int image_cache_refcount, dpyinfo_refcount; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
239 #endif |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
240 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
241 |
389 | 242 |
2999
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
243 /* Error if we are not connected to X. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
244 |
5948 | 245 void |
2999
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
246 check_x () |
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
247 { |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
248 if (! x_in_use) |
2999
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
249 error ("X windows are not in use or not initialized"); |
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
250 } |
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
251 |
13867
19a05b5a597d
(check_x_display_info, check_x_frame, x_set_font)
Richard M. Stallman <rms@gnu.org>
parents:
13781
diff
changeset
|
252 /* Nonzero if we can use mouse menus. |
19a05b5a597d
(check_x_display_info, check_x_frame, x_set_font)
Richard M. Stallman <rms@gnu.org>
parents:
13781
diff
changeset
|
253 You should not call this unless HAVE_MENUS is defined. */ |
7791
2b4e4a76468b
(using_x_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7683
diff
changeset
|
254 |
2b4e4a76468b
(using_x_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7683
diff
changeset
|
255 int |
13867
19a05b5a597d
(check_x_display_info, check_x_frame, x_set_font)
Richard M. Stallman <rms@gnu.org>
parents:
13781
diff
changeset
|
256 have_menus_p () |
7791
2b4e4a76468b
(using_x_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7683
diff
changeset
|
257 { |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
258 return x_in_use; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
259 } |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
260 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
261 /* Extract a frame as a FRAME_PTR, defaulting to the selected frame |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
262 and checking validity for X. */ |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
263 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
264 FRAME_PTR |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
265 check_x_frame (frame) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
266 Lisp_Object frame; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
267 { |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
268 FRAME_PTR f; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
269 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
270 if (NILP (frame)) |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
271 frame = selected_frame; |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
272 CHECK_LIVE_FRAME (frame); |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
273 f = XFRAME (frame); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
274 if (! FRAME_X_P (f)) |
13867
19a05b5a597d
(check_x_display_info, check_x_frame, x_set_font)
Richard M. Stallman <rms@gnu.org>
parents:
13781
diff
changeset
|
275 error ("Non-X frame used"); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
276 return f; |
7791
2b4e4a76468b
(using_x_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7683
diff
changeset
|
277 } |
2b4e4a76468b
(using_x_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7683
diff
changeset
|
278 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
279 /* Let the user specify an X display with a frame. |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
280 nil stands for the selected frame--or, if that is not an X frame, |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
281 the first X display on the list. */ |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
282 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
283 static struct x_display_info * |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
284 check_x_display_info (frame) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
285 Lisp_Object frame; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
286 { |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
287 struct x_display_info *dpyinfo = NULL; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
288 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
289 if (NILP (frame)) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
290 { |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
291 struct frame *sf = XFRAME (selected_frame); |
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
292 |
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
293 if (FRAME_X_P (sf) && FRAME_LIVE_P (sf)) |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
294 dpyinfo = FRAME_X_DISPLAY_INFO (sf); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
295 else if (x_display_list != 0) |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
296 dpyinfo = x_display_list; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
297 else |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
298 error ("X windows are not in use or not initialized"); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
299 } |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
300 else if (STRINGP (frame)) |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
301 dpyinfo = x_display_info_for_name (frame); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
302 else |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
303 { |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
304 FRAME_PTR f; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
305 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
306 CHECK_LIVE_FRAME (frame); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
307 f = XFRAME (frame); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
308 if (! FRAME_X_P (f)) |
13867
19a05b5a597d
(check_x_display_info, check_x_frame, x_set_font)
Richard M. Stallman <rms@gnu.org>
parents:
13781
diff
changeset
|
309 error ("Non-X frame used"); |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
310 dpyinfo = FRAME_X_DISPLAY_INFO (f); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
311 } |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
312 |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
313 return dpyinfo; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
314 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
315 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
316 |
771 | 317 /* Return the Emacs frame-object corresponding to an X window. |
318 It could be the frame's main window or an icon window. */ | |
319 | |
9948
982820033564
(x_window_to_frame, x_any_window_to_frame, x_top_window_to_frame): Use the new
Karl Heuer <kwzh@gnu.org>
parents:
9813
diff
changeset
|
320 /* This function can be called during GC, so use GC_xxx type test macros. */ |
2964
a0ff2bc5dd05
(x_window_to_frame): Use XGCTYPE.
Richard M. Stallman <rms@gnu.org>
parents:
2936
diff
changeset
|
321 |
771 | 322 struct frame * |
11197
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
323 x_window_to_frame (dpyinfo, wdesc) |
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
324 struct x_display_info *dpyinfo; |
389 | 325 int wdesc; |
326 { | |
771 | 327 Lisp_Object tail, frame; |
328 struct frame *f; | |
329 | |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
330 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
331 { |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
332 frame = XCAR (tail); |
9948
982820033564
(x_window_to_frame, x_any_window_to_frame, x_top_window_to_frame): Use the new
Karl Heuer <kwzh@gnu.org>
parents:
9813
diff
changeset
|
333 if (!GC_FRAMEP (frame)) |
389 | 334 continue; |
771 | 335 f = XFRAME (frame); |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
336 if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
11197
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
337 continue; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
338 if (f->output_data.x->hourglass_window == wdesc) |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
339 return f; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
340 #ifdef USE_X_TOOLKIT |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
341 if ((f->output_data.x->edit_widget |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
342 && XtWindow (f->output_data.x->edit_widget) == wdesc) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
343 /* A tooltip frame? */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
344 || (!f->output_data.x->edit_widget |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
345 && FRAME_X_WINDOW (f) == wdesc) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
346 || f->output_data.x->icon_desc == wdesc) |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
347 return f; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
348 #else /* not USE_X_TOOLKIT */ |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
349 if (FRAME_X_WINDOW (f) == wdesc |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
350 || f->output_data.x->icon_desc == wdesc) |
771 | 351 return f; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
352 #endif /* not USE_X_TOOLKIT */ |
389 | 353 } |
354 return 0; | |
355 } | |
356 | |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
357 #ifdef USE_X_TOOLKIT |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
358 /* Like x_window_to_frame but also compares the window with the widget's |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
359 windows. */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
360 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
361 struct frame * |
11197
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
362 x_any_window_to_frame (dpyinfo, wdesc) |
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
363 struct x_display_info *dpyinfo; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
364 int wdesc; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
365 { |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
366 Lisp_Object tail, frame; |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
367 struct frame *f, *found; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
368 struct x_output *x; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
369 |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
370 found = NULL; |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
371 for (tail = Vframe_list; GC_CONSP (tail) && !found; tail = XCDR (tail)) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
372 { |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
373 frame = XCAR (tail); |
9948
982820033564
(x_window_to_frame, x_any_window_to_frame, x_top_window_to_frame): Use the new
Karl Heuer <kwzh@gnu.org>
parents:
9813
diff
changeset
|
374 if (!GC_FRAMEP (frame)) |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
375 continue; |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
376 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
377 f = XFRAME (frame); |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
378 if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
379 { |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
380 /* This frame matches if the window is any of its widgets. */ |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
381 x = f->output_data.x; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
382 if (x->hourglass_window == wdesc) |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
383 found = f; |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
384 else if (x->widget) |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
385 { |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
386 if (wdesc == XtWindow (x->widget) |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
387 || wdesc == XtWindow (x->column_widget) |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
388 || wdesc == XtWindow (x->edit_widget)) |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
389 found = f; |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
390 /* Match if the window is this frame's menubar. */ |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
391 else if (lw_window_is_in_menubar (wdesc, x->menubar_widget)) |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
392 found = f; |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
393 } |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
394 else if (FRAME_X_WINDOW (f) == wdesc) |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
395 /* A tooltip frame. */ |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
396 found = f; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
397 } |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
398 } |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
399 |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
400 return found; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
401 } |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
402 |
11611
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
403 /* Likewise, but exclude the menu bar widget. */ |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
404 |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
405 struct frame * |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
406 x_non_menubar_window_to_frame (dpyinfo, wdesc) |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
407 struct x_display_info *dpyinfo; |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
408 int wdesc; |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
409 { |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
410 Lisp_Object tail, frame; |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
411 struct frame *f; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
412 struct x_output *x; |
11611
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
413 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
414 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
415 { |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
416 frame = XCAR (tail); |
11611
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
417 if (!GC_FRAMEP (frame)) |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
418 continue; |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
419 f = XFRAME (frame); |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
420 if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
11611
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
421 continue; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
422 x = f->output_data.x; |
11611
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
423 /* This frame matches if the window is any of its widgets. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
424 if (x->hourglass_window == wdesc) |
27798
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
425 return f; |
d00730392332
(x_window_to_frame, x_any_window_to_frame)
Gerd Moellmann <gerd@gnu.org>
parents:
27659
diff
changeset
|
426 else if (x->widget) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
427 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
428 if (wdesc == XtWindow (x->widget) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
429 || wdesc == XtWindow (x->column_widget) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
430 || wdesc == XtWindow (x->edit_widget)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
431 return f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
432 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
433 else if (FRAME_X_WINDOW (f) == wdesc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
434 /* A tooltip frame. */ |
11611
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
435 return f; |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
436 } |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
437 return 0; |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
438 } |
bf53e9945a3c
(x_non_menubar_window_to_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
11537
diff
changeset
|
439 |
12656
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
440 /* Likewise, but consider only the menu bar widget. */ |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
441 |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
442 struct frame * |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
443 x_menubar_window_to_frame (dpyinfo, wdesc) |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
444 struct x_display_info *dpyinfo; |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
445 int wdesc; |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
446 { |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
447 Lisp_Object tail, frame; |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
448 struct frame *f; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
449 struct x_output *x; |
12656
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
450 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
451 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
452 { |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
453 frame = XCAR (tail); |
12656
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
454 if (!GC_FRAMEP (frame)) |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
455 continue; |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
456 f = XFRAME (frame); |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
457 if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
12656
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
458 continue; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
459 x = f->output_data.x; |
12656
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
460 /* Match if the window is this frame's menubar. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
461 if (x->menubar_widget |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
462 && lw_window_is_in_menubar (wdesc, x->menubar_widget)) |
12656
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
463 return f; |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
464 } |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
465 return 0; |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
466 } |
5beb1d2be5c1
(x_menubar_window_to_frame): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12616
diff
changeset
|
467 |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
468 /* Return the frame whose principal (outermost) window is WDESC. |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
469 If WDESC is some other (smaller) window, we return 0. */ |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
470 |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
471 struct frame * |
11197
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
472 x_top_window_to_frame (dpyinfo, wdesc) |
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
473 struct x_display_info *dpyinfo; |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
474 int wdesc; |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
475 { |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
476 Lisp_Object tail, frame; |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
477 struct frame *f; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
478 struct x_output *x; |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
479 |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
480 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
481 { |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
482 frame = XCAR (tail); |
9948
982820033564
(x_window_to_frame, x_any_window_to_frame, x_top_window_to_frame): Use the new
Karl Heuer <kwzh@gnu.org>
parents:
9813
diff
changeset
|
483 if (!GC_FRAMEP (frame)) |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
484 continue; |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
485 f = XFRAME (frame); |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
486 if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
11197
1bdc265aab86
(x_window_to_frame): New arg DPYINFO. All callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11060
diff
changeset
|
487 continue; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
488 x = f->output_data.x; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
489 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
490 if (x->widget) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
491 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
492 /* This frame matches if the window is its topmost widget. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
493 if (wdesc == XtWindow (x->widget)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
494 return f; |
12019
63ee64941021
(x_top_window_to_frame): Don't match menu-bar widget.
Karl Heuer <kwzh@gnu.org>
parents:
12011
diff
changeset
|
495 #if 0 /* I don't know why it did this, |
63ee64941021
(x_top_window_to_frame): Don't match menu-bar widget.
Karl Heuer <kwzh@gnu.org>
parents:
12011
diff
changeset
|
496 but it seems logically wrong, |
63ee64941021
(x_top_window_to_frame): Don't match menu-bar widget.
Karl Heuer <kwzh@gnu.org>
parents:
12011
diff
changeset
|
497 and it causes trouble for MapNotify events. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
498 /* Match if the window is this frame's menubar. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
499 if (x->menubar_widget |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
500 && wdesc == XtWindow (x->menubar_widget)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
501 return f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
502 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
503 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
504 else if (FRAME_X_WINDOW (f) == wdesc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
505 /* Tooltip frame. */ |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
506 return f; |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
507 } |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
508 return 0; |
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
509 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
510 #endif /* USE_X_TOOLKIT */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
511 |
389 | 512 |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
513 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
514 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
515 id, which is just an int that this section returns. Bitmaps are |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
516 reference counted so they can be shared among frames. |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
517 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
518 Bitmap indices are guaranteed to be > 0, so a negative number can |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
519 be used to indicate no bitmap. |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
520 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
521 If you use x_create_bitmap_from_data, then you must keep track of |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
522 the bitmaps yourself. That is, creating a bitmap from the same |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
523 data more than once will not be caught. */ |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
524 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
525 |
9563 | 526 /* Functions to access the contents of a bitmap, given an id. */ |
527 | |
528 int | |
529 x_bitmap_height (f, id) | |
530 FRAME_PTR f; | |
531 int id; | |
532 { | |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
533 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height; |
9563 | 534 } |
535 | |
536 int | |
537 x_bitmap_width (f, id) | |
538 FRAME_PTR f; | |
539 int id; | |
540 { | |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
541 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width; |
9563 | 542 } |
543 | |
544 int | |
545 x_bitmap_pixmap (f, id) | |
546 FRAME_PTR f; | |
547 int id; | |
548 { | |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
549 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; |
9563 | 550 } |
551 | |
552 | |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
553 /* Allocate a new bitmap record. Returns index of new record. */ |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
554 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
555 static int |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
556 x_allocate_bitmap_record (f) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
557 FRAME_PTR f; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
558 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
559 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
560 int i; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
561 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
562 if (dpyinfo->bitmaps == NULL) |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
563 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
564 dpyinfo->bitmaps_size = 10; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
565 dpyinfo->bitmaps |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
566 = (struct x_bitmap_record *) xmalloc (dpyinfo->bitmaps_size * sizeof (struct x_bitmap_record)); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
567 dpyinfo->bitmaps_last = 1; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
568 return 1; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
569 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
570 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
571 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
572 return ++dpyinfo->bitmaps_last; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
573 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
574 for (i = 0; i < dpyinfo->bitmaps_size; ++i) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
575 if (dpyinfo->bitmaps[i].refcount == 0) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
576 return i + 1; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
577 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
578 dpyinfo->bitmaps_size *= 2; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
579 dpyinfo->bitmaps |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
580 = (struct x_bitmap_record *) xrealloc (dpyinfo->bitmaps, |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
581 dpyinfo->bitmaps_size * sizeof (struct x_bitmap_record)); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
582 return ++dpyinfo->bitmaps_last; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
583 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
584 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
585 /* Add one reference to the reference count of the bitmap with id ID. */ |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
586 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
587 void |
9563 | 588 x_reference_bitmap (f, id) |
589 FRAME_PTR f; | |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
590 int id; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
591 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
592 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
593 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
594 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
595 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
596 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
597 int |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
598 x_create_bitmap_from_data (f, bits, width, height) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
599 struct frame *f; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
600 char *bits; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
601 unsigned int width, height; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
602 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
603 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
604 Pixmap bitmap; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
605 int id; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
606 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
607 bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
608 bits, width, height); |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
609 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
610 if (! bitmap) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
611 return -1; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
612 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
613 id = x_allocate_bitmap_record (f); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
614 dpyinfo->bitmaps[id - 1].pixmap = bitmap; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
615 dpyinfo->bitmaps[id - 1].file = NULL; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
616 dpyinfo->bitmaps[id - 1].refcount = 1; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
617 dpyinfo->bitmaps[id - 1].depth = 1; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
618 dpyinfo->bitmaps[id - 1].height = height; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
619 dpyinfo->bitmaps[id - 1].width = width; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
620 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
621 return id; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
622 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
623 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
624 /* Create bitmap from file FILE for frame F. */ |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
625 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
626 int |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
627 x_create_bitmap_from_file (f, file) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
628 struct frame *f; |
9563 | 629 Lisp_Object file; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
630 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
631 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
632 unsigned int width, height; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
633 Pixmap bitmap; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
634 int xhot, yhot, result, id; |
9563 | 635 Lisp_Object found; |
636 int fd; | |
637 char *filename; | |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
638 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
639 /* Look for an existing bitmap with the same name. */ |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
640 for (id = 0; id < dpyinfo->bitmaps_last; ++id) |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
641 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
642 if (dpyinfo->bitmaps[id].refcount |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
643 && dpyinfo->bitmaps[id].file |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
644 && !strcmp (dpyinfo->bitmaps[id].file, (char *) XSTRING (file)->data)) |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
645 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
646 ++dpyinfo->bitmaps[id].refcount; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
647 return id + 1; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
648 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
649 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
650 |
9563 | 651 /* Search bitmap-file-path for the file, if appropriate. */ |
39812
66e0816837a8
Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39682
diff
changeset
|
652 fd = openp (Vx_bitmap_file_path, file, Qnil, &found, 0); |
9563 | 653 if (fd < 0) |
654 return -1; | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
26032
diff
changeset
|
655 emacs_close (fd); |
9563 | 656 |
657 filename = (char *) XSTRING (found)->data; | |
658 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
659 result = XReadBitmapFile (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
9563 | 660 filename, &width, &height, &bitmap, &xhot, &yhot); |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
661 if (result != BitmapSuccess) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
662 return -1; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
663 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
664 id = x_allocate_bitmap_record (f); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
665 dpyinfo->bitmaps[id - 1].pixmap = bitmap; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
666 dpyinfo->bitmaps[id - 1].refcount = 1; |
20629
69d52f3bdb46
(x_create_bitmap_from_file): Use size_byte on strings.
Richard M. Stallman <rms@gnu.org>
parents:
19825
diff
changeset
|
667 dpyinfo->bitmaps[id - 1].file |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
668 = (char *) xmalloc (STRING_BYTES (XSTRING (file)) + 1); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
669 dpyinfo->bitmaps[id - 1].depth = 1; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
670 dpyinfo->bitmaps[id - 1].height = height; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
671 dpyinfo->bitmaps[id - 1].width = width; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
672 strcpy (dpyinfo->bitmaps[id - 1].file, XSTRING (file)->data); |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
673 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
674 return id; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
675 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
676 |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
677 /* Remove reference to bitmap with id number ID. */ |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
678 |
21536
468585662fa8
(x_destroy_bitmap): Declare as void, not int.
Karl Heuer <kwzh@gnu.org>
parents:
21267
diff
changeset
|
679 void |
9563 | 680 x_destroy_bitmap (f, id) |
681 FRAME_PTR f; | |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
682 int id; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
683 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
684 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
685 |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
686 if (id > 0) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
687 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
688 --dpyinfo->bitmaps[id - 1].refcount; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
689 if (dpyinfo->bitmaps[id - 1].refcount == 0) |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
690 { |
12051
f193ce9efe24
(x_destroy_bitmap): Block and unblock input.
Karl Heuer <kwzh@gnu.org>
parents:
12046
diff
changeset
|
691 BLOCK_INPUT; |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
692 XFreePixmap (FRAME_X_DISPLAY (f), dpyinfo->bitmaps[id - 1].pixmap); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
693 if (dpyinfo->bitmaps[id - 1].file) |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
694 { |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
695 xfree (dpyinfo->bitmaps[id - 1].file); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
696 dpyinfo->bitmaps[id - 1].file = NULL; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
697 } |
12051
f193ce9efe24
(x_destroy_bitmap): Block and unblock input.
Karl Heuer <kwzh@gnu.org>
parents:
12046
diff
changeset
|
698 UNBLOCK_INPUT; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
699 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
700 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
701 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
702 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
703 /* Free all the bitmaps for the display specified by DPYINFO. */ |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
704 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
705 static void |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
706 x_destroy_all_bitmaps (dpyinfo) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
707 struct x_display_info *dpyinfo; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
708 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
709 int i; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
710 for (i = 0; i < dpyinfo->bitmaps_last; i++) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
711 if (dpyinfo->bitmaps[i].refcount > 0) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
712 { |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
713 XFreePixmap (dpyinfo->display, dpyinfo->bitmaps[i].pixmap); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
714 if (dpyinfo->bitmaps[i].file) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
715 xfree (dpyinfo->bitmaps[i].file); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
716 } |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
717 dpyinfo->bitmaps_last = 0; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
718 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
719 |
771 | 720 /* Connect the frame-parameter names for X frames |
389 | 721 to the ways of passing the parameter values to the window system. |
722 | |
723 The name of a parameter, as a Lisp symbol, | |
771 | 724 has an `x-frame-parameter' property which is an integer in Lisp |
14439
201ccc109ce7
(x_frame_parms): Alphabetize.
Richard M. Stallman <rms@gnu.org>
parents:
14381
diff
changeset
|
725 that is an index in this table. */ |
389 | 726 |
771 | 727 struct x_frame_parm_table |
389 | 728 { |
729 char *name; | |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
730 void (*setter) P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
389 | 731 }; |
732 | |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
733 static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
734 static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
735 static void x_change_window_heights P_ ((Lisp_Object, int)); |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
736 static void x_disable_image P_ ((struct frame *, struct image *)); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
737 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
28690
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
738 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
38183
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
739 static void x_set_wait_for_wm P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
740 static void x_set_fullscreen P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
741 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
742 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
743 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
744 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
745 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
746 void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
747 void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
748 static void x_set_fringe_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
749 void x_set_font P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
750 void x_set_border_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
751 void x_set_internal_border_width P_ ((struct frame *, Lisp_Object, |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
752 Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
753 void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
754 void x_set_autoraise P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
755 void x_set_autolower P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
756 void x_set_vertical_scroll_bars P_ ((struct frame *, Lisp_Object, |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
757 Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
758 void x_set_visibility P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
759 void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
760 void x_set_scroll_bar_width P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
761 void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
762 void x_set_unsplittable P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25528
diff
changeset
|
763 void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
764 void x_set_scroll_bar_foreground P_ ((struct frame *, Lisp_Object, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
765 Lisp_Object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
766 void x_set_scroll_bar_background P_ ((struct frame *, Lisp_Object, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
767 Lisp_Object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
768 static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
769 Lisp_Object, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
770 Lisp_Object, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
771 char *, char *, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
772 int)); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
773 static void x_set_screen_gamma P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
774 static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object, |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
775 Lisp_Object)); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
776 static void init_color_table P_ ((void)); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
777 static void free_color_table P_ ((void)); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
778 static unsigned long *colors_in_color_table P_ ((int *n)); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
779 static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b)); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
780 static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p)); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
781 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
782 |
389 | 783 |
771 | 784 static struct x_frame_parm_table x_frame_parms[] = |
389 | 785 { |
42123
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
786 {"auto-raise", x_set_autoraise}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
787 {"auto-lower", x_set_autolower}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
788 {"background-color", x_set_background_color}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
789 {"border-color", x_set_border_color}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
790 {"border-width", x_set_border_width}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
791 {"cursor-color", x_set_cursor_color}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
792 {"cursor-type", x_set_cursor_type}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
793 {"font", x_set_font}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
794 {"foreground-color", x_set_foreground_color}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
795 {"icon-name", x_set_icon_name}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
796 {"icon-type", x_set_icon_type}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
797 {"internal-border-width", x_set_internal_border_width}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
798 {"menu-bar-lines", x_set_menu_bar_lines}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
799 {"mouse-color", x_set_mouse_color}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
800 {"name", x_explicitly_set_name}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
801 {"scroll-bar-width", x_set_scroll_bar_width}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
802 {"title", x_set_title}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
803 {"unsplittable", x_set_unsplittable}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
804 {"vertical-scroll-bars", x_set_vertical_scroll_bars}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
805 {"visibility", x_set_visibility}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
806 {"tool-bar-lines", x_set_tool_bar_lines}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
807 {"scroll-bar-foreground", x_set_scroll_bar_foreground}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
808 {"scroll-bar-background", x_set_scroll_bar_background}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
809 {"screen-gamma", x_set_screen_gamma}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
810 {"line-spacing", x_set_line_spacing}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
811 {"left-fringe", x_set_fringe_width}, |
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
812 {"right-fringe", x_set_fringe_width}, |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
813 {"wait-for-wm", x_set_wait_for_wm}, |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
814 {"fullscreen", x_set_fullscreen}, |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
815 |
389 | 816 }; |
817 | |
771 | 818 /* Attach the `x-frame-parameter' properties to |
389 | 819 the Lisp symbol names of parameters relevant to X. */ |
820 | |
21846 | 821 void |
389 | 822 init_x_parm_symbols () |
823 { | |
824 int i; | |
825 | |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
826 for (i = 0; i < sizeof (x_frame_parms) / sizeof (x_frame_parms[0]); i++) |
771 | 827 Fput (intern (x_frame_parms[i].name), Qx_frame_parameter, |
389 | 828 make_number (i)); |
829 } | |
830 | |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
831 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
832 /* Really try to move where we want to be in case of fullscreen. Some WMs |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
833 moves the window where we tell them. Some (mwm, twm) moves the outer |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
834 window manager window there instead. |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
835 Try to compensate for those WM here. */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
836 static void |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
837 x_fullscreen_move (f, new_top, new_left) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
838 struct frame *f; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
839 int new_top; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
840 int new_left; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
841 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
842 if (new_top != f->output_data.x->top_pos |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
843 || new_left != f->output_data.x->left_pos) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
844 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
845 int move_x = new_left + f->output_data.x->x_pixels_outer_diff; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
846 int move_y = new_top + f->output_data.x->y_pixels_outer_diff; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
847 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
848 f->output_data.x->want_fullscreen |= FULLSCREEN_MOVE_WAIT; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
849 x_set_offset (f, move_x, move_y, 1); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
850 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
851 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
852 |
19095
2f58824bf3f6
(x_set_frame_parameters): Heading comment fixed.
Kenichi Handa <handa@m17n.org>
parents:
19026
diff
changeset
|
853 /* Change the parameters of frame F as specified by ALIST. |
29617
14aa31254532
(x_set_frame_parameters): Comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
29434
diff
changeset
|
854 If a parameter is not specially recognized, do nothing special; |
14aa31254532
(x_set_frame_parameters): Comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
29434
diff
changeset
|
855 otherwise call the `x_set_...' function for that parameter. |
14aa31254532
(x_set_frame_parameters): Comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
29434
diff
changeset
|
856 Except for certain geometry properties, always call store_frame_param |
14aa31254532
(x_set_frame_parameters): Comment fix.
Gerd Moellmann <gerd@gnu.org>
parents:
29434
diff
changeset
|
857 to store the new value in the parameter alist. */ |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
858 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
859 void |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
860 x_set_frame_parameters (f, alist) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
861 FRAME_PTR f; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
862 Lisp_Object alist; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
863 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
864 Lisp_Object tail; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
865 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
866 /* If both of these parameters are present, it's more efficient to |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
867 set them both at once. So we wait until we've looked at the |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
868 entire list before we set them. */ |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
869 int width, height; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
870 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
871 /* Same here. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
872 Lisp_Object left, top; |
3203
1055aa1b7547
* xfns.c (x_set_frame_parameters): Use the first
Jim Blandy <jimb@redhat.com>
parents:
3173
diff
changeset
|
873 |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
874 /* Same with these. */ |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
875 Lisp_Object icon_left, icon_top; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
876 |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
877 /* Record in these vectors all the parms specified. */ |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
878 Lisp_Object *parms; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
879 Lisp_Object *values; |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
880 int i, p; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
881 int left_no_change = 0, top_no_change = 0; |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
882 int icon_left_no_change = 0, icon_top_no_change = 0; |
42883
57c5f7f05f4c
xfns.c (x_set_frame_parameters): Just call x_fullscreen_adjust
Jan Djärv <jan.h.d@swipnet.se>
parents:
42721
diff
changeset
|
883 int fullscreen_is_being_set = 0; |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
884 |
24170
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
885 struct gcpro gcpro1, gcpro2; |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
886 |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
887 i = 0; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
888 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
889 i++; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
890 |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
891 parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
892 values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object)); |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
893 |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
894 /* Extract parm names and values into those vectors. */ |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
895 |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
896 i = 0; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
897 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
898 { |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
899 Lisp_Object elt; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
900 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
901 elt = Fcar (tail); |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
902 parms[i] = Fcar (elt); |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
903 values[i] = Fcdr (elt); |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
904 i++; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
905 } |
24170
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
906 /* TAIL and ALIST are not used again below here. */ |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
907 alist = tail = Qnil; |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
908 |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
909 GCPRO2 (*parms, *values); |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
910 gcpro1.nvars = i; |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
911 gcpro2.nvars = i; |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
912 |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
913 /* There is no need to gcpro LEFT, TOP, ICON_LEFT, or ICON_TOP, |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
914 because their values appear in VALUES and strings are not valid. */ |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
915 top = left = Qunbound; |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
916 icon_left = icon_top = Qunbound; |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
917 |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
918 /* Provide default values for HEIGHT and WIDTH. */ |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
919 if (FRAME_NEW_WIDTH (f)) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
920 width = FRAME_NEW_WIDTH (f); |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
921 else |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
922 width = FRAME_WIDTH (f); |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
923 |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
924 if (FRAME_NEW_HEIGHT (f)) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
925 height = FRAME_NEW_HEIGHT (f); |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
926 else |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
927 height = FRAME_HEIGHT (f); |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
928 |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
929 /* Process foreground_color and background_color before anything else. |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
930 They are independent of other properties, but other properties (e.g., |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
931 cursor_color) are dependent upon them. */ |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
932 /* Process default font as well, since fringe widths depends on it. */ |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
933 /* Also, process fullscreen, width and height depend upon that */ |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
934 for (p = 0; p < i; p++) |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
935 { |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
936 Lisp_Object prop, val; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
937 |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
938 prop = parms[p]; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
939 val = values[p]; |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
940 if (EQ (prop, Qforeground_color) |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
941 || EQ (prop, Qbackground_color) |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
942 || EQ (prop, Qfont) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
943 || EQ (prop, Qfullscreen)) |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
944 { |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
945 register Lisp_Object param_index, old_value; |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
946 |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
947 old_value = get_frame_param (f, prop); |
42894
b9c592cee6ec
xfns.c (x_set_frame_parameters): Typo in previous fix corrected.
Jan Djärv <jan.h.d@swipnet.se>
parents:
42883
diff
changeset
|
948 fullscreen_is_being_set |= EQ (prop, Qfullscreen); |
40802
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
949 |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
950 if (NILP (Fequal (val, old_value))) |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
951 { |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
952 store_frame_param (f, prop, val); |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
953 |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
954 param_index = Fget (prop, Qx_frame_parameter); |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
955 if (NATNUMP (param_index) |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
956 && (XFASTINT (param_index) |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
957 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
958 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
959 } |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
960 } |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
961 } |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
962 |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
963 /* Now process them in reverse of specified order. */ |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
964 for (i--; i >= 0; i--) |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
965 { |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
966 Lisp_Object prop, val; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
967 |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
968 prop = parms[i]; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
969 val = values[i]; |
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
970 |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
971 if (EQ (prop, Qwidth) && NUMBERP (val)) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
972 width = XFASTINT (val); |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
973 else if (EQ (prop, Qheight) && NUMBERP (val)) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
974 height = XFASTINT (val); |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
975 else if (EQ (prop, Qtop)) |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
976 top = val; |
3447
ed2a17aac4cd
(x_set_frame_parameters): Process all parms in reverse order.
Richard M. Stallman <rms@gnu.org>
parents:
3446
diff
changeset
|
977 else if (EQ (prop, Qleft)) |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
978 left = val; |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
979 else if (EQ (prop, Qicon_top)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
980 icon_top = val; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
981 else if (EQ (prop, Qicon_left)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
982 icon_left = val; |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
983 else if (EQ (prop, Qforeground_color) |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
984 || EQ (prop, Qbackground_color) |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
985 || EQ (prop, Qfont) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
986 || EQ (prop, Qfullscreen)) |
25289
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
987 /* Processed above. */ |
64b742df49ca
(x_set_frame_parameters): Set foreground and
Geoff Voelker <voelker@cs.washington.edu>
parents:
25200
diff
changeset
|
988 continue; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
989 else |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
990 { |
6519
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
991 register Lisp_Object param_index, old_value; |
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
992 |
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
993 old_value = get_frame_param (f, prop); |
40802
82e6baf4446f
(x_set_frame_parameters): Avoid infinite recursion.
Miles Bader <miles@gnu.org>
parents:
40715
diff
changeset
|
994 |
41089
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
995 store_frame_param (f, prop, val); |
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
996 |
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
997 param_index = Fget (prop, Qx_frame_parameter); |
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
998 if (NATNUMP (param_index) |
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
999 && (XFASTINT (param_index) |
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
1000 < sizeof (x_frame_parms)/sizeof (x_frame_parms[0]))) |
ead122ed3fe6
(x_set_frame_parameters): Revert change of 2001-11-07.
Gerd Moellmann <gerd@gnu.org>
parents:
41087
diff
changeset
|
1001 (*x_frame_parms[XINT (param_index)].setter)(f, val, old_value); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1002 } |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1003 } |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1004 |
4617
807ba8bcc309
(x_set_frame_parameters): Don't die if just one of
Richard M. Stallman <rms@gnu.org>
parents:
4606
diff
changeset
|
1005 /* Don't die if just one of these was set. */ |
807ba8bcc309
(x_set_frame_parameters): Don't die if just one of
Richard M. Stallman <rms@gnu.org>
parents:
4606
diff
changeset
|
1006 if (EQ (left, Qunbound)) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1007 { |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1008 left_no_change = 1; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1009 if (f->output_data.x->left_pos < 0) |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1010 left = Fcons (Qplus, Fcons (make_number (f->output_data.x->left_pos), Qnil)); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1011 else |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1012 XSETINT (left, f->output_data.x->left_pos); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1013 } |
4617
807ba8bcc309
(x_set_frame_parameters): Don't die if just one of
Richard M. Stallman <rms@gnu.org>
parents:
4606
diff
changeset
|
1014 if (EQ (top, Qunbound)) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1015 { |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1016 top_no_change = 1; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1017 if (f->output_data.x->top_pos < 0) |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1018 top = Fcons (Qplus, Fcons (make_number (f->output_data.x->top_pos), Qnil)); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1019 else |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1020 XSETINT (top, f->output_data.x->top_pos); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1021 } |
4617
807ba8bcc309
(x_set_frame_parameters): Don't die if just one of
Richard M. Stallman <rms@gnu.org>
parents:
4606
diff
changeset
|
1022 |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1023 /* If one of the icon positions was not set, preserve or default it. */ |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1024 if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1025 { |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1026 icon_left_no_change = 1; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1027 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1028 if (NILP (icon_left)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1029 XSETINT (icon_left, 0); |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1030 } |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1031 if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1032 { |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1033 icon_top_no_change = 1; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1034 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1035 if (NILP (icon_top)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1036 XSETINT (icon_top, 0); |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1037 } |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1038 |
42883
57c5f7f05f4c
xfns.c (x_set_frame_parameters): Just call x_fullscreen_adjust
Jan Djärv <jan.h.d@swipnet.se>
parents:
42721
diff
changeset
|
1039 if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1040 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1041 /* If the frame is visible already and the fullscreen parameter is |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1042 being set, it is too late to set WM manager hints to specify |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1043 size and position. |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1044 Here we first get the width, height and position that applies to |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1045 fullscreen. We then move the frame to the appropriate |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1046 position. Resize of the frame is taken care of in the code after |
42883
57c5f7f05f4c
xfns.c (x_set_frame_parameters): Just call x_fullscreen_adjust
Jan Djärv <jan.h.d@swipnet.se>
parents:
42721
diff
changeset
|
1047 this if-statement. */ |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1048 int new_left, new_top; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1049 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1050 x_fullscreen_adjust (f, &width, &height, &new_top, &new_left); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1051 x_fullscreen_move (f, new_top, new_left); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1052 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1053 |
11932
f3fb1e5dfde1
(x_set_frame_parameters) Fix typo.
Karl Heuer <kwzh@gnu.org>
parents:
11917
diff
changeset
|
1054 /* Don't set these parameters unless they've been explicitly |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1055 specified. The window might be mapped or resized while we're in |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1056 this function, and we don't want to override that unless the lisp |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1057 code has asked for it. |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1058 |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1059 Don't set these parameters unless they actually differ from the |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1060 window's current parameters; the window may not actually exist |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
1061 yet. */ |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1062 { |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1063 Lisp_Object frame; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1064 |
5107
2a019dd8ed51
(x_set_frame_parameters): Call check_frame_size
Richard M. Stallman <rms@gnu.org>
parents:
4771
diff
changeset
|
1065 check_frame_size (f, &height, &width); |
2a019dd8ed51
(x_set_frame_parameters): Call check_frame_size
Richard M. Stallman <rms@gnu.org>
parents:
4771
diff
changeset
|
1066 |
9285
75f1c0d90b3d
(x_set_frame_parameters, x_set_visibility, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
9240
diff
changeset
|
1067 XSETFRAME (frame, f); |
4617
807ba8bcc309
(x_set_frame_parameters): Don't die if just one of
Richard M. Stallman <rms@gnu.org>
parents:
4606
diff
changeset
|
1068 |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
1069 if (width != FRAME_WIDTH (f) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
1070 || height != FRAME_HEIGHT (f) |
14965
685888f786d3
(x_set_frame_parameters): Do call Fset_frame_size
Richard M. Stallman <rms@gnu.org>
parents:
14831
diff
changeset
|
1071 || FRAME_NEW_HEIGHT (f) || FRAME_NEW_WIDTH (f)) |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
1072 Fset_frame_size (frame, make_number (width), make_number (height)); |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1073 |
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1074 if ((!NILP (left) || !NILP (top)) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1075 && ! (left_no_change && top_no_change) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1076 && ! (NUMBERP (left) && XINT (left) == f->output_data.x->left_pos |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1077 && NUMBERP (top) && XINT (top) == f->output_data.x->top_pos)) |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1078 { |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1079 int leftpos = 0; |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1080 int toppos = 0; |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1081 |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1082 /* Record the signs. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1083 f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1084 if (EQ (left, Qminus)) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1085 f->output_data.x->size_hint_flags |= XNegative; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1086 else if (INTEGERP (left)) |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1087 { |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1088 leftpos = XINT (left); |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1089 if (leftpos < 0) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1090 f->output_data.x->size_hint_flags |= XNegative; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1091 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1092 else if (CONSP (left) && EQ (XCAR (left), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1093 && CONSP (XCDR (left)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1094 && INTEGERP (XCAR (XCDR (left)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1095 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1096 leftpos = - XINT (XCAR (XCDR (left))); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1097 f->output_data.x->size_hint_flags |= XNegative; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1098 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1099 else if (CONSP (left) && EQ (XCAR (left), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1100 && CONSP (XCDR (left)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1101 && INTEGERP (XCAR (XCDR (left)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1102 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1103 leftpos = XINT (XCAR (XCDR (left))); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1104 } |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1105 |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1106 if (EQ (top, Qminus)) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1107 f->output_data.x->size_hint_flags |= YNegative; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1108 else if (INTEGERP (top)) |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1109 { |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1110 toppos = XINT (top); |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1111 if (toppos < 0) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1112 f->output_data.x->size_hint_flags |= YNegative; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1113 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1114 else if (CONSP (top) && EQ (XCAR (top), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1115 && CONSP (XCDR (top)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1116 && INTEGERP (XCAR (XCDR (top)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1117 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1118 toppos = - XINT (XCAR (XCDR (top))); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1119 f->output_data.x->size_hint_flags |= YNegative; |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1120 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1121 else if (CONSP (top) && EQ (XCAR (top), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1122 && CONSP (XCDR (top)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1123 && INTEGERP (XCAR (XCDR (top)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1124 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1125 toppos = XINT (XCAR (XCDR (top))); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1126 } |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
1127 |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1128 |
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1129 /* Store the numeric value of the position. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1130 f->output_data.x->top_pos = toppos; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1131 f->output_data.x->left_pos = leftpos; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1132 |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1133 f->output_data.x->win_gravity = NorthWestGravity; |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1134 |
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1135 /* Actually set that position, and convert to absolute. */ |
11989
0deb4505c0f0
(x_set_frame_parameters): Pass -1 to x_set_offset.
Karl Heuer <kwzh@gnu.org>
parents:
11986
diff
changeset
|
1136 x_set_offset (f, leftpos, toppos, -1); |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
1137 } |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1138 |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1139 if ((!NILP (icon_left) || !NILP (icon_top)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1140 && ! (icon_left_no_change && icon_top_no_change)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
1141 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1142 } |
24170
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
1143 |
3689490f7f65
(x_set_frame_parameters): gcpro as needed.
Richard M. Stallman <rms@gnu.org>
parents:
23793
diff
changeset
|
1144 UNGCPRO; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1145 } |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
1146 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
1147 /* Store the screen positions of frame F into XPTR and YPTR. |
7408
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1148 These are the positions of the containing window manager window, |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1149 not Emacs's own window. */ |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1150 |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1151 void |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1152 x_real_positions (f, xptr, yptr) |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1153 FRAME_PTR f; |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1154 int *xptr, *yptr; |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1155 { |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1156 int win_x, win_y, outer_x, outer_y; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1157 int real_x = 0, real_y = 0; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1158 int had_errors = 0; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1159 Window win = f->output_data.x->parent_desc; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1160 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1161 int count; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1162 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1163 BLOCK_INPUT; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1164 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1165 count = x_catch_errors (FRAME_X_DISPLAY (f)); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1166 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1167 if (win == FRAME_X_DISPLAY_INFO (f)->root_window) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1168 win = FRAME_OUTER_WINDOW (f); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1169 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1170 /* This loop traverses up the containment tree until we hit the root |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1171 window. Window managers may intersect many windows between our window |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1172 and the root window. The window we find just before the root window |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1173 should be the outer WM window. */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1174 for (;;) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1175 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1176 Window wm_window, rootw; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1177 Window *tmp_children; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1178 unsigned int tmp_nchildren; |
43914
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1179 int success; |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1180 |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1181 success = XQueryTree (FRAME_X_DISPLAY (f), win, &rootw, |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1182 &wm_window, &tmp_children, &tmp_nchildren); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
1183 |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1184 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1185 |
43914
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1186 /* Don't free tmp_children if XQueryTree failed. */ |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1187 if (! success) |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1188 break; |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1189 |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1190 XFree ((char *) tmp_children); |
fed15ed090bc
(x_real_positions): Handle failure in XQueryTree.
Richard M. Stallman <rms@gnu.org>
parents:
43670
diff
changeset
|
1191 |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1192 if (wm_window == rootw || had_errors) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1193 break; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1194 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1195 win = wm_window; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1196 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1197 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1198 if (! had_errors) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1199 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1200 int ign; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1201 Window child, rootw; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1202 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1203 /* Get the real coordinates for the WM window upper left corner */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1204 XGetGeometry (FRAME_X_DISPLAY (f), win, |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1205 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1206 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1207 /* Translate real coordinates to coordinates relative to our |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1208 window. For our window, the upper left corner is 0, 0. |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1209 Since the upper left corner of the WM window is outside |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1210 our window, win_x and win_y will be negative: |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1211 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1212 ------------------ ---> x |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1213 | title | |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1214 | ----------------- v y |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1215 | | our window |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1216 */ |
17954
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1217 XTranslateCoordinates (FRAME_X_DISPLAY (f), |
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1218 |
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1219 /* From-window, to-window. */ |
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1220 FRAME_X_DISPLAY_INFO (f)->root_window, |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1221 FRAME_X_WINDOW (f), |
17954
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1222 |
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1223 /* From-position, to-position. */ |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1224 real_x, real_y, &win_x, &win_y, |
17954
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1225 |
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1226 /* Child of win. */ |
7c919d7f8217
(x_real_positions): Directly compare the frame's window
Richard M. Stallman <rms@gnu.org>
parents:
17836
diff
changeset
|
1227 &child); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
1228 |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1229 if (FRAME_X_WINDOW (f) == FRAME_OUTER_WINDOW (f)) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1230 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1231 outer_x = win_x; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1232 outer_y = win_y; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1233 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1234 else |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1235 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1236 XTranslateCoordinates (FRAME_X_DISPLAY (f), |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1237 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1238 /* From-window, to-window. */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1239 FRAME_X_DISPLAY_INFO (f)->root_window, |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1240 FRAME_OUTER_WINDOW (f), |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1241 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1242 /* From-position, to-position. */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1243 real_x, real_y, &outer_x, &outer_y, |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1244 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1245 /* Child of win. */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1246 &child); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1247 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1248 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1249 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1250 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1251 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1252 x_uncatch_errors (FRAME_X_DISPLAY (f), count); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1253 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1254 UNBLOCK_INPUT; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1255 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1256 if (had_errors) return; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1257 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1258 f->output_data.x->x_pixels_diff = -win_x; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1259 f->output_data.x->y_pixels_diff = -win_y; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1260 f->output_data.x->x_pixels_outer_diff = -outer_x; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1261 f->output_data.x->y_pixels_outer_diff = -outer_y; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1262 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1263 *xptr = real_x; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1264 *yptr = real_y; |
7408
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1265 } |
65c133b66371
(x_real_positions): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7308
diff
changeset
|
1266 |
771 | 1267 /* Insert a description of internally-recorded parameters of frame X |
389 | 1268 into the parameter alist *ALISTPTR that is to be given to the user. |
1269 Only parameters that are specific to the X window system | |
771 | 1270 and whose values are not correctly recorded in the frame's |
389 | 1271 param_alist need to be considered here. */ |
1272 | |
21536
468585662fa8
(x_destroy_bitmap): Declare as void, not int.
Karl Heuer <kwzh@gnu.org>
parents:
21267
diff
changeset
|
1273 void |
771 | 1274 x_report_frame_params (f, alistptr) |
1275 struct frame *f; | |
389 | 1276 Lisp_Object *alistptr; |
1277 { | |
1278 char buf[16]; | |
11986
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1279 Lisp_Object tem; |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1280 |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1281 /* Represent negative positions (off the top or left screen edge) |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1282 in a way that Fmodify_frame_parameters will understand correctly. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1283 XSETINT (tem, f->output_data.x->left_pos); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1284 if (f->output_data.x->left_pos >= 0) |
11986
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1285 store_in_alist (alistptr, Qleft, tem); |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1286 else |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1287 store_in_alist (alistptr, Qleft, Fcons (Qplus, Fcons (tem, Qnil))); |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1288 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1289 XSETINT (tem, f->output_data.x->top_pos); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1290 if (f->output_data.x->top_pos >= 0) |
11986
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1291 store_in_alist (alistptr, Qtop, tem); |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1292 else |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1293 store_in_alist (alistptr, Qtop, Fcons (Qplus, Fcons (tem, Qnil))); |
bfdf35b8c34b
(x_report_frame_params): Report top and left
Karl Heuer <kwzh@gnu.org>
parents:
11962
diff
changeset
|
1294 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1295 store_in_alist (alistptr, Qborder_width, |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1296 make_number (f->output_data.x->border_width)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1297 store_in_alist (alistptr, Qinternal_border_width, |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1298 make_number (f->output_data.x->internal_border_width)); |
41833
ad13493331f7
(x_report_frame_params): Make the scroll-bar-width frame parameter have a numeric value
Kim F. Storm <storm@cua.dk>
parents:
41722
diff
changeset
|
1299 store_in_alist (alistptr, Qleft_fringe, |
ad13493331f7
(x_report_frame_params): Make the scroll-bar-width frame parameter have a numeric value
Kim F. Storm <storm@cua.dk>
parents:
41722
diff
changeset
|
1300 make_number (f->output_data.x->left_fringe_width)); |
ad13493331f7
(x_report_frame_params): Make the scroll-bar-width frame parameter have a numeric value
Kim F. Storm <storm@cua.dk>
parents:
41722
diff
changeset
|
1301 store_in_alist (alistptr, Qright_fringe, |
ad13493331f7
(x_report_frame_params): Make the scroll-bar-width frame parameter have a numeric value
Kim F. Storm <storm@cua.dk>
parents:
41722
diff
changeset
|
1302 make_number (f->output_data.x->right_fringe_width)); |
42006
06231786ed81
(Frame_parameters): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41833
diff
changeset
|
1303 store_in_alist (alistptr, Qscroll_bar_width, |
06231786ed81
(Frame_parameters): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41833
diff
changeset
|
1304 make_number (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
06231786ed81
(Frame_parameters): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41833
diff
changeset
|
1305 ? FRAME_SCROLL_BAR_PIXEL_WIDTH(f) |
06231786ed81
(Frame_parameters): Makes the scroll-bar-width frame parameter have
Eli Zaretskii <eliz@gnu.org>
parents:
41833
diff
changeset
|
1306 : 0)); |
9182
516fdeee89d6
(x_report_frame_params): Fix format/arg mismatch.
Karl Heuer <kwzh@gnu.org>
parents:
9166
diff
changeset
|
1307 sprintf (buf, "%ld", (long) FRAME_X_WINDOW (f)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1308 store_in_alist (alistptr, Qwindow_id, |
389 | 1309 build_string (buf)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1310 #ifdef USE_X_TOOLKIT |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1311 /* Tooltip frame may not have this widget. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1312 if (f->output_data.x->widget) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1313 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1314 sprintf (buf, "%ld", (long) FRAME_OUTER_WINDOW (f)); |
23793
3f48dda0547a
(Qouter_window_id): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23411
diff
changeset
|
1315 store_in_alist (alistptr, Qouter_window_id, |
3f48dda0547a
(Qouter_window_id): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23411
diff
changeset
|
1316 build_string (buf)); |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
1317 store_in_alist (alistptr, Qicon_name, f->icon_name); |
6522
eecaa7b19b6c
(x_report_frame_params): Sample visibility.
Karl Heuer <kwzh@gnu.org>
parents:
6519
diff
changeset
|
1318 FRAME_SAMPLE_VISIBILITY (f); |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
1319 store_in_alist (alistptr, Qvisibility, |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
1320 (FRAME_VISIBLE_P (f) ? Qt |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
1321 : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); |
11483
089f81a81ba6
(x_report_frame_params): Report value of `display' parm.
Richard M. Stallman <rms@gnu.org>
parents:
11417
diff
changeset
|
1322 store_in_alist (alistptr, Qdisplay, |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1323 XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
1324 |
18612
88efccff8970
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18594
diff
changeset
|
1325 if (f->output_data.x->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) |
88efccff8970
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18594
diff
changeset
|
1326 tem = Qnil; |
88efccff8970
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18594
diff
changeset
|
1327 else |
88efccff8970
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18594
diff
changeset
|
1328 XSETFASTINT (tem, f->output_data.x->parent_desc); |
88efccff8970
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18594
diff
changeset
|
1329 store_in_alist (alistptr, Qparent_id, tem); |
389 | 1330 } |
1331 | |
10920
bb3f9aaf0e46
(defined_color): If colormap is full, find closest match.
Richard M. Stallman <rms@gnu.org>
parents:
10742
diff
changeset
|
1332 |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1333 |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1334 /* Gamma-correct COLOR on frame F. */ |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1335 |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1336 void |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1337 gamma_correct (f, color) |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1338 struct frame *f; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1339 XColor *color; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1340 { |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1341 if (f->gamma) |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1342 { |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1343 color->red = pow (color->red / 65535.0, f->gamma) * 65535.0 + 0.5; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1344 color->green = pow (color->green / 65535.0, f->gamma) * 65535.0 + 0.5; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1345 color->blue = pow (color->blue / 65535.0, f->gamma) * 65535.0 + 0.5; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1346 } |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1347 } |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1348 |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1349 |
28096
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1350 /* Decide if color named COLOR_NAME is valid for use on frame F. If |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1351 so, return the RGB values in COLOR. If ALLOC_P is non-zero, |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1352 allocate the color. Value is zero if COLOR_NAME is invalid, or |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1353 no color could be allocated. */ |
8675
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
1354 |
389 | 1355 int |
28096
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1356 x_defined_color (f, color_name, color, alloc_p) |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1357 struct frame *f; |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1358 char *color_name; |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1359 XColor *color; |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1360 int alloc_p; |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1361 { |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1362 int success_p; |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1363 Display *dpy = FRAME_X_DISPLAY (f); |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1364 Colormap cmap = FRAME_X_COLORMAP (f); |
389 | 1365 |
1366 BLOCK_INPUT; | |
28096
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1367 success_p = XParseColor (dpy, cmap, color_name, color); |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1368 if (success_p && alloc_p) |
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1369 success_p = x_alloc_nearest_color (f, cmap, color); |
389 | 1370 UNBLOCK_INPUT; |
1371 | |
28096
244f283b3d03
(x_defined_color): Rewritten to use x_allocate_nearest_color.
Gerd Moellmann <gerd@gnu.org>
parents:
28050
diff
changeset
|
1372 return success_p; |
389 | 1373 } |
1374 | |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1375 |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1376 /* Return the pixel color value for color COLOR_NAME on frame F. If F |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1377 is a monochrome frame, return MONO_COLOR regardless of what ARG says. |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1378 Signal an error if color can't be allocated. */ |
389 | 1379 |
1380 int | |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1381 x_decode_color (f, color_name, mono_color) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1382 FRAME_PTR f; |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1383 Lisp_Object color_name; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1384 int mono_color; |
389 | 1385 { |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1386 XColor cdef; |
389 | 1387 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1388 CHECK_STRING (color_name); |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1389 |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1390 #if 0 /* Don't do this. It's wrong when we're not using the default |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1391 colormap, it makes freeing difficult, and it's probably not |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1392 an important optimization. */ |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1393 if (strcmp (XSTRING (color_name)->data, "black") == 0) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1394 return BLACK_PIX_DEFAULT (f); |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1395 else if (strcmp (XSTRING (color_name)->data, "white") == 0) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1396 return WHITE_PIX_DEFAULT (f); |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1397 #endif |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1398 |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1399 /* Return MONO_COLOR for monochrome frames. */ |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1400 if (FRAME_X_DISPLAY_INFO (f)->n_planes == 1) |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1401 return mono_color; |
389 | 1402 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
1403 /* x_defined_color is responsible for coping with failures |
11060
0a7048d331e6
(x_decode_color): Don't use cdef if defined_color failed.
Richard M. Stallman <rms@gnu.org>
parents:
11014
diff
changeset
|
1404 by looking for a near-miss. */ |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1405 if (x_defined_color (f, XSTRING (color_name)->data, &cdef, 1)) |
11060
0a7048d331e6
(x_decode_color): Don't use cdef if defined_color failed.
Richard M. Stallman <rms@gnu.org>
parents:
11014
diff
changeset
|
1406 return cdef.pixel; |
0a7048d331e6
(x_decode_color): Don't use cdef if defined_color failed.
Richard M. Stallman <rms@gnu.org>
parents:
11014
diff
changeset
|
1407 |
31902
f526f6f002d7
(x_decode_color): Don't return a Lisp_Object.
Gerd Moellmann <gerd@gnu.org>
parents:
31824
diff
changeset
|
1408 Fsignal (Qerror, Fcons (build_string ("Undefined color"), |
f526f6f002d7
(x_decode_color): Don't return a Lisp_Object.
Gerd Moellmann <gerd@gnu.org>
parents:
31824
diff
changeset
|
1409 Fcons (color_name, Qnil))); |
f526f6f002d7
(x_decode_color): Don't return a Lisp_Object.
Gerd Moellmann <gerd@gnu.org>
parents:
31824
diff
changeset
|
1410 return 0; |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1411 } |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1412 |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
1413 |
389 | 1414 |
28690
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1415 /* Change the `line-spacing' frame parameter of frame F. OLD_VALUE is |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1416 the previous value of that parameter, NEW_VALUE is the new value. */ |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1417 |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1418 static void |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1419 x_set_line_spacing (f, new_value, old_value) |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1420 struct frame *f; |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1421 Lisp_Object new_value, old_value; |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1422 { |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1423 if (NILP (new_value)) |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1424 f->extra_line_spacing = 0; |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1425 else if (NATNUMP (new_value)) |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1426 f->extra_line_spacing = XFASTINT (new_value); |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1427 else |
30601
7c995a54a0e8
Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents:
30573
diff
changeset
|
1428 Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"), |
28690
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1429 Fcons (new_value, Qnil))); |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1430 if (FRAME_VISIBLE_P (f)) |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1431 redraw_frame (f); |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1432 } |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1433 |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
1434 |
38183
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1435 /* Change the `wait-for-wm' frame parameter of frame F. OLD_VALUE is |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1436 the previous value of that parameter, NEW_VALUE is the new value. |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1437 See also the comment of wait_for_wm in struct x_output. */ |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1438 |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1439 static void |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1440 x_set_wait_for_wm (f, new_value, old_value) |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1441 struct frame *f; |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1442 Lisp_Object new_value, old_value; |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1443 { |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1444 f->output_data.x->wait_for_wm = !NILP (new_value); |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1445 } |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1446 |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1447 |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1448 /* Change the `fullscreen' frame parameter of frame F. OLD_VALUE is |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1449 the previous value of that parameter, NEW_VALUE is the new value. */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1450 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1451 static void |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1452 x_set_fullscreen (f, new_value, old_value) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1453 struct frame *f; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1454 Lisp_Object new_value, old_value; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1455 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1456 if (NILP (new_value)) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1457 f->output_data.x->want_fullscreen = FULLSCREEN_NONE; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1458 else if (EQ (new_value, Qfullboth)) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1459 f->output_data.x->want_fullscreen = FULLSCREEN_BOTH; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1460 else if (EQ (new_value, Qfullwidth)) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1461 f->output_data.x->want_fullscreen = FULLSCREEN_WIDTH; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1462 else if (EQ (new_value, Qfullheight)) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1463 f->output_data.x->want_fullscreen = FULLSCREEN_HEIGHT; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1464 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1465 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
1466 |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1467 /* Change the `screen-gamma' frame parameter of frame F. OLD_VALUE is |
38183
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1468 the previous value of that parameter, NEW_VALUE is the new |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
1469 value. */ |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1470 |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1471 static void |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1472 x_set_screen_gamma (f, new_value, old_value) |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1473 struct frame *f; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1474 Lisp_Object new_value, old_value; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1475 { |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1476 if (NILP (new_value)) |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1477 f->gamma = 0; |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1478 else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0) |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1479 /* The value 0.4545 is the normal viewing gamma. */ |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1480 f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1481 else |
30601
7c995a54a0e8
Replace `illegal' with `invalid'.
Gerd Moellmann <gerd@gnu.org>
parents:
30573
diff
changeset
|
1482 Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"), |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1483 Fcons (new_value, Qnil))); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1484 |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1485 clear_face_cache (0); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1486 } |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1487 |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
1488 |
771 | 1489 /* Functions called only from `x_set_frame_param' |
389 | 1490 to set individual parameters. |
1491 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1492 If FRAME_X_WINDOW (f) is 0, |
771 | 1493 the frame is being created and its X-window does not exist yet. |
389 | 1494 In that case, just record the parameter's new value |
1495 in the standard place; do not attempt to change the window. */ | |
1496 | |
1497 void | |
771 | 1498 x_set_foreground_color (f, arg, oldval) |
1499 struct frame *f; | |
389 | 1500 Lisp_Object arg, oldval; |
1501 { | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1502 struct x_output *x = f->output_data.x; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1503 unsigned long fg, old_fg; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1504 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1505 fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1506 old_fg = x->foreground_pixel; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1507 x->foreground_pixel = fg; |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1508 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1509 if (FRAME_X_WINDOW (f) != 0) |
389 | 1510 { |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1511 Display *dpy = FRAME_X_DISPLAY (f); |
37608
9ce50239786f
(x_set_foreground_color): Set frame's cursor_pixel.
Gerd Moellmann <gerd@gnu.org>
parents:
37556
diff
changeset
|
1512 |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1513 BLOCK_INPUT; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1514 XSetForeground (dpy, x->normal_gc, fg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1515 XSetBackground (dpy, x->reverse_gc, fg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1516 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1517 if (x->cursor_pixel == old_fg) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1518 { |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1519 unload_color (f, x->cursor_pixel); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1520 x->cursor_pixel = x_copy_color (f, fg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1521 XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1522 } |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1523 |
389 | 1524 UNBLOCK_INPUT; |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1525 |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1526 update_face_from_frame_parameter (f, Qforeground_color, arg); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1527 |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
1528 if (FRAME_VISIBLE_P (f)) |
771 | 1529 redraw_frame (f); |
389 | 1530 } |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1531 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1532 unload_color (f, old_fg); |
389 | 1533 } |
1534 | |
1535 void | |
771 | 1536 x_set_background_color (f, arg, oldval) |
1537 struct frame *f; | |
389 | 1538 Lisp_Object arg, oldval; |
1539 { | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1540 struct x_output *x = f->output_data.x; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1541 unsigned long bg; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1542 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1543 bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1544 unload_color (f, x->background_pixel); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1545 x->background_pixel = bg; |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1546 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1547 if (FRAME_X_WINDOW (f) != 0) |
389 | 1548 { |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1549 Display *dpy = FRAME_X_DISPLAY (f); |
37608
9ce50239786f
(x_set_foreground_color): Set frame's cursor_pixel.
Gerd Moellmann <gerd@gnu.org>
parents:
37556
diff
changeset
|
1550 |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1551 BLOCK_INPUT; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1552 XSetBackground (dpy, x->normal_gc, bg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1553 XSetForeground (dpy, x->reverse_gc, bg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1554 XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1555 XSetForeground (dpy, x->cursor_gc, bg); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1556 |
39159
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1557 #ifndef USE_TOOLKIT_SCROLL_BARS /* Turns out to be annoying with |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1558 toolkit scroll bars. */ |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1559 { |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1560 Lisp_Object bar; |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1561 for (bar = FRAME_SCROLL_BARS (f); |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1562 !NILP (bar); |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1563 bar = XSCROLL_BAR (bar)->next) |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1564 { |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1565 Window window = SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)); |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1566 XSetWindowBackground (dpy, window, bg); |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1567 } |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1568 } |
2c7a6a1b047e
(x_set_background_color): Don't change the colors
Gerd Moellmann <gerd@gnu.org>
parents:
38749
diff
changeset
|
1569 #endif /* USE_TOOLKIT_SCROLL_BARS */ |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1570 |
389 | 1571 UNBLOCK_INPUT; |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1572 update_face_from_frame_parameter (f, Qbackground_color, arg); |
3075
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
1573 |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
1574 if (FRAME_VISIBLE_P (f)) |
771 | 1575 redraw_frame (f); |
389 | 1576 } |
1577 } | |
1578 | |
1579 void | |
771 | 1580 x_set_mouse_color (f, arg, oldval) |
1581 struct frame *f; | |
389 | 1582 Lisp_Object arg, oldval; |
1583 { | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1584 struct x_output *x = f->output_data.x; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1585 Display *dpy = FRAME_X_DISPLAY (f); |
6759
e0938c42218c
(syms_of_xfns): Define Vx_cross_pointer_shape.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6610
diff
changeset
|
1586 Cursor cursor, nontext_cursor, mode_cursor, cross_cursor; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
1587 Cursor hourglass_cursor, horizontal_drag_cursor; |
17609
8c878d76d6a4
(x_real_positions, x_set_mouse_color, Fx_list_fonts):
Richard M. Stallman <rms@gnu.org>
parents:
17579
diff
changeset
|
1588 int count; |
25075
9f5d679349e9
(x_set_mouse_color): Always unload the old color.
Karl Heuer <kwzh@gnu.org>
parents:
24994
diff
changeset
|
1589 unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1590 unsigned long mask_color = x->background_pixel; |
25075
9f5d679349e9
(x_set_mouse_color): Always unload the old color.
Karl Heuer <kwzh@gnu.org>
parents:
24994
diff
changeset
|
1591 |
9f5d679349e9
(x_set_mouse_color): Always unload the old color.
Karl Heuer <kwzh@gnu.org>
parents:
24994
diff
changeset
|
1592 /* Don't let pointers be invisible. */ |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1593 if (mask_color == pixel) |
35261
ba1f849f9381
(x_set_mouse_color): Fix color allocation.
Gerd Moellmann <gerd@gnu.org>
parents:
35191
diff
changeset
|
1594 { |
ba1f849f9381
(x_set_mouse_color): Fix color allocation.
Gerd Moellmann <gerd@gnu.org>
parents:
35191
diff
changeset
|
1595 x_free_colors (f, &pixel, 1); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1596 pixel = x_copy_color (f, x->foreground_pixel); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1597 } |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1598 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1599 unload_color (f, x->mouse_pixel); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1600 x->mouse_pixel = pixel; |
389 | 1601 |
1602 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1603 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3512
diff
changeset
|
1604 /* It's not okay to crash if the user selects a screwy cursor. */ |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1605 count = x_catch_errors (dpy); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1606 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1607 if (!NILP (Vx_pointer_shape)) |
389 | 1608 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1609 CHECK_NUMBER (Vx_pointer_shape); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1610 cursor = XCreateFontCursor (dpy, XINT (Vx_pointer_shape)); |
389 | 1611 } |
1612 else | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1613 cursor = XCreateFontCursor (dpy, XC_xterm); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1614 x_check_errors (dpy, "bad text pointer cursor: %s"); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1615 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1616 if (!NILP (Vx_nontext_pointer_shape)) |
389 | 1617 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1618 CHECK_NUMBER (Vx_nontext_pointer_shape); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1619 nontext_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1620 = XCreateFontCursor (dpy, XINT (Vx_nontext_pointer_shape)); |
389 | 1621 } |
1622 else | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1623 nontext_cursor = XCreateFontCursor (dpy, XC_left_ptr); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1624 x_check_errors (dpy, "bad nontext pointer cursor: %s"); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1625 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1626 if (!NILP (Vx_hourglass_pointer_shape)) |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
1627 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1628 CHECK_NUMBER (Vx_hourglass_pointer_shape); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1629 hourglass_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1630 = XCreateFontCursor (dpy, XINT (Vx_hourglass_pointer_shape)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1631 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
1632 else |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1633 hourglass_cursor = XCreateFontCursor (dpy, XC_watch); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1634 x_check_errors (dpy, "bad hourglass pointer cursor: %s"); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1635 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1636 x_check_errors (dpy, "bad nontext pointer cursor: %s"); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1637 if (!NILP (Vx_mode_pointer_shape)) |
389 | 1638 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1639 CHECK_NUMBER (Vx_mode_pointer_shape); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1640 mode_cursor = XCreateFontCursor (dpy, XINT (Vx_mode_pointer_shape)); |
389 | 1641 } |
1642 else | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1643 mode_cursor = XCreateFontCursor (dpy, XC_xterm); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1644 x_check_errors (dpy, "bad modeline pointer cursor: %s"); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1645 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1646 if (!NILP (Vx_sensitive_text_pointer_shape)) |
6759
e0938c42218c
(syms_of_xfns): Define Vx_cross_pointer_shape.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6610
diff
changeset
|
1647 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1648 CHECK_NUMBER (Vx_sensitive_text_pointer_shape); |
7683
be3423efbdce
(Vx_sensitive_text_pointer_shape):
Richard M. Stallman <rms@gnu.org>
parents:
7599
diff
changeset
|
1649 cross_cursor |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1650 = XCreateFontCursor (dpy, XINT (Vx_sensitive_text_pointer_shape)); |
6759
e0938c42218c
(syms_of_xfns): Define Vx_cross_pointer_shape.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6610
diff
changeset
|
1651 } |
e0938c42218c
(syms_of_xfns): Define Vx_cross_pointer_shape.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6610
diff
changeset
|
1652 else |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1653 cross_cursor = XCreateFontCursor (dpy, XC_crosshair); |
389 | 1654 |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1655 if (!NILP (Vx_window_horizontal_drag_shape)) |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1656 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1657 CHECK_NUMBER (Vx_window_horizontal_drag_shape); |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1658 horizontal_drag_cursor |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1659 = XCreateFontCursor (dpy, XINT (Vx_window_horizontal_drag_shape)); |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1660 } |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1661 else |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1662 horizontal_drag_cursor |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1663 = XCreateFontCursor (dpy, XC_sb_h_double_arrow); |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
1664 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1665 /* Check and report errors with the above calls. */ |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1666 x_check_errors (dpy, "can't set cursor shape: %s"); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1667 x_uncatch_errors (dpy, count); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1668 |
389 | 1669 { |
1670 XColor fore_color, back_color; | |
1671 | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1672 fore_color.pixel = x->mouse_pixel; |
32606
78b4e9f31087
(x_to_xcolors, x_set_mouse_color, lookup_pixel_color)
Gerd Moellmann <gerd@gnu.org>
parents:
32549
diff
changeset
|
1673 x_query_color (f, &fore_color); |
389 | 1674 back_color.pixel = mask_color; |
32606
78b4e9f31087
(x_to_xcolors, x_set_mouse_color, lookup_pixel_color)
Gerd Moellmann <gerd@gnu.org>
parents:
32549
diff
changeset
|
1675 x_query_color (f, &back_color); |
78b4e9f31087
(x_to_xcolors, x_set_mouse_color, lookup_pixel_color)
Gerd Moellmann <gerd@gnu.org>
parents:
32549
diff
changeset
|
1676 |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1677 XRecolorCursor (dpy, cursor, &fore_color, &back_color); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1678 XRecolorCursor (dpy, nontext_cursor, &fore_color, &back_color); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1679 XRecolorCursor (dpy, mode_cursor, &fore_color, &back_color); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1680 XRecolorCursor (dpy, cross_cursor, &fore_color, &back_color); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1681 XRecolorCursor (dpy, hourglass_cursor, &fore_color, &back_color); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1682 XRecolorCursor (dpy, horizontal_drag_cursor, &fore_color, &back_color); |
389 | 1683 } |
1684 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1685 if (FRAME_X_WINDOW (f) != 0) |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1686 XDefineCursor (dpy, FRAME_X_WINDOW (f), cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1687 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1688 if (cursor != x->text_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1689 && x->text_cursor != 0) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1690 XFreeCursor (dpy, x->text_cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1691 x->text_cursor = cursor; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1692 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1693 if (nontext_cursor != x->nontext_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1694 && x->nontext_cursor != 0) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1695 XFreeCursor (dpy, x->nontext_cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1696 x->nontext_cursor = nontext_cursor; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1697 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1698 if (hourglass_cursor != x->hourglass_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1699 && x->hourglass_cursor != 0) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1700 XFreeCursor (dpy, x->hourglass_cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1701 x->hourglass_cursor = hourglass_cursor; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1702 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1703 if (mode_cursor != x->modeline_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1704 && x->modeline_cursor != 0) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1705 XFreeCursor (dpy, f->output_data.x->modeline_cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1706 x->modeline_cursor = mode_cursor; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1707 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1708 if (cross_cursor != x->cross_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1709 && x->cross_cursor != 0) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1710 XFreeCursor (dpy, x->cross_cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1711 x->cross_cursor = cross_cursor; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1712 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1713 if (horizontal_drag_cursor != x->horizontal_drag_cursor |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1714 && x->horizontal_drag_cursor != 0) |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1715 XFreeCursor (dpy, x->horizontal_drag_cursor); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1716 x->horizontal_drag_cursor = horizontal_drag_cursor; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1717 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1718 XFlush (dpy); |
389 | 1719 UNBLOCK_INPUT; |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1720 |
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1721 update_face_from_frame_parameter (f, Qmouse_color, arg); |
389 | 1722 } |
1723 | |
1724 void | |
771 | 1725 x_set_cursor_color (f, arg, oldval) |
1726 struct frame *f; | |
389 | 1727 Lisp_Object arg, oldval; |
1728 { | |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1729 unsigned long fore_pixel, pixel; |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1730 int fore_pixel_allocated_p = 0, pixel_allocated_p = 0; |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1731 struct x_output *x = f->output_data.x; |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1732 |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1733 if (!NILP (Vx_cursor_fore_pixel)) |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1734 { |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1735 fore_pixel = x_decode_color (f, Vx_cursor_fore_pixel, |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1736 WHITE_PIX_DEFAULT (f)); |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1737 fore_pixel_allocated_p = 1; |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1738 } |
389 | 1739 else |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1740 fore_pixel = x->background_pixel; |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1741 |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1742 pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1743 pixel_allocated_p = 1; |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1744 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1745 /* Make sure that the cursor color differs from the background color. */ |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1746 if (pixel == x->background_pixel) |
389 | 1747 { |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1748 if (pixel_allocated_p) |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1749 { |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1750 x_free_colors (f, &pixel, 1); |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1751 pixel_allocated_p = 0; |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1752 } |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1753 |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1754 pixel = x->mouse_pixel; |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1755 if (pixel == fore_pixel) |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1756 { |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1757 if (fore_pixel_allocated_p) |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1758 { |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1759 x_free_colors (f, &fore_pixel, 1); |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1760 fore_pixel_allocated_p = 0; |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1761 } |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1762 fore_pixel = x->background_pixel; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1763 } |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1764 } |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1765 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1766 unload_color (f, x->cursor_foreground_pixel); |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1767 if (!fore_pixel_allocated_p) |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1768 fore_pixel = x_copy_color (f, fore_pixel); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1769 x->cursor_foreground_pixel = fore_pixel; |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1770 |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1771 unload_color (f, x->cursor_pixel); |
28355
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1772 if (!pixel_allocated_p) |
11d7a6fdad5f
(x_set_cursor_color): Get color reference counts right.
Gerd Moellmann <gerd@gnu.org>
parents:
28347
diff
changeset
|
1773 pixel = x_copy_color (f, pixel); |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1774 x->cursor_pixel = pixel; |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1775 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
1776 if (FRAME_X_WINDOW (f) != 0) |
389 | 1777 { |
1778 BLOCK_INPUT; | |
37762
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1779 XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel); |
ddf0a963805f
(x_set_foreground_color): Change frame's cursor_pixel
Gerd Moellmann <gerd@gnu.org>
parents:
37608
diff
changeset
|
1780 XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel); |
389 | 1781 UNBLOCK_INPUT; |
1782 | |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
1783 if (FRAME_VISIBLE_P (f)) |
389 | 1784 { |
15999
0e148af7d4ec
(x_set_cursor_color): Use x_update_cursor.
Richard M. Stallman <rms@gnu.org>
parents:
15942
diff
changeset
|
1785 x_update_cursor (f, 0); |
0e148af7d4ec
(x_set_cursor_color): Use x_update_cursor.
Richard M. Stallman <rms@gnu.org>
parents:
15942
diff
changeset
|
1786 x_update_cursor (f, 1); |
389 | 1787 } |
1788 } | |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1789 |
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1790 update_face_from_frame_parameter (f, Qcursor_color, arg); |
389 | 1791 } |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
1792 |
771 | 1793 /* Set the border-color of frame F to value described by ARG. |
389 | 1794 ARG can be a string naming a color. |
1795 The border-color is used for the border that is drawn by the X server. | |
1796 Note that this does not fully take effect if done before | |
771 | 1797 F has an x-window; it must be redone when the window is created. |
389 | 1798 |
1799 Note: this is done in two routines because of the way X10 works. | |
1800 | |
1801 Note: under X11, this is normally the province of the window manager, | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1802 and so emacs' border colors may be overridden. */ |
389 | 1803 |
1804 void | |
771 | 1805 x_set_border_color (f, arg, oldval) |
1806 struct frame *f; | |
389 | 1807 Lisp_Object arg, oldval; |
1808 { | |
1809 int pix; | |
1810 | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1811 CHECK_STRING (arg); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1812 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
771 | 1813 x_set_border_pixel (f, pix); |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
1814 update_face_from_frame_parameter (f, Qborder_color, arg); |
389 | 1815 } |
1816 | |
771 | 1817 /* Set the border-color of frame F to pixel value PIX. |
389 | 1818 Note that this does not fully take effect if done before |
771 | 1819 F has an x-window. */ |
1820 | |
21536
468585662fa8
(x_destroy_bitmap): Declare as void, not int.
Karl Heuer <kwzh@gnu.org>
parents:
21267
diff
changeset
|
1821 void |
771 | 1822 x_set_border_pixel (f, pix) |
1823 struct frame *f; | |
389 | 1824 int pix; |
1825 { | |
21779
6aaa0268fe91
(x_set_foreground_color, x_set_background_color)
Richard M. Stallman <rms@gnu.org>
parents:
21555
diff
changeset
|
1826 unload_color (f, f->output_data.x->border_pixel); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1827 f->output_data.x->border_pixel = pix; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1828 |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1829 if (FRAME_X_WINDOW (f) != 0 && f->output_data.x->border_width > 0) |
389 | 1830 { |
1831 BLOCK_INPUT; | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1832 XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
11882
8b3575269610
(hack_wm_protocols): Cast args of XGetWindowProperty.
Karl Heuer <kwzh@gnu.org>
parents:
11774
diff
changeset
|
1833 (unsigned long)pix); |
389 | 1834 UNBLOCK_INPUT; |
1835 | |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
1836 if (FRAME_VISIBLE_P (f)) |
771 | 1837 redraw_frame (f); |
389 | 1838 } |
1839 } | |
1840 | |
28347
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1841 |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1842 /* Value is the internal representation of the specified cursor type |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1843 ARG. If type is BAR_CURSOR, return in *WIDTH the specified width |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1844 of the bar cursor. */ |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1845 |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1846 enum text_cursor_kinds |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1847 x_specified_cursor_type (arg, width) |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1848 Lisp_Object arg; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1849 int *width; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1850 { |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1851 enum text_cursor_kinds type; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1852 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
1853 if (EQ (arg, Qbar)) |
10742
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1854 { |
28347
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1855 type = BAR_CURSOR; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1856 *width = 2; |
10742
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1857 } |
28050
79a67f9da183
(x_set_cursor_type): If ARG is nil, give frame no cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28044
diff
changeset
|
1858 else if (CONSP (arg) |
79a67f9da183
(x_set_cursor_type): If ARG is nil, give frame no cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28044
diff
changeset
|
1859 && EQ (XCAR (arg), Qbar) |
79a67f9da183
(x_set_cursor_type): If ARG is nil, give frame no cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28044
diff
changeset
|
1860 && INTEGERP (XCDR (arg)) |
79a67f9da183
(x_set_cursor_type): If ARG is nil, give frame no cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28044
diff
changeset
|
1861 && XINT (XCDR (arg)) >= 0) |
10742
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1862 { |
28347
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1863 type = BAR_CURSOR; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1864 *width = XINT (XCDR (arg)); |
10742
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1865 } |
28050
79a67f9da183
(x_set_cursor_type): If ARG is nil, give frame no cursor.
Gerd Moellmann <gerd@gnu.org>
parents:
28044
diff
changeset
|
1866 else if (NILP (arg)) |
28347
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1867 type = NO_CURSOR; |
3134
efdaaa695ad4
(x_set_cursor_type): If arg not recognized, use box cursor.
Richard M. Stallman <rms@gnu.org>
parents:
3108
diff
changeset
|
1868 else |
10742
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1869 /* Treat anything unknown as "box cursor". |
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1870 It was bad to signal an error; people have trouble fixing |
e4d6f6f1fc17
(x_set_cursor_type): Set cursor_width field.
Richard M. Stallman <rms@gnu.org>
parents:
10717
diff
changeset
|
1871 .Xdefaults with Emacs, when it has something bad in it. */ |
28347
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1872 type = FILLED_BOX_CURSOR; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1873 |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1874 return type; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1875 } |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1876 |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1877 void |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1878 x_set_cursor_type (f, arg, oldval) |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1879 FRAME_PTR f; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1880 Lisp_Object arg, oldval; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1881 { |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1882 int width; |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1883 |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1884 FRAME_DESIRED_CURSOR (f) = x_specified_cursor_type (arg, &width); |
ce7dddf6dfb7
(x_specified_cursor_type): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28229
diff
changeset
|
1885 f->output_data.x->cursor_width = width; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
1886 |
43987
ea6530f23937
(x_set_cursor_type): Set cursor_type_changed,
Richard M. Stallman <rms@gnu.org>
parents:
43917
diff
changeset
|
1887 /* Make sure the cursor gets redrawn. */ |
ea6530f23937
(x_set_cursor_type): Set cursor_type_changed,
Richard M. Stallman <rms@gnu.org>
parents:
43917
diff
changeset
|
1888 cursor_type_changed = 1; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
1889 } |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
1890 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
1891 void |
771 | 1892 x_set_icon_type (f, arg, oldval) |
1893 struct frame *f; | |
389 | 1894 Lisp_Object arg, oldval; |
1895 { | |
1896 int result; | |
1897 | |
9543
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
1898 if (STRINGP (arg)) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
1899 { |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
1900 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
1901 return; |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
1902 } |
3cf8aa53c4cf
(x_set_icon_type): If icon-type is a string, then use
Richard M. Stallman <rms@gnu.org>
parents:
9528
diff
changeset
|
1903 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) |
389 | 1904 return; |
1905 | |
1906 BLOCK_INPUT; | |
485 | 1907 if (NILP (arg)) |
12073 | 1908 result = x_text_icon (f, |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
1909 (char *) XSTRING ((!NILP (f->icon_name) |
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
1910 ? f->icon_name |
12073 | 1911 : f->name))->data); |
9563 | 1912 else |
1913 result = x_bitmap_icon (f, arg); | |
389 | 1914 |
1915 if (result) | |
1916 { | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
1917 UNBLOCK_INPUT; |
9353
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1918 error ("No icon window available"); |
389 | 1919 } |
1920 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
1921 XFlush (FRAME_X_DISPLAY (f)); |
389 | 1922 UNBLOCK_INPUT; |
1923 } | |
1924 | |
9563 | 1925 /* Return non-nil if frame F wants a bitmap icon. */ |
1926 | |
1927 Lisp_Object | |
9353
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1928 x_icon_type (f) |
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1929 FRAME_PTR f; |
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1930 { |
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1931 Lisp_Object tem; |
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1932 |
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1933 tem = assq_no_quit (Qicon_type, f->param_alist); |
9563 | 1934 if (CONSP (tem)) |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
1935 return XCDR (tem); |
9563 | 1936 else |
1937 return Qnil; | |
9353
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1938 } |
30659ed71a1b
(x_set_icon_type): Remove period from error message.
Richard M. Stallman <rms@gnu.org>
parents:
9329
diff
changeset
|
1939 |
12073 | 1940 void |
1941 x_set_icon_name (f, arg, oldval) | |
1942 struct frame *f; | |
1943 Lisp_Object arg, oldval; | |
1944 { | |
1945 int result; | |
1946 | |
1947 if (STRINGP (arg)) | |
1948 { | |
1949 if (STRINGP (oldval) && EQ (Fstring_equal (oldval, arg), Qt)) | |
1950 return; | |
1951 } | |
1952 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) | |
1953 return; | |
1954 | |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
1955 f->icon_name = arg; |
12073 | 1956 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
1957 if (f->output_data.x->icon_bitmap != 0) |
12073 | 1958 return; |
1959 | |
1960 BLOCK_INPUT; | |
1961 | |
1962 result = x_text_icon (f, | |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
1963 (char *) XSTRING ((!NILP (f->icon_name) |
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
1964 ? f->icon_name |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
1965 : !NILP (f->title) |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
1966 ? f->title |
12073 | 1967 : f->name))->data); |
1968 | |
1969 if (result) | |
1970 { | |
1971 UNBLOCK_INPUT; | |
1972 error ("No icon window available"); | |
1973 } | |
1974 | |
1975 XFlush (FRAME_X_DISPLAY (f)); | |
1976 UNBLOCK_INPUT; | |
1977 } | |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
1978 |
389 | 1979 void |
771 | 1980 x_set_font (f, arg, oldval) |
1981 struct frame *f; | |
389 | 1982 Lisp_Object arg, oldval; |
1983 { | |
3075
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
1984 Lisp_Object result; |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
1985 Lisp_Object fontset_name; |
18631
62bcc6aff013
(x_set_font): Funcall Qface_set_after_frame_default.
Richard M. Stallman <rms@gnu.org>
parents:
18612
diff
changeset
|
1986 Lisp_Object frame; |
36446
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
1987 int old_fontset = f->output_data.x->fontset; |
389 | 1988 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
1989 CHECK_STRING (arg); |
389 | 1990 |
21555
0927f341e390
(x_set_font): Give 2nd arg nil to Fquery_fontset.
Kenichi Handa <handa@m17n.org>
parents:
21549
diff
changeset
|
1991 fontset_name = Fquery_fontset (arg, Qnil); |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
1992 |
389 | 1993 BLOCK_INPUT; |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
1994 result = (STRINGP (fontset_name) |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
1995 ? x_new_fontset (f, XSTRING (fontset_name)->data) |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
1996 : x_new_font (f, XSTRING (arg)->data)); |
389 | 1997 UNBLOCK_INPUT; |
1998 | |
3075
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
1999 if (EQ (result, Qnil)) |
13867
19a05b5a597d
(check_x_display_info, check_x_frame, x_set_font)
Richard M. Stallman <rms@gnu.org>
parents:
13781
diff
changeset
|
2000 error ("Font `%s' is not defined", XSTRING (arg)->data); |
3075
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2001 else if (EQ (result, Qt)) |
24589
316c00e8bc62
(x_set_font): Fix error message.
Richard M. Stallman <rms@gnu.org>
parents:
24412
diff
changeset
|
2002 error ("The characters of the given font have varying widths"); |
3075
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2003 else if (STRINGP (result)) |
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2004 { |
36446
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2005 if (STRINGP (fontset_name)) |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2006 { |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2007 /* Fontset names are built from ASCII font names, so the |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2008 names may be equal despite there was a change. */ |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2009 if (old_fontset == f->output_data.x->fontset) |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2010 return; |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2011 } |
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2012 else if (!NILP (Fequal (result, oldval))) |
35859
c9edddbb8dbf
(x_set_font): If font hasn't changed, avoid recomputing
Gerd Moellmann <gerd@gnu.org>
parents:
35819
diff
changeset
|
2013 return; |
36446
59630511a774
(x_set_font): Handle case of x_new_fontset returning the
Gerd Moellmann <gerd@gnu.org>
parents:
36441
diff
changeset
|
2014 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2015 store_frame_param (f, Qfont, result); |
3075
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2016 recompute_basic_faces (f); |
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2017 } |
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2018 else |
878381e48b0d
* xfns.c: Clear out the old face stuff.
Jim Blandy <jimb@redhat.com>
parents:
3048
diff
changeset
|
2019 abort (); |
18631
62bcc6aff013
(x_set_font): Funcall Qface_set_after_frame_default.
Richard M. Stallman <rms@gnu.org>
parents:
18612
diff
changeset
|
2020 |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
2021 do_pending_window_change (0); |
25153
fc8435c2ae0e
(x_set_internal_border_width):
Richard M. Stallman <rms@gnu.org>
parents:
25082
diff
changeset
|
2022 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2023 /* Don't call `face-set-after-frame-default' when faces haven't been |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2024 initialized yet. This is the case when called from |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2025 Fx_create_frame. In that case, the X widget or window doesn't |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2026 exist either, and we can end up in x_report_frame_params with a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2027 null widget which gives a segfault. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2028 if (FRAME_FACE_CACHE (f)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2029 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2030 XSETFRAME (frame, f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2031 call1 (Qface_set_after_frame_default, frame); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2032 } |
389 | 2033 } |
2034 | |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2035 static void |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2036 x_set_fringe_width (f, new_value, old_value) |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2037 struct frame *f; |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2038 Lisp_Object new_value, old_value; |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2039 { |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2040 x_compute_fringe_widths (f, 1); |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2041 } |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
2042 |
389 | 2043 void |
771 | 2044 x_set_border_width (f, arg, oldval) |
2045 struct frame *f; | |
389 | 2046 Lisp_Object arg, oldval; |
2047 { | |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2048 CHECK_NUMBER (arg); |
389 | 2049 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2050 if (XINT (arg) == f->output_data.x->border_width) |
389 | 2051 return; |
2052 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2053 if (FRAME_X_WINDOW (f) != 0) |
389 | 2054 error ("Cannot change the border width of a window"); |
2055 | |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2056 f->output_data.x->border_width = XINT (arg); |
389 | 2057 } |
2058 | |
2059 void | |
771 | 2060 x_set_internal_border_width (f, arg, oldval) |
2061 struct frame *f; | |
389 | 2062 Lisp_Object arg, oldval; |
2063 { | |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2064 int old = f->output_data.x->internal_border_width; |
389 | 2065 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2066 CHECK_NUMBER (arg); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2067 f->output_data.x->internal_border_width = XINT (arg); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2068 if (f->output_data.x->internal_border_width < 0) |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2069 f->output_data.x->internal_border_width = 0; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2070 |
16396
4e4cc27b2a2a
(x_set_internal_border_width): Only change
Richard M. Stallman <rms@gnu.org>
parents:
16357
diff
changeset
|
2071 #ifdef USE_X_TOOLKIT |
16351
ac552926fc7e
(x_set_internal_border_width, Fx_create_frame):
Richard M. Stallman <rms@gnu.org>
parents:
16305
diff
changeset
|
2072 if (f->output_data.x->edit_widget) |
21536
468585662fa8
(x_destroy_bitmap): Declare as void, not int.
Karl Heuer <kwzh@gnu.org>
parents:
21267
diff
changeset
|
2073 widget_store_internal_border (f->output_data.x->edit_widget); |
16396
4e4cc27b2a2a
(x_set_internal_border_width): Only change
Richard M. Stallman <rms@gnu.org>
parents:
16357
diff
changeset
|
2074 #endif |
16351
ac552926fc7e
(x_set_internal_border_width, Fx_create_frame):
Richard M. Stallman <rms@gnu.org>
parents:
16305
diff
changeset
|
2075 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2076 if (f->output_data.x->internal_border_width == old) |
389 | 2077 return; |
2078 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2079 if (FRAME_X_WINDOW (f) != 0) |
389 | 2080 { |
5899
4e8f26a0f2b7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5721
diff
changeset
|
2081 x_set_window_size (f, 0, f->width, f->height); |
771 | 2082 SET_FRAME_GARBAGED (f); |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
2083 do_pending_window_change (0); |
389 | 2084 } |
40437
1ee61682a51f
(x_set_internal_border_width): Set frame garbaged
Gerd Moellmann <gerd@gnu.org>
parents:
40427
diff
changeset
|
2085 else |
1ee61682a51f
(x_set_internal_border_width): Set frame garbaged
Gerd Moellmann <gerd@gnu.org>
parents:
40427
diff
changeset
|
2086 SET_FRAME_GARBAGED (f); |
389 | 2087 } |
2088 | |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2089 void |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2090 x_set_visibility (f, value, oldval) |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2091 struct frame *f; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2092 Lisp_Object value, oldval; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2093 { |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2094 Lisp_Object frame; |
9285
75f1c0d90b3d
(x_set_frame_parameters, x_set_visibility, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
9240
diff
changeset
|
2095 XSETFRAME (frame, f); |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2096 |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2097 if (NILP (value)) |
5899
4e8f26a0f2b7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5721
diff
changeset
|
2098 Fmake_frame_invisible (frame, Qt); |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
2099 else if (EQ (value, Qicon)) |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
2100 Ficonify_frame (frame); |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
2101 else |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2102 Fmake_frame_visible (frame); |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2103 } |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2104 |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2105 |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2106 /* Change window heights in windows rooted in WINDOW by N lines. */ |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2107 |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2108 static void |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2109 x_change_window_heights (window, n) |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2110 Lisp_Object window; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2111 int n; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2112 { |
3477
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2113 struct window *w = XWINDOW (window); |
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2114 |
9329
4e1048594e7f
(x_set_menu_bar_lines_1): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9327
diff
changeset
|
2115 XSETFASTINT (w->top, XFASTINT (w->top) + n); |
4e1048594e7f
(x_set_menu_bar_lines_1): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9327
diff
changeset
|
2116 XSETFASTINT (w->height, XFASTINT (w->height) - n); |
3477
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2117 |
28010
5e3c139838a6
(x_set_menu_bar_lines_1): Adjust window's orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
28001
diff
changeset
|
2118 if (INTEGERP (w->orig_top)) |
5e3c139838a6
(x_set_menu_bar_lines_1): Adjust window's orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
28001
diff
changeset
|
2119 XSETFASTINT (w->orig_top, XFASTINT (w->orig_top) + n); |
5e3c139838a6
(x_set_menu_bar_lines_1): Adjust window's orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
28001
diff
changeset
|
2120 if (INTEGERP (w->orig_height)) |
5e3c139838a6
(x_set_menu_bar_lines_1): Adjust window's orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
28001
diff
changeset
|
2121 XSETFASTINT (w->orig_height, XFASTINT (w->orig_height) - n); |
5e3c139838a6
(x_set_menu_bar_lines_1): Adjust window's orig_top and
Gerd Moellmann <gerd@gnu.org>
parents:
28001
diff
changeset
|
2122 |
3477
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2123 /* Handle just the top child in a vertical split. */ |
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2124 if (!NILP (w->vchild)) |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2125 x_change_window_heights (w->vchild, n); |
3477
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2126 |
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2127 /* Adjust all children in a horizontal split. */ |
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2128 for (window = w->hchild; !NILP (window); window = w->next) |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2129 { |
3477
c079a2d6cf0e
(x_set_menu_bar_lines_1): Adjust just the uppermost child
Richard M. Stallman <rms@gnu.org>
parents:
3447
diff
changeset
|
2130 w = XWINDOW (window); |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2131 x_change_window_heights (window, n); |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2132 } |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2133 } |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2134 |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2135 void |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2136 x_set_menu_bar_lines (f, value, oldval) |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2137 struct frame *f; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2138 Lisp_Object value, oldval; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2139 { |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2140 int nlines; |
25715
feaedc03dbc8
(x_set_background_color): Remove unused variable(s).
Gerd Moellmann <gerd@gnu.org>
parents:
25691
diff
changeset
|
2141 #ifndef USE_X_TOOLKIT |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2142 int olines = FRAME_MENU_BAR_LINES (f); |
25715
feaedc03dbc8
(x_set_background_color): Remove unused variable(s).
Gerd Moellmann <gerd@gnu.org>
parents:
25691
diff
changeset
|
2143 #endif |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2144 |
2880
9a78169e44df
* xfns.c (x_set_menu_bar_lines): Minibuffer-only frames can't have
Jim Blandy <jimb@redhat.com>
parents:
2842
diff
changeset
|
2145 /* Right now, menu bars don't work properly in minibuf-only frames; |
9a78169e44df
* xfns.c (x_set_menu_bar_lines): Minibuffer-only frames can't have
Jim Blandy <jimb@redhat.com>
parents:
2842
diff
changeset
|
2146 most of the commands try to apply themselves to the minibuffer |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2147 frame itself, and get an error because you can't switch buffers |
2880
9a78169e44df
* xfns.c (x_set_menu_bar_lines): Minibuffer-only frames can't have
Jim Blandy <jimb@redhat.com>
parents:
2842
diff
changeset
|
2148 in or split the minibuffer window. */ |
2885
cb1709f302e9
(x_set_menu_bar_lines): Fix typo in last change.
Richard M. Stallman <rms@gnu.org>
parents:
2880
diff
changeset
|
2149 if (FRAME_MINIBUF_ONLY_P (f)) |
2880
9a78169e44df
* xfns.c (x_set_menu_bar_lines): Minibuffer-only frames can't have
Jim Blandy <jimb@redhat.com>
parents:
2842
diff
changeset
|
2150 return; |
9a78169e44df
* xfns.c (x_set_menu_bar_lines): Minibuffer-only frames can't have
Jim Blandy <jimb@redhat.com>
parents:
2842
diff
changeset
|
2151 |
9103
948e8acb6990
(x_set_frame_parameters, x_set_menu_bar_lines, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
9022
diff
changeset
|
2152 if (INTEGERP (value)) |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2153 nlines = XINT (value); |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2154 else |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2155 nlines = 0; |
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2156 |
17556
c0f8f4264f7a
(x_set_menu_bar_lines): Increment windows_or_buffers_changed.
Richard M. Stallman <rms@gnu.org>
parents:
17106
diff
changeset
|
2157 /* Make sure we redisplay all windows in this frame. */ |
c0f8f4264f7a
(x_set_menu_bar_lines): Increment windows_or_buffers_changed.
Richard M. Stallman <rms@gnu.org>
parents:
17106
diff
changeset
|
2158 windows_or_buffers_changed++; |
c0f8f4264f7a
(x_set_menu_bar_lines): Increment windows_or_buffers_changed.
Richard M. Stallman <rms@gnu.org>
parents:
17106
diff
changeset
|
2159 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2160 #ifdef USE_X_TOOLKIT |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2161 FRAME_MENU_BAR_LINES (f) = 0; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2162 if (nlines) |
12832
0d750e41c4f2
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: When turning
Richard M. Stallman <rms@gnu.org>
parents:
12773
diff
changeset
|
2163 { |
0d750e41c4f2
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: When turning
Richard M. Stallman <rms@gnu.org>
parents:
12773
diff
changeset
|
2164 FRAME_EXTERNAL_MENU_BAR (f) = 1; |
13734
714433bead7f
(x_set_menu_bar_lines) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
13508
diff
changeset
|
2165 if (FRAME_X_P (f) && f->output_data.x->menubar_widget == 0) |
12832
0d750e41c4f2
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: When turning
Richard M. Stallman <rms@gnu.org>
parents:
12773
diff
changeset
|
2166 /* Make sure next redisplay shows the menu bar. */ |
0d750e41c4f2
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: When turning
Richard M. Stallman <rms@gnu.org>
parents:
12773
diff
changeset
|
2167 XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt; |
0d750e41c4f2
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: When turning
Richard M. Stallman <rms@gnu.org>
parents:
12773
diff
changeset
|
2168 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2169 else |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2170 { |
5900
284c0d70a50a
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: Dont Call XtDestroyWidget but
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5899
diff
changeset
|
2171 if (FRAME_EXTERNAL_MENU_BAR (f) == 1) |
284c0d70a50a
(x_set_menu_bar_lines) [USE_X_TOOLKIT]: Dont Call XtDestroyWidget but
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5899
diff
changeset
|
2172 free_frame_menubar (f); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2173 FRAME_EXTERNAL_MENU_BAR (f) = 0; |
13734
714433bead7f
(x_set_menu_bar_lines) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
13508
diff
changeset
|
2174 if (FRAME_X_P (f)) |
714433bead7f
(x_set_menu_bar_lines) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
13508
diff
changeset
|
2175 f->output_data.x->menubar_widget = 0; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2176 } |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2177 #else /* not USE_X_TOOLKIT */ |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
2178 FRAME_MENU_BAR_LINES (f) = nlines; |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2179 x_change_window_heights (f->root_window, nlines - olines); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2180 #endif /* not USE_X_TOOLKIT */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2181 adjust_glyphs (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2182 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2183 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2184 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2185 /* Set the number of lines used for the tool bar of frame F to VALUE. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2186 VALUE not an integer, or < 0 means set the lines to zero. OLDVAL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2187 is the old number of tool bar lines. This function changes the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2188 height of all windows on frame F to match the new tool bar height. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2189 The frame's height doesn't change. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2190 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2191 void |
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25528
diff
changeset
|
2192 x_set_tool_bar_lines (f, value, oldval) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2193 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2194 Lisp_Object value, oldval; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2195 { |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2196 int delta, nlines, root_height; |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2197 Lisp_Object root_window; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2198 |
35819
74e2d9de2fc1
(x_set_tool_bar_lines): Do nothing If frame is
Gerd Moellmann <gerd@gnu.org>
parents:
35733
diff
changeset
|
2199 /* Treat tool bars like menu bars. */ |
74e2d9de2fc1
(x_set_tool_bar_lines): Do nothing If frame is
Gerd Moellmann <gerd@gnu.org>
parents:
35733
diff
changeset
|
2200 if (FRAME_MINIBUF_ONLY_P (f)) |
74e2d9de2fc1
(x_set_tool_bar_lines): Do nothing If frame is
Gerd Moellmann <gerd@gnu.org>
parents:
35733
diff
changeset
|
2201 return; |
74e2d9de2fc1
(x_set_tool_bar_lines): Do nothing If frame is
Gerd Moellmann <gerd@gnu.org>
parents:
35733
diff
changeset
|
2202 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2203 /* Use VALUE only if an integer >= 0. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2204 if (INTEGERP (value) && XINT (value) >= 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2205 nlines = XFASTINT (value); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2206 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2207 nlines = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2208 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2209 /* Make sure we redisplay all windows in this frame. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2210 ++windows_or_buffers_changed; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2211 |
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25528
diff
changeset
|
2212 delta = nlines - FRAME_TOOL_BAR_LINES (f); |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2213 |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2214 /* Don't resize the tool-bar to more than we have room for. */ |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2215 root_window = FRAME_ROOT_WINDOW (f); |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2216 root_height = XINT (XWINDOW (root_window)->height); |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2217 if (root_height - delta < 1) |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2218 { |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2219 delta = root_height - 1; |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2220 nlines = FRAME_TOOL_BAR_LINES (f) + delta; |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2221 } |
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2222 |
25544
693ca9ba497a
Change spelling of `toolbar' to `tool_bar' or `tool-bar'.
Gerd Moellmann <gerd@gnu.org>
parents:
25528
diff
changeset
|
2223 FRAME_TOOL_BAR_LINES (f) = nlines; |
31930
9c779861abff
(x_set_tool_bar_lines): Don't use more lines for the
Gerd Moellmann <gerd@gnu.org>
parents:
31902
diff
changeset
|
2224 x_change_window_heights (root_window, delta); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2225 adjust_glyphs (f); |
31999
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2226 |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2227 /* We also have to make sure that the internal border at the top of |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2228 the frame, below the menu bar or tool bar, is redrawn when the |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2229 tool bar disappears. This is so because the internal border is |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2230 below the tool bar if one is displayed, but is below the menu bar |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2231 if there isn't a tool bar. The tool bar draws into the area |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2232 below the menu bar. */ |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2233 if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0) |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2234 { |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2235 updating_frame = f; |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2236 clear_frame (); |
33601
1ee8ea329b7b
(x_set_tool_bar_lines): When clearing the frame, also
Gerd Moellmann <gerd@gnu.org>
parents:
33589
diff
changeset
|
2237 clear_current_matrices (f); |
31999
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2238 updating_frame = NULL; |
d862c73ea0d5
(x_set_tool_bar_lines): Clear frame when tool bar
Gerd Moellmann <gerd@gnu.org>
parents:
31930
diff
changeset
|
2239 } |
33747
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2240 |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2241 /* If the tool bar gets smaller, the internal border below it |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2242 has to be cleared. It was formerly part of the display |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2243 of the larger tool bar, and updating windows won't clear it. */ |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2244 if (delta < 0) |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2245 { |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2246 int height = FRAME_INTERNAL_BORDER_WIDTH (f); |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2247 int width = PIXEL_WIDTH (f); |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2248 int y = nlines * CANON_Y_UNIT (f); |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2249 |
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2250 BLOCK_INPUT; |
35579
65c31f59048a
* xfns.c (x_set_tool_bar_lines): Use x_clear_area instead of
Gerd Moellmann <gerd@gnu.org>
parents:
35566
diff
changeset
|
2251 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
65c31f59048a
* xfns.c (x_set_tool_bar_lines): Use x_clear_area instead of
Gerd Moellmann <gerd@gnu.org>
parents:
35566
diff
changeset
|
2252 0, y, width, height, False); |
33747
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2253 UNBLOCK_INPUT; |
38625
0bfdfd449f4a
(x_set_tool_bar_lines): Clear the tool bar window's
Gerd Moellmann <gerd@gnu.org>
parents:
38575
diff
changeset
|
2254 |
0bfdfd449f4a
(x_set_tool_bar_lines): Clear the tool bar window's
Gerd Moellmann <gerd@gnu.org>
parents:
38575
diff
changeset
|
2255 if (WINDOWP (f->tool_bar_window)) |
0bfdfd449f4a
(x_set_tool_bar_lines): Clear the tool bar window's
Gerd Moellmann <gerd@gnu.org>
parents:
38575
diff
changeset
|
2256 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); |
33747
e0e2461a24fe
(x_set_tool_bar_lines): Clear internal border when
Gerd Moellmann <gerd@gnu.org>
parents:
33713
diff
changeset
|
2257 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2258 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2259 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2260 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2261 /* Set the foreground color for scroll bars on frame F to VALUE. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2262 VALUE should be a string, a color name. If it isn't a string or |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2263 isn't a valid color name, do nothing. OLDVAL is the old value of |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2264 the frame parameter. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2265 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2266 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2267 x_set_scroll_bar_foreground (f, value, oldval) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2268 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2269 Lisp_Object value, oldval; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2270 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2271 unsigned long pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2272 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2273 if (STRINGP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2274 pixel = x_decode_color (f, value, BLACK_PIX_DEFAULT (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2275 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2276 pixel = -1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2277 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2278 if (f->output_data.x->scroll_bar_foreground_pixel != -1) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2279 unload_color (f, f->output_data.x->scroll_bar_foreground_pixel); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2280 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2281 f->output_data.x->scroll_bar_foreground_pixel = pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2282 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2283 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2284 /* Remove all scroll bars because they have wrong colors. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2285 if (condemn_scroll_bars_hook) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2286 (*condemn_scroll_bars_hook) (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2287 if (judge_scroll_bars_hook) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2288 (*judge_scroll_bars_hook) (f); |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
2289 |
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
2290 update_face_from_frame_parameter (f, Qscroll_bar_foreground, value); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2291 redraw_frame (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2292 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2293 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2294 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2295 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2296 /* Set the background color for scroll bars on frame F to VALUE VALUE |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2297 should be a string, a color name. If it isn't a string or isn't a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2298 valid color name, do nothing. OLDVAL is the old value of the frame |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2299 parameter. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2300 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2301 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2302 x_set_scroll_bar_background (f, value, oldval) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2303 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2304 Lisp_Object value, oldval; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2305 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2306 unsigned long pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2307 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2308 if (STRINGP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2309 pixel = x_decode_color (f, value, WHITE_PIX_DEFAULT (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2310 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2311 pixel = -1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2312 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2313 if (f->output_data.x->scroll_bar_background_pixel != -1) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2314 unload_color (f, f->output_data.x->scroll_bar_background_pixel); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2315 |
39619
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2316 #ifdef USE_TOOLKIT_SCROLL_BARS |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2317 /* Scrollbar shadow colors. */ |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2318 if (f->output_data.x->scroll_bar_top_shadow_pixel != -1) |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2319 { |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2320 unload_color (f, f->output_data.x->scroll_bar_top_shadow_pixel); |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2321 f->output_data.x->scroll_bar_top_shadow_pixel = -1; |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2322 } |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2323 if (f->output_data.x->scroll_bar_bottom_shadow_pixel != -1) |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2324 { |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2325 unload_color (f, f->output_data.x->scroll_bar_bottom_shadow_pixel); |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2326 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2327 } |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2328 #endif /* USE_TOOLKIT_SCROLL_BARS */ |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
2329 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2330 f->output_data.x->scroll_bar_background_pixel = pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2331 if (FRAME_X_WINDOW (f) && FRAME_VISIBLE_P (f)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2332 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2333 /* Remove all scroll bars because they have wrong colors. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2334 if (condemn_scroll_bars_hook) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2335 (*condemn_scroll_bars_hook) (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2336 if (judge_scroll_bars_hook) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2337 (*judge_scroll_bars_hook) (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2338 |
25593
9aecfcf3cb43
(x_set_foreground_color): Call
Gerd Moellmann <gerd@gnu.org>
parents:
25550
diff
changeset
|
2339 update_face_from_frame_parameter (f, Qscroll_bar_background, value); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2340 redraw_frame (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2341 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2342 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2343 |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2344 |
30383 | 2345 /* Encode Lisp string STRING as a text in a format appropriate for |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2346 XICCC (X Inter Client Communication Conventions). |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2347 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2348 If STRING contains only ASCII characters, do no conversion and |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2349 return the string data of STRING. Otherwise, encode the text by |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2350 CODING_SYSTEM, and return a newly allocated memory area which |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2351 should be freed by `xfree' by a caller. |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2352 |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2353 SELECTIONP non-zero means the string is being encoded for an X |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2354 selection, so it is safe to run pre-write conversions (which |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2355 may run Lisp code). |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2356 |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2357 Store the byte length of resulting text in *TEXT_BYTES. |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2358 |
30354 | 2359 If the text contains only ASCII and Latin-1, store 1 in *STRING_P, |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2360 which means that the `encoding' of the result can be `STRING'. |
30354 | 2361 Otherwise store 0 in *STRINGP, which means that the `encoding' of |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2362 the result should be `COMPOUND_TEXT'. */ |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2363 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2364 unsigned char * |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2365 x_encode_text (string, coding_system, selectionp, text_bytes, stringp) |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2366 Lisp_Object string, coding_system; |
30354 | 2367 int *text_bytes, *stringp; |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2368 int selectionp; |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2369 { |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2370 unsigned char *str = XSTRING (string)->data; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2371 int chars = XSTRING (string)->size; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2372 int bytes = STRING_BYTES (XSTRING (string)); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2373 int charset_info; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2374 int bufsize; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2375 unsigned char *buf; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2376 struct coding_system coding; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2377 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2378 charset_info = find_charset_in_text (str, chars, bytes, NULL, Qnil); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2379 if (charset_info == 0) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2380 { |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2381 /* No multibyte character in OBJ. We need not encode it. */ |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2382 *text_bytes = bytes; |
30354 | 2383 *stringp = 1; |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2384 return str; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2385 } |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2386 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2387 setup_coding_system (coding_system, &coding); |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2388 if (selectionp |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2389 && SYMBOLP (coding.pre_write_conversion) |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2390 && !NILP (Ffboundp (coding.pre_write_conversion))) |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2391 { |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2392 string = run_pre_post_conversion_on_str (string, &coding, 1); |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2393 str = XSTRING (string)->data; |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2394 chars = XSTRING (string)->size; |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2395 bytes = STRING_BYTES (XSTRING (string)); |
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2396 } |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2397 coding.src_multibyte = 1; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2398 coding.dst_multibyte = 0; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2399 coding.mode |= CODING_MODE_LAST_BLOCK; |
30354 | 2400 if (coding.type == coding_type_iso2022) |
2401 coding.flags |= CODING_FLAG_ISO_SAFE; | |
33242
421e3db4e24e
(x_encode_text): Suppress producing escape sequences for composition.
Kenichi Handa <handa@m17n.org>
parents:
32606
diff
changeset
|
2402 /* We suppress producing escape sequences for composition. */ |
421e3db4e24e
(x_encode_text): Suppress producing escape sequences for composition.
Kenichi Handa <handa@m17n.org>
parents:
32606
diff
changeset
|
2403 coding.composing = COMPOSITION_DISABLED; |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2404 bufsize = encoding_buffer_size (&coding, bytes); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2405 buf = (unsigned char *) xmalloc (bufsize); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2406 encode_coding (&coding, str, buf, bytes, bufsize); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2407 *text_bytes = coding.produced; |
30354 | 2408 *stringp = (charset_info == 1 || !EQ (coding_system, Qcompound_text)); |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2409 return buf; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2410 } |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2411 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2412 |
4650 | 2413 /* Change the name of frame F to NAME. If NAME is nil, set F's name to |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2414 x_id_name. |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2415 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2416 If EXPLICIT is non-zero, that indicates that lisp code is setting the |
4650 | 2417 name; if NAME is a string, set F's name to NAME and set |
2418 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2419 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2420 If EXPLICIT is zero, that indicates that Emacs redisplay code is |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2421 suggesting a new name, which lisp code should override; if |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2422 F->explicit_name is set, ignore the new name; otherwise, set it. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2423 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2424 void |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2425 x_set_name (f, name, explicit) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2426 struct frame *f; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2427 Lisp_Object name; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2428 int explicit; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2429 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2430 /* Make sure that requests from lisp code override requests from |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2431 Emacs redisplay code. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2432 if (explicit) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2433 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2434 /* If we're switching from explicit to implicit, we had better |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2435 update the mode lines and thereby update the title. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2436 if (f->explicit_name && NILP (name)) |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2437 update_mode_lines = 1; |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2438 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2439 f->explicit_name = ! NILP (name); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2440 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2441 else if (f->explicit_name) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2442 return; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2443 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2444 /* If NAME is nil, set the name to the x_id_name. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2445 if (NILP (name)) |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
2446 { |
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
2447 /* Check for no change needed in this very common case |
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
2448 before we do any consing. */ |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
2449 if (!strcmp (FRAME_X_DISPLAY_INFO (f)->x_id_name, |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
2450 XSTRING (f->name)->data)) |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
2451 return; |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
2452 name = build_string (FRAME_X_DISPLAY_INFO (f)->x_id_name); |
8090
bb03e344f07e
(x_set_frame_parameters): Call x_set_offset directly.
Richard M. Stallman <rms@gnu.org>
parents:
7989
diff
changeset
|
2453 } |
833 | 2454 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2455 CHECK_STRING (name); |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2456 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2457 /* Don't change the name if it's already NAME. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2458 if (! NILP (Fstring_equal (name, f->name))) |
727 | 2459 return; |
2460 | |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2461 f->name = name; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2462 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2463 /* For setting the frame title, the title parameter should override |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2464 the name parameter. */ |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2465 if (! NILP (f->title)) |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2466 name = f->title; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2467 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2468 if (FRAME_X_WINDOW (f)) |
389 | 2469 { |
708 | 2470 BLOCK_INPUT; |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2471 #ifdef HAVE_X11R4 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2472 { |
12073 | 2473 XTextProperty text, icon; |
30354 | 2474 int bytes, stringp; |
30355 | 2475 Lisp_Object coding_system; |
2476 | |
2477 coding_system = Vlocale_coding_system; | |
2478 if (NILP (coding_system)) | |
2479 coding_system = Qcompound_text; | |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2480 text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp); |
30354 | 2481 text.encoding = (stringp ? XA_STRING |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2482 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2483 text.format = 8; |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2484 text.nitems = bytes; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2485 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2486 if (NILP (f->icon_name)) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2487 { |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2488 icon = text; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2489 } |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2490 else |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2491 { |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2492 icon.value = x_encode_text (f->icon_name, coding_system, 0, |
30354 | 2493 &bytes, &stringp); |
2494 icon.encoding = (stringp ? XA_STRING | |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2495 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2496 icon.format = 8; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2497 icon.nitems = bytes; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2498 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2499 #ifdef USE_X_TOOLKIT |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2500 XSetWMName (FRAME_X_DISPLAY (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2501 XtWindow (f->output_data.x->widget), &text); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
2502 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), |
12073 | 2503 &icon); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2504 #else /* not USE_X_TOOLKIT */ |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2505 XSetWMName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &text); |
12073 | 2506 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &icon); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2507 #endif /* not USE_X_TOOLKIT */ |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2508 if (!NILP (f->icon_name) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2509 && icon.value != XSTRING (f->icon_name)->data) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2510 xfree (icon.value); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2511 if (text.value != XSTRING (name)->data) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2512 xfree (text.value); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2513 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2514 #else /* not HAVE_X11R4 */ |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2515 XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2516 XSTRING (name)->data); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2517 XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
2518 XSTRING (name)->data); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
2519 #endif /* not HAVE_X11R4 */ |
708 | 2520 UNBLOCK_INPUT; |
389 | 2521 } |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2522 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2523 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2524 /* This function should be called when the user's lisp code has |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2525 specified a name for the frame; the name will override any set by the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2526 redisplay code. */ |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2527 void |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2528 x_explicitly_set_name (f, arg, oldval) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2529 FRAME_PTR f; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2530 Lisp_Object arg, oldval; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2531 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2532 x_set_name (f, arg, 1); |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2533 } |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2534 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2535 /* This function should be called by Emacs redisplay code to set the |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2536 name; names set this way will never override names set by the user's |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2537 lisp code. */ |
1125
059624bf9bf0
Declare x_implicitly_set_name to be void.
Jim Blandy <jimb@redhat.com>
parents:
1096
diff
changeset
|
2538 void |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2539 x_implicitly_set_name (f, arg, oldval) |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2540 FRAME_PTR f; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2541 Lisp_Object arg, oldval; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2542 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
2543 x_set_name (f, arg, 0); |
389 | 2544 } |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2545 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2546 /* Change the title of frame F to NAME. |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2547 If NAME is nil, use the frame name as the title. |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2548 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2549 If EXPLICIT is non-zero, that indicates that lisp code is setting the |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2550 name; if NAME is a string, set F's name to NAME and set |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2551 F->explicit_name; if NAME is Qnil, then clear F->explicit_name. |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2552 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2553 If EXPLICIT is zero, that indicates that Emacs redisplay code is |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2554 suggesting a new name, which lisp code should override; if |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2555 F->explicit_name is set, ignore the new name; otherwise, set it. */ |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2556 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2557 void |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
2558 x_set_title (f, name, old_name) |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2559 struct frame *f; |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
2560 Lisp_Object name, old_name; |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2561 { |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2562 /* Don't change the title if it's already NAME. */ |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2563 if (EQ (name, f->title)) |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2564 return; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2565 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2566 update_mode_lines = 1; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2567 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2568 f->title = name; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2569 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2570 if (NILP (name)) |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2571 name = f->name; |
16732
f52c4fd47f03
(x_set_title): Check data type of NAME.
Richard M. Stallman <rms@gnu.org>
parents:
16682
diff
changeset
|
2572 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2573 CHECK_STRING (name); |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2574 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2575 if (FRAME_X_WINDOW (f)) |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2576 { |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2577 BLOCK_INPUT; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2578 #ifdef HAVE_X11R4 |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2579 { |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2580 XTextProperty text, icon; |
30354 | 2581 int bytes, stringp; |
30355 | 2582 Lisp_Object coding_system; |
2583 | |
2584 coding_system = Vlocale_coding_system; | |
2585 if (NILP (coding_system)) | |
2586 coding_system = Qcompound_text; | |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2587 text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp); |
30354 | 2588 text.encoding = (stringp ? XA_STRING |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2589 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2590 text.format = 8; |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2591 text.nitems = bytes; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2592 |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2593 if (NILP (f->icon_name)) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2594 { |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2595 icon = text; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2596 } |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2597 else |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2598 { |
43452
75677c801c26
(x_encode_text): Accept additional arg SELECTIONP; all
Eli Zaretskii <eliz@gnu.org>
parents:
43426
diff
changeset
|
2599 icon.value = x_encode_text (f->icon_name, coding_system, 0, |
30354 | 2600 &bytes, &stringp); |
2601 icon.encoding = (stringp ? XA_STRING | |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2602 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2603 icon.format = 8; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2604 icon.nitems = bytes; |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2605 } |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2606 #ifdef USE_X_TOOLKIT |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2607 XSetWMName (FRAME_X_DISPLAY (f), |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2608 XtWindow (f->output_data.x->widget), &text); |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2609 XSetWMIconName (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2610 &icon); |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2611 #else /* not USE_X_TOOLKIT */ |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2612 XSetWMName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &text); |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2613 XSetWMIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &icon); |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2614 #endif /* not USE_X_TOOLKIT */ |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2615 if (!NILP (f->icon_name) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2616 && icon.value != XSTRING (f->icon_name)->data) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2617 xfree (icon.value); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2618 if (text.value != XSTRING (name)->data) |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
2619 xfree (text.value); |
14482
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2620 } |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2621 #else /* not HAVE_X11R4 */ |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2622 XSetIconName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2623 XSTRING (name)->data); |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2624 XStoreName (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2625 XSTRING (name)->data); |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2626 #endif /* not HAVE_X11R4 */ |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2627 UNBLOCK_INPUT; |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2628 } |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2629 } |
479987ba2c8d
(x_frame_parms): Add "title" element.
Richard M. Stallman <rms@gnu.org>
parents:
14439
diff
changeset
|
2630 |
389 | 2631 void |
771 | 2632 x_set_autoraise (f, arg, oldval) |
2633 struct frame *f; | |
389 | 2634 Lisp_Object arg, oldval; |
2635 { | |
771 | 2636 f->auto_raise = !EQ (Qnil, arg); |
389 | 2637 } |
2638 | |
2639 void | |
771 | 2640 x_set_autolower (f, arg, oldval) |
2641 struct frame *f; | |
389 | 2642 Lisp_Object arg, oldval; |
2643 { | |
771 | 2644 f->auto_lower = !EQ (Qnil, arg); |
389 | 2645 } |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2646 |
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2647 void |
9580
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2648 x_set_unsplittable (f, arg, oldval) |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2649 struct frame *f; |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2650 Lisp_Object arg, oldval; |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2651 { |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2652 f->no_split = !NILP (arg); |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2653 } |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2654 |
bcc9342cf633
(x_set_unsplittable): New function.
Karl Heuer <kwzh@gnu.org>
parents:
9563
diff
changeset
|
2655 void |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1932
diff
changeset
|
2656 x_set_vertical_scroll_bars (f, arg, oldval) |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2657 struct frame *f; |
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2658 Lisp_Object arg, oldval; |
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2659 { |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2660 if ((EQ (arg, Qleft) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2661 || (EQ (arg, Qright) && FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2662 || (NILP (arg) && FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2663 || (!NILP (arg) && ! FRAME_HAS_VERTICAL_SCROLL_BARS (f))) |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2664 { |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2665 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2666 = (NILP (arg) |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2667 ? vertical_scroll_bar_none |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2668 : EQ (Qright, arg) |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2669 ? vertical_scroll_bar_right |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
2670 : vertical_scroll_bar_left); |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2671 |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2672 /* We set this parameter before creating the X window for the |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2673 frame, so we can get the geometry right from the start. |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2674 However, if the window hasn't been created yet, we shouldn't |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2675 call x_set_window_size. */ |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2676 if (FRAME_X_WINDOW (f)) |
5899
4e8f26a0f2b7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5721
diff
changeset
|
2677 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
2678 do_pending_window_change (0); |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2679 } |
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
2680 } |
8942
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2681 |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2682 void |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2683 x_set_scroll_bar_width (f, arg, oldval) |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2684 struct frame *f; |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2685 Lisp_Object arg, oldval; |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2686 { |
18594
5ca5ff1c74eb
(x_set_scroll_bar_width): By default, use enough
Richard M. Stallman <rms@gnu.org>
parents:
18114
diff
changeset
|
2687 int wid = FONT_WIDTH (f->output_data.x->font); |
5ca5ff1c74eb
(x_set_scroll_bar_width): By default, use enough
Richard M. Stallman <rms@gnu.org>
parents:
18114
diff
changeset
|
2688 |
9166
44b44e900cf1
(x_set_scroll_bar_width): Nil now means 2 columns' worth of pixels.
Karl Heuer <kwzh@gnu.org>
parents:
9103
diff
changeset
|
2689 if (NILP (arg)) |
44b44e900cf1
(x_set_scroll_bar_width): Nil now means 2 columns' worth of pixels.
Karl Heuer <kwzh@gnu.org>
parents:
9103
diff
changeset
|
2690 { |
25511
9bc9d4d6c716
(x_set_scroll_bar_width): Change conditional compilation
Gerd Moellmann <gerd@gnu.org>
parents:
25464
diff
changeset
|
2691 #ifdef USE_TOOLKIT_SCROLL_BARS |
9bc9d4d6c716
(x_set_scroll_bar_width): Change conditional compilation
Gerd Moellmann <gerd@gnu.org>
parents:
25464
diff
changeset
|
2692 /* A minimum width of 14 doesn't look good for toolkit scroll bars. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2693 int width = 16 + 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2694 FRAME_SCROLL_BAR_COLS (f) = (width + wid - 1) / wid; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2695 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2696 #else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2697 /* Make the actual width at least 14 pixels and a multiple of a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2698 character width. */ |
18594
5ca5ff1c74eb
(x_set_scroll_bar_width): By default, use enough
Richard M. Stallman <rms@gnu.org>
parents:
18114
diff
changeset
|
2699 FRAME_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2700 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2701 /* Use all of that space (aside from required margins) for the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2702 scroll bar. */ |
9166
44b44e900cf1
(x_set_scroll_bar_width): Nil now means 2 columns' worth of pixels.
Karl Heuer <kwzh@gnu.org>
parents:
9103
diff
changeset
|
2703 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2704 #endif |
18594
5ca5ff1c74eb
(x_set_scroll_bar_width): By default, use enough
Richard M. Stallman <rms@gnu.org>
parents:
18114
diff
changeset
|
2705 |
15891
dbc8c9c9d819
(x_set_scroll_bar_width): Call x_set_window_size when arg is nil.
Richard M. Stallman <rms@gnu.org>
parents:
15881
diff
changeset
|
2706 if (FRAME_X_WINDOW (f)) |
dbc8c9c9d819
(x_set_scroll_bar_width): Call x_set_window_size when arg is nil.
Richard M. Stallman <rms@gnu.org>
parents:
15881
diff
changeset
|
2707 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
2708 do_pending_window_change (0); |
9166
44b44e900cf1
(x_set_scroll_bar_width): Nil now means 2 columns' worth of pixels.
Karl Heuer <kwzh@gnu.org>
parents:
9103
diff
changeset
|
2709 } |
44b44e900cf1
(x_set_scroll_bar_width): Nil now means 2 columns' worth of pixels.
Karl Heuer <kwzh@gnu.org>
parents:
9103
diff
changeset
|
2710 else if (INTEGERP (arg) && XINT (arg) > 0 |
44b44e900cf1
(x_set_scroll_bar_width): Nil now means 2 columns' worth of pixels.
Karl Heuer <kwzh@gnu.org>
parents:
9103
diff
changeset
|
2711 && XFASTINT (arg) != FRAME_SCROLL_BAR_PIXEL_WIDTH (f)) |
8942
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2712 { |
17629
fa92ac645cf0
(x_set_scroll_bar_width): If arg is too small, round it up.
Richard M. Stallman <rms@gnu.org>
parents:
17609
diff
changeset
|
2713 if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM) |
fa92ac645cf0
(x_set_scroll_bar_width): If arg is too small, round it up.
Richard M. Stallman <rms@gnu.org>
parents:
17609
diff
changeset
|
2714 XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1); |
16682
fe4b95eb15ae
(x_set_scroll_bar_width): Reject a width that's too small.
Richard M. Stallman <rms@gnu.org>
parents:
16515
diff
changeset
|
2715 |
8942
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2716 FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg); |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2717 FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid; |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2718 if (FRAME_X_WINDOW (f)) |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2719 x_set_window_size (f, 0, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
2720 } |
16302
025b3dc7a6ba
(Fx_create_frame): Default Qinternal_border_width to 1.
Richard M. Stallman <rms@gnu.org>
parents:
16254
diff
changeset
|
2721 |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
2722 change_frame_size (f, 0, FRAME_WIDTH (f), 0, 0, 0); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2723 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.hpos = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2724 XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2725 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2726 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2727 |
389 | 2728 |
771 | 2729 /* Subroutines of creating an X frame. */ |
389 | 2730 |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2731 /* Make sure that Vx_resource_name is set to a reasonable value. |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2732 Fix it up, or set it to `emacs' if it is too hopeless. */ |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2733 |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2734 static void |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2735 validate_x_resource_name () |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2736 { |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2737 int len = 0; |
11353
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2738 /* Number of valid characters in the resource name. */ |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2739 int good_count = 0; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2740 /* Number of invalid characters in the resource name. */ |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2741 int bad_count = 0; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2742 Lisp_Object new; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2743 int i; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2744 |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
2745 if (!STRINGP (Vx_resource_class)) |
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
2746 Vx_resource_class = build_string (EMACS_CLASS); |
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
2747 |
7525
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2748 if (STRINGP (Vx_resource_name)) |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2749 { |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2750 unsigned char *p = XSTRING (Vx_resource_name)->data; |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2751 int i; |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2752 |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2753 len = STRING_BYTES (XSTRING (Vx_resource_name)); |
11353
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2754 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2755 /* Only letters, digits, - and _ are valid in resource names. |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2756 Count the valid characters and count the invalid ones. */ |
7525
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2757 for (i = 0; i < len; i++) |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2758 { |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2759 int c = p[i]; |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2760 if (! ((c >= 'a' && c <= 'z') |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2761 || (c >= 'A' && c <= 'Z') |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2762 || (c >= '0' && c <= '9') |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2763 || c == '-' || c == '_')) |
11353
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2764 bad_count++; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2765 else |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2766 good_count++; |
7525
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2767 } |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2768 } |
5b784d881c0f
(validate_x_resource_name): Don't let Vx_resource_name have invalid characters.
Richard M. Stallman <rms@gnu.org>
parents:
7408
diff
changeset
|
2769 else |
11353
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2770 /* Not a string => completely invalid. */ |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2771 bad_count = 5, good_count = 0; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2772 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2773 /* If name is valid already, return. */ |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2774 if (bad_count == 0) |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2775 return; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2776 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2777 /* If name is entirely invalid, or nearly so, use `emacs'. */ |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2778 if (good_count == 0 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2779 || (good_count == 1 && bad_count > 0)) |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2780 { |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2781 Vx_resource_name = build_string ("emacs"); |
11353
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2782 return; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2783 } |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2784 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2785 /* Name is partly valid. Copy it and replace the invalid characters |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2786 with underscores. */ |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2787 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2788 Vx_resource_name = new = Fcopy_sequence (Vx_resource_name); |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2789 |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2790 for (i = 0; i < len; i++) |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2791 { |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2792 int c = XSTRING (new)->data[i]; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2793 if (! ((c >= 'a' && c <= 'z') |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2794 || (c >= 'A' && c <= 'Z') |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2795 || (c >= '0' && c <= '9') |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2796 || c == '-' || c == '_')) |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2797 XSTRING (new)->data[i] = '_'; |
9e3da029f921
(x_window): Copy the frame name to non-Lisp string.
Richard M. Stallman <rms@gnu.org>
parents:
11235
diff
changeset
|
2798 } |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2799 } |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2800 |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2801 |
389 | 2802 extern char *x_get_string_resource (); |
2803 | |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2804 DEFUN ("x-get-resource", Fx_get_resource, Sx_get_resource, 2, 4, 0, |
40599 | 2805 doc: /* Return the value of ATTRIBUTE, of class CLASS, from the X defaults database. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2806 This uses `INSTANCE.ATTRIBUTE' as the key and `Emacs.CLASS' as the |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2807 class, where INSTANCE is the name under which Emacs was invoked, or |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2808 the name specified by the `-name' or `-rn' command-line arguments. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2809 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2810 The optional arguments COMPONENT and SUBCLASS add to the key and the |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2811 class, respectively. You must specify both of them or neither. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
2812 If you specify them, the key is `INSTANCE.COMPONENT.ATTRIBUTE' |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
2813 and the class is `Emacs.CLASS.SUBCLASS'. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
2814 (attribute, class, component, subclass) |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2815 Lisp_Object attribute, class, component, subclass; |
389 | 2816 { |
2817 register char *value; | |
2818 char *name_key; | |
2819 char *class_key; | |
2820 | |
2999
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
2821 check_x (); |
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
2822 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2823 CHECK_STRING (attribute); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2824 CHECK_STRING (class); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2825 |
1733
2d41a3d7b9a6
(Fx_get_resource): Use EMACS_CLASS to make class_key
Richard M. Stallman <rms@gnu.org>
parents:
1719
diff
changeset
|
2826 if (!NILP (component)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2827 CHECK_STRING (component); |
1733
2d41a3d7b9a6
(Fx_get_resource): Use EMACS_CLASS to make class_key
Richard M. Stallman <rms@gnu.org>
parents:
1719
diff
changeset
|
2828 if (!NILP (subclass)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2829 CHECK_STRING (subclass); |
1733
2d41a3d7b9a6
(Fx_get_resource): Use EMACS_CLASS to make class_key
Richard M. Stallman <rms@gnu.org>
parents:
1719
diff
changeset
|
2830 if (NILP (component) != NILP (subclass)) |
2d41a3d7b9a6
(Fx_get_resource): Use EMACS_CLASS to make class_key
Richard M. Stallman <rms@gnu.org>
parents:
1719
diff
changeset
|
2831 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); |
2d41a3d7b9a6
(Fx_get_resource): Use EMACS_CLASS to make class_key
Richard M. Stallman <rms@gnu.org>
parents:
1719
diff
changeset
|
2832 |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
2833 validate_x_resource_name (); |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2834 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2835 /* Allocate space for the components, the dots which separate them, |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2836 and the final '\0'. Make them big enough for the worst case. */ |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2837 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2838 + (STRINGP (component) |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2839 ? STRING_BYTES (XSTRING (component)) : 0) |
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2840 + STRING_BYTES (XSTRING (attribute)) |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2841 + 3); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2842 |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2843 class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class)) |
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2844 + STRING_BYTES (XSTRING (class)) |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2845 + (STRINGP (subclass) |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2846 ? STRING_BYTES (XSTRING (subclass)) : 0) |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2847 + 3); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2848 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2849 /* Start with emacs.FRAMENAME for the name (the specific one) |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2850 and with `Emacs' for the class key (the general one). */ |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2851 strcpy (name_key, XSTRING (Vx_resource_name)->data); |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
2852 strcpy (class_key, XSTRING (Vx_resource_class)->data); |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2853 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2854 strcat (class_key, "."); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2855 strcat (class_key, XSTRING (class)->data); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2856 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2857 if (!NILP (component)) |
389 | 2858 { |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2859 strcat (class_key, "."); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2860 strcat (class_key, XSTRING (subclass)->data); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2861 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2862 strcat (name_key, "."); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2863 strcat (name_key, XSTRING (component)->data); |
389 | 2864 } |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2865 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2866 strcat (name_key, "."); |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
2867 strcat (name_key, XSTRING (attribute)->data); |
389 | 2868 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2869 value = x_get_string_resource (check_x_display_info (Qnil)->xrdb, |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2870 name_key, class_key); |
389 | 2871 |
2872 if (value != (char *) 0) | |
2873 return build_string (value); | |
2874 else | |
2875 return Qnil; | |
2876 } | |
2877 | |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2878 /* Get an X resource, like Fx_get_resource, but for display DPYINFO. */ |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2879 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2880 Lisp_Object |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2881 display_x_get_resource (dpyinfo, attribute, class, component, subclass) |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2882 struct x_display_info *dpyinfo; |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2883 Lisp_Object attribute, class, component, subclass; |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2884 { |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2885 register char *value; |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2886 char *name_key; |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2887 char *class_key; |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2888 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2889 CHECK_STRING (attribute); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2890 CHECK_STRING (class); |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2891 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2892 if (!NILP (component)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2893 CHECK_STRING (component); |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2894 if (!NILP (subclass)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
2895 CHECK_STRING (subclass); |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2896 if (NILP (component) != NILP (subclass)) |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2897 error ("x-get-resource: must specify both COMPONENT and SUBCLASS or neither"); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2898 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2899 validate_x_resource_name (); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2900 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2901 /* Allocate space for the components, the dots which separate them, |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2902 and the final '\0'. Make them big enough for the worst case. */ |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2903 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name)) |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2904 + (STRINGP (component) |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2905 ? STRING_BYTES (XSTRING (component)) : 0) |
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2906 + STRING_BYTES (XSTRING (attribute)) |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2907 + 3); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2908 |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2909 class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class)) |
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2910 + STRING_BYTES (XSTRING (class)) |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2911 + (STRINGP (subclass) |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2912 ? STRING_BYTES (XSTRING (subclass)) : 0) |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2913 + 3); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2914 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2915 /* Start with emacs.FRAMENAME for the name (the specific one) |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2916 and with `Emacs' for the class key (the general one). */ |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2917 strcpy (name_key, XSTRING (Vx_resource_name)->data); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2918 strcpy (class_key, XSTRING (Vx_resource_class)->data); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2919 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2920 strcat (class_key, "."); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2921 strcat (class_key, XSTRING (class)->data); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2922 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2923 if (!NILP (component)) |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2924 { |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2925 strcat (class_key, "."); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2926 strcat (class_key, XSTRING (subclass)->data); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2927 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2928 strcat (name_key, "."); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2929 strcat (name_key, XSTRING (component)->data); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2930 } |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2931 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2932 strcat (name_key, "."); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2933 strcat (name_key, XSTRING (attribute)->data); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2934 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2935 value = x_get_string_resource (dpyinfo->xrdb, name_key, class_key); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2936 |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2937 if (value != (char *) 0) |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2938 return build_string (value); |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2939 else |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2940 return Qnil; |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2941 } |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2942 |
3173
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2943 /* Used when C code wants a resource value. */ |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2944 |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2945 char * |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2946 x_get_resource_string (attribute, class) |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2947 char *attribute, *class; |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2948 { |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2949 char *name_key; |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2950 char *class_key; |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
2951 struct frame *sf = SELECTED_FRAME (); |
3173
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2952 |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2953 /* Allocate space for the components, the dots which separate them, |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2954 and the final '\0'. */ |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
20629
diff
changeset
|
2955 name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name)) |
3173
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2956 + strlen (attribute) + 2); |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2957 class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1) |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2958 + strlen (class) + 2); |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2959 |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2960 sprintf (name_key, "%s.%s", |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2961 XSTRING (Vinvocation_name)->data, |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2962 attribute); |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2963 sprintf (class_key, "%s.%s", EMACS_CLASS, class); |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2964 |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
2965 return x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb, |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
2966 name_key, class_key); |
3173
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2967 } |
c3c1b1ceab05
(x_get_resource_string): New function.
Richard M. Stallman <rms@gnu.org>
parents:
3170
diff
changeset
|
2968 |
398 | 2969 /* Types we might convert a resource string into. */ |
2970 enum resource_types | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2971 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2972 RES_TYPE_NUMBER, |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
2973 RES_TYPE_FLOAT, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2974 RES_TYPE_BOOLEAN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2975 RES_TYPE_STRING, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2976 RES_TYPE_SYMBOL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
2977 }; |
398 | 2978 |
389 | 2979 /* Return the value of parameter PARAM. |
398 | 2980 |
771 | 2981 First search ALIST, then Vdefault_frame_alist, then the X defaults |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2982 database, using ATTRIBUTE as the attribute name and CLASS as its class. |
398 | 2983 |
2984 Convert the resource to the type specified by desired_type. | |
2985 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2986 If no default is specified, return Qunbound. If you call |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
2987 x_get_arg, make sure you deal with Qunbound in a reasonable way, |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
2988 and don't let it get stored in any Lisp-visible variables! */ |
389 | 2989 |
2990 static Lisp_Object | |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2991 x_get_arg (dpyinfo, alist, param, attribute, class, type) |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
2992 struct x_display_info *dpyinfo; |
641 | 2993 Lisp_Object alist, param; |
398 | 2994 char *attribute; |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
2995 char *class; |
398 | 2996 enum resource_types type; |
389 | 2997 { |
2998 register Lisp_Object tem; | |
2999 | |
3000 tem = Fassq (param, alist); | |
3001 if (EQ (tem, Qnil)) | |
771 | 3002 tem = Fassq (param, Vdefault_frame_alist); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3003 if (EQ (tem, Qnil)) |
389 | 3004 { |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3005 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3006 if (attribute) |
398 | 3007 { |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3008 tem = display_x_get_resource (dpyinfo, |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3009 build_string (attribute), |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3010 build_string (class), |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3011 Qnil, Qnil); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3012 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3013 if (NILP (tem)) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3014 return Qunbound; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3015 |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3016 switch (type) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3017 { |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3018 case RES_TYPE_NUMBER: |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3019 return make_number (atoi (XSTRING (tem)->data)); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3020 |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
3021 case RES_TYPE_FLOAT: |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
3022 return make_float (atof (XSTRING (tem)->data)); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
3023 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3024 case RES_TYPE_BOOLEAN: |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3025 tem = Fdowncase (tem); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3026 if (!strcmp (XSTRING (tem)->data, "on") |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3027 || !strcmp (XSTRING (tem)->data, "true")) |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3028 return Qt; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3029 else |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3030 return Qnil; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3031 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3032 case RES_TYPE_STRING: |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3033 return tem; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3034 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3035 case RES_TYPE_SYMBOL: |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3036 /* As a special case, we map the values `true' and `on' |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3037 to Qt, and `false' and `off' to Qnil. */ |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3038 { |
6519
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
3039 Lisp_Object lower; |
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
3040 lower = Fdowncase (tem); |
6523
d9d9ab5951dd
(x_get_arg): Use downcased string in compare.
Karl Heuer <kwzh@gnu.org>
parents:
6522
diff
changeset
|
3041 if (!strcmp (XSTRING (lower)->data, "on") |
d9d9ab5951dd
(x_get_arg): Use downcased string in compare.
Karl Heuer <kwzh@gnu.org>
parents:
6522
diff
changeset
|
3042 || !strcmp (XSTRING (lower)->data, "true")) |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3043 return Qt; |
6523
d9d9ab5951dd
(x_get_arg): Use downcased string in compare.
Karl Heuer <kwzh@gnu.org>
parents:
6522
diff
changeset
|
3044 else if (!strcmp (XSTRING (lower)->data, "off") |
d9d9ab5951dd
(x_get_arg): Use downcased string in compare.
Karl Heuer <kwzh@gnu.org>
parents:
6522
diff
changeset
|
3045 || !strcmp (XSTRING (lower)->data, "false")) |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3046 return Qnil; |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3047 else |
2686
a84b9a78ab08
(x_get_arg): Call Fintern, not intern.
Richard M. Stallman <rms@gnu.org>
parents:
2439
diff
changeset
|
3048 return Fintern (tem, Qnil); |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
3049 } |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
3050 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3051 default: |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3052 abort (); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3053 } |
398 | 3054 } |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3055 else |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3056 return Qunbound; |
389 | 3057 } |
3058 return Fcdr (tem); | |
3059 } | |
3060 | |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3061 /* Like x_get_arg, but also record the value in f->param_alist. */ |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3062 |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3063 static Lisp_Object |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3064 x_get_and_record_arg (f, alist, param, attribute, class, type) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3065 struct frame *f; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3066 Lisp_Object alist, param; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3067 char *attribute; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3068 char *class; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3069 enum resource_types type; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3070 { |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3071 Lisp_Object value; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3072 |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3073 value = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param, |
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3074 attribute, class, type); |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3075 if (! NILP (value)) |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3076 store_frame_param (f, param, value); |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3077 |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3078 return value; |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3079 } |
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
3080 |
771 | 3081 /* Record in frame F the specified or default value according to ALIST |
19095
2f58824bf3f6
(x_set_frame_parameters): Heading comment fixed.
Kenichi Handa <handa@m17n.org>
parents:
19026
diff
changeset
|
3082 of the parameter named PROP (a Lisp symbol). |
2f58824bf3f6
(x_set_frame_parameters): Heading comment fixed.
Kenichi Handa <handa@m17n.org>
parents:
19026
diff
changeset
|
3083 If no value is specified for PROP, look for an X default for XPROP |
771 | 3084 on the frame named NAME. |
389 | 3085 If that is not found either, use the value DEFLT. */ |
3086 | |
3087 static Lisp_Object | |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
3088 x_default_parameter (f, alist, prop, deflt, xprop, xclass, type) |
771 | 3089 struct frame *f; |
389 | 3090 Lisp_Object alist; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3091 Lisp_Object prop; |
389 | 3092 Lisp_Object deflt; |
3093 char *xprop; | |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
3094 char *xclass; |
398 | 3095 enum resource_types type; |
389 | 3096 { |
3097 Lisp_Object tem; | |
3098 | |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3099 tem = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, prop, xprop, xclass, type); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3100 if (EQ (tem, Qunbound)) |
389 | 3101 tem = deflt; |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3102 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); |
389 | 3103 return tem; |
3104 } | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3105 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3106 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3107 /* Record in frame F the specified or default value according to ALIST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3108 of the parameter named PROP (a Lisp symbol). If no value is |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3109 specified for PROP, look for an X default for XPROP on the frame |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3110 named NAME. If that is not found either, use the value DEFLT. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3111 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3112 static Lisp_Object |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3113 x_default_scroll_bar_color_parameter (f, alist, prop, xprop, xclass, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3114 foreground_p) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3115 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3116 Lisp_Object alist; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3117 Lisp_Object prop; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3118 char *xprop; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3119 char *xclass; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3120 int foreground_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3121 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3122 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3123 Lisp_Object tem; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3124 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3125 tem = x_get_arg (dpyinfo, alist, prop, xprop, xclass, RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3126 if (EQ (tem, Qunbound)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3127 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3128 #ifdef USE_TOOLKIT_SCROLL_BARS |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3129 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3130 /* See if an X resource for the scroll bar color has been |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3131 specified. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3132 tem = display_x_get_resource (dpyinfo, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3133 build_string (foreground_p |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3134 ? "foreground" |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3135 : "background"), |
39812
66e0816837a8
Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39682
diff
changeset
|
3136 empty_string, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3137 build_string ("verticalScrollBar"), |
39812
66e0816837a8
Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39682
diff
changeset
|
3138 empty_string); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3139 if (!STRINGP (tem)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3140 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3141 /* If nothing has been specified, scroll bars will use a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3142 toolkit-dependent default. Because these defaults are |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3143 difficult to get at without actually creating a scroll |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3144 bar, use nil to indicate that no color has been |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3145 specified. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3146 tem = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3147 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3148 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3149 #else /* not USE_TOOLKIT_SCROLL_BARS */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3150 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3151 tem = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3152 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3153 #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3154 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3155 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3156 x_set_frame_parameters (f, Fcons (Fcons (prop, tem), Qnil)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3157 return tem; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3158 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3159 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3160 |
389 | 3161 |
2328
82e4fed9cdd6
* xfns.c (Fx_parse_geometry): Renamed from Fx_geometry.
Jim Blandy <jimb@redhat.com>
parents:
2295
diff
changeset
|
3162 DEFUN ("x-parse-geometry", Fx_parse_geometry, Sx_parse_geometry, 1, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
3163 doc: /* Parse an X-style geometry string STRING. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
3164 Returns an alist of the form ((top . TOP), (left . LEFT) ... ). |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
3165 The properties returned may include `top', `left', `height', and `width'. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
3166 The value of `left' or `top' may be an integer, |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
3167 or a list (+ N) meaning N pixels relative to top/left corner, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
3168 or a list (- N) meaning -N pixels relative to bottom/right corner. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
3169 (string) |
1528
924c8a609582
* xfns.c (x_decode_color, Fx_color_display_p): x_screen_planes is
Jim Blandy <jimb@redhat.com>
parents:
1438
diff
changeset
|
3170 Lisp_Object string; |
389 | 3171 { |
3172 int geometry, x, y; | |
3173 unsigned int width, height; | |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3174 Lisp_Object result; |
389 | 3175 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
3176 CHECK_STRING (string); |
389 | 3177 |
3178 geometry = XParseGeometry ((char *) XSTRING (string)->data, | |
3179 &x, &y, &width, &height); | |
3180 | |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3181 #if 0 |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3182 if (!!(geometry & XValue) != !!(geometry & YValue)) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3183 error ("Must specify both x and y position, or neither"); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3184 #endif |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3185 |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3186 result = Qnil; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3187 if (geometry & XValue) |
389 | 3188 { |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3189 Lisp_Object element; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3190 |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3191 if (x >= 0 && (geometry & XNegative)) |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3192 element = Fcons (Qleft, Fcons (Qminus, Fcons (make_number (-x), Qnil))); |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3193 else if (x < 0 && ! (geometry & XNegative)) |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3194 element = Fcons (Qleft, Fcons (Qplus, Fcons (make_number (x), Qnil))); |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3195 else |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3196 element = Fcons (Qleft, make_number (x)); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3197 result = Fcons (element, result); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3198 } |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3199 |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3200 if (geometry & YValue) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3201 { |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3202 Lisp_Object element; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3203 |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3204 if (y >= 0 && (geometry & YNegative)) |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3205 element = Fcons (Qtop, Fcons (Qminus, Fcons (make_number (-y), Qnil))); |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3206 else if (y < 0 && ! (geometry & YNegative)) |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3207 element = Fcons (Qtop, Fcons (Qplus, Fcons (make_number (y), Qnil))); |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3208 else |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3209 element = Fcons (Qtop, make_number (y)); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3210 result = Fcons (element, result); |
389 | 3211 } |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3212 |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3213 if (geometry & WidthValue) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3214 result = Fcons (Fcons (Qwidth, make_number (width)), result); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3215 if (geometry & HeightValue) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3216 result = Fcons (Fcons (Qheight, make_number (height)), result); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3217 |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3218 return result; |
389 | 3219 } |
3220 | |
3221 /* Calculate the desired size and position of this window, | |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3222 and return the flags saying which aspects were specified. |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3223 |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3224 This function does not make the coordinates positive. */ |
389 | 3225 |
3226 #define DEFAULT_ROWS 40 | |
3227 #define DEFAULT_COLS 80 | |
3228 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
3229 static int |
771 | 3230 x_figure_window_size (f, parms) |
3231 struct frame *f; | |
389 | 3232 Lisp_Object parms; |
3233 { | |
7251
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3234 register Lisp_Object tem0, tem1, tem2; |
389 | 3235 long window_prompting = 0; |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
3236 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
389 | 3237 |
3238 /* Default values if we fall through. | |
3239 Actually, if that happens we should get | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3240 window manager prompting. */ |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
3241 SET_FRAME_WIDTH (f, DEFAULT_COLS); |
771 | 3242 f->height = DEFAULT_ROWS; |
3108
461470daafaa
(x_figure_window_size): Make the default frame coords (0,0).
Richard M. Stallman <rms@gnu.org>
parents:
3080
diff
changeset
|
3243 /* Window managers expect that if program-specified |
461470daafaa
(x_figure_window_size): Make the default frame coords (0,0).
Richard M. Stallman <rms@gnu.org>
parents:
3080
diff
changeset
|
3244 positions are not (0,0), they're intentional, not defaults. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3245 f->output_data.x->top_pos = 0; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3246 f->output_data.x->left_pos = 0; |
389 | 3247 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3248 tem0 = x_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3249 tem1 = x_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3250 tem2 = x_get_arg (dpyinfo, parms, Quser_size, 0, 0, RES_TYPE_NUMBER); |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3251 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
389 | 3252 { |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3253 if (!EQ (tem0, Qunbound)) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3254 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
3255 CHECK_NUMBER (tem0); |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3256 f->height = XINT (tem0); |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3257 } |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3258 if (!EQ (tem1, Qunbound)) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3259 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
3260 CHECK_NUMBER (tem1); |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
3261 SET_FRAME_WIDTH (f, XINT (tem1)); |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3262 } |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3263 if (!NILP (tem2) && !EQ (tem2, Qunbound)) |
7251
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3264 window_prompting |= USSize; |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3265 else |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3266 window_prompting |= PSize; |
389 | 3267 } |
3268 | |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3269 f->output_data.x->vertical_scroll_bar_extra |
9240
60497ceed71a
(x_figure_window_size): Use new formula for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
9231
diff
changeset
|
3270 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
60497ceed71a
(x_figure_window_size): Use new formula for scroll bar width.
Karl Heuer <kwzh@gnu.org>
parents:
9231
diff
changeset
|
3271 ? 0 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3272 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
3273 |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
3274 x_compute_fringe_widths (f, 0); |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
3275 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3276 f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3277 f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
389 | 3278 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3279 tem0 = x_get_arg (dpyinfo, parms, Qtop, 0, 0, RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3280 tem1 = x_get_arg (dpyinfo, parms, Qleft, 0, 0, RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3281 tem2 = x_get_arg (dpyinfo, parms, Quser_position, 0, 0, RES_TYPE_NUMBER); |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3282 if (! EQ (tem0, Qunbound) || ! EQ (tem1, Qunbound)) |
389 | 3283 { |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3284 if (EQ (tem0, Qminus)) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3285 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3286 f->output_data.x->top_pos = 0; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3287 window_prompting |= YNegative; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3288 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3289 else if (CONSP (tem0) && EQ (XCAR (tem0), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3290 && CONSP (XCDR (tem0)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3291 && INTEGERP (XCAR (XCDR (tem0)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3292 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3293 f->output_data.x->top_pos = - XINT (XCAR (XCDR (tem0))); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3294 window_prompting |= YNegative; |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3295 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3296 else if (CONSP (tem0) && EQ (XCAR (tem0), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3297 && CONSP (XCDR (tem0)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3298 && INTEGERP (XCAR (XCDR (tem0)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3299 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3300 f->output_data.x->top_pos = XINT (XCAR (XCDR (tem0))); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3301 } |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3302 else if (EQ (tem0, Qunbound)) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3303 f->output_data.x->top_pos = 0; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3304 else |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3305 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
3306 CHECK_NUMBER (tem0); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3307 f->output_data.x->top_pos = XINT (tem0); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3308 if (f->output_data.x->top_pos < 0) |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3309 window_prompting |= YNegative; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3310 } |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3311 |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3312 if (EQ (tem1, Qminus)) |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3313 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3314 f->output_data.x->left_pos = 0; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3315 window_prompting |= XNegative; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3316 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3317 else if (CONSP (tem1) && EQ (XCAR (tem1), Qminus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3318 && CONSP (XCDR (tem1)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3319 && INTEGERP (XCAR (XCDR (tem1)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3320 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3321 f->output_data.x->left_pos = - XINT (XCAR (XCDR (tem1))); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3322 window_prompting |= XNegative; |
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3323 } |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3324 else if (CONSP (tem1) && EQ (XCAR (tem1), Qplus) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3325 && CONSP (XCDR (tem1)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3326 && INTEGERP (XCAR (XCDR (tem1)))) |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3327 { |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
3328 f->output_data.x->left_pos = XINT (XCAR (XCDR (tem1))); |
9022
10fa443c671a
(Fx_create_frame): Rename menuBarLines resource to menuBar.
Richard M. Stallman <rms@gnu.org>
parents:
9014
diff
changeset
|
3329 } |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3330 else if (EQ (tem1, Qunbound)) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3331 f->output_data.x->left_pos = 0; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3332 else |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3333 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
3334 CHECK_NUMBER (tem1); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3335 f->output_data.x->left_pos = XINT (tem1); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3336 if (f->output_data.x->left_pos < 0) |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3337 window_prompting |= XNegative; |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3338 } |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3339 |
10264
92dcc001aa20
(x_figure_window_size): Treat missing user-position parm as nil.
Richard M. Stallman <rms@gnu.org>
parents:
10222
diff
changeset
|
3340 if (!NILP (tem2) && ! EQ (tem2, Qunbound)) |
7251
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3341 window_prompting |= USPosition; |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3342 else |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
3343 window_prompting |= PPosition; |
389 | 3344 } |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
3345 |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3346 if (f->output_data.x->want_fullscreen != FULLSCREEN_NONE) |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3347 { |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3348 int left, top; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3349 int width, height; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3350 |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3351 /* It takes both for some WM:s to place it where we want */ |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3352 window_prompting = USPosition | PPosition; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3353 x_fullscreen_adjust (f, &width, &height, &top, &left); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3354 f->width = width; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3355 f->height = height; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3356 f->output_data.x->pixel_width = CHAR_TO_PIXEL_WIDTH (f, f->width); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3357 f->output_data.x->pixel_height = CHAR_TO_PIXEL_HEIGHT (f, f->height); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3358 f->output_data.x->left_pos = left; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3359 f->output_data.x->top_pos = top; |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3360 } |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
3361 |
3293
03e4cad68481
(Fx_close_current_connection): Clear x_current_display.
Richard M. Stallman <rms@gnu.org>
parents:
3203
diff
changeset
|
3362 return window_prompting; |
389 | 3363 } |
3364 | |
5229
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3365 #if !defined (HAVE_X11R4) && !defined (HAVE_XSETWMPROTOCOLS) |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3366 |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3367 Status |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3368 XSetWMProtocols (dpy, w, protocols, count) |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3369 Display *dpy; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3370 Window w; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3371 Atom *protocols; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3372 int count; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3373 { |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3374 Atom prop; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3375 prop = XInternAtom (dpy, "WM_PROTOCOLS", False); |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3376 if (prop == None) return False; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3377 XChangeProperty (dpy, w, prop, XA_ATOM, 32, PropModeReplace, |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3378 (unsigned char *) protocols, count); |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3379 return True; |
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3380 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3381 #endif /* not HAVE_X11R4 && not HAVE_XSETWMPROTOCOLS */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3382 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3383 #ifdef USE_X_TOOLKIT |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3384 |
9528
db02bc274f20
(Fx_create_frame): Init the FRAME_X_SCREEN as soon as can be done.
Richard M. Stallman <rms@gnu.org>
parents:
9353
diff
changeset
|
3385 /* If the WM_PROTOCOLS property does not already contain WM_TAKE_FOCUS, |
db02bc274f20
(Fx_create_frame): Init the FRAME_X_SCREEN as soon as can be done.
Richard M. Stallman <rms@gnu.org>
parents:
9353
diff
changeset
|
3386 WM_DELETE_WINDOW, and WM_SAVE_YOURSELF, then add them. (They may |
8845
c4b7fda8f611
(hack_wm_protocols): Arrange to handle WM_SAVE_YOURSELF.
Richard M. Stallman <rms@gnu.org>
parents:
8782
diff
changeset
|
3387 already be present because of the toolkit (Motif adds some of them, |
c4b7fda8f611
(hack_wm_protocols): Arrange to handle WM_SAVE_YOURSELF.
Richard M. Stallman <rms@gnu.org>
parents:
8782
diff
changeset
|
3388 for example, but Xt doesn't). */ |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3389 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3390 static void |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3391 hack_wm_protocols (f, widget) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3392 FRAME_PTR f; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3393 Widget widget; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3394 { |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3395 Display *dpy = XtDisplay (widget); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3396 Window w = XtWindow (widget); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3397 int need_delete = 1; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3398 int need_focus = 1; |
8845
c4b7fda8f611
(hack_wm_protocols): Arrange to handle WM_SAVE_YOURSELF.
Richard M. Stallman <rms@gnu.org>
parents:
8782
diff
changeset
|
3399 int need_save = 1; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3400 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3401 BLOCK_INPUT; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3402 { |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3403 Atom type, *atoms = 0; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3404 int format = 0; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3405 unsigned long nitems = 0; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3406 unsigned long bytes_after; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3407 |
11882
8b3575269610
(hack_wm_protocols): Cast args of XGetWindowProperty.
Karl Heuer <kwzh@gnu.org>
parents:
11774
diff
changeset
|
3408 if ((XGetWindowProperty (dpy, w, |
8b3575269610
(hack_wm_protocols): Cast args of XGetWindowProperty.
Karl Heuer <kwzh@gnu.org>
parents:
11774
diff
changeset
|
3409 FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols, |
11894
b20c45d49063
(hack_wm_protocols): Use cast instead of suffix.
Karl Heuer <kwzh@gnu.org>
parents:
11893
diff
changeset
|
3410 (long)0, (long)100, False, XA_ATOM, |
11882
8b3575269610
(hack_wm_protocols): Cast args of XGetWindowProperty.
Karl Heuer <kwzh@gnu.org>
parents:
11774
diff
changeset
|
3411 &type, &format, &nitems, &bytes_after, |
8b3575269610
(hack_wm_protocols): Cast args of XGetWindowProperty.
Karl Heuer <kwzh@gnu.org>
parents:
11774
diff
changeset
|
3412 (unsigned char **) &atoms) |
8b3575269610
(hack_wm_protocols): Cast args of XGetWindowProperty.
Karl Heuer <kwzh@gnu.org>
parents:
11774
diff
changeset
|
3413 == Success) |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3414 && format == 32 && type == XA_ATOM) |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3415 while (nitems > 0) |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3416 { |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3417 nitems--; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3418 if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3419 need_delete = 0; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3420 else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3421 need_focus = 0; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3422 else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3423 need_save = 0; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3424 } |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3425 if (atoms) XFree ((char *) atoms); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3426 } |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3427 { |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3428 Atom props [10]; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3429 int count = 0; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3430 if (need_delete) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3431 props[count++] = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3432 if (need_focus) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3433 props[count++] = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3434 if (need_save) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3435 props[count++] = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3436 if (count) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3437 XChangeProperty (dpy, w, FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols, |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3438 XA_ATOM, 32, PropModeAppend, |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3439 (unsigned char *) props, count); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3440 } |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3441 UNBLOCK_INPUT; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3442 } |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3443 #endif |
27157
3dafddaefc2c
(x_create_im): New function to set IM and IC of a frame.
Gerd Moellmann <gerd@gnu.org>
parents:
27153
diff
changeset
|
3444 |
3dafddaefc2c
(x_create_im): New function to set IM and IC of a frame.
Gerd Moellmann <gerd@gnu.org>
parents:
27153
diff
changeset
|
3445 |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3446 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3447 /* Support routines for XIC (X Input Context). */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3448 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3449 #ifdef HAVE_X_I18N |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3450 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3451 static XFontSet xic_create_xfontset P_ ((struct frame *, char *)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3452 static XIMStyle best_xim_style P_ ((XIMStyles *, XIMStyles *)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3453 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3454 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3455 /* Supported XIM styles, ordered by preferenc. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3456 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3457 static XIMStyle supported_xim_styles[] = |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3458 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3459 XIMPreeditPosition | XIMStatusArea, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3460 XIMPreeditPosition | XIMStatusNothing, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3461 XIMPreeditPosition | XIMStatusNone, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3462 XIMPreeditNothing | XIMStatusArea, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3463 XIMPreeditNothing | XIMStatusNothing, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3464 XIMPreeditNothing | XIMStatusNone, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3465 XIMPreeditNone | XIMStatusArea, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3466 XIMPreeditNone | XIMStatusNothing, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3467 XIMPreeditNone | XIMStatusNone, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3468 0, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3469 }; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3470 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3471 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3472 /* Create an X fontset on frame F with base font name |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3473 BASE_FONTNAME.. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3474 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3475 static XFontSet |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3476 xic_create_xfontset (f, base_fontname) |
27157
3dafddaefc2c
(x_create_im): New function to set IM and IC of a frame.
Gerd Moellmann <gerd@gnu.org>
parents:
27153
diff
changeset
|
3477 struct frame *f; |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3478 char *base_fontname; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3479 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3480 XFontSet xfs; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3481 char **missing_list; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3482 int missing_count; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3483 char *def_string; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3484 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3485 xfs = XCreateFontSet (FRAME_X_DISPLAY (f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3486 base_fontname, &missing_list, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3487 &missing_count, &def_string); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3488 if (missing_list) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3489 XFreeStringList (missing_list); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3490 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3491 /* No need to free def_string. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3492 return xfs; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3493 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3494 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3495 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3496 /* Value is the best input style, given user preferences USER (already |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3497 checked to be supported by Emacs), and styles supported by the |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3498 input method XIM. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3499 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3500 static XIMStyle |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3501 best_xim_style (user, xim) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3502 XIMStyles *user; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3503 XIMStyles *xim; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3504 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3505 int i, j; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3506 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3507 for (i = 0; i < user->count_styles; ++i) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3508 for (j = 0; j < xim->count_styles; ++j) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3509 if (user->supported_styles[i] == xim->supported_styles[j]) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3510 return user->supported_styles[i]; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3511 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3512 /* Return the default style. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3513 return XIMPreeditNothing | XIMStatusNothing; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3514 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3515 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3516 /* Create XIC for frame F. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3517 |
35592 | 3518 static XIMStyle xic_style; |
3519 | |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3520 void |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3521 create_frame_xic (f) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3522 struct frame *f; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3523 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3524 XIM xim; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3525 XIC xic = NULL; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3526 XFontSet xfs = NULL; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3527 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3528 if (FRAME_XIC (f)) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3529 return; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3530 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3531 xim = FRAME_X_XIM (f); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3532 if (xim) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3533 { |
27659
4137c807296b
(create_frame_xic): Fix initialization of automatic aggregates for pcc.
Dave Love <fx@gnu.org>
parents:
27502
diff
changeset
|
3534 XRectangle s_area; |
4137c807296b
(create_frame_xic): Fix initialization of automatic aggregates for pcc.
Dave Love <fx@gnu.org>
parents:
27502
diff
changeset
|
3535 XPoint spot; |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3536 XVaNestedList preedit_attr; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3537 XVaNestedList status_attr; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3538 char *base_fontname; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3539 int fontset; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3540 |
27659
4137c807296b
(create_frame_xic): Fix initialization of automatic aggregates for pcc.
Dave Love <fx@gnu.org>
parents:
27502
diff
changeset
|
3541 s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1; |
4137c807296b
(create_frame_xic): Fix initialization of automatic aggregates for pcc.
Dave Love <fx@gnu.org>
parents:
27502
diff
changeset
|
3542 spot.x = 0; spot.y = 1; |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3543 /* Create X fontset. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3544 fontset = FRAME_FONTSET (f); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3545 if (fontset < 0) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3546 base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3547 else |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3548 { |
28229
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3549 /* Determine the base fontname from the ASCII font name of |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3550 FONTSET. */ |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3551 char *ascii_font = (char *) XSTRING (fontset_ascii (fontset))->data; |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3552 char *p = ascii_font; |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3553 int i; |
28229
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3554 |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3555 for (i = 0; *p; p++) |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3556 if (*p == '-') i++; |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3557 if (i != 14) |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3558 /* As the font name doesn't conform to XLFD, we can't |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3559 modify it to get a suitable base fontname for the |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3560 frame. */ |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3561 base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*"; |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3562 else |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3563 { |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3564 int len = strlen (ascii_font) + 1; |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
3565 char *p1 = NULL; |
28229
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3566 |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3567 for (i = 0, p = ascii_font; i < 8; p++) |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3568 { |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3569 if (*p == '-') |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3570 { |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3571 i++; |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3572 if (i == 3) |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3573 p1 = p + 1; |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3574 } |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3575 } |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3576 base_fontname = (char *) alloca (len); |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3577 bzero (base_fontname, len); |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3578 strcpy (base_fontname, "-*-*-"); |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3579 bcopy (p1, base_fontname + 5, p - p1); |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3580 strcat (base_fontname, "*-*-*-*-*-*-*"); |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
3581 } |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3582 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3583 xfs = xic_create_xfontset (f, base_fontname); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3584 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3585 /* Determine XIC style. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3586 if (xic_style == 0) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3587 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3588 XIMStyles supported_list; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3589 supported_list.count_styles = (sizeof supported_xim_styles |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3590 / sizeof supported_xim_styles[0]); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3591 supported_list.supported_styles = supported_xim_styles; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3592 xic_style = best_xim_style (&supported_list, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3593 FRAME_X_XIM_STYLES (f)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3594 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3595 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3596 preedit_attr = XVaCreateNestedList (0, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3597 XNFontSet, xfs, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3598 XNForeground, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3599 FRAME_FOREGROUND_PIXEL (f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3600 XNBackground, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3601 FRAME_BACKGROUND_PIXEL (f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3602 (xic_style & XIMPreeditPosition |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3603 ? XNSpotLocation |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3604 : NULL), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3605 &spot, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3606 NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3607 status_attr = XVaCreateNestedList (0, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3608 XNArea, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3609 &s_area, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3610 XNFontSet, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3611 xfs, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3612 XNForeground, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3613 FRAME_FOREGROUND_PIXEL (f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3614 XNBackground, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3615 FRAME_BACKGROUND_PIXEL (f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3616 NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3617 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3618 xic = XCreateIC (xim, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3619 XNInputStyle, xic_style, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3620 XNClientWindow, FRAME_X_WINDOW(f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3621 XNFocusWindow, FRAME_X_WINDOW(f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3622 XNStatusAttributes, status_attr, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3623 XNPreeditAttributes, preedit_attr, |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3624 NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3625 XFree (preedit_attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3626 XFree (status_attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3627 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3628 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3629 FRAME_XIC (f) = xic; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3630 FRAME_XIC_STYLE (f) = xic_style; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3631 FRAME_XIC_FONTSET (f) = xfs; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3632 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3633 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3634 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3635 /* Destroy XIC and free XIC fontset of frame F, if any. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3636 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3637 void |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3638 free_frame_xic (f) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3639 struct frame *f; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3640 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3641 if (FRAME_XIC (f) == NULL) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3642 return; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3643 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3644 XDestroyIC (FRAME_XIC (f)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3645 if (FRAME_XIC_FONTSET (f)) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3646 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3647 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3648 FRAME_XIC (f) = NULL; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3649 FRAME_XIC_FONTSET (f) = NULL; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3650 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3651 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3652 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3653 /* Place preedit area for XIC of window W's frame to specified |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3654 pixel position X/Y. X and Y are relative to window W. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3655 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3656 void |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3657 xic_set_preeditarea (w, x, y) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3658 struct window *w; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3659 int x, y; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3660 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3661 struct frame *f = XFRAME (w->frame); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3662 XVaNestedList attr; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3663 XPoint spot; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3664 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3665 spot.x = WINDOW_TO_FRAME_PIXEL_X (w, x); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3666 spot.y = WINDOW_TO_FRAME_PIXEL_Y (w, y) + FONT_BASE (FRAME_FONT (f)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3667 attr = XVaCreateNestedList (0, XNSpotLocation, &spot, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3668 XSetICValues (FRAME_XIC (f), XNPreeditAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3669 XFree (attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3670 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3671 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3672 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3673 /* Place status area for XIC in bottom right corner of frame F.. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3674 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3675 void |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3676 xic_set_statusarea (f) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3677 struct frame *f; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3678 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3679 XIC xic = FRAME_XIC (f); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3680 XVaNestedList attr; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3681 XRectangle area; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3682 XRectangle *needed; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3683 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3684 /* Negotiate geometry of status area. If input method has existing |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3685 status area, use its current size. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3686 area.x = area.y = area.width = area.height = 0; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3687 attr = XVaCreateNestedList (0, XNAreaNeeded, &area, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3688 XSetICValues (xic, XNStatusAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3689 XFree (attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3690 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3691 attr = XVaCreateNestedList (0, XNAreaNeeded, &needed, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3692 XGetICValues (xic, XNStatusAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3693 XFree (attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3694 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3695 if (needed->width == 0) /* Use XNArea instead of XNAreaNeeded */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3696 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3697 attr = XVaCreateNestedList (0, XNArea, &needed, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3698 XGetICValues (xic, XNStatusAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3699 XFree (attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3700 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3701 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3702 area.width = needed->width; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3703 area.height = needed->height; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3704 area.x = PIXEL_WIDTH (f) - area.width - FRAME_INTERNAL_BORDER_WIDTH (f); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3705 area.y = (PIXEL_HEIGHT (f) - area.height |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3706 - FRAME_MENUBAR_HEIGHT (f) - FRAME_INTERNAL_BORDER_WIDTH (f)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3707 XFree (needed); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3708 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3709 attr = XVaCreateNestedList (0, XNArea, &area, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3710 XSetICValues(xic, XNStatusAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3711 XFree (attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3712 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3713 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3714 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3715 /* Set X fontset for XIC of frame F, using base font name |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3716 BASE_FONTNAME. Called when a new Emacs fontset is chosen. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3717 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3718 void |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3719 xic_set_xfontset (f, base_fontname) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3720 struct frame *f; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3721 char *base_fontname; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3722 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3723 XVaNestedList attr; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3724 XFontSet xfs; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3725 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3726 xfs = xic_create_xfontset (f, base_fontname); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3727 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3728 attr = XVaCreateNestedList (0, XNFontSet, xfs, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3729 if (FRAME_XIC_STYLE (f) & XIMPreeditPosition) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3730 XSetICValues (FRAME_XIC (f), XNPreeditAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3731 if (FRAME_XIC_STYLE (f) & XIMStatusArea) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3732 XSetICValues (FRAME_XIC (f), XNStatusAttributes, attr, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3733 XFree (attr); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3734 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3735 if (FRAME_XIC_FONTSET (f)) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3736 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3737 FRAME_XIC_FONTSET (f) = xfs; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3738 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3739 |
27157
3dafddaefc2c
(x_create_im): New function to set IM and IC of a frame.
Gerd Moellmann <gerd@gnu.org>
parents:
27153
diff
changeset
|
3740 #endif /* HAVE_X_I18N */ |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3741 |
27157
3dafddaefc2c
(x_create_im): New function to set IM and IC of a frame.
Gerd Moellmann <gerd@gnu.org>
parents:
27153
diff
changeset
|
3742 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3743 |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3744 #ifdef USE_X_TOOLKIT |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3745 |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3746 /* Create and set up the X widget for frame F. */ |
5229
110539a25499
(Fx_list_fonts): Handle BROKEN_XLISTFONTSWITHINFO.
Richard M. Stallman <rms@gnu.org>
parents:
5193
diff
changeset
|
3747 |
389 | 3748 static void |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3749 x_window (f, window_prompting, minibuffer_only) |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3750 struct frame *f; |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3751 long window_prompting; |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3752 int minibuffer_only; |
389 | 3753 { |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3754 XClassHint class_hints; |
6059
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3755 XSetWindowAttributes attributes; |
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3756 unsigned long attribute_mask; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3757 Widget shell_widget; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3758 Widget pane_widget; |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3759 Widget frame_widget; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3760 Arg al [25]; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3761 int ac; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3762 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3763 BLOCK_INPUT; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3764 |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3765 /* Use the resource name as the top-level widget name |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3766 for looking up resources. Make a non-Lisp copy |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3767 for the window manager, so GC relocation won't bother it. |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3768 |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3769 Elsewhere we specify the window name for the window manager. */ |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3770 |
11496
db02849ee365
(x_window): Use (or reuse) frame's namebuf instead of a
Karl Heuer <kwzh@gnu.org>
parents:
11483
diff
changeset
|
3771 { |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3772 char *str = (char *) XSTRING (Vx_resource_name)->data; |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3773 f->namebuf = (char *) xmalloc (strlen (str) + 1); |
11496
db02849ee365
(x_window): Use (or reuse) frame's namebuf instead of a
Karl Heuer <kwzh@gnu.org>
parents:
11483
diff
changeset
|
3774 strcpy (f->namebuf, str); |
db02849ee365
(x_window): Use (or reuse) frame's namebuf instead of a
Karl Heuer <kwzh@gnu.org>
parents:
11483
diff
changeset
|
3775 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3776 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3777 ac = 0; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3778 XtSetArg (al[ac], XtNallowShellResize, 1); ac++; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3779 XtSetArg (al[ac], XtNinput, 1); ac++; |
11707
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3780 XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3781 XtSetArg (al[ac], XtNborderWidth, f->output_data.x->border_width); ac++; |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3782 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3783 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3784 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; |
11496
db02849ee365
(x_window): Use (or reuse) frame's namebuf instead of a
Karl Heuer <kwzh@gnu.org>
parents:
11483
diff
changeset
|
3785 shell_widget = XtAppCreateShell (f->namebuf, EMACS_CLASS, |
12019
63ee64941021
(x_top_window_to_frame): Don't match menu-bar widget.
Karl Heuer <kwzh@gnu.org>
parents:
12011
diff
changeset
|
3786 applicationShellWidgetClass, |
9742
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
3787 FRAME_X_DISPLAY (f), al, ac); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3788 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3789 f->output_data.x->widget = shell_widget; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3790 /* maybe_set_screen_title_format (shell_widget); */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3791 |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3792 pane_widget = lw_create_widget ("main", "pane", widget_id_tick++, |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3793 (widget_value *) NULL, |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3794 shell_widget, False, |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3795 (lw_callback) NULL, |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3796 (lw_callback) NULL, |
27343
43230463dfcf
(x_window): Call lw_create_widget with new parameter
Gerd Moellmann <gerd@gnu.org>
parents:
27157
diff
changeset
|
3797 (lw_callback) NULL, |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3798 (lw_callback) NULL); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3799 |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3800 ac = 0; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3801 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3802 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3803 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3804 XtSetValues (pane_widget, al, ac); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3805 f->output_data.x->column_widget = pane_widget; |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3806 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3807 /* mappedWhenManaged to false tells to the paned window to not map/unmap |
7040
cd4dd38925f9
(x_window): Test FRAME_EXTERNAL_MENU_BAR
Richard M. Stallman <rms@gnu.org>
parents:
6940
diff
changeset
|
3808 the emacs screen when changing menubar. This reduces flickering. */ |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3809 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3810 ac = 0; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3811 XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3812 XtSetArg (al[ac], XtNshowGrip, 0); ac++; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3813 XtSetArg (al[ac], XtNallowResize, 1); ac++; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3814 XtSetArg (al[ac], XtNresizeToPreferred, 1); ac++; |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3815 XtSetArg (al[ac], XtNemacsFrame, f); ac++; |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3816 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3817 XtSetArg (al[ac], XtNdepth, FRAME_X_DISPLAY_INFO (f)->n_planes); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3818 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3819 frame_widget = XtCreateWidget (f->namebuf, emacsFrameClass, pane_widget, |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3820 al, ac); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3821 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3822 f->output_data.x->edit_widget = frame_widget; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3823 |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3824 XtManageChild (frame_widget); |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3825 |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3826 /* Do some needed geometry management. */ |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3827 { |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3828 int len; |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3829 char *tem, shell_position[32]; |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3830 Arg al[2]; |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3831 int ac = 0; |
12190
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3832 int extra_borders = 0; |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3833 int menubar_size |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3834 = (f->output_data.x->menubar_widget |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3835 ? (f->output_data.x->menubar_widget->core.height |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3836 + f->output_data.x->menubar_widget->core.border_width) |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3837 : 0); |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3838 |
15942
ff30ec8aab54
(x_window): Don't add ibw to menubar_size.
Richard M. Stallman <rms@gnu.org>
parents:
15891
diff
changeset
|
3839 #if 0 /* Experimentally, we now get the right results |
ff30ec8aab54
(x_window): Don't add ibw to menubar_size.
Richard M. Stallman <rms@gnu.org>
parents:
15891
diff
changeset
|
3840 for -geometry -0-0 without this. 24 Aug 96, rms. */ |
7969
7f15f77cb644
(x_window): Take account of pane widget internal border width.
Richard M. Stallman <rms@gnu.org>
parents:
7946
diff
changeset
|
3841 if (FRAME_EXTERNAL_MENU_BAR (f)) |
7f15f77cb644
(x_window): Take account of pane widget internal border width.
Richard M. Stallman <rms@gnu.org>
parents:
7946
diff
changeset
|
3842 { |
9808
4c43c9dbe130
(x_window): Make ibw 0 by default.
Richard M. Stallman <rms@gnu.org>
parents:
9742
diff
changeset
|
3843 Dimension ibw = 0; |
7969
7f15f77cb644
(x_window): Take account of pane widget internal border width.
Richard M. Stallman <rms@gnu.org>
parents:
7946
diff
changeset
|
3844 XtVaGetValues (pane_widget, XtNinternalBorderWidth, &ibw, NULL); |
7f15f77cb644
(x_window): Take account of pane widget internal border width.
Richard M. Stallman <rms@gnu.org>
parents:
7946
diff
changeset
|
3845 menubar_size += ibw; |
7f15f77cb644
(x_window): Take account of pane widget internal border width.
Richard M. Stallman <rms@gnu.org>
parents:
7946
diff
changeset
|
3846 } |
15942
ff30ec8aab54
(x_window): Don't add ibw to menubar_size.
Richard M. Stallman <rms@gnu.org>
parents:
15891
diff
changeset
|
3847 #endif |
7969
7f15f77cb644
(x_window): Take account of pane widget internal border width.
Richard M. Stallman <rms@gnu.org>
parents:
7946
diff
changeset
|
3848 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3849 f->output_data.x->menubar_height = menubar_size; |
11897
cbd3724a9696
(x_window) [both versions]: Set menubar_height.
Karl Heuer <kwzh@gnu.org>
parents:
11894
diff
changeset
|
3850 |
16305
00e57c8adaba
(x_window): With Motif, double extra_borders.
Richard M. Stallman <rms@gnu.org>
parents:
16302
diff
changeset
|
3851 #ifndef USE_LUCID |
12190
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3852 /* Motif seems to need this amount added to the sizes |
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3853 specified for the shell widget. The Athena/Lucid widgets don't. |
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3854 Both conclusions reached experimentally. -- rms. */ |
16305
00e57c8adaba
(x_window): With Motif, double extra_borders.
Richard M. Stallman <rms@gnu.org>
parents:
16302
diff
changeset
|
3855 XtVaGetValues (f->output_data.x->edit_widget, XtNinternalBorderWidth, |
00e57c8adaba
(x_window): With Motif, double extra_borders.
Richard M. Stallman <rms@gnu.org>
parents:
16302
diff
changeset
|
3856 &extra_borders, NULL); |
00e57c8adaba
(x_window): With Motif, double extra_borders.
Richard M. Stallman <rms@gnu.org>
parents:
16302
diff
changeset
|
3857 extra_borders *= 2; |
00e57c8adaba
(x_window): With Motif, double extra_borders.
Richard M. Stallman <rms@gnu.org>
parents:
16302
diff
changeset
|
3858 #endif |
12190
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3859 |
11707
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3860 /* Convert our geometry parameters into a geometry string |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3861 and specify it. |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3862 Note that we do not specify here whether the position |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3863 is a user-specified or program-specified one. |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3864 We pass that information later, in x_wm_set_size_hints. */ |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3865 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3866 int left = f->output_data.x->left_pos; |
11707
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3867 int xneg = window_prompting & XNegative; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3868 int top = f->output_data.x->top_pos; |
11707
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3869 int yneg = window_prompting & YNegative; |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3870 if (xneg) |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3871 left = -left; |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3872 if (yneg) |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3873 top = -top; |
11893
1f70ffad3d6d
[USE_X_TOOLKIT] (x_window): Pass position to toolkit
Karl Heuer <kwzh@gnu.org>
parents:
11882
diff
changeset
|
3874 |
1f70ffad3d6d
[USE_X_TOOLKIT] (x_window): Pass position to toolkit
Karl Heuer <kwzh@gnu.org>
parents:
11882
diff
changeset
|
3875 if (window_prompting & USPosition) |
12190
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3876 sprintf (shell_position, "=%dx%d%c%d%c%d", |
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3877 PIXEL_WIDTH (f) + extra_borders, |
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3878 PIXEL_HEIGHT (f) + menubar_size + extra_borders, |
11893
1f70ffad3d6d
[USE_X_TOOLKIT] (x_window): Pass position to toolkit
Karl Heuer <kwzh@gnu.org>
parents:
11882
diff
changeset
|
3879 (xneg ? '-' : '+'), left, |
1f70ffad3d6d
[USE_X_TOOLKIT] (x_window): Pass position to toolkit
Karl Heuer <kwzh@gnu.org>
parents:
11882
diff
changeset
|
3880 (yneg ? '-' : '+'), top); |
1f70ffad3d6d
[USE_X_TOOLKIT] (x_window): Pass position to toolkit
Karl Heuer <kwzh@gnu.org>
parents:
11882
diff
changeset
|
3881 else |
12190
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3882 sprintf (shell_position, "=%dx%d", |
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3883 PIXEL_WIDTH (f) + extra_borders, |
e0abe30899a9
[USE_X_TOOLKIT] (x_window): If using Motif,
Karl Heuer <kwzh@gnu.org>
parents:
12111
diff
changeset
|
3884 PIXEL_HEIGHT (f) + menubar_size + extra_borders); |
11707
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3885 } |
b0cb8129be58
[USE_X_TOOLKIT] (x_window): Always pass position in geometry.
Richard M. Stallman <rms@gnu.org>
parents:
11611
diff
changeset
|
3886 |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3887 len = strlen (shell_position) + 1; |
17579 | 3888 /* We don't free this because we don't know whether |
3889 it is safe to free it while the frame exists. | |
3890 It isn't worth the trouble of arranging to free it | |
3891 when the frame is deleted. */ | |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3892 tem = (char *) xmalloc (len); |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3893 strncpy (tem, shell_position, len); |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3894 XtSetArg (al[ac], XtNgeometry, tem); ac++; |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3895 XtSetValues (shell_widget, al, ac); |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3896 } |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
3897 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3898 XtManageChild (pane_widget); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3899 XtRealizeWidget (shell_widget); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3900 |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3901 FRAME_X_WINDOW (f) = XtWindow (frame_widget); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3902 |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3903 validate_x_resource_name (); |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
3904 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3905 class_hints.res_name = (char *) XSTRING (Vx_resource_name)->data; |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
3906 class_hints.res_class = (char *) XSTRING (Vx_resource_class)->data; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3907 XSetClassHint (FRAME_X_DISPLAY (f), XtWindow (shell_widget), &class_hints); |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3908 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3909 #ifdef HAVE_X_I18N |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3910 FRAME_XIC (f) = NULL; |
29947
b7556fa4c05b
(x_window) [!USE_XIM]: Don't call create_frame_ic.
Gerd Moellmann <gerd@gnu.org>
parents:
29938
diff
changeset
|
3911 #ifdef USE_XIM |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3912 create_frame_xic (f); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3913 #endif |
29947
b7556fa4c05b
(x_window) [!USE_XIM]: Don't call create_frame_ic.
Gerd Moellmann <gerd@gnu.org>
parents:
29938
diff
changeset
|
3914 #endif |
13227
d8af44485b3c
(x_window, both versions): Add HAVE_X_I18N support.
Richard M. Stallman <rms@gnu.org>
parents:
13083
diff
changeset
|
3915 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3916 f->output_data.x->wm_hints.input = True; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3917 f->output_data.x->wm_hints.flags |= InputHint; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3918 XSetWMHints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3919 &f->output_data.x->wm_hints); |
7172
f9eeb75c2b76
(x_window) [USE_X_TOOLKIT]: Call XSetWMHints.
Richard M. Stallman <rms@gnu.org>
parents:
7040
diff
changeset
|
3920 |
9703
85ac0e4030d4
(x_window): Pass new arg f to hack_wm_protocols.
Richard M. Stallman <rms@gnu.org>
parents:
9690
diff
changeset
|
3921 hack_wm_protocols (f, shell_widget); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3922 |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3923 #ifdef HACK_EDITRES |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3924 XtAddEventHandler (shell_widget, 0, True, _XEditResCheckMessages, 0); |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3925 #endif |
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3926 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3927 /* Do a stupid property change to force the server to generate a |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
3928 PropertyNotify event so that the event_stream server timestamp will |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3929 be initialized to something relevant to the time we created the window. |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3930 */ |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3931 XChangeProperty (XtDisplay (frame_widget), XtWindow (frame_widget), |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3932 FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols, |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3933 XA_ATOM, 32, PropModeAppend, |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3934 (unsigned char*) NULL, 0); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3935 |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3936 /* Make all the standard events reach the Emacs frame. */ |
6059
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3937 attributes.event_mask = STANDARD_EVENT_SET; |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3938 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3939 #ifdef HAVE_X_I18N |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3940 if (FRAME_XIC (f)) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3941 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3942 /* XIM server might require some X events. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3943 unsigned long fevent = NoEventMask; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3944 XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3945 attributes.event_mask |= fevent; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3946 } |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3947 #endif /* HAVE_X_I18N */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
3948 |
6059
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3949 attribute_mask = CWEventMask; |
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3950 XChangeWindowAttributes (XtDisplay (shell_widget), XtWindow (shell_widget), |
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3951 attribute_mask, &attributes); |
0021cbdc591b
(x_window): Call XChangeWindowAttributes with the standard
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6011
diff
changeset
|
3952 |
9231
eeb35369e536
(HACK_EDITRES): Declare if using X11R5.
Paul Reilly <pmr@pajato.com>
parents:
9182
diff
changeset
|
3953 XtMapWidget (frame_widget); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3954 |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3955 /* x_set_name normally ignores requests to set the name if the |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3956 requested name is the same as the current name. This is the one |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3957 place where that assumption isn't correct; f->name is set, but |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3958 the X server hasn't been told. */ |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3959 { |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3960 Lisp_Object name; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3961 int explicit = f->explicit_name; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3962 |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3963 f->explicit_name = 0; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3964 name = f->name; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3965 f->name = Qnil; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3966 x_set_name (f, name, explicit); |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3967 } |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3968 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
3969 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3970 f->output_data.x->text_cursor); |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3971 |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3972 UNBLOCK_INPUT; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3973 |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
3974 /* This is a no-op, except under Motif. Make sure main areas are |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
3975 set to something reasonable, in case we get an error later. */ |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
3976 lw_set_main_areas (pane_widget, 0, frame_widget); |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3977 } |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3978 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3979 #else /* not USE_X_TOOLKIT */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
3980 |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3981 /* Create and set up the X window for frame F. */ |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3982 |
21846 | 3983 void |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3984 x_window (f) |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3985 struct frame *f; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3986 |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3987 { |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3988 XClassHint class_hints; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3989 XSetWindowAttributes attributes; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3990 unsigned long attribute_mask; |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
3991 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3992 attributes.background_pixel = f->output_data.x->background_pixel; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
3993 attributes.border_pixel = f->output_data.x->border_pixel; |
389 | 3994 attributes.bit_gravity = StaticGravity; |
3995 attributes.backing_store = NotUseful; | |
3996 attributes.save_under = True; | |
3997 attributes.event_mask = STANDARD_EVENT_SET; | |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3998 attributes.colormap = FRAME_X_COLORMAP (f); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
3999 attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4000 | CWColormap); |
389 | 4001 |
4002 BLOCK_INPUT; | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4003 FRAME_X_WINDOW (f) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4004 = XCreateWindow (FRAME_X_DISPLAY (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4005 f->output_data.x->parent_desc, |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4006 f->output_data.x->left_pos, |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4007 f->output_data.x->top_pos, |
771 | 4008 PIXEL_WIDTH (f), PIXEL_HEIGHT (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4009 f->output_data.x->border_width, |
389 | 4010 CopyFromParent, /* depth */ |
4011 InputOutput, /* class */ | |
28144
71ebba3566ec
(X_I18N_INHIBITED): Don't define.
Gerd Moellmann <gerd@gnu.org>
parents:
28096
diff
changeset
|
4012 FRAME_X_VISUAL (f), |
389 | 4013 attribute_mask, &attributes); |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4014 |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4015 #ifdef HAVE_X_I18N |
29947
b7556fa4c05b
(x_window) [!USE_XIM]: Don't call create_frame_ic.
Gerd Moellmann <gerd@gnu.org>
parents:
29938
diff
changeset
|
4016 #ifdef USE_XIM |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4017 create_frame_xic (f); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4018 if (FRAME_XIC (f)) |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4019 { |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4020 /* XIM server might require some X events. */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4021 unsigned long fevent = NoEventMask; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4022 XGetICValues(FRAME_XIC (f), XNFilterEvents, &fevent, NULL); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4023 attributes.event_mask |= fevent; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4024 attribute_mask = CWEventMask; |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4025 XChangeWindowAttributes (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4026 attribute_mask, &attributes); |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4027 } |
29947
b7556fa4c05b
(x_window) [!USE_XIM]: Don't call create_frame_ic.
Gerd Moellmann <gerd@gnu.org>
parents:
29938
diff
changeset
|
4028 #endif |
27502
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4029 #endif /* HAVE_X_I18N */ |
52e8cb1333f2
(xic_set_preeditarea): Take window parameter and
Gerd Moellmann <gerd@gnu.org>
parents:
27343
diff
changeset
|
4030 |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
4031 validate_x_resource_name (); |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4032 |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
4033 class_hints.res_name = (char *) XSTRING (Vx_resource_name)->data; |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
4034 class_hints.res_class = (char *) XSTRING (Vx_resource_class)->data; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4035 XSetClassHint (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &class_hints); |
771 | 4036 |
11897
cbd3724a9696
(x_window) [both versions]: Set menubar_height.
Karl Heuer <kwzh@gnu.org>
parents:
11894
diff
changeset
|
4037 /* The menubar is part of the ordinary display; |
cbd3724a9696
(x_window) [both versions]: Set menubar_height.
Karl Heuer <kwzh@gnu.org>
parents:
11894
diff
changeset
|
4038 it does not count in addition to the height of the window. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4039 f->output_data.x->menubar_height = 0; |
11897
cbd3724a9696
(x_window) [both versions]: Set menubar_height.
Karl Heuer <kwzh@gnu.org>
parents:
11894
diff
changeset
|
4040 |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
4041 /* This indicates that we use the "Passive Input" input model. |
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
4042 Unless we do this, we don't get the Focus{In,Out} events that we |
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
4043 need to draw the cursor correctly. Accursed bureaucrats. |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4044 XWhipsAndChains (FRAME_X_DISPLAY (f), IronMaiden, &TheRack); */ |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
4045 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4046 f->output_data.x->wm_hints.input = True; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4047 f->output_data.x->wm_hints.flags |= InputHint; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4048 XSetWMHints (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4049 &f->output_data.x->wm_hints); |
15081
ab8c81feacf9
(x_window) [! USE_X_TOOLKIT]: Initialize wm_hints.icon_pixmap.
Richard M. Stallman <rms@gnu.org>
parents:
15079
diff
changeset
|
4050 f->output_data.x->wm_hints.icon_pixmap = None; |
7860
26a1d7b2670b
(x_window): Request "save yourself" commands.
Richard M. Stallman <rms@gnu.org>
parents:
7802
diff
changeset
|
4051 |
26a1d7b2670b
(x_window): Request "save yourself" commands.
Richard M. Stallman <rms@gnu.org>
parents:
7802
diff
changeset
|
4052 /* Request "save yourself" and "delete window" commands from wm. */ |
26a1d7b2670b
(x_window): Request "save yourself" commands.
Richard M. Stallman <rms@gnu.org>
parents:
7802
diff
changeset
|
4053 { |
26a1d7b2670b
(x_window): Request "save yourself" commands.
Richard M. Stallman <rms@gnu.org>
parents:
7802
diff
changeset
|
4054 Atom protocols[2]; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4055 protocols[0] = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4056 protocols[1] = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4057 XSetWMProtocols (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), protocols, 2); |
7860
26a1d7b2670b
(x_window): Request "save yourself" commands.
Richard M. Stallman <rms@gnu.org>
parents:
7802
diff
changeset
|
4058 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4059 |
817 | 4060 /* x_set_name normally ignores requests to set the name if the |
4061 requested name is the same as the current name. This is the one | |
4062 place where that assumption isn't correct; f->name is set, but | |
4063 the X server hasn't been told. */ | |
4064 { | |
6519
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
4065 Lisp_Object name; |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4066 int explicit = f->explicit_name; |
817 | 4067 |
6519
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
4068 f->explicit_name = 0; |
22c56514eeb3
(x_set_frame_parameters, x_get_arg, x_window, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
6506
diff
changeset
|
4069 name = f->name; |
817 | 4070 f->name = Qnil; |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4071 x_set_name (f, name, explicit); |
817 | 4072 } |
4073 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4074 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4075 f->output_data.x->text_cursor); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4076 |
389 | 4077 UNBLOCK_INPUT; |
4078 | |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4079 if (FRAME_X_WINDOW (f) == 0) |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4080 error ("Unable to create window"); |
389 | 4081 } |
4082 | |
6790
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
4083 #endif /* not USE_X_TOOLKIT */ |
ee8090b47ea6
(x_figure_window_size): Don't call x_calc_absolute_position.
Richard M. Stallman <rms@gnu.org>
parents:
6783
diff
changeset
|
4084 |
389 | 4085 /* Handle the icon stuff for this window. Perhaps later we might |
4086 want an x_set_icon_position which can be called interactively as | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4087 well. */ |
389 | 4088 |
4089 static void | |
771 | 4090 x_icon (f, parms) |
4091 struct frame *f; | |
389 | 4092 Lisp_Object parms; |
4093 { | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4094 Lisp_Object icon_x, icon_y; |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
4095 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
389 | 4096 |
4097 /* Set the position of the icon. Note that twm groups all | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4098 icons in an icon window. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4099 icon_x = x_get_and_record_arg (f, parms, Qicon_left, 0, 0, RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4100 icon_y = x_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4101 if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
389 | 4102 { |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
4103 CHECK_NUMBER (icon_x); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
4104 CHECK_NUMBER (icon_y); |
389 | 4105 } |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4106 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
389 | 4107 error ("Both left and top icon corners of icon must be specified"); |
4108 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4109 BLOCK_INPUT; |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4110 |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4111 if (! EQ (icon_x, Qunbound)) |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
4112 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4113 |
389 | 4114 /* Start up iconic or window? */ |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
4115 x_wm_set_window_state |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4116 (f, (EQ (x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, RES_TYPE_SYMBOL), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4117 Qicon) |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
4118 ? IconicState |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
4119 : NormalState)); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4120 |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
4121 x_text_icon (f, (char *) XSTRING ((!NILP (f->icon_name) |
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
4122 ? f->icon_name |
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
4123 : f->name))->data); |
12073 | 4124 |
389 | 4125 UNBLOCK_INPUT; |
4126 } | |
4127 | |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
4128 /* Make the GCs needed for this window, setting the |
389 | 4129 background, border and mouse colors; also create the |
4130 mouse cursor and the gray border tile. */ | |
4131 | |
1018
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4132 static char cursor_bits[] = |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4133 { |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4134 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4135 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4138 }; |
5fd29acd3db7
* xfns.c (x_set_name): Take new argument EXPLICIT, instead of
Jim Blandy <jimb@redhat.com>
parents:
974
diff
changeset
|
4139 |
389 | 4140 static void |
771 | 4141 x_make_gc (f) |
4142 struct frame *f; | |
389 | 4143 { |
4144 XGCValues gc_values; | |
4145 | |
2341
1982e2983822
* xfns.c (x_make_gc): Don't forget to block X input around the
Jim Blandy <jimb@redhat.com>
parents:
2328
diff
changeset
|
4146 BLOCK_INPUT; |
1982e2983822
* xfns.c (x_make_gc): Don't forget to block X input around the
Jim Blandy <jimb@redhat.com>
parents:
2328
diff
changeset
|
4147 |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
4148 /* Create the GCs of this frame. |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4149 Note that many default values are used. */ |
389 | 4150 |
4151 /* Normal video */ | |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4152 gc_values.font = f->output_data.x->font->fid; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4153 gc_values.foreground = f->output_data.x->foreground_pixel; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4154 gc_values.background = f->output_data.x->background_pixel; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4155 gc_values.line_width = 0; /* Means 1 using fast algorithm. */ |
34321
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4156 f->output_data.x->normal_gc |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4157 = XCreateGC (FRAME_X_DISPLAY (f), |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4158 FRAME_X_WINDOW (f), |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4159 GCLineWidth | GCFont | GCForeground | GCBackground, |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4160 &gc_values); |
389 | 4161 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4162 /* Reverse video style. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4163 gc_values.foreground = f->output_data.x->background_pixel; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4164 gc_values.background = f->output_data.x->foreground_pixel; |
34321
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4165 f->output_data.x->reverse_gc |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4166 = XCreateGC (FRAME_X_DISPLAY (f), |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4167 FRAME_X_WINDOW (f), |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4168 GCFont | GCForeground | GCBackground | GCLineWidth, |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4169 &gc_values); |
389 | 4170 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4171 /* Cursor has cursor-color background, background-color foreground. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4172 gc_values.foreground = f->output_data.x->background_pixel; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4173 gc_values.background = f->output_data.x->cursor_pixel; |
389 | 4174 gc_values.fill_style = FillOpaqueStippled; |
4175 gc_values.stipple | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4176 = XCreateBitmapFromData (FRAME_X_DISPLAY (f), |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4177 FRAME_X_DISPLAY_INFO (f)->root_window, |
389 | 4178 cursor_bits, 16, 16); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4179 f->output_data.x->cursor_gc |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4180 = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
389 | 4181 (GCFont | GCForeground | GCBackground |
24905
2c79eecad64d
(x_make_gc): Turn off GCStipple when setting up cursor_gc.
Richard M. Stallman <rms@gnu.org>
parents:
24677
diff
changeset
|
4182 | GCFillStyle /* | GCStipple */ | GCLineWidth), |
389 | 4183 &gc_values); |
4184 | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4185 /* Reliefs. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4186 f->output_data.x->white_relief.gc = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4187 f->output_data.x->black_relief.gc = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4188 |
389 | 4189 /* Create the gray border tile used when the pointer is not in |
771 | 4190 the frame. Since this depends on the frame's pixel values, |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4191 this must be done on a per-frame basis. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4192 f->output_data.x->border_tile |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
4193 = (XCreatePixmapFromBitmapData |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4194 (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
4195 gray_bits, gray_width, gray_height, |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4196 f->output_data.x->foreground_pixel, |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4197 f->output_data.x->background_pixel, |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
4198 DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)))); |
2341
1982e2983822
* xfns.c (x_make_gc): Don't forget to block X input around the
Jim Blandy <jimb@redhat.com>
parents:
2328
diff
changeset
|
4199 |
1982e2983822
* xfns.c (x_make_gc): Don't forget to block X input around the
Jim Blandy <jimb@redhat.com>
parents:
2328
diff
changeset
|
4200 UNBLOCK_INPUT; |
389 | 4201 } |
4202 | |
34321
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4203 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4204 /* Free what was was allocated in x_make_gc. */ |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4205 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4206 void |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4207 x_free_gcs (f) |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4208 struct frame *f; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4209 { |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4210 Display *dpy = FRAME_X_DISPLAY (f); |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4211 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4212 BLOCK_INPUT; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4213 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4214 if (f->output_data.x->normal_gc) |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4215 { |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4216 XFreeGC (dpy, f->output_data.x->normal_gc); |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4217 f->output_data.x->normal_gc = 0; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4218 } |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4219 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4220 if (f->output_data.x->reverse_gc) |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4221 { |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4222 XFreeGC (dpy, f->output_data.x->reverse_gc); |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4223 f->output_data.x->reverse_gc = 0; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4224 } |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4225 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4226 if (f->output_data.x->cursor_gc) |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4227 { |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4228 XFreeGC (dpy, f->output_data.x->cursor_gc); |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4229 f->output_data.x->cursor_gc = 0; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4230 } |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4231 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4232 if (f->output_data.x->border_tile) |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4233 { |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4234 XFreePixmap (dpy, f->output_data.x->border_tile); |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4235 f->output_data.x->border_tile = 0; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4236 } |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4237 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4238 UNBLOCK_INPUT; |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4239 } |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4240 |
41ecc8525dbc
(x_free_gcs): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
33994
diff
changeset
|
4241 |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4242 /* Handler for signals raised during x_create_frame and |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4243 x_create_top_frame. FRAME is the frame which is partially |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4244 constructed. */ |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4245 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4246 static Lisp_Object |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4247 unwind_create_frame (frame) |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4248 Lisp_Object frame; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4249 { |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4250 struct frame *f = XFRAME (frame); |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4251 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4252 /* If frame is ``official'', nothing to do. */ |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4253 if (!CONSP (Vframe_list) || !EQ (XCAR (Vframe_list), frame)) |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4254 { |
34895
53e52b3525bf
Use #if GLYPH_DEBUG instead of #ifdef GLYPH_DEBUG.
Gerd Moellmann <gerd@gnu.org>
parents:
34662
diff
changeset
|
4255 #if GLYPH_DEBUG |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4256 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4257 #endif |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4258 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4259 x_free_frame_resources (f); |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4260 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4261 /* Check that reference counts are indeed correct. */ |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4262 xassert (dpyinfo->reference_count == dpyinfo_refcount); |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4263 xassert (dpyinfo->image_cache->refcount == image_cache_refcount); |
34638
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
4264 return Qt; |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4265 } |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4266 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4267 return Qnil; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4268 } |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4269 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4270 |
771 | 4271 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
389 | 4272 1, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4273 doc: /* Make a new X window, which is called a "frame" in Emacs terms. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4274 Returns an Emacs frame object. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4275 ALIST is an alist of frame parameters. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4276 If the parameters specify that the frame should not have a minibuffer, |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4277 and do not specify a specific minibuffer window to use, |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4278 then `default-minibuffer-frame' must be a frame whose minibuffer can |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4279 be shared by the new frame. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4280 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4281 This function is an internal primitive--use `make-frame' instead. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4282 (parms) |
389 | 4283 Lisp_Object parms; |
4284 { | |
771 | 4285 struct frame *f; |
6935
675e4ec5f14f
(Fx_create_frame): Delete excess args to x_wm_set_size_hint.
Richard M. Stallman <rms@gnu.org>
parents:
6882
diff
changeset
|
4286 Lisp_Object frame, tem; |
389 | 4287 Lisp_Object name; |
4288 int minibuffer_only = 0; | |
4289 long window_prompting = 0; | |
4290 int width, height; | |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4291 int count = BINDING_STACK_SIZE (); |
15566
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4292 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4293 Lisp_Object display; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4294 struct x_display_info *dpyinfo = NULL; |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4295 Lisp_Object parent; |
11774
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4296 struct kboard *kb; |
389 | 4297 |
2999
33c820044087
(check_x): New function.
Richard M. Stallman <rms@gnu.org>
parents:
2964
diff
changeset
|
4298 check_x (); |
389 | 4299 |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4300 /* Use this general default value to start with |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4301 until we know if this frame has a specified name. */ |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4302 Vx_resource_name = Vinvocation_name; |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4303 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4304 display = x_get_arg (dpyinfo, parms, Qdisplay, 0, 0, RES_TYPE_STRING); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4305 if (EQ (display, Qunbound)) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4306 display = Qnil; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4307 dpyinfo = check_x_display_info (display); |
11774
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4308 #ifdef MULTI_KBOARD |
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4309 kb = dpyinfo->kboard; |
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4310 #else |
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4311 kb = &the_only_kboard; |
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4312 #endif |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4313 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4314 name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING); |
9103
948e8acb6990
(x_set_frame_parameters, x_set_menu_bar_lines, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
9022
diff
changeset
|
4315 if (!STRINGP (name) |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4316 && ! EQ (name, Qunbound) |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4317 && ! NILP (name)) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4318 error ("Invalid frame name--not a string or nil"); |
398 | 4319 |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4320 if (STRINGP (name)) |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4321 Vx_resource_name = name; |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
4322 |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4323 /* See if parent window is specified. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4324 parent = x_get_arg (dpyinfo, parms, Qparent_id, NULL, NULL, RES_TYPE_NUMBER); |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4325 if (EQ (parent, Qunbound)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4326 parent = Qnil; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4327 if (! NILP (parent)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
4328 CHECK_NUMBER (parent); |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4329 |
15566
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4330 /* make_frame_without_minibuffer can run Lisp code and garbage collect. */ |
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4331 /* No need to protect DISPLAY because that's not used after passing |
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4332 it to make_frame_without_minibuffer. */ |
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4333 frame = Qnil; |
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4334 GCPRO4 (parms, parent, name, frame); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4335 tem = x_get_arg (dpyinfo, parms, Qminibuffer, "minibuffer", "Minibuffer", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4336 RES_TYPE_SYMBOL); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4337 if (EQ (tem, Qnone) || NILP (tem)) |
12011
854e396aabed
(Fx_create_frame): Pass new arg to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11989
diff
changeset
|
4338 f = make_frame_without_minibuffer (Qnil, kb, display); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4339 else if (EQ (tem, Qonly)) |
389 | 4340 { |
771 | 4341 f = make_minibuffer_frame (); |
389 | 4342 minibuffer_only = 1; |
4343 } | |
9103
948e8acb6990
(x_set_frame_parameters, x_set_menu_bar_lines, Fx_create_frame,
Karl Heuer <kwzh@gnu.org>
parents:
9022
diff
changeset
|
4344 else if (WINDOWP (tem)) |
12011
854e396aabed
(Fx_create_frame): Pass new arg to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11989
diff
changeset
|
4345 f = make_frame_without_minibuffer (tem, kb, display); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4346 else |
771 | 4347 f = make_frame (1); |
4348 | |
15566
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4349 XSETFRAME (frame, f); |
3d03a3fb8757
(Fx_create_frame): Gcpro parms, parent, and name.
Richard M. Stallman <rms@gnu.org>
parents:
15495
diff
changeset
|
4350 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1932
diff
changeset
|
4351 /* Note that X Windows does support scroll bars. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1932
diff
changeset
|
4352 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1; |
1719
48f539ac6921
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1657
diff
changeset
|
4353 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4354 f->output_method = output_x_window; |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4355 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4356 bzero (f->output_data.x, sizeof (struct x_output)); |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4357 f->output_data.x->icon_bitmap = -1; |
19026
db6728252ce2
(Fx_create_frame): Initialize fontset in output_data.
Richard M. Stallman <rms@gnu.org>
parents:
18947
diff
changeset
|
4358 f->output_data.x->fontset = -1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4359 f->output_data.x->scroll_bar_foreground_pixel = -1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4360 f->output_data.x->scroll_bar_background_pixel = -1; |
39619
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
4361 #ifdef USE_TOOLKIT_SCROLL_BARS |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
4362 f->output_data.x->scroll_bar_top_shadow_pixel = -1; |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
4363 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
4364 #endif /* USE_TOOLKIT_SCROLL_BARS */ |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4365 record_unwind_protect (unwind_create_frame, frame); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4366 |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
4367 f->icon_name |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4368 = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4369 RES_TYPE_STRING); |
12276
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
4370 if (! STRINGP (f->icon_name)) |
2e376a4397bc
(x_report_frame_params, x_set_icon_type, x_set_icon_name)
Richard M. Stallman <rms@gnu.org>
parents:
12209
diff
changeset
|
4371 f->icon_name = Qnil; |
12073 | 4372 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4373 FRAME_X_DISPLAY_INFO (f) = dpyinfo; |
34895
53e52b3525bf
Use #if GLYPH_DEBUG instead of #ifdef GLYPH_DEBUG.
Gerd Moellmann <gerd@gnu.org>
parents:
34662
diff
changeset
|
4374 #if GLYPH_DEBUG |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4375 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4376 dpyinfo_refcount = dpyinfo->reference_count; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4377 #endif /* GLYPH_DEBUG */ |
11014
634a98104921
(Fx_create_frame): set the frame's kboard member.
Karl Heuer <kwzh@gnu.org>
parents:
10920
diff
changeset
|
4378 #ifdef MULTI_KBOARD |
11774
0b5cb5170084
(Fx_create_frame): Pass kb to make_frame_without_minibuffer.
Karl Heuer <kwzh@gnu.org>
parents:
11772
diff
changeset
|
4379 FRAME_KBOARD (f) = kb; |
11014
634a98104921
(Fx_create_frame): set the frame's kboard member.
Karl Heuer <kwzh@gnu.org>
parents:
10920
diff
changeset
|
4380 #endif |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4381 |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4382 /* These colors will be set anyway later, but it's important |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4383 to get the color reference counts right, so initialize them! */ |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4384 { |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4385 Lisp_Object black; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4386 struct gcpro gcpro1; |
38345
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4387 |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4388 /* Function x_decode_color can signal an error. Make |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4389 sure to initialize color slots so that we won't try |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4390 to free colors we haven't allocated. */ |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4391 f->output_data.x->foreground_pixel = -1; |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4392 f->output_data.x->background_pixel = -1; |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4393 f->output_data.x->cursor_pixel = -1; |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4394 f->output_data.x->cursor_foreground_pixel = -1; |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4395 f->output_data.x->border_pixel = -1; |
3238db7bdfef
(Fx_create_frame): Initialize frame colors to -1,
Gerd Moellmann <gerd@gnu.org>
parents:
38183
diff
changeset
|
4396 f->output_data.x->mouse_pixel = -1; |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4397 |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4398 black = build_string ("black"); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4399 GCPRO1 (black); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4400 f->output_data.x->foreground_pixel |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4401 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4402 f->output_data.x->background_pixel |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4403 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4404 f->output_data.x->cursor_pixel |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4405 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4406 f->output_data.x->cursor_foreground_pixel |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4407 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4408 f->output_data.x->border_pixel |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4409 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4410 f->output_data.x->mouse_pixel |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4411 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4412 UNGCPRO; |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4413 } |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
4414 |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4415 /* Specify the parent under which to make this X window. */ |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4416 |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4417 if (!NILP (parent)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4418 { |
18612
88efccff8970
Fix bugs with inappropriate mixing of Lisp_Object with int.
Richard M. Stallman <rms@gnu.org>
parents:
18594
diff
changeset
|
4419 f->output_data.x->parent_desc = (Window) XFASTINT (parent); |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4420 f->output_data.x->explicit_parent = 1; |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4421 } |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4422 else |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4423 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4424 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4425 f->output_data.x->explicit_parent = 0; |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4426 } |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4427 |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4428 /* Set the name; the functions to which we pass f expect the name to |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4429 be set. */ |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4430 if (EQ (name, Qunbound) || NILP (name)) |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4431 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4432 f->name = build_string (dpyinfo->x_id_name); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4433 f->explicit_name = 0; |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4434 } |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4435 else |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4436 { |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4437 f->name = name; |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4438 f->explicit_name = 1; |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4439 /* use the frame's title when getting resources for this frame. */ |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4440 specbind (Qx_resource_name, name); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4441 } |
771 | 4442 |
389 | 4443 /* Extract the window parameters from the supplied values |
4444 that are needed to determine window geometry. */ | |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
4445 { |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
4446 Lisp_Object font; |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
4447 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4448 font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); |
18947
386d68191907
(Fx_create_frame): Don't fail to initialize `font'.
Richard M. Stallman <rms@gnu.org>
parents:
18893
diff
changeset
|
4449 |
4150
e2e92cd737bf
* xfns.c (Fx_create_frame): Block input around call to
Jim Blandy <jimb@redhat.com>
parents:
4146
diff
changeset
|
4450 BLOCK_INPUT; |
4259
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4451 /* First, try whatever font the caller has specified. */ |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4452 if (STRINGP (font)) |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
4453 { |
21555
0927f341e390
(x_set_font): Give 2nd arg nil to Fquery_fontset.
Kenichi Handa <handa@m17n.org>
parents:
21549
diff
changeset
|
4454 tem = Fquery_fontset (font, Qnil); |
17722
27df69e20b98
(Fx_create_frame): Delete code for handling the X
Kenichi Handa <handa@m17n.org>
parents:
17629
diff
changeset
|
4455 if (STRINGP (tem)) |
27df69e20b98
(Fx_create_frame): Delete code for handling the X
Kenichi Handa <handa@m17n.org>
parents:
17629
diff
changeset
|
4456 font = x_new_fontset (f, XSTRING (tem)->data); |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
4457 else |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
4458 font = x_new_font (f, XSTRING (font)->data); |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
4459 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4460 |
4259
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4461 /* Try out a font which we hope has bold and italic variations. */ |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4462 if (!STRINGP (font)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4463 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4464 if (!STRINGP (font)) |
8270
1a0af0f4fb1d
(Fx_create_frame): Use 140 as default font size.
Richard M. Stallman <rms@gnu.org>
parents:
8192
diff
changeset
|
4465 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); |
4259
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4466 if (! STRINGP (font)) |
8270
1a0af0f4fb1d
(Fx_create_frame): Use 140 as default font size.
Richard M. Stallman <rms@gnu.org>
parents:
8192
diff
changeset
|
4467 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); |
4259
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4468 if (! STRINGP (font)) |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4469 /* This was formerly the first thing tried, but it finds too many fonts |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4470 and takes too long. */ |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4471 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1"); |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4472 /* If those didn't work, look for something which will at least work. */ |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4473 if (! STRINGP (font)) |
8270
1a0af0f4fb1d
(Fx_create_frame): Use 140 as default font size.
Richard M. Stallman <rms@gnu.org>
parents:
8192
diff
changeset
|
4474 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); |
4150
e2e92cd737bf
* xfns.c (Fx_create_frame): Block input around call to
Jim Blandy <jimb@redhat.com>
parents:
4146
diff
changeset
|
4475 UNBLOCK_INPUT; |
e2e92cd737bf
* xfns.c (Fx_create_frame): Block input around call to
Jim Blandy <jimb@redhat.com>
parents:
4146
diff
changeset
|
4476 if (! STRINGP (font)) |
4259
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4477 font = build_string ("fixed"); |
085095792d99
(Fx_create_frame): Don't look for default font
Richard M. Stallman <rms@gnu.org>
parents:
4195
diff
changeset
|
4478 |
17722
27df69e20b98
(Fx_create_frame): Delete code for handling the X
Kenichi Handa <handa@m17n.org>
parents:
17629
diff
changeset
|
4479 x_default_parameter (f, parms, Qfont, font, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4480 "font", "Font", RES_TYPE_STRING); |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
4481 } |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4482 |
15720
f1549b7501af
(Fx_create_frame): Do xlwmenu hack only if USE_LUCID.
Karl Heuer <kwzh@gnu.org>
parents:
15706
diff
changeset
|
4483 #ifdef USE_LUCID |
9742
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
4484 /* Prevent lwlib/xlwmenu.c from crashing because of a bug |
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
4485 whereby it fails to get any font. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4486 xlwmenu_default_font = f->output_data.x->font; |
9808
4c43c9dbe130
(x_window): Make ibw 0 by default.
Richard M. Stallman <rms@gnu.org>
parents:
9742
diff
changeset
|
4487 #endif |
9742
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
4488 |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4489 x_default_parameter (f, parms, Qborder_width, make_number (2), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4490 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4491 |
40715 | 4492 /* This defaults to 1 in order to match xterm. We recognize either |
3923
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4493 internalBorderWidth or internalBorder (which is what xterm calls |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4494 it). */ |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4495 if (NILP (Fassq (Qinternal_border_width, parms))) |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4496 { |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4497 Lisp_Object value; |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4498 |
17779
094e5efd262d
(Fx_create_frame): Get X resources from the display
Richard M. Stallman <rms@gnu.org>
parents:
17722
diff
changeset
|
4499 value = x_get_arg (dpyinfo, parms, Qinternal_border_width, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4500 "internalBorder", "internalBorder", RES_TYPE_NUMBER); |
3923
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4501 if (! EQ (value, Qunbound)) |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4502 parms = Fcons (Fcons (Qinternal_border_width, value), |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4503 parms); |
cb16ebff1c44
* xfns.c (Fx_create_frame): Check for internalBorder resource, as
Jim Blandy <jimb@redhat.com>
parents:
3888
diff
changeset
|
4504 } |
16302
025b3dc7a6ba
(Fx_create_frame): Default Qinternal_border_width to 1.
Richard M. Stallman <rms@gnu.org>
parents:
16254
diff
changeset
|
4505 x_default_parameter (f, parms, Qinternal_border_width, make_number (1), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4506 "internalBorderWidth", "internalBorderWidth", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4507 RES_TYPE_NUMBER); |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
4508 x_default_parameter (f, parms, Qvertical_scroll_bars, Qleft, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4509 "verticalScrollBars", "ScrollBars", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4510 RES_TYPE_SYMBOL); |
389 | 4511 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4512 /* Also do the stuff which must be set before the window exists. */ |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4513 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4514 "foreground", "Foreground", RES_TYPE_STRING); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4515 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), |
26808 | 4516 "background", "Background", RES_TYPE_STRING); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4517 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4518 "pointerColor", "Foreground", RES_TYPE_STRING); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4519 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4520 "cursorColor", "Foreground", RES_TYPE_STRING); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4521 x_default_parameter (f, parms, Qborder_color, build_string ("black"), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4522 "borderColor", "BorderColor", RES_TYPE_STRING); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
4523 x_default_parameter (f, parms, Qscreen_gamma, Qnil, |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
4524 "screenGamma", "ScreenGamma", RES_TYPE_FLOAT); |
28690
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
4525 x_default_parameter (f, parms, Qline_spacing, Qnil, |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
4526 "lineSpacing", "LineSpacing", RES_TYPE_NUMBER); |
41722
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
4527 x_default_parameter (f, parms, Qleft_fringe, Qnil, |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
4528 "leftFringe", "LeftFringe", RES_TYPE_NUMBER); |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
4529 x_default_parameter (f, parms, Qright_fringe, Qnil, |
fd499c5c75d2
(x_frame_parms): Add `left-fringe' and `right-fringe' parms.
Kim F. Storm <storm@cua.dk>
parents:
41449
diff
changeset
|
4530 "rightFringe", "RightFringe", RES_TYPE_NUMBER); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4531 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4532 x_default_scroll_bar_color_parameter (f, parms, Qscroll_bar_foreground, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4533 "scrollBarForeground", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4534 "ScrollBarForeground", 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4535 x_default_scroll_bar_color_parameter (f, parms, Qscroll_bar_background, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4536 "scrollBarBackground", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4537 "ScrollBarBackground", 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4538 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4539 /* Init faces before x_default_parameter is called for scroll-bar |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4540 parameters because that function calls x_set_scroll_bar_width, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4541 which calls change_frame_size, which calls Fset_window_buffer, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4542 which runs hooks, which call Fvertical_motion. At the end, we |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4543 end up in init_iterator with a null face cache, which should not |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4544 happen. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4545 init_frame_faces (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4546 |
8758
fac1c4722677
(Fx_create_frame): Make 1 the default for menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
8675
diff
changeset
|
4547 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4548 "menuBar", "MenuBar", RES_TYPE_NUMBER); |
31824
b3295c7e7a60
(Fx_create_frame): Set default frame parameter value
Gerd Moellmann <gerd@gnu.org>
parents:
31768
diff
changeset
|
4549 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4550 "toolBar", "ToolBar", RES_TYPE_NUMBER); |
13083
16638ebb209f
(Fx_create_frame): Set up buffer-predicate slot.
Richard M. Stallman <rms@gnu.org>
parents:
12832
diff
changeset
|
4551 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4552 "bufferPredicate", "BufferPredicate", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4553 RES_TYPE_SYMBOL); |
14381 | 4554 x_default_parameter (f, parms, Qtitle, Qnil, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4555 "title", "Title", RES_TYPE_STRING); |
38183
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
4556 x_default_parameter (f, parms, Qwait_for_wm, Qt, |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
4557 "waitForWM", "WaitForWM", RES_TYPE_BOOLEAN); |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
4558 x_default_parameter (f, parms, Qfullscreen, Qnil, |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
4559 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); |
6882
3096a6f7fffb
(Fx_list_fonts): Error if non-X frame used.
Richard M. Stallman <rms@gnu.org>
parents:
6790
diff
changeset
|
4560 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4561 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
36459
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4562 |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4563 /* Add the tool-bar height to the initial frame height so that the |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4564 user gets a text display area of the size he specified with -g or |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4565 via .Xdefaults. Later changes of the tool-bar height don't |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4566 change the frame size. This is done so that users can create |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4567 tall Emacs frames without having to guess how tall the tool-bar |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4568 will get. */ |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4569 if (FRAME_TOOL_BAR_LINES (f)) |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4570 { |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4571 int margin, relief, bar_height; |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4572 |
41087
cec842fa938e
(Fx_create_frame): Accept zero tool_bar_button_relief.
Gerd Moellmann <gerd@gnu.org>
parents:
40802
diff
changeset
|
4573 relief = (tool_bar_button_relief >= 0 |
36459
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4574 ? tool_bar_button_relief |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4575 : DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4576 |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4577 if (INTEGERP (Vtool_bar_button_margin) |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4578 && XINT (Vtool_bar_button_margin) > 0) |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4579 margin = XFASTINT (Vtool_bar_button_margin); |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4580 else if (CONSP (Vtool_bar_button_margin) |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4581 && INTEGERP (XCDR (Vtool_bar_button_margin)) |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4582 && XINT (XCDR (Vtool_bar_button_margin)) > 0) |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4583 margin = XFASTINT (XCDR (Vtool_bar_button_margin)); |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4584 else |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4585 margin = 0; |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4586 |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4587 bar_height = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4588 f->height += (bar_height + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4589 } |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4590 |
919d77f8d0ff
(Fx_create_frame): Adjust the frame's height for presence
Gerd Moellmann <gerd@gnu.org>
parents:
36448
diff
changeset
|
4591 /* Compute the size of the X window. */ |
771 | 4592 window_prompting = x_figure_window_size (f, parms); |
4593 | |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4594 if (window_prompting & XNegative) |
6935
675e4ec5f14f
(Fx_create_frame): Delete excess args to x_wm_set_size_hint.
Richard M. Stallman <rms@gnu.org>
parents:
6882
diff
changeset
|
4595 { |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4596 if (window_prompting & YNegative) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4597 f->output_data.x->win_gravity = SouthEastGravity; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4598 else |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4599 f->output_data.x->win_gravity = NorthEastGravity; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4600 } |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4601 else |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4602 { |
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4603 if (window_prompting & YNegative) |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4604 f->output_data.x->win_gravity = SouthWestGravity; |
7261
a752899939f7
(x_figure_window_size): Handle `-' for top or left.
Richard M. Stallman <rms@gnu.org>
parents:
7251
diff
changeset
|
4605 else |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4606 f->output_data.x->win_gravity = NorthWestGravity; |
6935
675e4ec5f14f
(Fx_create_frame): Delete excess args to x_wm_set_size_hint.
Richard M. Stallman <rms@gnu.org>
parents:
6882
diff
changeset
|
4607 } |
675e4ec5f14f
(Fx_create_frame): Delete excess args to x_wm_set_size_hint.
Richard M. Stallman <rms@gnu.org>
parents:
6882
diff
changeset
|
4608 |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4609 f->output_data.x->size_hint_flags = window_prompting; |
7263
b7025b4bf659
(Fx_create_frame): Set the size_hint_flags field.
Richard M. Stallman <rms@gnu.org>
parents:
7261
diff
changeset
|
4610 |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4611 tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4612 f->no_split = minibuffer_only || EQ (tem, Qt); |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4613 |
35733
4f422aadd415
(Fx_create_frame): Add the tool bar height to the frame
Gerd Moellmann <gerd@gnu.org>
parents:
35592
diff
changeset
|
4614 /* Create the X widget or window. */ |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
4615 #ifdef USE_X_TOOLKIT |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
4616 x_window (f, window_prompting, minibuffer_only); |
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
4617 #else |
771 | 4618 x_window (f); |
6604
bb11213734d6
(x_window) [USE_X_TOOLKIT]: New args window_prompting and minibuffer_only.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6523
diff
changeset
|
4619 #endif |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4620 |
771 | 4621 x_icon (f, parms); |
4622 x_make_gc (f); | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4623 |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4624 /* Now consider the frame official. */ |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4625 FRAME_X_DISPLAY_INFO (f)->reference_count++; |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4626 Vframe_list = Fcons (frame, Vframe_list); |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4627 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4628 /* We need to do this after creating the X window, so that the |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4629 icon-creation functions can say whose icon they're describing. */ |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4630 x_default_parameter (f, parms, Qicon_type, Qnil, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4631 "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4632 |
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4633 x_default_parameter (f, parms, Qauto_raise, Qnil, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4634 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
1786
5179baee010b
* xfns.c (Fx_create_frame): After mapping the frame, call
Jim Blandy <jimb@redhat.com>
parents:
1733
diff
changeset
|
4635 x_default_parameter (f, parms, Qauto_lower, Qnil, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4636 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
4637 x_default_parameter (f, parms, Qcursor_type, Qbox, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4638 "cursorType", "CursorType", RES_TYPE_SYMBOL); |
26978
06f887a1c834
(Fx_create_frame): Move x_default_parameter calls that
Gerd Moellmann <gerd@gnu.org>
parents:
26954
diff
changeset
|
4639 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, |
06f887a1c834
(Fx_create_frame): Move x_default_parameter calls that
Gerd Moellmann <gerd@gnu.org>
parents:
26954
diff
changeset
|
4640 "scrollBarWidth", "ScrollBarWidth", |
06f887a1c834
(Fx_create_frame): Move x_default_parameter calls that
Gerd Moellmann <gerd@gnu.org>
parents:
26954
diff
changeset
|
4641 RES_TYPE_NUMBER); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
4642 |
771 | 4643 /* Dimensions, especially f->height, must be done via change_frame_size. |
389 | 4644 Change will not be effected unless different from the current |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4645 f->height. */ |
771 | 4646 width = f->width; |
4647 height = f->height; | |
35733
4f422aadd415
(Fx_create_frame): Add the tool bar height to the frame
Gerd Moellmann <gerd@gnu.org>
parents:
35592
diff
changeset
|
4648 |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
4649 f->height = 0; |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
4650 SET_FRAME_WIDTH (f, 0); |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
4651 change_frame_size (f, height, width, 1, 0, 0); |
2136
17ab6ed0f98b
(x_frame_parms): Add elts for visibility and menu-bar-lines.
Richard M. Stallman <rms@gnu.org>
parents:
2067
diff
changeset
|
4652 |
33994
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4653 /* Set up faces after all frame parameters are known. This call |
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4654 also merges in face attributes specified for new frames. If we |
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4655 don't do this, the `menu' face for instance won't have the right |
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4656 colors, and the menu bar won't appear in the specified colors for |
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4657 new frames. */ |
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4658 call1 (Qface_set_after_frame_default, frame); |
c7396fdd8d6b
(Fx_create_frame): Reintroduce the call to
Gerd Moellmann <gerd@gnu.org>
parents:
33960
diff
changeset
|
4659 |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4660 #ifdef USE_X_TOOLKIT |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4661 /* Create the menu bar. */ |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4662 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4663 { |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4664 /* If this signals an error, we haven't set size hints for the |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4665 frame and we didn't make it visible. */ |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4666 initialize_frame_menubar (f); |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4667 |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4668 /* This is a no-op, except under Motif where it arranges the |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4669 main window for the widgets on it. */ |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4670 lw_set_main_areas (f->output_data.x->column_widget, |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4671 f->output_data.x->menubar_widget, |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4672 f->output_data.x->edit_widget); |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4673 } |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4674 #endif /* USE_X_TOOLKIT */ |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4675 |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4676 /* Tell the server what size and position, etc, we want, and how |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4677 badly we want them. This should be done after we have the menu |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4678 bar so that its size can be taken into account. */ |
389 | 4679 BLOCK_INPUT; |
7209
ca5e04c9795c
(Fx_create_frame): Pass 0 as 3rd arg to x_wm_set_size_hint.
Richard M. Stallman <rms@gnu.org>
parents:
7172
diff
changeset
|
4680 x_wm_set_size_hint (f, window_prompting, 0); |
389 | 4681 UNBLOCK_INPUT; |
4682 | |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4683 /* Make the window appear on the frame and enable display, unless |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4684 the caller says not to. However, with explicit parent, Emacs |
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4685 cannot control visibility, so don't try. */ |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
4686 if (! f->output_data.x->explicit_parent) |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4687 { |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4688 Lisp_Object visibility; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4689 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4690 visibility = x_get_arg (dpyinfo, parms, Qvisibility, 0, 0, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
4691 RES_TYPE_SYMBOL); |
10222
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4692 if (EQ (visibility, Qunbound)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4693 visibility = Qt; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4694 |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4695 if (EQ (visibility, Qicon)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4696 x_iconify_frame (f); |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4697 else if (! NILP (visibility)) |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4698 x_make_frame_visible (f); |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4699 else |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4700 /* Must have been Qnil. */ |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4701 ; |
617bee0c64f6
(x_set_frame_parameters): Handle icon-left, icon-top parms.
Richard M. Stallman <rms@gnu.org>
parents:
10080
diff
changeset
|
4702 } |
771 | 4703 |
25320
107c9221181c
(x_window) [USE_X_TOOLKIT]: Remove test for
Gerd Moellmann <gerd@gnu.org>
parents:
25289
diff
changeset
|
4704 UNGCPRO; |
36594
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36459
diff
changeset
|
4705 |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36459
diff
changeset
|
4706 /* Make sure windows on this frame appear in calls to next-window |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36459
diff
changeset
|
4707 and similar functions. */ |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36459
diff
changeset
|
4708 Vwindow_list = Qnil; |
756c28377036
(Fx_create_frame): Clear Vwindow_list.
Gerd Moellmann <gerd@gnu.org>
parents:
36459
diff
changeset
|
4709 |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
4710 return unbind_to (count, frame); |
389 | 4711 } |
4712 | |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
4713 |
11537
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4714 /* FRAME is used only to get a handle on the X display. We don't pass the |
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4715 display info directly because we're called from frame.c, which doesn't |
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4716 know about that structure. */ |
16156
d435199e529d
(x_set_frame_parameters): Make height and width ints.
Richard M. Stallman <rms@gnu.org>
parents:
16041
diff
changeset
|
4717 |
6485
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4718 Lisp_Object |
11537
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4719 x_get_focus_frame (frame) |
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4720 struct frame *frame; |
6485
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4721 { |
11537
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4722 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (frame); |
6485
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4723 Lisp_Object xfocus; |
11537
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4724 if (! dpyinfo->x_focus_frame) |
6485
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4725 return Qnil; |
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4726 |
11537
9d4df3cf95b3
(x_get_focus_frame): New arg FRAME. Callers changed.
Karl Heuer <kwzh@gnu.org>
parents:
11496
diff
changeset
|
4727 XSETFRAME (xfocus, dpyinfo->x_focus_frame); |
6485
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4728 return xfocus; |
b0825eef18b1
(x_get_focus_frame): New function.
Karl Heuer <kwzh@gnu.org>
parents:
6480
diff
changeset
|
4729 } |
3048
96ff8e5744b2
* xfns.c (select_visual): Include the screen number in the
Jim Blandy <jimb@redhat.com>
parents:
3015
diff
changeset
|
4730 |
28044
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4731 |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4732 /* In certain situations, when the window manager follows a |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4733 click-to-focus policy, there seems to be no way around calling |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4734 XSetInputFocus to give another frame the input focus . |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4735 |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4736 In an ideal world, XSetInputFocus should generally be avoided so |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4737 that applications don't interfere with the window manager's focus |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4738 policy. But I think it's okay to use when it's clearly done |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4739 following a user-command. */ |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4740 |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4741 DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4742 doc: /* Set the input focus to FRAME. |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4743 FRAME nil means use the selected frame. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4744 (frame) |
28044
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4745 Lisp_Object frame; |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4746 { |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4747 struct frame *f = check_x_frame (frame); |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4748 Display *dpy = FRAME_X_DISPLAY (f); |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4749 int count; |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4750 |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4751 BLOCK_INPUT; |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4752 count = x_catch_errors (dpy); |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4753 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4754 RevertToParent, CurrentTime); |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4755 x_uncatch_errors (dpy, count); |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4756 UNBLOCK_INPUT; |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4757 |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4758 return Qnil; |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4759 } |
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
4760 |
3048
96ff8e5744b2
* xfns.c (select_visual): Include the screen number in the
Jim Blandy <jimb@redhat.com>
parents:
3015
diff
changeset
|
4761 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
4762 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4763 doc: /* Internal function called by `color-defined-p', which see. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4764 (color, frame) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4765 Lisp_Object color, frame; |
389 | 4766 { |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4767 XColor foo; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4768 FRAME_PTR f = check_x_frame (frame); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4769 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
4770 CHECK_STRING (color); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4771 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
4772 if (x_defined_color (f, XSTRING (color)->data, &foo, 0)) |
8675
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
4773 return Qt; |
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
4774 else |
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
4775 return Qnil; |
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
4776 } |
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
4777 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
4778 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4779 doc: /* Internal function called by `color-values', which see. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4780 (color, frame) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4781 Lisp_Object color, frame; |
8675
1fe413b0a916
(defined_color): New arg ALLOC--optionally don't allocate the color.
Richard M. Stallman <rms@gnu.org>
parents:
8655
diff
changeset
|
4782 { |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4783 XColor foo; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4784 FRAME_PTR f = check_x_frame (frame); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4785 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
4786 CHECK_STRING (color); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4787 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
4788 if (x_defined_color (f, XSTRING (color)->data, &foo, 0)) |
8655
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4789 { |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4790 Lisp_Object rgb[3]; |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4791 |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4792 rgb[0] = make_number (foo.red); |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4793 rgb[1] = make_number (foo.green); |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4794 rgb[2] = make_number (foo.blue); |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4795 return Flist (3, rgb); |
4c69fcaaa037
(Fx_color_defined_p): Return list of RGB values, not just t.
Richard M. Stallman <rms@gnu.org>
parents:
8405
diff
changeset
|
4796 } |
389 | 4797 else |
4798 return Qnil; | |
4799 } | |
4800 | |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
4801 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4802 doc: /* Internal function called by `display-color-p', which see. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4803 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4804 Lisp_Object display; |
389 | 4805 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4806 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4807 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4808 if (dpyinfo->n_planes <= 2) |
389 | 4809 return Qnil; |
4810 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4811 switch (dpyinfo->visual->class) |
389 | 4812 { |
4813 case StaticColor: | |
4814 case PseudoColor: | |
4815 case TrueColor: | |
4816 case DirectColor: | |
4817 return Qt; | |
4818 | |
4819 default: | |
4820 return Qnil; | |
4821 } | |
4822 } | |
4823 | |
8779
12c6296bbb4b
(Fx_display_grayscale_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8758
diff
changeset
|
4824 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4825 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4826 doc: /* Return t if the X display supports shades of gray. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4827 Note that color displays do support shades of gray. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4828 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4829 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4830 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4831 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4832 Lisp_Object display; |
8779
12c6296bbb4b
(Fx_display_grayscale_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8758
diff
changeset
|
4833 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4834 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4835 |
12347
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4836 if (dpyinfo->n_planes <= 1) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4837 return Qnil; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4838 |
12347
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4839 switch (dpyinfo->visual->class) |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4840 { |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4841 case StaticColor: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4842 case PseudoColor: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4843 case TrueColor: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4844 case DirectColor: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4845 case StaticGray: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4846 case GrayScale: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4847 return Qt; |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4848 |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4849 default: |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4850 return Qnil; |
0731c1ec96ad
(Fx_display_grayscale_p): Return t or nil.
Richard M. Stallman <rms@gnu.org>
parents:
12316
diff
changeset
|
4851 } |
8779
12c6296bbb4b
(Fx_display_grayscale_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8758
diff
changeset
|
4852 } |
12c6296bbb4b
(Fx_display_grayscale_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8758
diff
changeset
|
4853 |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4854 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4855 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4856 doc: /* Returns the width in pixels of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4857 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4858 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4859 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4860 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4861 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4862 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4863 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4864 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4865 return make_number (dpyinfo->width); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4866 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4867 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4868 DEFUN ("x-display-pixel-height", Fx_display_pixel_height, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4869 Sx_display_pixel_height, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4870 doc: /* Returns the height in pixels of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4871 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4872 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4873 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4874 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4875 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4876 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4877 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4878 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4879 return make_number (dpyinfo->height); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4880 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4881 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4882 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4883 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4884 doc: /* Returns the number of bitplanes of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4885 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4886 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4887 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4888 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4889 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4890 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4891 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4892 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4893 return make_number (dpyinfo->n_planes); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4894 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4895 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4896 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4897 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4898 doc: /* Returns the number of color cells of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4899 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4900 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4901 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4902 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4903 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4904 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4905 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4906 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4907 return make_number (DisplayCells (dpyinfo->display, |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4908 XScreenNumberOfScreen (dpyinfo->screen))); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4909 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4910 |
4279 | 4911 DEFUN ("x-server-max-request-size", Fx_server_max_request_size, |
4912 Sx_server_max_request_size, | |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4913 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4914 doc: /* Returns the maximum request size of the X server of display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4915 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4916 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4917 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4918 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4919 Lisp_Object display; |
4279 | 4920 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4921 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4922 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4923 return make_number (MAXREQUEST (dpyinfo->display)); |
4279 | 4924 } |
4925 | |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4926 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4927 doc: /* Returns the vendor ID string of the X server of display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4928 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4929 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4930 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4931 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4932 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4933 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4934 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4935 char *vendor = ServerVendor (dpyinfo->display); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4936 |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4937 if (! vendor) vendor = ""; |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4938 return build_string (vendor); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4939 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4940 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4941 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4942 doc: /* Returns the version numbers of the X server of display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4943 The value is a list of three integers: the major and minor |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4944 version numbers of the X Protocol in use, and the vendor-specific release |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4945 number. See also the function `x-server-vendor'. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4946 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4947 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4948 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4949 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4950 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4951 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4952 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4953 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4954 Display *dpy = dpyinfo->display; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4955 |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4956 return Fcons (make_number (ProtocolVersion (dpy)), |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4957 Fcons (make_number (ProtocolRevision (dpy)), |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4958 Fcons (make_number (VendorRelease (dpy)), Qnil))); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4959 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4960 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4961 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4962 doc: /* Return the number of screens on the X server of display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4963 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4964 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4965 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4966 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4967 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4968 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4969 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4970 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4971 return make_number (ScreenCount (dpyinfo->display)); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4972 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4973 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4974 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4975 doc: /* Return the height in millimeters of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4976 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4977 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4978 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4979 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4980 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4981 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4982 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4983 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4984 return make_number (HeightMMOfScreen (dpyinfo->screen)); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4985 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4986 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4987 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4988 doc: /* Return the width in millimeters of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4989 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
4990 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4991 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
4992 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4993 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4994 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
4995 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4996 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
4997 return make_number (WidthMMOfScreen (dpyinfo->screen)); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4998 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
4999 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5000 DEFUN ("x-display-backing-store", Fx_display_backing_store, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5001 Sx_display_backing_store, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5002 doc: /* Returns an indication of whether X display DISPLAY does backing store. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5003 The value may be `always', `when-mapped', or `not-useful'. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5004 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5005 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5006 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5007 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5008 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5009 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5010 struct x_display_info *dpyinfo = check_x_display_info (display); |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5011 Lisp_Object result; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5012 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5013 switch (DoesBackingStore (dpyinfo->screen)) |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5014 { |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5015 case Always: |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5016 result = intern ("always"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5017 break; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5018 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5019 case WhenMapped: |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5020 result = intern ("when-mapped"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5021 break; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5022 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5023 case NotUseful: |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5024 result = intern ("not-useful"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5025 break; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5026 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5027 default: |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5028 error ("Strange value for BackingStore parameter of screen"); |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5029 result = Qnil; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5030 } |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5031 |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5032 return result; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5033 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5034 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5035 DEFUN ("x-display-visual-class", Fx_display_visual_class, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5036 Sx_display_visual_class, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5037 doc: /* Return the visual class of the X display DISPLAY. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5038 The value is one of the symbols `static-gray', `gray-scale', |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5039 `static-color', `pseudo-color', `true-color', or `direct-color'. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5040 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5041 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5042 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5043 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5044 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5045 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5046 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5047 struct x_display_info *dpyinfo = check_x_display_info (display); |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5048 Lisp_Object result; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5049 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5050 switch (dpyinfo->visual->class) |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5051 { |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5052 case StaticGray: |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5053 result = intern ("static-gray"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5054 break; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5055 case GrayScale: |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5056 result = intern ("gray-scale"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5057 break; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5058 case StaticColor: |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5059 result = intern ("static-color"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5060 break; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5061 case PseudoColor: |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5062 result = intern ("pseudo-color"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5063 break; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5064 case TrueColor: |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5065 result = intern ("true-color"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5066 break; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5067 case DirectColor: |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5068 result = intern ("direct-color"); |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5069 break; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5070 default: |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5071 error ("Display has an unknown visual class"); |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5072 result = Qnil; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5073 } |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5074 |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
5075 return result; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5076 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5077 |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5078 DEFUN ("x-display-save-under", Fx_display_save_under, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5079 Sx_display_save_under, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5080 doc: /* Returns t if the X display DISPLAY supports the save-under feature. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5081 The optional argument DISPLAY specifies which display to ask about. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5082 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5083 If omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5084 (display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5085 Lisp_Object display; |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5086 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5087 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5088 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5089 if (DoesSaveUnders (dpyinfo->screen) == True) |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5090 return Qt; |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5091 else |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5092 return Qnil; |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5093 } |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
5094 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5095 int |
2067
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5096 x_pixel_width (f) |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5097 register struct frame *f; |
389 | 5098 { |
2067
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5099 return PIXEL_WIDTH (f); |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5100 } |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5101 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5102 int |
2067
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5103 x_pixel_height (f) |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5104 register struct frame *f; |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5105 { |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5106 return PIXEL_HEIGHT (f); |
389 | 5107 } |
5108 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5109 int |
2067
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5110 x_char_width (f) |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5111 register struct frame *f; |
389 | 5112 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
5113 return FONT_WIDTH (f->output_data.x->font); |
2067
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5114 } |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5115 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5116 int |
2067
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5117 x_char_height (f) |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5118 register struct frame *f; |
0a353ddd4bf4
(Fx_pixel_width, Fx_pixel_height): Fns deleted.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
5119 { |
12667
a3466dad7d6d
Renamings: frame->display => frame->output, struct x_display -> sruct x_output.
Richard M. Stallman <rms@gnu.org>
parents:
12656
diff
changeset
|
5120 return f->output_data.x->line_height; |
389 | 5121 } |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5122 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5123 int |
19825
cdfaf8ce5208
(x_screen_planes): Fix type of argument.
Richard M. Stallman <rms@gnu.org>
parents:
19095
diff
changeset
|
5124 x_screen_planes (f) |
cdfaf8ce5208
(x_screen_planes): Fix type of argument.
Richard M. Stallman <rms@gnu.org>
parents:
19095
diff
changeset
|
5125 register struct frame *f; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5126 { |
19825
cdfaf8ce5208
(x_screen_planes): Fix type of argument.
Richard M. Stallman <rms@gnu.org>
parents:
19095
diff
changeset
|
5127 return FRAME_X_DISPLAY_INFO (f)->n_planes; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5128 } |
28044
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
5129 |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5130 |
389 | 5131 |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5132 /************************************************************************ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5133 X Displays |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5134 ************************************************************************/ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5135 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5136 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5137 /* Mapping visual names to visuals. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5138 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5139 static struct visual_class |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5140 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5141 char *name; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5142 int class; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5143 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5144 visual_classes[] = |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5145 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5146 {"StaticGray", StaticGray}, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5147 {"GrayScale", GrayScale}, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5148 {"StaticColor", StaticColor}, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5149 {"PseudoColor", PseudoColor}, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5150 {"TrueColor", TrueColor}, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5151 {"DirectColor", DirectColor}, |
42123
7f5f06b97bfc
(x_frame_parms): Add missing braces around initializer.
Pavel Janík <Pavel@Janik.cz>
parents:
42006
diff
changeset
|
5152 {NULL, 0} |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5153 }; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5154 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5155 |
4606
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5156 #ifndef HAVE_XSCREENNUMBEROFSCREEN |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5157 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5158 /* Value is the screen number of screen SCR. This is a substitute for |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5159 the X function with the same name when that doesn't exist. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5160 |
4606
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5161 int |
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5162 XScreenNumberOfScreen (scr) |
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5163 register Screen *scr; |
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5164 { |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5165 Display *dpy = scr->display; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5166 int i; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5167 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5168 for (i = 0; i < dpy->nscreens; ++i) |
40325
2eb0395c1697
(XScreenNumberOfScreen): Fix struct to pointer
Gerd Moellmann <gerd@gnu.org>
parents:
40279
diff
changeset
|
5169 if (scr == dpy->screens + i) |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5170 break; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5171 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5172 return i; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5173 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5174 |
4606
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5175 #endif /* not HAVE_XSCREENNUMBEROFSCREEN */ |
0866f021a2cc
(XScreenNumberOfScreen): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4571
diff
changeset
|
5176 |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5177 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5178 /* Select the visual that should be used on display DPYINFO. Set |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5179 members of DPYINFO appropriately. Called from x_term_init. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5180 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5181 void |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5182 select_visual (dpyinfo) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5183 struct x_display_info *dpyinfo; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5184 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5185 Display *dpy = dpyinfo->display; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5186 Screen *screen = dpyinfo->screen; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5187 Lisp_Object value; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5188 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5189 /* See if a visual is specified. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5190 value = display_x_get_resource (dpyinfo, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5191 build_string ("visualClass"), |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5192 build_string ("VisualClass"), |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5193 Qnil, Qnil); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5194 if (STRINGP (value)) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5195 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5196 /* VALUE should be of the form CLASS-DEPTH, where CLASS is one |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5197 of `PseudoColor', `TrueColor' etc. and DEPTH is the color |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5198 depth, a decimal number. NAME is compared with case ignored. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5199 char *s = (char *) alloca (STRING_BYTES (XSTRING (value)) + 1); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5200 char *dash; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5201 int i, class = -1; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5202 XVisualInfo vinfo; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5203 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5204 strcpy (s, XSTRING (value)->data); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5205 dash = index (s, '-'); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5206 if (dash) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5207 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5208 dpyinfo->n_planes = atoi (dash + 1); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5209 *dash = '\0'; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5210 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5211 else |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5212 /* We won't find a matching visual with depth 0, so that |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5213 an error will be printed below. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5214 dpyinfo->n_planes = 0; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5215 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5216 /* Determine the visual class. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5217 for (i = 0; visual_classes[i].name; ++i) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5218 if (xstricmp (s, visual_classes[i].name) == 0) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5219 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5220 class = visual_classes[i].class; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5221 break; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5222 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5223 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5224 /* Look up a matching visual for the specified class. */ |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5225 if (class == -1 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5226 || !XMatchVisualInfo (dpy, XScreenNumberOfScreen (screen), |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5227 dpyinfo->n_planes, class, &vinfo)) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5228 fatal ("Invalid visual specification `%s'", XSTRING (value)->data); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5229 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5230 dpyinfo->visual = vinfo.visual; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5231 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5232 else |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5233 { |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5234 int n_visuals; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5235 XVisualInfo *vinfo, vinfo_template; |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5236 |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5237 dpyinfo->visual = DefaultVisualOfScreen (screen); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
5238 |
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
5239 #ifdef HAVE_X11R4 |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5240 vinfo_template.visualid = XVisualIDFromVisual (dpyinfo->visual); |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
5241 #else |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5242 vinfo_template.visualid = dpyinfo->visual->visualid; |
1050
133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
Jim Blandy <jimb@redhat.com>
parents:
1018
diff
changeset
|
5243 #endif |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5244 vinfo_template.screen = XScreenNumberOfScreen (screen); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5245 vinfo = XGetVisualInfo (dpy, VisualIDMask | VisualScreenMask, |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5246 &vinfo_template, &n_visuals); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5247 if (n_visuals != 1) |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5248 fatal ("Can't get proper X visual info"); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5249 |
28199
56a776500341
* xfns.c (select_visual): Don't set dpyinfo->n_planes to the
Gerd Moellmann <gerd@gnu.org>
parents:
28144
diff
changeset
|
5250 dpyinfo->n_planes = vinfo->depth; |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5251 XFree ((char *) vinfo); |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5252 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5253 } |
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5254 |
389 | 5255 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5256 /* Return the X display structure for the display named NAME. |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5257 Open a new connection if necessary. */ |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5258 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5259 struct x_display_info * |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5260 x_display_info_for_name (name) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5261 Lisp_Object name; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5262 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5263 Lisp_Object names; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5264 struct x_display_info *dpyinfo; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5265 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
5266 CHECK_STRING (name); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5267 |
12381
67cb86bbdb55
(Fx_open_connection, x_display_info_for_name):
Richard M. Stallman <rms@gnu.org>
parents:
12347
diff
changeset
|
5268 if (! EQ (Vwindow_system, intern ("x"))) |
67cb86bbdb55
(Fx_open_connection, x_display_info_for_name):
Richard M. Stallman <rms@gnu.org>
parents:
12347
diff
changeset
|
5269 error ("Not using X Windows"); |
67cb86bbdb55
(Fx_open_connection, x_display_info_for_name):
Richard M. Stallman <rms@gnu.org>
parents:
12347
diff
changeset
|
5270 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5271 for (dpyinfo = x_display_list, names = x_display_name_list; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5272 dpyinfo; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
5273 dpyinfo = dpyinfo->next, names = XCDR (names)) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5274 { |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5275 Lisp_Object tem; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
5276 tem = Fstring_equal (XCAR (XCAR (names)), name); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5277 if (!NILP (tem)) |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5278 return dpyinfo; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5279 } |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5280 |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
5281 /* Use this general default value to start with. */ |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
5282 Vx_resource_name = Vinvocation_name; |
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
5283 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5284 validate_x_resource_name (); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5285 |
34976
05c36b1fa618
(x_display_info_for_name): Cast 0 to "char *" in the call
Eli Zaretskii <eliz@gnu.org>
parents:
34911
diff
changeset
|
5286 dpyinfo = x_term_init (name, (char *)0, |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
5287 (char *) XSTRING (Vx_resource_name)->data); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5288 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5289 if (dpyinfo == 0) |
12046
d23f2c9990b2
(x_display_info_for_name): Fix error message.
Karl Heuer <kwzh@gnu.org>
parents:
12036
diff
changeset
|
5290 error ("Cannot connect to X server %s", XSTRING (name)->data); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5291 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5292 x_in_use = 1; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5293 XSETFASTINT (Vwindow_system_version, 11); |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5294 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5295 return dpyinfo; |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5296 } |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5297 |
27993
3a34e2d1bf3c
(select_visual): Rewritten. Recognize user-specified
Gerd Moellmann <gerd@gnu.org>
parents:
27987
diff
changeset
|
5298 |
389 | 5299 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5300 1, 3, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5301 doc: /* Open a connection to an X server. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5302 DISPLAY is the name of the display to connect to. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5303 Optional second arg XRM-STRING is a string of resources in xrdb format. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5304 If the optional third arg MUST-SUCCEED is non-nil, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5305 terminate Emacs if we can't open the connection. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5306 (display, xrm_string, must_succeed) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5307 Lisp_Object display, xrm_string, must_succeed; |
389 | 5308 { |
5309 unsigned char *xrm_option; | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5310 struct x_display_info *dpyinfo; |
389 | 5311 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
5312 CHECK_STRING (display); |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
5313 if (! NILP (xrm_string)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
5314 CHECK_STRING (xrm_string); |
389 | 5315 |
12381
67cb86bbdb55
(Fx_open_connection, x_display_info_for_name):
Richard M. Stallman <rms@gnu.org>
parents:
12347
diff
changeset
|
5316 if (! EQ (Vwindow_system, intern ("x"))) |
67cb86bbdb55
(Fx_open_connection, x_display_info_for_name):
Richard M. Stallman <rms@gnu.org>
parents:
12347
diff
changeset
|
5317 error ("Not using X Windows"); |
67cb86bbdb55
(Fx_open_connection, x_display_info_for_name):
Richard M. Stallman <rms@gnu.org>
parents:
12347
diff
changeset
|
5318 |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
5319 if (! NILP (xrm_string)) |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
5320 xrm_option = (unsigned char *) XSTRING (xrm_string)->data; |
389 | 5321 else |
5322 xrm_option = (unsigned char *) 0; | |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
5323 |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
5324 validate_x_resource_name (); |
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
5325 |
7802
d687e885fa6a
(Fx_open_connection): Set up Vx_resource_name and xrm_option
Richard M. Stallman <rms@gnu.org>
parents:
7797
diff
changeset
|
5326 /* This is what opens the connection and sets x_current_display. |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5327 This also initializes many symbols, such as those used for input. */ |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5328 dpyinfo = x_term_init (display, xrm_option, |
11917
2314b62ca4ab
(Fx_get_resource): Major rewrite to make it clearer.
Karl Heuer <kwzh@gnu.org>
parents:
11900
diff
changeset
|
5329 (char *) XSTRING (Vx_resource_name)->data); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5330 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5331 if (dpyinfo == 0) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5332 { |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5333 if (!NILP (must_succeed)) |
39907 | 5334 fatal ("Cannot connect to X server %s.\n\ |
5335 Check the DISPLAY environment variable or use `-d'.\n\ | |
5336 Also use the `xhost' program to verify that it is set to permit\n\ | |
12046
d23f2c9990b2
(x_display_info_for_name): Fix error message.
Karl Heuer <kwzh@gnu.org>
parents:
12036
diff
changeset
|
5337 connections from your machine.\n", |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5338 XSTRING (display)->data); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5339 else |
12046
d23f2c9990b2
(x_display_info_for_name): Fix error message.
Karl Heuer <kwzh@gnu.org>
parents:
12036
diff
changeset
|
5340 error ("Cannot connect to X server %s", XSTRING (display)->data); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5341 } |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5342 |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5343 x_in_use = 1; |
7802
d687e885fa6a
(Fx_open_connection): Set up Vx_resource_name and xrm_option
Richard M. Stallman <rms@gnu.org>
parents:
7797
diff
changeset
|
5344 |
9327
b3398cf56fba
(Fx_open_connection): Don't use XFASTINT as an lvalue.
Karl Heuer <kwzh@gnu.org>
parents:
9285
diff
changeset
|
5345 XSETFASTINT (Vwindow_system_version, 11); |
389 | 5346 return Qnil; |
5347 } | |
5348 | |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5349 DEFUN ("x-close-connection", Fx_close_connection, |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5350 Sx_close_connection, 1, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5351 doc: /* Close the connection to DISPLAY's X server. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5352 For DISPLAY, specify either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5353 If DISPLAY is nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5354 (display) |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5355 Lisp_Object display; |
389 | 5356 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5357 struct x_display_info *dpyinfo = check_x_display_info (display); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5358 int i; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5359 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5360 if (dpyinfo->reference_count > 0) |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5361 error ("Display still has frames on it"); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5362 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5363 BLOCK_INPUT; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5364 /* Free the fonts in the font table. */ |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5365 for (i = 0; i < dpyinfo->n_fonts; i++) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5366 if (dpyinfo->font_table[i].name) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5367 { |
28229
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
5368 if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) |
5a0af67169a7
(Fx_create_frame): Don't cal fs_register_fontset.
Kenichi Handa <handa@m17n.org>
parents:
28199
diff
changeset
|
5369 xfree (dpyinfo->font_table[i].full_name); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5370 xfree (dpyinfo->font_table[i].name); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5371 XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5372 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5373 |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5374 x_destroy_all_bitmaps (dpyinfo); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5375 XSetCloseDownMode (dpyinfo->display, DestroyAll); |
9742
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
5376 |
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
5377 #ifdef USE_X_TOOLKIT |
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
5378 XtCloseDisplay (dpyinfo->display); |
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
5379 #else |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5380 XCloseDisplay (dpyinfo->display); |
9742
fe7653791d28
(Fx_create_frame): Set xlwmenu_default_font.
Richard M. Stallman <rms@gnu.org>
parents:
9703
diff
changeset
|
5381 #endif |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5382 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5383 x_delete_display (dpyinfo); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5384 UNBLOCK_INPUT; |
8782
51241477cfc5
Delete X11 conditionals.
Richard M. Stallman <rms@gnu.org>
parents:
8780
diff
changeset
|
5385 |
389 | 5386 return Qnil; |
5387 } | |
5388 | |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5389 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5390 doc: /* Return the list of display names that Emacs has connections to. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5391 () |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5392 { |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5393 Lisp_Object tail, result; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5394 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5395 result = Qnil; |
25646
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
5396 for (tail = x_display_name_list; ! NILP (tail); tail = XCDR (tail)) |
9154af188477
Use XCAR and XCDR instead of explicit member references.
Ken Raeburn <raeburn@raeburn.org>
parents:
25628
diff
changeset
|
5397 result = Fcons (XCAR (XCAR (tail)), result); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5398 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5399 return result; |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5400 } |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5401 |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5402 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5403 doc: /* If ON is non-nil, report X errors as soon as the erring request is made. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5404 If ON is nil, allow buffering of requests. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5405 Turning on synchronization prohibits the Xlib routines from buffering |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5406 requests and seriously degrades performance, but makes debugging much |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5407 easier. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5408 The optional second argument DISPLAY specifies which display to act on. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5409 DISPLAY should be either a frame or a display name (a string). |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5410 If DISPLAY is omitted or nil, that stands for the selected frame's display. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5411 (on, display) |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5412 Lisp_Object display, on; |
389 | 5413 { |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
5414 struct x_display_info *dpyinfo = check_x_display_info (display); |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5415 |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5416 XSynchronize (dpyinfo->display, !EQ (on, Qnil)); |
389 | 5417 |
5418 return Qnil; | |
5419 } | |
5420 | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5421 /* Wait for responses to all X commands issued so far for frame F. */ |
5536 | 5422 |
5423 void | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5424 x_sync (f) |
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5425 FRAME_PTR f; |
5536 | 5426 { |
5558 | 5427 BLOCK_INPUT; |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
5428 XSync (FRAME_X_DISPLAY (f), False); |
5558 | 5429 UNBLOCK_INPUT; |
5536 | 5430 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5431 |
389 | 5432 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5433 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5434 Image types |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5435 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5436 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5437 /* Value is the number of elements of vector VECTOR. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5438 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5439 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5440 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5441 /* List of supported image types. Use define_image_type to add new |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5442 types. Use lookup_image_type to find a type for a given symbol. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5443 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5444 static struct image_type *image_types; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5445 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5446 /* The symbol `image' which is the car of the lists used to represent |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5447 images in Lisp. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5448 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5449 extern Lisp_Object Qimage; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5450 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5451 /* The symbol `xbm' which is used as the type symbol for XBM images. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5452 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5453 Lisp_Object Qxbm; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5454 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5455 /* Keywords. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5456 |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
5457 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; |
28001
fed7f17af8c1
(QCdata): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
27993
diff
changeset
|
5458 extern Lisp_Object QCdata; |
fed7f17af8c1
(QCdata): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
27993
diff
changeset
|
5459 Lisp_Object QCtype, QCascent, QCmargin, QCrelief; |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
5460 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
5461 Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5462 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5463 /* Other symbols. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5464 |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
5465 Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5466 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5467 /* Time in seconds after which images should be removed from the cache |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5468 if not displayed. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5469 |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
5470 Lisp_Object Vimage_cache_eviction_delay; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5471 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5472 /* Function prototypes. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5473 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5474 static void define_image_type P_ ((struct image_type *type)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5475 static struct image_type *lookup_image_type P_ ((Lisp_Object symbol)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5476 static void image_error P_ ((char *format, Lisp_Object, Lisp_Object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5477 static void x_laplace P_ ((struct frame *, struct image *)); |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
5478 static void x_emboss P_ ((struct frame *, struct image *)); |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
5479 static int x_build_heuristic_mask P_ ((struct frame *, struct image *, |
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
5480 Lisp_Object)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5481 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5482 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5483 /* Define a new image type from TYPE. This adds a copy of TYPE to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5484 image_types and adds the symbol *TYPE->type to Vimage_types. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5485 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5486 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5487 define_image_type (type) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5488 struct image_type *type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5489 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5490 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5491 The initialized data segment is read-only. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5492 struct image_type *p = (struct image_type *) xmalloc (sizeof *p); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5493 bcopy (type, p, sizeof *p); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5494 p->next = image_types; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5495 image_types = p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5496 Vimage_types = Fcons (*p->type, Vimage_types); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5497 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5498 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5499 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5500 /* Look up image type SYMBOL, and return a pointer to its image_type |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5501 structure. Value is null if SYMBOL is not a known image type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5502 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5503 static INLINE struct image_type * |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5504 lookup_image_type (symbol) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5505 Lisp_Object symbol; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5506 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5507 struct image_type *type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5508 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5509 for (type = image_types; type; type = type->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5510 if (EQ (symbol, *type->type)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5511 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5512 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5513 return type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5514 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5515 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5516 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5517 /* Value is non-zero if OBJECT is a valid Lisp image specification. A |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5518 valid image specification is a list whose car is the symbol |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5519 `image', and whose rest is a property list. The property list must |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5520 contain a value for key `:type'. That value must be the name of a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5521 supported image type. The rest of the property list depends on the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5522 image type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5523 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5524 int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5525 valid_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5526 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5527 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5528 int valid_p = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5529 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5530 if (CONSP (object) && EQ (XCAR (object), Qimage)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5531 { |
38542
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5532 Lisp_Object tem; |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5533 |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5534 for (tem = XCDR (object); CONSP (tem); tem = XCDR (tem)) |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5535 if (EQ (XCAR (tem), QCtype)) |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5536 { |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5537 tem = XCDR (tem); |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5538 if (CONSP (tem) && SYMBOLP (XCAR (tem))) |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5539 { |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5540 struct image_type *type; |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5541 type = lookup_image_type (XCAR (tem)); |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5542 if (type) |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5543 valid_p = type->valid_p (object); |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5544 } |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5545 |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5546 break; |
27905f0c73b7
(valid_image_p): Protect better against invalid image
Gerd Moellmann <gerd@gnu.org>
parents:
38345
diff
changeset
|
5547 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5548 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5549 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5550 return valid_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5551 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5552 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5553 |
25800
609695887d08
(image_error): Use add_to_log.
Gerd Moellmann <gerd@gnu.org>
parents:
25715
diff
changeset
|
5554 /* Log error message with format string FORMAT and argument ARG. |
609695887d08
(image_error): Use add_to_log.
Gerd Moellmann <gerd@gnu.org>
parents:
25715
diff
changeset
|
5555 Signaling an error, e.g. when an image cannot be loaded, is not a |
609695887d08
(image_error): Use add_to_log.
Gerd Moellmann <gerd@gnu.org>
parents:
25715
diff
changeset
|
5556 good idea because this would interrupt redisplay, and the error |
609695887d08
(image_error): Use add_to_log.
Gerd Moellmann <gerd@gnu.org>
parents:
25715
diff
changeset
|
5557 message display would lead to another redisplay. This function |
609695887d08
(image_error): Use add_to_log.
Gerd Moellmann <gerd@gnu.org>
parents:
25715
diff
changeset
|
5558 therefore simply displays a message. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5559 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5560 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5561 image_error (format, arg1, arg2) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5562 char *format; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5563 Lisp_Object arg1, arg2; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5564 { |
25800
609695887d08
(image_error): Use add_to_log.
Gerd Moellmann <gerd@gnu.org>
parents:
25715
diff
changeset
|
5565 add_to_log (format, arg1, arg2); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5566 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5567 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5568 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5569 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5570 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5571 Image specifications |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5572 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5573 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5574 enum image_value_type |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5575 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5576 IMAGE_DONT_CHECK_VALUE_TYPE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5577 IMAGE_STRING_VALUE, |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
5578 IMAGE_STRING_OR_NIL_VALUE, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5579 IMAGE_SYMBOL_VALUE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5580 IMAGE_POSITIVE_INTEGER_VALUE, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5581 IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5582 IMAGE_NON_NEGATIVE_INTEGER_VALUE, |
28787 | 5583 IMAGE_ASCENT_VALUE, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5584 IMAGE_INTEGER_VALUE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5585 IMAGE_FUNCTION_VALUE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5586 IMAGE_NUMBER_VALUE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5587 IMAGE_BOOL_VALUE |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5588 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5589 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5590 /* Structure used when parsing image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5591 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5592 struct image_keyword |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5593 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5594 /* Name of keyword. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5595 char *name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5596 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5597 /* The type of value allowed. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5598 enum image_value_type type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5599 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5600 /* Non-zero means key must be present. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5601 int mandatory_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5602 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5603 /* Used to recognize duplicate keywords in a property list. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5604 int count; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5605 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5606 /* The value that was found. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5607 Lisp_Object value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5608 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5609 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5610 |
26401 | 5611 static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *, |
5612 int, Lisp_Object)); | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5613 static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5614 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5615 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5616 /* Parse image spec SPEC according to KEYWORDS. A valid image spec |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5617 has the format (image KEYWORD VALUE ...). One of the keyword/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5618 value pairs must be `:type TYPE'. KEYWORDS is a vector of |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5619 image_keywords structures of size NKEYWORDS describing other |
26401 | 5620 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5621 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5622 static int |
26401 | 5623 parse_image_spec (spec, keywords, nkeywords, type) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5624 Lisp_Object spec; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5625 struct image_keyword *keywords; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5626 int nkeywords; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5627 Lisp_Object type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5628 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5629 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5630 Lisp_Object plist; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5631 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5632 if (!CONSP (spec) || !EQ (XCAR (spec), Qimage)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5633 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5634 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5635 plist = XCDR (spec); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5636 while (CONSP (plist)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5637 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5638 Lisp_Object key, value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5639 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5640 /* First element of a pair must be a symbol. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5641 key = XCAR (plist); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5642 plist = XCDR (plist); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5643 if (!SYMBOLP (key)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5644 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5645 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5646 /* There must follow a value. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5647 if (!CONSP (plist)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5648 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5649 value = XCAR (plist); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5650 plist = XCDR (plist); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5651 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5652 /* Find key in KEYWORDS. Error if not found. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5653 for (i = 0; i < nkeywords; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5654 if (strcmp (keywords[i].name, XSYMBOL (key)->name->data) == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5655 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5656 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5657 if (i == nkeywords) |
26401 | 5658 continue; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5659 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5660 /* Record that we recognized the keyword. If a keywords |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5661 was found more than once, it's an error. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5662 keywords[i].value = value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5663 ++keywords[i].count; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5664 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5665 if (keywords[i].count > 1) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5666 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5667 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5668 /* Check type of value against allowed type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5669 switch (keywords[i].type) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5670 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5671 case IMAGE_STRING_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5672 if (!STRINGP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5673 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5674 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5675 |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
5676 case IMAGE_STRING_OR_NIL_VALUE: |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
5677 if (!STRINGP (value) && !NILP (value)) |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
5678 return 0; |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
5679 break; |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
5680 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5681 case IMAGE_SYMBOL_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5682 if (!SYMBOLP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5683 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5684 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5685 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5686 case IMAGE_POSITIVE_INTEGER_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5687 if (!INTEGERP (value) || XINT (value) <= 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5688 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5689 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5690 |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5691 case IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR: |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5692 if (INTEGERP (value) && XINT (value) >= 0) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5693 break; |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5694 if (CONSP (value) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5695 && INTEGERP (XCAR (value)) && INTEGERP (XCDR (value)) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5696 && XINT (XCAR (value)) >= 0 && XINT (XCDR (value)) >= 0) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5697 break; |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5698 return 0; |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5699 |
28787 | 5700 case IMAGE_ASCENT_VALUE: |
5701 if (SYMBOLP (value) && EQ (value, Qcenter)) | |
5702 break; | |
5703 else if (INTEGERP (value) | |
5704 && XINT (value) >= 0 | |
5705 && XINT (value) <= 100) | |
5706 break; | |
5707 return 0; | |
5708 | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5709 case IMAGE_NON_NEGATIVE_INTEGER_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5710 if (!INTEGERP (value) || XINT (value) < 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5711 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5712 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5713 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5714 case IMAGE_DONT_CHECK_VALUE_TYPE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5715 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5716 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5717 case IMAGE_FUNCTION_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5718 value = indirect_function (value); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5719 if (SUBRP (value) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5720 || COMPILEDP (value) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5721 || (CONSP (value) && EQ (XCAR (value), Qlambda))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5722 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5723 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5724 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5725 case IMAGE_NUMBER_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5726 if (!INTEGERP (value) && !FLOATP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5727 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5728 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5729 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5730 case IMAGE_INTEGER_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5731 if (!INTEGERP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5732 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5733 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5734 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5735 case IMAGE_BOOL_VALUE: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5736 if (!NILP (value) && !EQ (value, Qt)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5737 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5738 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5739 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5740 default: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5741 abort (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5742 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5743 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5744 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5745 if (EQ (key, QCtype) && !EQ (type, value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5746 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5747 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5748 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5749 /* Check that all mandatory fields are present. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5750 for (i = 0; i < nkeywords; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5751 if (keywords[i].mandatory_p && keywords[i].count == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5752 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5753 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5754 return NILP (plist); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5755 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5756 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5757 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5758 /* Return the value of KEY in image specification SPEC. Value is nil |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5759 if KEY is not present in SPEC. if FOUND is not null, set *FOUND |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5760 to 1 if KEY was found in SPEC, set it to 0 otherwise. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5761 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5762 static Lisp_Object |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5763 image_spec_value (spec, key, found) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5764 Lisp_Object spec, key; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5765 int *found; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5766 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5767 Lisp_Object tail; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5768 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5769 xassert (valid_image_p (spec)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5770 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5771 for (tail = XCDR (spec); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5772 CONSP (tail) && CONSP (XCDR (tail)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5773 tail = XCDR (XCDR (tail))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5774 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5775 if (EQ (XCAR (tail), key)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5776 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5777 if (found) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5778 *found = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5779 return XCAR (XCDR (tail)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5780 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5781 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5782 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5783 if (found) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5784 *found = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5785 return Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5786 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5787 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5788 |
29938
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5789 DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5790 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT). |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5791 PIXELS non-nil means return the size in pixels, otherwise return the |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5792 size in canonical character units. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5793 FRAME is the frame on which the image will be displayed. FRAME nil |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5794 or omitted means use the selected frame. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5795 (spec, pixels, frame) |
29938
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5796 Lisp_Object spec, pixels, frame; |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5797 { |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5798 Lisp_Object size; |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5799 |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5800 size = Qnil; |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5801 if (valid_image_p (spec)) |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5802 { |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5803 struct frame *f = check_x_frame (frame); |
32536 | 5804 int id = lookup_image (f, spec); |
29938
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5805 struct image *img = IMAGE_FROM_ID (f, id); |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5806 int width = img->width + 2 * img->hmargin; |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5807 int height = img->height + 2 * img->vmargin; |
29938
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5808 |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5809 if (NILP (pixels)) |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5810 size = Fcons (make_float ((double) width / CANON_X_UNIT (f)), |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5811 make_float ((double) height / CANON_Y_UNIT (f))); |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5812 else |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5813 size = Fcons (make_number (width), make_number (height)); |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5814 } |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5815 else |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5816 error ("Invalid image specification"); |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5817 |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5818 return size; |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5819 } |
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
5820 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5821 |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5822 DEFUN ("image-mask-p", Fimage_mask_p, Simage_mask_p, 1, 2, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5823 doc: /* Return t if image SPEC has a mask bitmap. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
5824 FRAME is the frame on which the image will be displayed. FRAME nil |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5825 or omitted means use the selected frame. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
5826 (spec, frame) |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5827 Lisp_Object spec, frame; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5828 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5829 Lisp_Object mask; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5830 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5831 mask = Qnil; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5832 if (valid_image_p (spec)) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5833 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5834 struct frame *f = check_x_frame (frame); |
32536 | 5835 int id = lookup_image (f, spec); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5836 struct image *img = IMAGE_FROM_ID (f, id); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5837 if (img->mask) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5838 mask = Qt; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5839 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5840 else |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5841 error ("Invalid image specification"); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5842 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5843 return mask; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5844 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5845 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
5846 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5847 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5848 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5849 Image type independent image structures |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5850 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5851 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5852 static struct image *make_image P_ ((Lisp_Object spec, unsigned hash)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5853 static void free_image P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5854 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5855 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5856 /* Allocate and return a new image structure for image specification |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5857 SPEC. SPEC has a hash value of HASH. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5858 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5859 static struct image * |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5860 make_image (spec, hash) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5861 Lisp_Object spec; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5862 unsigned hash; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5863 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5864 struct image *img = (struct image *) xmalloc (sizeof *img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5865 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5866 xassert (valid_image_p (spec)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5867 bzero (img, sizeof *img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5868 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5869 xassert (img->type != NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5870 img->spec = spec; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5871 img->data.lisp_val = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5872 img->ascent = DEFAULT_IMAGE_ASCENT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5873 img->hash = hash; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5874 return img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5875 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5876 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5877 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5878 /* Free image IMG which was used on frame F, including its resources. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5879 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5880 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5881 free_image (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5882 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5883 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5884 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5885 if (img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5886 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5887 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5888 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5889 /* Remove IMG from the hash table of its cache. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5890 if (img->prev) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5891 img->prev->next = img->next; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5892 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5893 c->buckets[img->hash % IMAGE_CACHE_BUCKETS_SIZE] = img->next; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5894 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5895 if (img->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5896 img->next->prev = img->prev; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5897 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5898 c->images[img->id] = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5899 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5900 /* Free resources, then free IMG. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5901 img->type->free (f, img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5902 xfree (img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5903 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5904 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5905 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5906 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5907 /* Prepare image IMG for display on frame F. Must be called before |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5908 drawing an image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5909 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5910 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5911 prepare_image_for_display (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5912 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5913 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5914 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5915 EMACS_TIME t; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5916 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5917 /* We're about to display IMG, so set its timestamp to `now'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5918 EMACS_GET_TIME (t); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5919 img->timestamp = EMACS_SECS (t); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5920 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5921 /* If IMG doesn't have a pixmap yet, load it now, using the image |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5922 type dependent loader function. */ |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
5923 if (img->pixmap == None && !img->load_failed_p) |
25955
3daaee890b1e
(prepare_image_for_display): Don't try to load image if
Gerd Moellmann <gerd@gnu.org>
parents:
25817
diff
changeset
|
5924 img->load_failed_p = img->type->load (f, img) == 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5925 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5926 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
5927 |
28787 | 5928 /* Value is the number of pixels for the ascent of image IMG when |
5929 drawn in face FACE. */ | |
5930 | |
5931 int | |
5932 image_ascent (img, face) | |
5933 struct image *img; | |
5934 struct face *face; | |
5935 { | |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
5936 int height = img->height + img->vmargin; |
28787 | 5937 int ascent; |
5938 | |
5939 if (img->ascent == CENTERED_IMAGE_ASCENT) | |
5940 { | |
5941 if (face->font) | |
32160
0abb3c153331
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Miles Bader <miles@gnu.org>
parents:
31999
diff
changeset
|
5942 /* This expression is arranged so that if the image can't be |
0abb3c153331
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Miles Bader <miles@gnu.org>
parents:
31999
diff
changeset
|
5943 exactly centered, it will be moved slightly up. This is |
0abb3c153331
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Miles Bader <miles@gnu.org>
parents:
31999
diff
changeset
|
5944 because a typical font is `top-heavy' (due to the presence |
0abb3c153331
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Miles Bader <miles@gnu.org>
parents:
31999
diff
changeset
|
5945 uppercase letters), so the image placement should err towards |
0abb3c153331
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Miles Bader <miles@gnu.org>
parents:
31999
diff
changeset
|
5946 being top-heavy too. It also just generally looks better. */ |
0abb3c153331
(image_ascent): Rearrange ascent calculation for the has-a-font case.
Miles Bader <miles@gnu.org>
parents:
31999
diff
changeset
|
5947 ascent = (height + face->font->ascent - face->font->descent + 1) / 2; |
28787 | 5948 else |
5949 ascent = height / 2; | |
5950 } | |
5951 else | |
5952 ascent = height * img->ascent / 100.0; | |
5953 | |
5954 return ascent; | |
5955 } | |
5956 | |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5957 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5958 /* Image background colors. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5959 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5960 static unsigned long |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5961 four_corners_best (ximg, width, height) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5962 XImage *ximg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5963 unsigned long width, height; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5964 { |
40606
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5965 unsigned long corners[4], best; |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5966 int i, best_count; |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5967 |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5968 /* Get the colors at the corners of ximg. */ |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5969 corners[0] = XGetPixel (ximg, 0, 0); |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5970 corners[1] = XGetPixel (ximg, width - 1, 0); |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5971 corners[2] = XGetPixel (ximg, width - 1, height - 1); |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5972 corners[3] = XGetPixel (ximg, 0, height - 1); |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5973 |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5974 /* Choose the most frequently found color as background. */ |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5975 for (i = best_count = 0; i < 4; ++i) |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5976 { |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5977 int j, n; |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5978 |
40606
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5979 for (j = n = 0; j < 4; ++j) |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5980 if (corners[i] == corners[j]) |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5981 ++n; |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5982 |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5983 if (n > best_count) |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5984 best = corners[i], best_count = n; |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5985 } |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5986 |
d590ec395dcd
(four_corners_best): Reindent.
Gerd Moellmann <gerd@gnu.org>
parents:
40599
diff
changeset
|
5987 return best; |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5988 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5989 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5990 /* Return the `background' field of IMG. If IMG doesn't have one yet, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5991 it is guessed heuristically. If non-zero, XIMG is an existing XImage |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5992 object to use for the heuristic. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5993 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5994 unsigned long |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5995 image_background (img, f, ximg) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5996 struct image *img; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5997 struct frame *f; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5998 XImage *ximg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
5999 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6000 if (! img->background_valid) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6001 /* IMG doesn't have a background yet, try to guess a reasonable value. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6002 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6003 int free_ximg = !ximg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6004 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6005 if (! ximg) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6006 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6007 0, 0, img->width, img->height, ~0, ZPixmap); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6008 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6009 img->background = four_corners_best (ximg, img->width, img->height); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6010 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6011 if (free_ximg) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6012 XDestroyImage (ximg); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6013 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6014 img->background_valid = 1; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6015 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6016 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6017 return img->background; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6018 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6019 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6020 /* Return the `background_transparent' field of IMG. If IMG doesn't |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6021 have one yet, it is guessed heuristically. If non-zero, MASK is an |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6022 existing XImage object to use for the heuristic. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6023 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6024 int |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6025 image_background_transparent (img, f, mask) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6026 struct image *img; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6027 struct frame *f; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6028 XImage *mask; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6029 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6030 if (! img->background_transparent_valid) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6031 /* IMG doesn't have a background yet, try to guess a reasonable value. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6032 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6033 if (img->mask) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6034 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6035 int free_mask = !mask; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6036 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6037 if (! mask) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6038 mask = XGetImage (FRAME_X_DISPLAY (f), img->mask, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6039 0, 0, img->width, img->height, ~0, ZPixmap); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6040 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6041 img->background_transparent |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6042 = !four_corners_best (mask, img->width, img->height); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6043 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6044 if (free_mask) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6045 XDestroyImage (mask); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6046 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6047 else |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6048 img->background_transparent = 0; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6049 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6050 img->background_transparent_valid = 1; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6051 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6052 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6053 return img->background_transparent; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6054 } |
28787 | 6055 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6056 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6057 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6058 Helper functions for X image types |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6059 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6060 |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6061 static void x_clear_image_1 P_ ((struct frame *, struct image *, int, |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6062 int, int)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6063 static void x_clear_image P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6064 static unsigned long x_alloc_image_color P_ ((struct frame *f, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6065 struct image *img, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6066 Lisp_Object color_name, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6067 unsigned long dflt)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6068 |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6069 |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6070 /* Clear X resources of image IMG on frame F. PIXMAP_P non-zero means |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6071 free the pixmap if any. MASK_P non-zero means clear the mask |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6072 pixmap if any. COLORS_P non-zero means free colors allocated for |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6073 the image, if any. */ |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6074 |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6075 static void |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6076 x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p) |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6077 struct frame *f; |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6078 struct image *img; |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6079 int pixmap_p, mask_p, colors_p; |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6080 { |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6081 if (pixmap_p && img->pixmap) |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6082 { |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6083 XFreePixmap (FRAME_X_DISPLAY (f), img->pixmap); |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6084 img->pixmap = None; |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6085 img->background_valid = 0; |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6086 } |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6087 |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6088 if (mask_p && img->mask) |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6089 { |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6090 XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6091 img->mask = None; |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6092 img->background_transparent_valid = 0; |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6093 } |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6094 |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6095 if (colors_p && img->ncolors) |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6096 { |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6097 x_free_colors (f, img->colors, img->ncolors); |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6098 xfree (img->colors); |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6099 img->colors = NULL; |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6100 img->ncolors = 0; |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6101 } |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6102 } |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6103 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6104 /* Free X resources of image IMG which is used on frame F. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6105 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6106 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6107 x_clear_image (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6108 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6109 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6110 { |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6111 BLOCK_INPUT; |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6112 x_clear_image_1 (f, img, 1, 1, 1); |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6113 UNBLOCK_INPUT; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6114 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6115 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6116 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6117 /* Allocate color COLOR_NAME for image IMG on frame F. If color |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6118 cannot be allocated, use DFLT. Add a newly allocated color to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6119 IMG->colors, so that it can be freed again. Value is the pixel |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6120 color. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6121 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6122 static unsigned long |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6123 x_alloc_image_color (f, img, color_name, dflt) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6124 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6125 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6126 Lisp_Object color_name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6127 unsigned long dflt; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6128 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6129 XColor color; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6130 unsigned long result; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6131 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6132 xassert (STRINGP (color_name)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6133 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
6134 if (x_defined_color (f, XSTRING (color_name)->data, &color, 1)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6135 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6136 /* This isn't called frequently so we get away with simply |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6137 reallocating the color vector to the needed size, here. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6138 ++img->ncolors; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6139 img->colors = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6140 (unsigned long *) xrealloc (img->colors, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6141 img->ncolors * sizeof *img->colors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6142 img->colors[img->ncolors - 1] = color.pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6143 result = color.pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6144 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6145 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6146 result = dflt; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6147 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6148 return result; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6149 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6150 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6151 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6152 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6153 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6154 Image Cache |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6155 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6156 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6157 static void cache_image P_ ((struct frame *f, struct image *img)); |
37173
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6158 static void postprocess_image P_ ((struct frame *, struct image *)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6159 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6160 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6161 /* Return a new, initialized image cache that is allocated from the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6162 heap. Call free_image_cache to free an image cache. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6163 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6164 struct image_cache * |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6165 make_image_cache () |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6166 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6167 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6168 int size; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6169 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6170 bzero (c, sizeof *c); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6171 c->size = 50; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6172 c->images = (struct image **) xmalloc (c->size * sizeof *c->images); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6173 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6174 c->buckets = (struct image **) xmalloc (size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6175 bzero (c->buckets, size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6176 return c; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6177 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6178 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6179 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6180 /* Free image cache of frame F. Be aware that X frames share images |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6181 caches. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6182 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6183 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6184 free_image_cache (f) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6185 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6186 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6187 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6188 if (c) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6189 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6190 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6191 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6192 /* Cache should not be referenced by any frame when freed. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6193 xassert (c->refcount == 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6194 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6195 for (i = 0; i < c->used; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6196 free_image (f, c->images[i]); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6197 xfree (c->images); |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
6198 xfree (c->buckets); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6199 xfree (c); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6200 FRAME_X_IMAGE_CACHE (f) = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6201 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6202 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6203 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6204 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6205 /* Clear image cache of frame F. FORCE_P non-zero means free all |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6206 images. FORCE_P zero means clear only images that haven't been |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6207 displayed for some time. Should be called from time to time to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6208 reduce the number of loaded images. If image-eviction-seconds is |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6209 non-nil, this frees images in the cache which weren't displayed for |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6210 at least that many seconds. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6211 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6212 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6213 clear_image_cache (f, force_p) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6214 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6215 int force_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6216 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6217 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6218 |
32536 | 6219 if (c && INTEGERP (Vimage_cache_eviction_delay)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6220 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6221 EMACS_TIME t; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6222 unsigned long old; |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6223 int i, nfreed; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6224 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6225 EMACS_GET_TIME (t); |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
6226 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay); |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6227 |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6228 /* Block input so that we won't be interrupted by a SIGIO |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6229 while being in an inconsistent state. */ |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6230 BLOCK_INPUT; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6231 |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6232 for (i = nfreed = 0; i < c->used; ++i) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6233 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6234 struct image *img = c->images[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6235 if (img != NULL |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6236 && (force_p || img->timestamp < old)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6237 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6238 free_image (f, img); |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6239 ++nfreed; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6240 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6241 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6242 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6243 /* We may be clearing the image cache because, for example, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6244 Emacs was iconified for a longer period of time. In that |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6245 case, current matrices may still contain references to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6246 images freed above. So, clear these matrices. */ |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6247 if (nfreed) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6248 { |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6249 Lisp_Object tail, frame; |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6250 |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6251 FOR_EACH_FRAME (tail, frame) |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6252 { |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6253 struct frame *f = XFRAME (frame); |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6254 if (FRAME_X_P (f) |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6255 && FRAME_X_IMAGE_CACHE (f) == c) |
32536 | 6256 clear_current_matrices (f); |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6257 } |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6258 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6259 ++windows_or_buffers_changed; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6260 } |
31688
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6261 |
437830e83b45
(clear_image_cache): Clear current matrices of all
Gerd Moellmann <gerd@gnu.org>
parents:
31686
diff
changeset
|
6262 UNBLOCK_INPUT; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6263 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6264 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6265 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6266 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6267 DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6268 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
6269 doc: /* Clear the image cache of FRAME. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
6270 FRAME nil or omitted means use the selected frame. |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
6271 FRAME t means clear the image caches of all frames. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
6272 (frame) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6273 Lisp_Object frame; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6274 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6275 if (EQ (frame, Qt)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6276 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6277 Lisp_Object tail; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6278 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6279 FOR_EACH_FRAME (tail, frame) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6280 if (FRAME_X_P (XFRAME (frame))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6281 clear_image_cache (XFRAME (frame), 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6282 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6283 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6284 clear_image_cache (check_x_frame (frame), 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6285 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6286 return Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6287 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6288 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6289 |
37173
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6290 /* Compute masks and transform image IMG on frame F, as specified |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6291 by the image's specification, */ |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6292 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6293 static void |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6294 postprocess_image (f, img) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6295 struct frame *f; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6296 struct image *img; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6297 { |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6298 /* Manipulation of the image's mask. */ |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6299 if (img->pixmap) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6300 { |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6301 Lisp_Object conversion, spec; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6302 Lisp_Object mask; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6303 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6304 spec = img->spec; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6305 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6306 /* `:heuristic-mask t' |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6307 `:mask heuristic' |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6308 means build a mask heuristically. |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6309 `:heuristic-mask (R G B)' |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6310 `:mask (heuristic (R G B))' |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6311 means build a mask from color (R G B) in the |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6312 image. |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6313 `:mask nil' |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6314 means remove a mask, if any. */ |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6315 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6316 mask = image_spec_value (spec, QCheuristic_mask, NULL); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6317 if (!NILP (mask)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6318 x_build_heuristic_mask (f, img, mask); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6319 else |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6320 { |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6321 int found_p; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6322 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6323 mask = image_spec_value (spec, QCmask, &found_p); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6324 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6325 if (EQ (mask, Qheuristic)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6326 x_build_heuristic_mask (f, img, Qt); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6327 else if (CONSP (mask) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6328 && EQ (XCAR (mask), Qheuristic)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6329 { |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6330 if (CONSP (XCDR (mask))) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6331 x_build_heuristic_mask (f, img, XCAR (XCDR (mask))); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6332 else |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6333 x_build_heuristic_mask (f, img, XCDR (mask)); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6334 } |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6335 else if (NILP (mask) && found_p && img->mask) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6336 { |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6337 XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6338 img->mask = None; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6339 } |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6340 } |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6341 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6342 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6343 /* Should we apply an image transformation algorithm? */ |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6344 conversion = image_spec_value (spec, QCconversion, NULL); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6345 if (EQ (conversion, Qdisabled)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6346 x_disable_image (f, img); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6347 else if (EQ (conversion, Qlaplace)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6348 x_laplace (f, img); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6349 else if (EQ (conversion, Qemboss)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6350 x_emboss (f, img); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6351 else if (CONSP (conversion) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6352 && EQ (XCAR (conversion), Qedge_detection)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6353 { |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6354 Lisp_Object tem; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6355 tem = XCDR (conversion); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6356 if (CONSP (tem)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6357 x_edge_detection (f, img, |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6358 Fplist_get (tem, QCmatrix), |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6359 Fplist_get (tem, QCcolor_adjustment)); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6360 } |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6361 } |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6362 } |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6363 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6364 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6365 /* Return the id of image with Lisp specification SPEC on frame F. |
32536 | 6366 SPEC must be a valid Lisp image specification (see valid_image_p). */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6367 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6368 int |
32536 | 6369 lookup_image (f, spec) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6370 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6371 Lisp_Object spec; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6372 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6373 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6374 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6375 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6376 unsigned hash; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6377 struct gcpro gcpro1; |
25817
190a99688b53
(lookup_image): Set image's timestamp because it's
Gerd Moellmann <gerd@gnu.org>
parents:
25800
diff
changeset
|
6378 EMACS_TIME now; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6379 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6380 /* F must be a window-system frame, and SPEC must be a valid image |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6381 specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6382 xassert (FRAME_WINDOW_P (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6383 xassert (valid_image_p (spec)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6384 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6385 GCPRO1 (spec); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6386 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6387 /* Look up SPEC in the hash table of the image cache. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6388 hash = sxhash (spec, 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6389 i = hash % IMAGE_CACHE_BUCKETS_SIZE; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6390 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6391 for (img = c->buckets[i]; img; img = img->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6392 if (img->hash == hash && !NILP (Fequal (img->spec, spec))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6393 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6394 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6395 /* If not found, create a new image and cache it. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6396 if (img == NULL) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6397 { |
37173
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6398 extern Lisp_Object Qpostscript; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6399 |
31686
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
6400 BLOCK_INPUT; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6401 img = make_image (spec, hash); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6402 cache_image (f, img); |
32536 | 6403 img->load_failed_p = img->type->load (f, img) == 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6404 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6405 /* If we can't load the image, and we don't have a width and |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6406 height, use some arbitrary width and height so that we can |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6407 draw a rectangle for it. */ |
32536 | 6408 if (img->load_failed_p) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6409 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6410 Lisp_Object value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6411 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6412 value = image_spec_value (spec, QCwidth, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6413 img->width = (INTEGERP (value) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6414 ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6415 value = image_spec_value (spec, QCheight, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6416 img->height = (INTEGERP (value) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6417 ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6418 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6419 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6420 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6421 /* Handle image type independent image attributes |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6422 `:ascent ASCENT', `:margin MARGIN', `:relief RELIEF', |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6423 `:background COLOR'. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6424 Lisp_Object ascent, margin, relief, bg; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6425 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6426 ascent = image_spec_value (spec, QCascent, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6427 if (INTEGERP (ascent)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6428 img->ascent = XFASTINT (ascent); |
28787 | 6429 else if (EQ (ascent, Qcenter)) |
6430 img->ascent = CENTERED_IMAGE_ASCENT; | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6431 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6432 margin = image_spec_value (spec, QCmargin, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6433 if (INTEGERP (margin) && XINT (margin) >= 0) |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6434 img->vmargin = img->hmargin = XFASTINT (margin); |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6435 else if (CONSP (margin) && INTEGERP (XCAR (margin)) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6436 && INTEGERP (XCDR (margin))) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6437 { |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6438 if (XINT (XCAR (margin)) > 0) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6439 img->hmargin = XFASTINT (XCAR (margin)); |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6440 if (XINT (XCDR (margin)) > 0) |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6441 img->vmargin = XFASTINT (XCDR (margin)); |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6442 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6443 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6444 relief = image_spec_value (spec, QCrelief, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6445 if (INTEGERP (relief)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6446 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6447 img->relief = XINT (relief); |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6448 img->hmargin += abs (img->relief); |
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6449 img->vmargin += abs (img->relief); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6450 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6451 |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6452 if (! img->background_valid) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6453 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6454 bg = image_spec_value (img->spec, QCbackground, NULL); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6455 if (!NILP (bg)) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6456 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6457 img->background |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6458 = x_alloc_image_color (f, img, bg, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6459 FRAME_BACKGROUND_PIXEL (f)); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6460 img->background_valid = 1; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6461 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6462 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
6463 |
37173
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6464 /* Do image transformations and compute masks, unless we |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6465 don't have the image yet. */ |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6466 if (!EQ (*img->type->type, Qpostscript)) |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
6467 postprocess_image (f, img); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6468 } |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6469 |
31686
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
6470 UNBLOCK_INPUT; |
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
6471 xassert (!interrupt_input_blocked); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6472 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6473 |
25817
190a99688b53
(lookup_image): Set image's timestamp because it's
Gerd Moellmann <gerd@gnu.org>
parents:
25800
diff
changeset
|
6474 /* We're using IMG, so set its timestamp to `now'. */ |
190a99688b53
(lookup_image): Set image's timestamp because it's
Gerd Moellmann <gerd@gnu.org>
parents:
25800
diff
changeset
|
6475 EMACS_GET_TIME (now); |
190a99688b53
(lookup_image): Set image's timestamp because it's
Gerd Moellmann <gerd@gnu.org>
parents:
25800
diff
changeset
|
6476 img->timestamp = EMACS_SECS (now); |
190a99688b53
(lookup_image): Set image's timestamp because it's
Gerd Moellmann <gerd@gnu.org>
parents:
25800
diff
changeset
|
6477 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6478 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6479 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6480 /* Value is the image id. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6481 return img->id; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6482 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6483 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6484 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6485 /* Cache image IMG in the image cache of frame F. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6486 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6487 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6488 cache_image (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6489 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6490 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6491 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6492 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6493 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6494 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6495 /* Find a free slot in c->images. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6496 for (i = 0; i < c->used; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6497 if (c->images[i] == NULL) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6498 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6499 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6500 /* If no free slot found, maybe enlarge c->images. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6501 if (i == c->used && c->used == c->size) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6502 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6503 c->size *= 2; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6504 c->images = (struct image **) xrealloc (c->images, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6505 c->size * sizeof *c->images); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6506 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6507 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6508 /* Add IMG to c->images, and assign IMG an id. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6509 c->images[i] = img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6510 img->id = i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6511 if (i == c->used) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6512 ++c->used; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6513 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6514 /* Add IMG to the cache's hash table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6515 i = img->hash % IMAGE_CACHE_BUCKETS_SIZE; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6516 img->next = c->buckets[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6517 if (img->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6518 img->next->prev = img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6519 img->prev = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6520 c->buckets[i] = img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6521 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6522 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6523 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6524 /* Call FN on every image in the image cache of frame F. Used to mark |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6525 Lisp Objects in the image cache. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6526 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6527 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6528 forall_images_in_image_cache (f, fn) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6529 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6530 void (*fn) P_ ((struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6531 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6532 if (FRAME_LIVE_P (f) && FRAME_X_P (f)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6533 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6534 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6535 if (c) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6536 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6537 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6538 for (i = 0; i < c->used; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6539 if (c->images[i]) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6540 fn (c->images[i]); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6541 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6542 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6543 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6544 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6545 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6546 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6547 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6548 X support code |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6549 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6550 |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
6551 static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int, |
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
6552 XImage **, Pixmap *)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6553 static void x_destroy_x_image P_ ((XImage *)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6554 static void x_put_x_image P_ ((struct frame *, XImage *, Pixmap, int, int)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6555 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6556 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6557 /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6558 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6559 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6560 via xmalloc. Print error messages via image_error if an error |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
6561 occurs. Value is non-zero if successful. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6562 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6563 static int |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
6564 x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6565 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6566 int width, height, depth; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6567 XImage **ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6568 Pixmap *pixmap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6569 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6570 Display *display = FRAME_X_DISPLAY (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6571 Screen *screen = FRAME_X_SCREEN (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6572 Window window = FRAME_X_WINDOW (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6573 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6574 xassert (interrupt_input_blocked); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6575 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6576 if (depth <= 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6577 depth = DefaultDepthOfScreen (screen); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6578 *ximg = XCreateImage (display, DefaultVisualOfScreen (screen), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6579 depth, ZPixmap, 0, NULL, width, height, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6580 depth > 16 ? 32 : depth > 8 ? 16 : 8, 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6581 if (*ximg == NULL) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6582 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
6583 image_error ("Unable to allocate X image", Qnil, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6584 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6585 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6586 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6587 /* Allocate image raster. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6588 (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6589 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6590 /* Allocate a pixmap of the same size. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6591 *pixmap = XCreatePixmap (display, window, width, height, depth); |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
6592 if (*pixmap == None) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6593 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6594 x_destroy_x_image (*ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6595 *ximg = NULL; |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
6596 image_error ("Unable to create X pixmap", Qnil, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6597 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6598 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6599 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6600 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6601 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6602 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6603 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6604 /* Destroy XImage XIMG. Free XIMG->data. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6605 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6606 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6607 x_destroy_x_image (ximg) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6608 XImage *ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6609 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6610 xassert (interrupt_input_blocked); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6611 if (ximg) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6612 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6613 xfree (ximg->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6614 ximg->data = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6615 XDestroyImage (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6616 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6617 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6618 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6619 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6620 /* Put XImage XIMG into pixmap PIXMAP on frame F. WIDTH and HEIGHT |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6621 are width and height of both the image and pixmap. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6622 |
25691
815efc48a80b
(x_put_x_image): Make type consistent with declaration.
Dave Love <fx@gnu.org>
parents:
25679
diff
changeset
|
6623 static void |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6624 x_put_x_image (f, ximg, pixmap, width, height) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6625 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6626 XImage *ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6627 Pixmap pixmap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6628 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6629 GC gc; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6630 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6631 xassert (interrupt_input_blocked); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6632 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6633 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6634 XFreeGC (FRAME_X_DISPLAY (f), gc); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6635 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6636 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6637 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6638 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6639 /*********************************************************************** |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6640 File Handling |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6641 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6642 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6643 static Lisp_Object x_find_image_file P_ ((Lisp_Object)); |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6644 static char *slurp_file P_ ((char *, int *)); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6645 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6646 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6647 /* Find image file FILE. Look in data-directory, then |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6648 x-bitmap-file-path. Value is the full name of the file found, or |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6649 nil if not found. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6650 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6651 static Lisp_Object |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6652 x_find_image_file (file) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6653 Lisp_Object file; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6654 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6655 Lisp_Object file_found, search_path; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6656 struct gcpro gcpro1, gcpro2; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6657 int fd; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6658 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6659 file_found = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6660 search_path = Fcons (Vdata_directory, Vx_bitmap_file_path); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6661 GCPRO2 (file_found, search_path); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6662 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6663 /* Try to find FILE in data-directory, then x-bitmap-file-path. */ |
39812
66e0816837a8
Update calls to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39682
diff
changeset
|
6664 fd = openp (search_path, file, Qnil, &file_found, 0); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6665 |
33443
2c60aa5cd386
(x_create_bitmap_from_file, x_find_image_file): Use new openp return protocol.
Miles Bader <miles@gnu.org>
parents:
33242
diff
changeset
|
6666 if (fd == -1) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6667 file_found = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6668 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6669 close (fd); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6670 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6671 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6672 return file_found; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6673 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6674 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6675 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6676 /* Read FILE into memory. Value is a pointer to a buffer allocated |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6677 with xmalloc holding FILE's contents. Value is null if an error |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
6678 occurred. *SIZE is set to the size of the file. */ |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6679 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6680 static char * |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6681 slurp_file (file, size) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6682 char *file; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6683 int *size; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6684 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6685 FILE *fp = NULL; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6686 char *buf = NULL; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6687 struct stat st; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6688 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6689 if (stat (file, &st) == 0 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6690 && (fp = fopen (file, "r")) != NULL |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6691 && (buf = (char *) xmalloc (st.st_size), |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6692 fread (buf, 1, st.st_size, fp) == st.st_size)) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6693 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6694 *size = st.st_size; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6695 fclose (fp); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6696 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6697 else |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6698 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6699 if (fp) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6700 fclose (fp); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6701 if (buf) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6702 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6703 xfree (buf); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6704 buf = NULL; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6705 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6706 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6707 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6708 return buf; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6709 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6710 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6711 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6712 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6713 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6714 XBM images |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6715 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6716 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6717 static int xbm_scan P_ ((char **, char *, char *, int *)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6718 static int xbm_load P_ ((struct frame *f, struct image *img)); |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6719 static int xbm_load_image P_ ((struct frame *f, struct image *img, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6720 char *, char *)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6721 static int xbm_image_p P_ ((Lisp_Object object)); |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6722 static int xbm_read_bitmap_data P_ ((char *, char *, int *, int *, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6723 unsigned char **)); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6724 static int xbm_file_p P_ ((Lisp_Object)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6725 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6726 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6727 /* Indices of image specification fields in xbm_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6728 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6729 enum xbm_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6730 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6731 XBM_TYPE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6732 XBM_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6733 XBM_WIDTH, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6734 XBM_HEIGHT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6735 XBM_DATA, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6736 XBM_FOREGROUND, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6737 XBM_BACKGROUND, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6738 XBM_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6739 XBM_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6740 XBM_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6741 XBM_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6742 XBM_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
6743 XBM_MASK, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6744 XBM_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6745 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6746 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6747 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6748 of valid XBM image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6749 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6750 static struct image_keyword xbm_format[XBM_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6751 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6752 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6753 {":file", IMAGE_STRING_VALUE, 0}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6754 {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6755 {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6756 {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
6757 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
6758 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}, |
28787 | 6759 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
6760 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6761 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
6762 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
6763 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
6764 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6765 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6766 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6767 /* Structure describing the image type XBM. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6768 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6769 static struct image_type xbm_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6770 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6771 &Qxbm, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6772 xbm_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6773 xbm_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6774 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6775 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6776 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6777 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6778 /* Tokens returned from xbm_scan. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6779 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6780 enum xbm_token |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6781 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6782 XBM_TK_IDENT = 256, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6783 XBM_TK_NUMBER |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6784 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6785 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6786 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6787 /* Return non-zero if OBJECT is a valid XBM-type image specification. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6788 A valid specification is a list starting with the symbol `image' |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6789 The rest of the list is a property list which must contain an |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6790 entry `:type xbm.. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6791 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6792 If the specification specifies a file to load, it must contain |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6793 an entry `:file FILENAME' where FILENAME is a string. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6794 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6795 If the specification is for a bitmap loaded from memory it must |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6796 contain `:width WIDTH', `:height HEIGHT', and `:data DATA', where |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6797 WIDTH and HEIGHT are integers > 0. DATA may be: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6798 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6799 1. a string large enough to hold the bitmap data, i.e. it must |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6800 have a size >= (WIDTH + 7) / 8 * HEIGHT |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6801 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6802 2. a bool-vector of size >= WIDTH * HEIGHT |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6803 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6804 3. a vector of strings or bool-vectors, one for each line of the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6805 bitmap. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6806 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6807 4. A string containing an in-memory XBM file. WIDTH and HEIGHT |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6808 may not be specified in this case because they are defined in the |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6809 XBM file. |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6810 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6811 Both the file and data forms may contain the additional entries |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6812 `:background COLOR' and `:foreground COLOR'. If not present, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6813 foreground and background of the frame on which the image is |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
6814 displayed is used. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6815 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6816 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6817 xbm_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6818 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6819 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6820 struct image_keyword kw[XBM_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6821 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6822 bcopy (xbm_format, kw, sizeof kw); |
26401 | 6823 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6824 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6825 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6826 xassert (EQ (kw[XBM_TYPE].value, Qxbm)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6827 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6828 if (kw[XBM_FILE].count) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6829 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6830 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_DATA].count) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6831 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6832 } |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6833 else if (kw[XBM_DATA].count && xbm_file_p (kw[XBM_DATA].value)) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6834 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6835 /* In-memory XBM file. */ |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6836 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_FILE].count) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6837 return 0; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6838 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6839 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6840 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6841 Lisp_Object data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6842 int width, height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6843 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6844 /* Entries for `:width', `:height' and `:data' must be present. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6845 if (!kw[XBM_WIDTH].count |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6846 || !kw[XBM_HEIGHT].count |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6847 || !kw[XBM_DATA].count) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6848 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6849 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6850 data = kw[XBM_DATA].value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6851 width = XFASTINT (kw[XBM_WIDTH].value); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6852 height = XFASTINT (kw[XBM_HEIGHT].value); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6853 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6854 /* Check type of data, and width and height against contents of |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6855 data. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6856 if (VECTORP (data)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6857 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6858 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6859 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6860 /* Number of elements of the vector must be >= height. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6861 if (XVECTOR (data)->size < height) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6862 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6863 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6864 /* Each string or bool-vector in data must be large enough |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6865 for one line of the image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6866 for (i = 0; i < height; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6867 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6868 Lisp_Object elt = XVECTOR (data)->contents[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6869 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6870 if (STRINGP (elt)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6871 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6872 if (XSTRING (elt)->size |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6873 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6874 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6875 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6876 else if (BOOL_VECTOR_P (elt)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6877 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6878 if (XBOOL_VECTOR (elt)->size < width) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6879 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6880 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6881 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6882 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6883 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6884 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6885 else if (STRINGP (data)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6886 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6887 if (XSTRING (data)->size |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6888 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6889 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6890 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6891 else if (BOOL_VECTOR_P (data)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6892 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6893 if (XBOOL_VECTOR (data)->size < width * height) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6894 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6895 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6896 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6897 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6898 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6899 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6900 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6901 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6902 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6903 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6904 /* Scan a bitmap file. FP is the stream to read from. Value is |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6905 either an enumerator from enum xbm_token, or a character for a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6906 single-character token, or 0 at end of file. If scanning an |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6907 identifier, store the lexeme of the identifier in SVAL. If |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6908 scanning a number, store its value in *IVAL. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6909 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6910 static int |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6911 xbm_scan (s, end, sval, ival) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6912 char **s, *end; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6913 char *sval; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6914 int *ival; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6915 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6916 int c; |
31768
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6917 |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6918 loop: |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6919 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6920 /* Skip white space. */ |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6921 while (*s < end && (c = *(*s)++, isspace (c))) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6922 ; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6923 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6924 if (*s >= end) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6925 c = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6926 else if (isdigit (c)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6927 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6928 int value = 0, digit; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6929 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6930 if (c == '0' && *s < end) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6931 { |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6932 c = *(*s)++; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6933 if (c == 'x' || c == 'X') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6934 { |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6935 while (*s < end) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6936 { |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6937 c = *(*s)++; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6938 if (isdigit (c)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6939 digit = c - '0'; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6940 else if (c >= 'a' && c <= 'f') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6941 digit = c - 'a' + 10; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6942 else if (c >= 'A' && c <= 'F') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6943 digit = c - 'A' + 10; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6944 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6945 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6946 value = 16 * value + digit; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6947 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6948 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6949 else if (isdigit (c)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6950 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6951 value = c - '0'; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6952 while (*s < end |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6953 && (c = *(*s)++, isdigit (c))) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6954 value = 8 * value + c - '0'; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6955 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6956 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6957 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6958 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6959 value = c - '0'; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6960 while (*s < end |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6961 && (c = *(*s)++, isdigit (c))) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6962 value = 10 * value + c - '0'; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6963 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6964 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6965 if (*s < end) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6966 *s = *s - 1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6967 *ival = value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6968 c = XBM_TK_NUMBER; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6969 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6970 else if (isalpha (c) || c == '_') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6971 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6972 *sval++ = c; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6973 while (*s < end |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6974 && (c = *(*s)++, (isalnum (c) || c == '_'))) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6975 *sval++ = c; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6976 *sval = 0; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6977 if (*s < end) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6978 *s = *s - 1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6979 c = XBM_TK_IDENT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6980 } |
31768
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6981 else if (c == '/' && **s == '*') |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6982 { |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6983 /* C-style comment. */ |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6984 ++*s; |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6985 while (**s && (**s != '*' || *(*s + 1) != '/')) |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6986 ++*s; |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6987 if (**s) |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6988 { |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6989 *s += 2; |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6990 goto loop; |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6991 } |
5f91cf9127a6
(xbm_scan): Allow C-style comments.
Gerd Moellmann <gerd@gnu.org>
parents:
31761
diff
changeset
|
6992 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6993 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6994 return c; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6995 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6996 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6997 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
6998 /* Replacement for XReadBitmapFileData which isn't available under old |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
6999 X versions. CONTENTS is a pointer to a buffer to parse; END is the |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7000 buffer's end. Set *WIDTH and *HEIGHT to the width and height of |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7001 the image. Return in *DATA the bitmap data allocated with xmalloc. |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7002 Value is non-zero if successful. DATA null means just test if |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7003 CONTENTS looks like an in-memory XBM file. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7004 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7005 static int |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7006 xbm_read_bitmap_data (contents, end, width, height, data) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7007 char *contents, *end; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7008 int *width, *height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7009 unsigned char **data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7010 { |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7011 char *s = contents; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7012 char buffer[BUFSIZ]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7013 int padding_p = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7014 int v10 = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7015 int bytes_per_line, i, nbytes; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7016 unsigned char *p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7017 int value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7018 int LA1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7019 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7020 #define match() \ |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7021 LA1 = xbm_scan (&s, end, buffer, &value) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7022 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7023 #define expect(TOKEN) \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7024 if (LA1 != (TOKEN)) \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7025 goto failure; \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7026 else \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7027 match () |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7028 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7029 #define expect_ident(IDENT) \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7030 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7031 match (); \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7032 else \ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7033 goto failure |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7034 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7035 *width = *height = -1; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7036 if (data) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7037 *data = NULL; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7038 LA1 = xbm_scan (&s, end, buffer, &value); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7039 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7040 /* Parse defines for width, height and hot-spots. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7041 while (LA1 == '#') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7042 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7043 match (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7044 expect_ident ("define"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7045 expect (XBM_TK_IDENT); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7046 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7047 if (LA1 == XBM_TK_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7048 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7049 char *p = strrchr (buffer, '_'); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7050 p = p ? p + 1 : buffer; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7051 if (strcmp (p, "width") == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7052 *width = value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7053 else if (strcmp (p, "height") == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7054 *height = value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7055 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7056 expect (XBM_TK_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7057 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7058 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7059 if (*width < 0 || *height < 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7060 goto failure; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7061 else if (data == NULL) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7062 goto success; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7063 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7064 /* Parse bits. Must start with `static'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7065 expect_ident ("static"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7066 if (LA1 == XBM_TK_IDENT) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7067 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7068 if (strcmp (buffer, "unsigned") == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7069 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7070 match (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7071 expect_ident ("char"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7072 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7073 else if (strcmp (buffer, "short") == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7074 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7075 match (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7076 v10 = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7077 if (*width % 16 && *width % 16 < 9) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7078 padding_p = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7079 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7080 else if (strcmp (buffer, "char") == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7081 match (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7082 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7083 goto failure; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7084 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7085 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7086 goto failure; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7087 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7088 expect (XBM_TK_IDENT); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7089 expect ('['); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7090 expect (']'); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7091 expect ('='); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7092 expect ('{'); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7093 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7094 bytes_per_line = (*width + 7) / 8 + padding_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7095 nbytes = bytes_per_line * *height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7096 p = *data = (char *) xmalloc (nbytes); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7097 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7098 if (v10) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7099 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7100 for (i = 0; i < nbytes; i += 2) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7101 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7102 int val = value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7103 expect (XBM_TK_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7104 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7105 *p++ = val; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7106 if (!padding_p || ((i + 2) % bytes_per_line)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7107 *p++ = value >> 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7108 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7109 if (LA1 == ',' || LA1 == '}') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7110 match (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7111 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7112 goto failure; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7113 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7114 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7115 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7116 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7117 for (i = 0; i < nbytes; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7118 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7119 int val = value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7120 expect (XBM_TK_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7121 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7122 *p++ = val; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7123 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7124 if (LA1 == ',' || LA1 == '}') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7125 match (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7126 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7127 goto failure; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7128 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7129 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7130 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7131 success: |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7132 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7133 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7134 failure: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7135 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7136 if (data && *data) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7137 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7138 xfree (*data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7139 *data = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7140 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7141 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7142 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7143 #undef match |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7144 #undef expect |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7145 #undef expect_ident |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7146 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7147 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7148 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7149 /* Load XBM image IMG which will be displayed on frame F from buffer |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7150 CONTENTS. END is the end of the buffer. Value is non-zero if |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7151 successful. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7152 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7153 static int |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7154 xbm_load_image (f, img, contents, end) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7155 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7156 struct image *img; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7157 char *contents, *end; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7158 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7159 int rc; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7160 unsigned char *data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7161 int success_p = 0; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7162 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7163 rc = xbm_read_bitmap_data (contents, end, &img->width, &img->height, &data); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7164 if (rc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7165 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7166 int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7167 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7168 unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7169 Lisp_Object value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7170 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7171 xassert (img->width > 0 && img->height > 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7172 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7173 /* Get foreground and background colors, maybe allocate colors. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7174 value = image_spec_value (img->spec, QCforeground, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7175 if (!NILP (value)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7176 foreground = x_alloc_image_color (f, img, value, foreground); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7177 value = image_spec_value (img->spec, QCbackground, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7178 if (!NILP (value)) |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7179 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7180 background = x_alloc_image_color (f, img, value, background); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7181 img->background = background; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7182 img->background_valid = 1; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7183 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7184 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7185 img->pixmap |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7186 = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7187 FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7188 data, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7189 img->width, img->height, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7190 foreground, background, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7191 depth); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7192 xfree (data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7193 |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
7194 if (img->pixmap == None) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7195 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7196 x_clear_image (f, img); |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7197 image_error ("Unable to create X pixmap for `%s'", img->spec, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7198 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7199 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7200 success_p = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7201 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7202 else |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
7203 image_error ("Error loading XBM image `%s'", img->spec, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7204 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7205 return success_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7206 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7207 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7208 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7209 /* Value is non-zero if DATA looks like an in-memory XBM file. */ |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7210 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7211 static int |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7212 xbm_file_p (data) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7213 Lisp_Object data; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7214 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7215 int w, h; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7216 return (STRINGP (data) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7217 && xbm_read_bitmap_data (XSTRING (data)->data, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7218 (XSTRING (data)->data |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7219 + STRING_BYTES (XSTRING (data))), |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7220 &w, &h, NULL)); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7221 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7222 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7223 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7224 /* Fill image IMG which is used on frame F with pixmap data. Value is |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7225 non-zero if successful. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7226 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7227 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7228 xbm_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7229 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7230 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7231 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7232 int success_p = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7233 Lisp_Object file_name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7234 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7235 xassert (xbm_image_p (img->spec)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7236 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7237 /* If IMG->spec specifies a file name, create a non-file spec from it. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7238 file_name = image_spec_value (img->spec, QCfile, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7239 if (STRINGP (file_name)) |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7240 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7241 Lisp_Object file; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7242 char *contents; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7243 int size; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7244 struct gcpro gcpro1; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7245 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7246 file = x_find_image_file (file_name); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7247 GCPRO1 (file); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7248 if (!STRINGP (file)) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7249 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7250 image_error ("Cannot find image file `%s'", file_name, Qnil); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7251 UNGCPRO; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7252 return 0; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7253 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7254 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7255 contents = slurp_file (XSTRING (file)->data, &size); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7256 if (contents == NULL) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7257 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7258 image_error ("Error loading XBM image `%s'", img->spec, Qnil); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7259 UNGCPRO; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7260 return 0; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7261 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7262 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7263 success_p = xbm_load_image (f, img, contents, contents + size); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7264 UNGCPRO; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7265 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7266 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7267 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7268 struct image_keyword fmt[XBM_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7269 Lisp_Object data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7270 int depth; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7271 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7272 unsigned long background = FRAME_BACKGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7273 char *bits; |
34976
05c36b1fa618
(x_display_info_for_name): Cast 0 to "char *" in the call
Eli Zaretskii <eliz@gnu.org>
parents:
34911
diff
changeset
|
7274 int parsed_p; |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7275 int in_memory_file_p = 0; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7276 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7277 /* See if data looks like an in-memory XBM file. */ |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7278 data = image_spec_value (img->spec, QCdata, NULL); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7279 in_memory_file_p = xbm_file_p (data); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7280 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7281 /* Parse the image specification. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7282 bcopy (xbm_format, fmt, sizeof fmt); |
26401 | 7283 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7284 xassert (parsed_p); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7285 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7286 /* Get specified width, and height. */ |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7287 if (!in_memory_file_p) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7288 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7289 img->width = XFASTINT (fmt[XBM_WIDTH].value); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7290 img->height = XFASTINT (fmt[XBM_HEIGHT].value); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7291 xassert (img->width > 0 && img->height > 0); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7292 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7293 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7294 /* Get foreground and background colors, maybe allocate colors. */ |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
7295 if (fmt[XBM_FOREGROUND].count |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
7296 && STRINGP (fmt[XBM_FOREGROUND].value)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7297 foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7298 foreground); |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
7299 if (fmt[XBM_BACKGROUND].count |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
7300 && STRINGP (fmt[XBM_BACKGROUND].value)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7301 background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7302 background); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7303 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7304 if (in_memory_file_p) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7305 success_p = xbm_load_image (f, img, XSTRING (data)->data, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7306 (XSTRING (data)->data |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7307 + STRING_BYTES (XSTRING (data)))); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7308 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7309 { |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7310 if (VECTORP (data)) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7311 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7312 int i; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7313 char *p; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7314 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7315 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7316 p = bits = (char *) alloca (nbytes * img->height); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7317 for (i = 0; i < img->height; ++i, p += nbytes) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7318 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7319 Lisp_Object line = XVECTOR (data)->contents[i]; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7320 if (STRINGP (line)) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7321 bcopy (XSTRING (line)->data, p, nbytes); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7322 else |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7323 bcopy (XBOOL_VECTOR (line)->data, p, nbytes); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7324 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7325 } |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7326 else if (STRINGP (data)) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7327 bits = XSTRING (data)->data; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7328 else |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7329 bits = XBOOL_VECTOR (data)->data; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7330 |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7331 /* Create the pixmap. */ |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7332 depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7333 img->pixmap |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7334 = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7335 FRAME_X_WINDOW (f), |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7336 bits, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7337 img->width, img->height, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7338 foreground, background, |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7339 depth); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7340 if (img->pixmap) |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7341 success_p = 1; |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7342 else |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7343 { |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7344 image_error ("Unable to create pixmap for XBM image `%s'", |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7345 img->spec, Qnil); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7346 x_clear_image (f, img); |
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
7347 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7348 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7349 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7350 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7351 return success_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7352 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7353 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7354 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7355 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7356 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7357 XPM images |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7358 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7359 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7360 #if HAVE_XPM |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7361 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7362 static int xpm_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7363 static int xpm_load P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7364 static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7365 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7366 #include "X11/xpm.h" |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7367 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7368 /* The symbol `xpm' identifying XPM-format images. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7369 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7370 Lisp_Object Qxpm; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7371 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7372 /* Indices of image specification fields in xpm_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7373 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7374 enum xpm_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7375 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7376 XPM_TYPE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7377 XPM_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7378 XPM_DATA, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7379 XPM_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7380 XPM_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7381 XPM_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7382 XPM_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7383 XPM_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
7384 XPM_MASK, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7385 XPM_COLOR_SYMBOLS, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7386 XPM_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7387 XPM_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7388 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7389 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7390 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7391 of valid XPM image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7392 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7393 static struct image_keyword xpm_format[XPM_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7394 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7395 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7396 {":file", IMAGE_STRING_VALUE, 0}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7397 {":data", IMAGE_STRING_VALUE, 0}, |
28787 | 7398 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
7399 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7400 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
7401 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7402 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
7403 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7404 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
7405 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7406 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7407 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7408 /* Structure describing the image type XBM. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7409 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7410 static struct image_type xpm_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7411 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7412 &Qxpm, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7413 xpm_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7414 xpm_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7415 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7416 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7417 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7418 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7419 |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7420 /* Define ALLOC_XPM_COLORS if we can use Emacs' own color allocation |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7421 functions for allocating image colors. Our own functions handle |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7422 color allocation failures more gracefully than the ones on the XPM |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7423 lib. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7424 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7425 #if defined XpmAllocColor && defined XpmFreeColors && defined XpmColorClosure |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7426 #define ALLOC_XPM_COLORS |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7427 #endif |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7428 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7429 #ifdef ALLOC_XPM_COLORS |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7430 |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7431 static void xpm_init_color_cache P_ ((struct frame *, XpmAttributes *)); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7432 static void xpm_free_color_cache P_ ((void)); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7433 static int xpm_lookup_color P_ ((struct frame *, char *, XColor *)); |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7434 static int xpm_color_bucket P_ ((char *)); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7435 static struct xpm_cached_color *xpm_cache_color P_ ((struct frame *, char *, |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7436 XColor *, int)); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7437 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7438 /* An entry in a hash table used to cache color definitions of named |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7439 colors. This cache is necessary to speed up XPM image loading in |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7440 case we do color allocations ourselves. Without it, we would need |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7441 a call to XParseColor per pixel in the image. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7442 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7443 struct xpm_cached_color |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7444 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7445 /* Next in collision chain. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7446 struct xpm_cached_color *next; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7447 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7448 /* Color definition (RGB and pixel color). */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7449 XColor color; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7450 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7451 /* Color name. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7452 char name[1]; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7453 }; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7454 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7455 /* The hash table used for the color cache, and its bucket vector |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7456 size. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7457 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7458 #define XPM_COLOR_CACHE_BUCKETS 1001 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7459 struct xpm_cached_color **xpm_color_cache; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7460 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7461 /* Initialize the color cache. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7462 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7463 static void |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7464 xpm_init_color_cache (f, attrs) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7465 struct frame *f; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7466 XpmAttributes *attrs; |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7467 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7468 size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7469 xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7470 memset (xpm_color_cache, 0, nbytes); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7471 init_color_table (); |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7472 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7473 if (attrs->valuemask & XpmColorSymbols) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7474 { |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7475 int i; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7476 XColor color; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7477 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7478 for (i = 0; i < attrs->numsymbols; ++i) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7479 if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7480 attrs->colorsymbols[i].value, &color)) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7481 { |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7482 color.pixel = lookup_rgb_color (f, color.red, color.green, |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7483 color.blue); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7484 xpm_cache_color (f, attrs->colorsymbols[i].name, &color, -1); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7485 } |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7486 } |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7487 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7488 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7489 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7490 /* Free the color cache. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7491 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7492 static void |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7493 xpm_free_color_cache () |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7494 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7495 struct xpm_cached_color *p, *next; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7496 int i; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7497 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7498 for (i = 0; i < XPM_COLOR_CACHE_BUCKETS; ++i) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7499 for (p = xpm_color_cache[i]; p; p = next) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7500 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7501 next = p->next; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7502 xfree (p); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7503 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7504 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7505 xfree (xpm_color_cache); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7506 xpm_color_cache = NULL; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7507 free_color_table (); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7508 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7509 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7510 |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7511 /* Return the bucket index for color named COLOR_NAME in the color |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7512 cache. */ |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7513 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7514 static int |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7515 xpm_color_bucket (color_name) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7516 char *color_name; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7517 { |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7518 unsigned h = 0; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7519 char *s; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7520 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7521 for (s = color_name; *s; ++s) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7522 h = (h << 2) ^ *s; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7523 return h %= XPM_COLOR_CACHE_BUCKETS; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7524 } |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7525 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7526 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7527 /* On frame F, cache values COLOR for color with name COLOR_NAME. |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7528 BUCKET, if >= 0, is a precomputed bucket index. Value is the cache |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7529 entry added. */ |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7530 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7531 static struct xpm_cached_color * |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7532 xpm_cache_color (f, color_name, color, bucket) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7533 struct frame *f; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7534 char *color_name; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7535 XColor *color; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7536 int bucket; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7537 { |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7538 size_t nbytes; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7539 struct xpm_cached_color *p; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7540 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7541 if (bucket < 0) |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7542 bucket = xpm_color_bucket (color_name); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7543 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7544 nbytes = sizeof *p + strlen (color_name); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7545 p = (struct xpm_cached_color *) xmalloc (nbytes); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7546 strcpy (p->name, color_name); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7547 p->color = *color; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7548 p->next = xpm_color_cache[bucket]; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7549 xpm_color_cache[bucket] = p; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7550 return p; |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7551 } |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7552 |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7553 |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7554 /* Look up color COLOR_NAME for frame F in the color cache. If found, |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7555 return the cached definition in *COLOR. Otherwise, make a new |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7556 entry in the cache and allocate the color. Value is zero if color |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7557 allocation failed. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7558 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7559 static int |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7560 xpm_lookup_color (f, color_name, color) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7561 struct frame *f; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7562 char *color_name; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7563 XColor *color; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7564 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7565 struct xpm_cached_color *p; |
32536 | 7566 int h = xpm_color_bucket (color_name); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7567 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7568 for (p = xpm_color_cache[h]; p; p = p->next) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7569 if (strcmp (p->name, color_name) == 0) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7570 break; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7571 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7572 if (p != NULL) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7573 *color = p->color; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7574 else if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7575 color_name, color)) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7576 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7577 color->pixel = lookup_rgb_color (f, color->red, color->green, |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7578 color->blue); |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7579 p = xpm_cache_color (f, color_name, color, h); |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7580 } |
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7581 |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7582 return p != NULL; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7583 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7584 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7585 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7586 /* Callback for allocating color COLOR_NAME. Called from the XPM lib. |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7587 CLOSURE is a pointer to the frame on which we allocate the |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7588 color. Return in *COLOR the allocated color. Value is non-zero |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7589 if successful. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7590 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7591 static int |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7592 xpm_alloc_color (dpy, cmap, color_name, color, closure) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7593 Display *dpy; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7594 Colormap cmap; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7595 char *color_name; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7596 XColor *color; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7597 void *closure; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7598 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7599 return xpm_lookup_color ((struct frame *) closure, color_name, color); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7600 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7601 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7602 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7603 /* Callback for freeing NPIXELS colors contained in PIXELS. CLOSURE |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7604 is a pointer to the frame on which we allocate the color. Value is |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7605 non-zero if successful. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7606 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7607 static int |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7608 xpm_free_colors (dpy, cmap, pixels, npixels, closure) |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7609 Display *dpy; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7610 Colormap cmap; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7611 Pixel *pixels; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7612 int npixels; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7613 void *closure; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7614 { |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7615 return 1; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7616 } |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7617 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7618 #endif /* ALLOC_XPM_COLORS */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7619 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7620 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7621 /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7622 for XPM images. Such a list must consist of conses whose car and |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7623 cdr are strings. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7624 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7625 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7626 xpm_valid_color_symbols_p (color_symbols) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7627 Lisp_Object color_symbols; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7628 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7629 while (CONSP (color_symbols)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7630 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7631 Lisp_Object sym = XCAR (color_symbols); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7632 if (!CONSP (sym) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7633 || !STRINGP (XCAR (sym)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7634 || !STRINGP (XCDR (sym))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7635 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7636 color_symbols = XCDR (color_symbols); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7637 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7638 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7639 return NILP (color_symbols); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7640 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7641 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7642 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7643 /* Value is non-zero if OBJECT is a valid XPM image specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7644 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7645 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7646 xpm_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7647 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7648 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7649 struct image_keyword fmt[XPM_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7650 bcopy (xpm_format, fmt, sizeof fmt); |
26401 | 7651 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7652 /* Either `:file' or `:data' must be present. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7653 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7654 /* Either no `:color-symbols' or it's a list of conses |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7655 whose car and cdr are strings. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7656 && (fmt[XPM_COLOR_SYMBOLS].count == 0 |
28787 | 7657 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value))); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7658 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7659 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7660 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7661 /* Load image IMG which will be displayed on frame F. Value is |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7662 non-zero if successful. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7663 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7664 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7665 xpm_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7666 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7667 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7668 { |
34976
05c36b1fa618
(x_display_info_for_name): Cast 0 to "char *" in the call
Eli Zaretskii <eliz@gnu.org>
parents:
34911
diff
changeset
|
7669 int rc; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7670 XpmAttributes attrs; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7671 Lisp_Object specified_file, color_symbols; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7672 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7673 /* Configure the XPM lib. Use the visual of frame F. Allocate |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7674 close colors. Return colors allocated. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7675 bzero (&attrs, sizeof attrs); |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
7676 attrs.visual = FRAME_X_VISUAL (f); |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
7677 attrs.colormap = FRAME_X_COLORMAP (f); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7678 attrs.valuemask |= XpmVisual; |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
7679 attrs.valuemask |= XpmColormap; |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7680 |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7681 #ifdef ALLOC_XPM_COLORS |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7682 /* Allocate colors with our own functions which handle |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7683 failing color allocation more gracefully. */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7684 attrs.color_closure = f; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7685 attrs.alloc_color = xpm_alloc_color; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7686 attrs.free_colors = xpm_free_colors; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7687 attrs.valuemask |= XpmAllocColor | XpmFreeColors | XpmColorClosure; |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7688 #else /* not ALLOC_XPM_COLORS */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7689 /* Let the XPM lib allocate colors. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7690 attrs.valuemask |= XpmReturnAllocPixels; |
25200
8ab4da818dc0
(xpm_load) [!XpmAllocCloseColors]:
Richard M. Stallman <rms@gnu.org>
parents:
25153
diff
changeset
|
7691 #ifdef XpmAllocCloseColors |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7692 attrs.alloc_close_colors = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7693 attrs.valuemask |= XpmAllocCloseColors; |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7694 #else /* not XpmAllocCloseColors */ |
25200
8ab4da818dc0
(xpm_load) [!XpmAllocCloseColors]:
Richard M. Stallman <rms@gnu.org>
parents:
25153
diff
changeset
|
7695 attrs.closeness = 600; |
8ab4da818dc0
(xpm_load) [!XpmAllocCloseColors]:
Richard M. Stallman <rms@gnu.org>
parents:
25153
diff
changeset
|
7696 attrs.valuemask |= XpmCloseness; |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7697 #endif /* not XpmAllocCloseColors */ |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7698 #endif /* ALLOC_XPM_COLORS */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7699 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7700 /* If image specification contains symbolic color definitions, add |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7701 these to `attrs'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7702 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7703 if (CONSP (color_symbols)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7704 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7705 Lisp_Object tail; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7706 XpmColorSymbol *xpm_syms; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7707 int i, size; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7708 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7709 attrs.valuemask |= XpmColorSymbols; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7710 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7711 /* Count number of symbols. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7712 attrs.numsymbols = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7713 for (tail = color_symbols; CONSP (tail); tail = XCDR (tail)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7714 ++attrs.numsymbols; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7715 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7716 /* Allocate an XpmColorSymbol array. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7717 size = attrs.numsymbols * sizeof *xpm_syms; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7718 xpm_syms = (XpmColorSymbol *) alloca (size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7719 bzero (xpm_syms, size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7720 attrs.colorsymbols = xpm_syms; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7721 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7722 /* Fill the color symbol array. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7723 for (tail = color_symbols, i = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7724 CONSP (tail); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7725 ++i, tail = XCDR (tail)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7726 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7727 Lisp_Object name = XCAR (XCAR (tail)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7728 Lisp_Object color = XCDR (XCAR (tail)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7729 xpm_syms[i].name = (char *) alloca (XSTRING (name)->size + 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7730 strcpy (xpm_syms[i].name, XSTRING (name)->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7731 xpm_syms[i].value = (char *) alloca (XSTRING (color)->size + 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7732 strcpy (xpm_syms[i].value, XSTRING (color)->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7733 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7734 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7735 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7736 /* Create a pixmap for the image, either from a file, or from a |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7737 string buffer containing data in the same format as an XPM file. */ |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7738 #ifdef ALLOC_XPM_COLORS |
31761
d9efa91b06ab
(xpm_init_color_cache) [ALLOC_XPM_COLORS]: If color
Gerd Moellmann <gerd@gnu.org>
parents:
31693
diff
changeset
|
7739 xpm_init_color_cache (f, &attrs); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7740 #endif |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7741 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7742 specified_file = image_spec_value (img->spec, QCfile, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7743 if (STRINGP (specified_file)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7744 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7745 Lisp_Object file = x_find_image_file (specified_file); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7746 if (!STRINGP (file)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7747 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
7748 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7749 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7750 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7751 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7752 rc = XpmReadFileToPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7753 XSTRING (file)->data, &img->pixmap, &img->mask, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7754 &attrs); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7755 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7756 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7757 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7758 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7759 rc = XpmCreatePixmapFromBuffer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7760 XSTRING (buffer)->data, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7761 &img->pixmap, &img->mask, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7762 &attrs); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7763 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7764 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7765 if (rc == XpmSuccess) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7766 { |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7767 #ifdef ALLOC_XPM_COLORS |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7768 img->colors = colors_in_color_table (&img->ncolors); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7769 #else /* not ALLOC_XPM_COLORS */ |
35146
9b49ba6631c5
* xfns.c (xpm_load) [!ALLOC_XPM_COLORS]: Declare local variable I in inner block.
Ken Raeburn <raeburn@raeburn.org>
parents:
35068
diff
changeset
|
7770 int i; |
9b49ba6631c5
* xfns.c (xpm_load) [!ALLOC_XPM_COLORS]: Declare local variable I in inner block.
Ken Raeburn <raeburn@raeburn.org>
parents:
35068
diff
changeset
|
7771 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7772 img->ncolors = attrs.nalloc_pixels; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7773 img->colors = (unsigned long *) xmalloc (img->ncolors |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7774 * sizeof *img->colors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7775 for (i = 0; i < attrs.nalloc_pixels; ++i) |
28597
6bbcb7e674b1
(xpm_load) [DEBUG_X_COLORS]: Register colors.
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7776 { |
6bbcb7e674b1
(xpm_load) [DEBUG_X_COLORS]: Register colors.
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7777 img->colors[i] = attrs.alloc_pixels[i]; |
6bbcb7e674b1
(xpm_load) [DEBUG_X_COLORS]: Register colors.
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7778 #ifdef DEBUG_X_COLORS |
6bbcb7e674b1
(xpm_load) [DEBUG_X_COLORS]: Register colors.
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7779 register_color (img->colors[i]); |
6bbcb7e674b1
(xpm_load) [DEBUG_X_COLORS]: Register colors.
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7780 #endif |
6bbcb7e674b1
(xpm_load) [DEBUG_X_COLORS]: Register colors.
Gerd Moellmann <gerd@gnu.org>
parents:
28464
diff
changeset
|
7781 } |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7782 #endif /* not ALLOC_XPM_COLORS */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7783 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7784 img->width = attrs.width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7785 img->height = attrs.height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7786 xassert (img->width > 0 && img->height > 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7787 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7788 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7789 XpmFreeAttributes (&attrs); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7790 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7791 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7792 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7793 switch (rc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7794 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7795 case XpmOpenFailed: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7796 image_error ("Error opening XPM file (%s)", img->spec, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7797 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7798 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7799 case XpmFileInvalid: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7800 image_error ("Invalid XPM file (%s)", img->spec, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7801 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7802 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7803 case XpmNoMemory: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7804 image_error ("Out of memory (%s)", img->spec, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7805 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7806 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7807 case XpmColorFailed: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7808 image_error ("Color allocation error (%s)", img->spec, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7809 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7810 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7811 default: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7812 image_error ("Unknown error (%s)", img->spec, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7813 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7814 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7815 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7816 |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7817 #ifdef ALLOC_XPM_COLORS |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7818 xpm_free_color_cache (); |
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
7819 #endif |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7820 return rc == XpmSuccess; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7821 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7822 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7823 #endif /* HAVE_XPM != 0 */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7824 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7825 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7826 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7827 Color table |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7828 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7829 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7830 /* An entry in the color table mapping an RGB color to a pixel color. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7831 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7832 struct ct_color |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7833 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7834 int r, g, b; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7835 unsigned long pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7836 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7837 /* Next in color table collision list. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7838 struct ct_color *next; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7839 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7840 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7841 /* The bucket vector size to use. Must be prime. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7842 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7843 #define CT_SIZE 101 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7844 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7845 /* Value is a hash of the RGB color given by R, G, and B. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7846 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7847 #define CT_HASH_RGB(R, G, B) (((R) << 16) ^ ((G) << 8) ^ (B)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7848 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7849 /* The color hash table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7850 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7851 struct ct_color **ct_table; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7852 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7853 /* Number of entries in the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7854 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7855 int ct_colors_allocated; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7856 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7857 /* Initialize the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7858 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7859 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7860 init_color_table () |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7861 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7862 int size = CT_SIZE * sizeof (*ct_table); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7863 ct_table = (struct ct_color **) xmalloc (size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7864 bzero (ct_table, size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7865 ct_colors_allocated = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7866 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7867 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7868 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7869 /* Free memory associated with the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7870 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7871 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7872 free_color_table () |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7873 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7874 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7875 struct ct_color *p, *next; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7876 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7877 for (i = 0; i < CT_SIZE; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7878 for (p = ct_table[i]; p; p = next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7879 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7880 next = p->next; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7881 xfree (p); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7882 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7883 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7884 xfree (ct_table); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7885 ct_table = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7886 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7887 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7888 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7889 /* Value is a pixel color for RGB color R, G, B on frame F. If an |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7890 entry for that color already is in the color table, return the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7891 pixel color of that entry. Otherwise, allocate a new color for R, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7892 G, B, and make an entry in the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7893 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7894 static unsigned long |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7895 lookup_rgb_color (f, r, g, b) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7896 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7897 int r, g, b; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7898 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7899 unsigned hash = CT_HASH_RGB (r, g, b); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7900 int i = hash % CT_SIZE; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7901 struct ct_color *p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7902 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7903 for (p = ct_table[i]; p; p = p->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7904 if (p->r == r && p->g == g && p->b == b) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7905 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7906 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7907 if (p == NULL) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7908 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7909 XColor color; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7910 Colormap cmap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7911 int rc; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7912 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7913 color.red = r; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7914 color.green = g; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7915 color.blue = b; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7916 |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
7917 cmap = FRAME_X_COLORMAP (f); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
7918 rc = x_alloc_nearest_color (f, cmap, &color); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7919 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7920 if (rc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7921 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7922 ++ct_colors_allocated; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7923 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7924 p = (struct ct_color *) xmalloc (sizeof *p); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7925 p->r = r; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7926 p->g = g; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7927 p->b = b; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7928 p->pixel = color.pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7929 p->next = ct_table[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7930 ct_table[i] = p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7931 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7932 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7933 return FRAME_FOREGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7934 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7935 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7936 return p->pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7937 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7938 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7939 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7940 /* Look up pixel color PIXEL which is used on frame F in the color |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7941 table. If not already present, allocate it. Value is PIXEL. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7942 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7943 static unsigned long |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7944 lookup_pixel_color (f, pixel) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7945 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7946 unsigned long pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7947 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7948 int i = pixel % CT_SIZE; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7949 struct ct_color *p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7950 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7951 for (p = ct_table[i]; p; p = p->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7952 if (p->pixel == pixel) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7953 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7954 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7955 if (p == NULL) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7956 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7957 XColor color; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7958 Colormap cmap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7959 int rc; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7960 |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
7961 cmap = FRAME_X_COLORMAP (f); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7962 color.pixel = pixel; |
32606
78b4e9f31087
(x_to_xcolors, x_set_mouse_color, lookup_pixel_color)
Gerd Moellmann <gerd@gnu.org>
parents:
32549
diff
changeset
|
7963 x_query_color (f, &color); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
7964 rc = x_alloc_nearest_color (f, cmap, &color); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7965 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7966 if (rc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7967 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7968 ++ct_colors_allocated; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7969 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7970 p = (struct ct_color *) xmalloc (sizeof *p); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7971 p->r = color.red; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7972 p->g = color.green; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7973 p->b = color.blue; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7974 p->pixel = pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7975 p->next = ct_table[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7976 ct_table[i] = p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7977 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7978 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7979 return FRAME_FOREGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7980 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7981 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7982 return p->pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7983 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7984 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7985 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7986 /* Value is a vector of all pixel colors contained in the color table, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7987 allocated via xmalloc. Set *N to the number of colors. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7988 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7989 static unsigned long * |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7990 colors_in_color_table (n) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7991 int *n; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7992 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7993 int i, j; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7994 struct ct_color *p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7995 unsigned long *colors; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7996 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7997 if (ct_colors_allocated == 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7998 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
7999 *n = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8000 colors = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8001 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8002 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8003 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8004 colors = (unsigned long *) xmalloc (ct_colors_allocated |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8005 * sizeof *colors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8006 *n = ct_colors_allocated; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8007 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8008 for (i = j = 0; i < CT_SIZE; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8009 for (p = ct_table[i]; p; p = p->next) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8010 colors[j++] = p->pixel; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8011 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8012 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8013 return colors; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8014 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8015 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8016 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8017 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8018 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8019 Algorithms |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8020 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8021 |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8022 static XColor *x_to_xcolors P_ ((struct frame *, struct image *, int)); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8023 static void x_from_xcolors P_ ((struct frame *, struct image *, XColor *)); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8024 static void x_detect_edges P_ ((struct frame *, struct image *, int[9], int)); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8025 |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
8026 /* Non-zero means draw a cross on images having `:conversion |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8027 disabled'. */ |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8028 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8029 int cross_disabled_images; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8030 |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8031 /* Edge detection matrices for different edge-detection |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8032 strategies. */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8033 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8034 static int emboss_matrix[9] = { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8035 /* x - 1 x x + 1 */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8036 2, -1, 0, /* y - 1 */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8037 -1, 0, 1, /* y */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8038 0, 1, -2 /* y + 1 */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8039 }; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8040 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8041 static int laplace_matrix[9] = { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8042 /* x - 1 x x + 1 */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8043 1, 0, 0, /* y - 1 */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8044 0, 0, 0, /* y */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8045 0, 0, -1 /* y + 1 */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8046 }; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8047 |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8048 /* Value is the intensity of the color whose red/green/blue values |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8049 are R, G, and B. */ |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8050 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8051 #define COLOR_INTENSITY(R, G, B) ((2 * (R) + 3 * (G) + (B)) / 6) |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8052 |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8053 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8054 /* On frame F, return an array of XColor structures describing image |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8055 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8056 non-zero means also fill the red/green/blue members of the XColor |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8057 structures. Value is a pointer to the array of XColors structures, |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8058 allocated with xmalloc; it must be freed by the caller. */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8059 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8060 static XColor * |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8061 x_to_xcolors (f, img, rgb_p) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8062 struct frame *f; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8063 struct image *img; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8064 int rgb_p; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8065 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8066 int x, y; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8067 XColor *colors, *p; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8068 XImage *ximg; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8069 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8070 colors = (XColor *) xmalloc (img->width * img->height * sizeof *colors); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8071 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8072 /* Get the X image IMG->pixmap. */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8073 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8074 0, 0, img->width, img->height, ~0, ZPixmap); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8075 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8076 /* Fill the `pixel' members of the XColor array. I wished there |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8077 were an easy and portable way to circumvent XGetPixel. */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8078 p = colors; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8079 for (y = 0; y < img->height; ++y) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8080 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8081 XColor *row = p; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8082 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8083 for (x = 0; x < img->width; ++x, ++p) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8084 p->pixel = XGetPixel (ximg, x, y); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8085 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8086 if (rgb_p) |
32606
78b4e9f31087
(x_to_xcolors, x_set_mouse_color, lookup_pixel_color)
Gerd Moellmann <gerd@gnu.org>
parents:
32549
diff
changeset
|
8087 x_query_colors (f, row, img->width); |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8088 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8089 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8090 XDestroyImage (ximg); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8091 return colors; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8092 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8093 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8094 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8095 /* Create IMG->pixmap from an array COLORS of XColor structures, whose |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8096 RGB members are set. F is the frame on which this all happens. |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8097 COLORS will be freed; an existing IMG->pixmap will be freed, too. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8098 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8099 static void |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8100 x_from_xcolors (f, img, colors) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8101 struct frame *f; |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8102 struct image *img; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8103 XColor *colors; |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8104 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8105 int x, y; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8106 XImage *oimg; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8107 Pixmap pixmap; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8108 XColor *p; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8109 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8110 init_color_table (); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8111 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8112 x_create_x_image_and_pixmap (f, img->width, img->height, 0, |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8113 &oimg, &pixmap); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8114 p = colors; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8115 for (y = 0; y < img->height; ++y) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8116 for (x = 0; x < img->width; ++x, ++p) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8117 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8118 unsigned long pixel; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8119 pixel = lookup_rgb_color (f, p->red, p->green, p->blue); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8120 XPutPixel (oimg, x, y, pixel); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8121 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8122 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8123 xfree (colors); |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
8124 x_clear_image_1 (f, img, 1, 0, 1); |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8125 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8126 x_put_x_image (f, oimg, pixmap, img->width, img->height); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8127 x_destroy_x_image (oimg); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8128 img->pixmap = pixmap; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8129 img->colors = colors_in_color_table (&img->ncolors); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8130 free_color_table (); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8131 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8132 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8133 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8134 /* On frame F, perform edge-detection on image IMG. |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8135 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8136 MATRIX is a nine-element array specifying the transformation |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8137 matrix. See emboss_matrix for an example. |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8138 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8139 COLOR_ADJUST is a color adjustment added to each pixel of the |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8140 outgoing image. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8141 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8142 static void |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8143 x_detect_edges (f, img, matrix, color_adjust) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8144 struct frame *f; |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8145 struct image *img; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8146 int matrix[9], color_adjust; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8147 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8148 XColor *colors = x_to_xcolors (f, img, 1); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8149 XColor *new, *p; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8150 int x, y, i, sum; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8151 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8152 for (i = sum = 0; i < 9; ++i) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8153 sum += abs (matrix[i]); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8154 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8155 #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X)) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8156 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8157 new = (XColor *) xmalloc (img->width * img->height * sizeof *new); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8158 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8159 for (y = 0; y < img->height; ++y) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8160 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8161 p = COLOR (new, 0, y); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8162 p->red = p->green = p->blue = 0xffff/2; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8163 p = COLOR (new, img->width - 1, y); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8164 p->red = p->green = p->blue = 0xffff/2; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8165 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8166 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8167 for (x = 1; x < img->width - 1; ++x) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8168 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8169 p = COLOR (new, x, 0); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8170 p->red = p->green = p->blue = 0xffff/2; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8171 p = COLOR (new, x, img->height - 1); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8172 p->red = p->green = p->blue = 0xffff/2; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8173 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8174 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8175 for (y = 1; y < img->height - 1; ++y) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8176 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8177 p = COLOR (new, 1, y); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8178 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8179 for (x = 1; x < img->width - 1; ++x, ++p) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8180 { |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8181 int r, g, b, y1, x1; |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8182 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8183 r = g = b = i = 0; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8184 for (y1 = y - 1; y1 < y + 2; ++y1) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8185 for (x1 = x - 1; x1 < x + 2; ++x1, ++i) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8186 if (matrix[i]) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8187 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8188 XColor *t = COLOR (colors, x1, y1); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8189 r += matrix[i] * t->red; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8190 g += matrix[i] * t->green; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8191 b += matrix[i] * t->blue; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8192 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8193 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8194 r = (r / sum + color_adjust) & 0xffff; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8195 g = (g / sum + color_adjust) & 0xffff; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8196 b = (b / sum + color_adjust) & 0xffff; |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8197 p->red = p->green = p->blue = COLOR_INTENSITY (r, g, b); |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8198 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8199 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8200 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8201 xfree (colors); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8202 x_from_xcolors (f, img, new); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8203 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8204 #undef COLOR |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8205 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8206 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8207 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8208 /* Perform the pre-defined `emboss' edge-detection on image IMG |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8209 on frame F. */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8210 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8211 static void |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8212 x_emboss (f, img) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8213 struct frame *f; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8214 struct image *img; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8215 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8216 x_detect_edges (f, img, emboss_matrix, 0xffff / 2); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8217 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8218 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8219 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8220 /* Perform the pre-defined `laplace' edge-detection on image IMG |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8221 on frame F. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8222 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8223 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8224 x_laplace (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8225 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8226 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8227 { |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8228 x_detect_edges (f, img, laplace_matrix, 45000); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8229 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8230 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8231 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8232 /* Perform edge-detection on image IMG on frame F, with specified |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8233 transformation matrix MATRIX and color-adjustment COLOR_ADJUST. |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8234 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8235 MATRIX must be either |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8236 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8237 - a list of at least 9 numbers in row-major form |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8238 - a vector of at least 9 numbers |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8239 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8240 COLOR_ADJUST nil means use a default; otherwise it must be a |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8241 number. */ |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8242 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8243 static void |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8244 x_edge_detection (f, img, matrix, color_adjust) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8245 struct frame *f; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8246 struct image *img; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8247 Lisp_Object matrix, color_adjust; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8248 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8249 int i = 0; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8250 int trans[9]; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8251 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8252 if (CONSP (matrix)) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8253 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8254 for (i = 0; |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8255 i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix)); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8256 ++i, matrix = XCDR (matrix)) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8257 trans[i] = XFLOATINT (XCAR (matrix)); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8258 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8259 else if (VECTORP (matrix) && ASIZE (matrix) >= 9) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8260 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8261 for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8262 trans[i] = XFLOATINT (AREF (matrix, i)); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8263 } |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8264 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8265 if (NILP (color_adjust)) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8266 color_adjust = make_number (0xffff / 2); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8267 |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8268 if (i == 9 && NUMBERP (color_adjust)) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8269 x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8270 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8271 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8272 |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8273 /* Transform image IMG on frame F so that it looks disabled. */ |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8274 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8275 static void |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8276 x_disable_image (f, img) |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8277 struct frame *f; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8278 struct image *img; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8279 { |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8280 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
8281 |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8282 if (dpyinfo->n_planes >= 2) |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8283 { |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8284 /* Color (or grayscale). Convert to gray, and equalize. Just |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8285 drawing such images with a stipple can look very odd, so |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8286 we're using this method instead. */ |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8287 XColor *colors = x_to_xcolors (f, img, 1); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8288 XColor *p, *end; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8289 const int h = 15000; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8290 const int l = 30000; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8291 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8292 for (p = colors, end = colors + img->width * img->height; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8293 p < end; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8294 ++p) |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8295 { |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8296 int i = COLOR_INTENSITY (p->red, p->green, p->blue); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8297 int i2 = (0xffff - h - l) * i / 0xffff + l; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8298 p->red = p->green = p->blue = i2; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8299 } |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8300 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8301 x_from_xcolors (f, img, colors); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8302 } |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8303 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8304 /* Draw a cross over the disabled image, if we must or if we |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8305 should. */ |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8306 if (dpyinfo->n_planes < 2 || cross_disabled_images) |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8307 { |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8308 Display *dpy = FRAME_X_DISPLAY (f); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8309 GC gc; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8310 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8311 gc = XCreateGC (dpy, img->pixmap, 0, NULL); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8312 XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f)); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8313 XDrawLine (dpy, img->pixmap, gc, 0, 0, |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8314 img->width - 1, img->height - 1); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8315 XDrawLine (dpy, img->pixmap, gc, 0, img->height - 1, |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8316 img->width - 1, 0); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8317 XFreeGC (dpy, gc); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8318 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8319 if (img->mask) |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8320 { |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8321 gc = XCreateGC (dpy, img->mask, 0, NULL); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8322 XSetForeground (dpy, gc, WHITE_PIX_DEFAULT (f)); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8323 XDrawLine (dpy, img->mask, gc, 0, 0, |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8324 img->width - 1, img->height - 1); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8325 XDrawLine (dpy, img->mask, gc, 0, img->height - 1, |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8326 img->width - 1, 0); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8327 XFreeGC (dpy, gc); |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8328 } |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8329 } |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8330 } |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8331 |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
8332 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8333 /* Build a mask for image IMG which is used on frame F. FILE is the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8334 name of an image file, for error messages. HOW determines how to |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8335 determine the background color of IMG. If it is a list '(R G B)', |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8336 with R, G, and B being integers >= 0, take that as the color of the |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8337 background. Otherwise, determine the background color of IMG |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8338 heuristically. Value is non-zero if successful. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8339 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8340 static int |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8341 x_build_heuristic_mask (f, img, how) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8342 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8343 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8344 Lisp_Object how; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8345 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8346 Display *dpy = FRAME_X_DISPLAY (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8347 XImage *ximg, *mask_img; |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8348 int x, y, rc, use_img_background; |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
8349 unsigned long bg = 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8350 |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8351 if (img->mask) |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8352 { |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8353 XFreePixmap (FRAME_X_DISPLAY (f), img->mask); |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
8354 img->mask = None; |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8355 img->background_transparent_valid = 0; |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
8356 } |
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
8357 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8358 /* Create an image and pixmap serving as mask. */ |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8359 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8360 &mask_img, &img->mask); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8361 if (!rc) |
31686
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
8362 return 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8363 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8364 /* Get the X image of IMG->pixmap. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8365 ximg = XGetImage (dpy, img->pixmap, 0, 0, img->width, img->height, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8366 ~0, ZPixmap); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8367 |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8368 /* Determine the background color of ximg. If HOW is `(R G B)' |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8369 take that as color. Otherwise, use the image's background color. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8370 use_img_background = 1; |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8371 |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8372 if (CONSP (how)) |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8373 { |
40421
1eec9125d32e
(x_build_heuristic_mask): Fix a bug not incrementing
Gerd Moellmann <gerd@gnu.org>
parents:
40325
diff
changeset
|
8374 int rgb[3], i; |
1eec9125d32e
(x_build_heuristic_mask): Fix a bug not incrementing
Gerd Moellmann <gerd@gnu.org>
parents:
40325
diff
changeset
|
8375 |
1eec9125d32e
(x_build_heuristic_mask): Fix a bug not incrementing
Gerd Moellmann <gerd@gnu.org>
parents:
40325
diff
changeset
|
8376 for (i = 0; i < 3 && CONSP (how) && NATNUMP (XCAR (how)); ++i) |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8377 { |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8378 rgb[i] = XFASTINT (XCAR (how)) & 0xffff; |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8379 how = XCDR (how); |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8380 } |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8381 |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8382 if (i == 3 && NILP (how)) |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8383 { |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8384 char color_name[30]; |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8385 sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]); |
40427
979757645800
(x_build_heuristic_mask): Use x_alloc_image_color.
Gerd Moellmann <gerd@gnu.org>
parents:
40421
diff
changeset
|
8386 bg = x_alloc_image_color (f, img, build_string (color_name), 0); |
979757645800
(x_build_heuristic_mask): Use x_alloc_image_color.
Gerd Moellmann <gerd@gnu.org>
parents:
40421
diff
changeset
|
8387 use_img_background = 0; |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8388 } |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8389 } |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
8390 |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8391 if (use_img_background) |
40608
134b236ad704
(x_build_heuristic_mask): Use four_corners_best
Gerd Moellmann <gerd@gnu.org>
parents:
40606
diff
changeset
|
8392 bg = four_corners_best (ximg, img->width, img->height); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8393 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8394 /* Set all bits in mask_img to 1 whose color in ximg is different |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8395 from the background color bg. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8396 for (y = 0; y < img->height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8397 for (x = 0; x < img->width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8398 XPutPixel (mask_img, x, y, XGetPixel (ximg, x, y) != bg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8399 |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8400 /* Fill in the background_transparent field while we have the mask handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8401 image_background_transparent (img, f, mask_img); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8402 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8403 /* Put mask_img into img->mask. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8404 x_put_x_image (f, mask_img, img->mask, img->width, img->height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8405 x_destroy_x_image (mask_img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8406 XDestroyImage (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8407 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8408 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8409 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8410 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8411 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8412 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8413 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8414 PBM (mono, gray, color) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8415 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8416 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8417 static int pbm_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8418 static int pbm_load P_ ((struct frame *f, struct image *img)); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8419 static int pbm_scan_number P_ ((unsigned char **, unsigned char *)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8420 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8421 /* The symbol `pbm' identifying images of this type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8422 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8423 Lisp_Object Qpbm; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8424 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8425 /* Indices of image specification fields in gs_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8426 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8427 enum pbm_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8428 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8429 PBM_TYPE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8430 PBM_FILE, |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8431 PBM_DATA, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8432 PBM_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8433 PBM_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8434 PBM_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8435 PBM_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8436 PBM_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8437 PBM_MASK, |
32549
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8438 PBM_FOREGROUND, |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8439 PBM_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8440 PBM_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8441 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8442 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8443 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8444 of valid user-defined image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8445 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8446 static struct image_keyword pbm_format[PBM_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8447 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8448 {":type", IMAGE_SYMBOL_VALUE, 1}, |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8449 {":file", IMAGE_STRING_VALUE, 0}, |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8450 {":data", IMAGE_STRING_VALUE, 0}, |
28787 | 8451 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
8452 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8453 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
8454 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8455 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
32549
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8456 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
8457 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0}, |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
8458 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8459 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8460 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8461 /* Structure describing the image type `pbm'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8462 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8463 static struct image_type pbm_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8464 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8465 &Qpbm, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8466 pbm_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8467 pbm_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8468 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8469 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8470 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8471 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8472 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8473 /* Return non-zero if OBJECT is a valid PBM image specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8474 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8475 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8476 pbm_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8477 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8478 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8479 struct image_keyword fmt[PBM_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8480 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8481 bcopy (pbm_format, fmt, sizeof fmt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8482 |
28787 | 8483 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8484 return 0; |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8485 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8486 /* Must specify either :data or :file. */ |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8487 return fmt[PBM_DATA].count + fmt[PBM_FILE].count == 1; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8488 } |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8489 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8490 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8491 /* Scan a decimal number from *S and return it. Advance *S while |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8492 reading the number. END is the end of the string. Value is -1 at |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8493 end of input. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8494 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8495 static int |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8496 pbm_scan_number (s, end) |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8497 unsigned char **s, *end; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8498 { |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
8499 int c = 0, val = -1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8500 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8501 while (*s < end) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8502 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8503 /* Skip white-space. */ |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8504 while (*s < end && (c = *(*s)++, isspace (c))) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8505 ; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8506 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8507 if (c == '#') |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8508 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8509 /* Skip comment to end of line. */ |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8510 while (*s < end && (c = *(*s)++, c != '\n')) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8511 ; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8512 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8513 else if (isdigit (c)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8514 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8515 /* Read decimal number. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8516 val = c - '0'; |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8517 while (*s < end && (c = *(*s)++, isdigit (c))) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8518 val = 10 * val + c - '0'; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8519 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8520 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8521 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8522 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8523 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8524 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8525 return val; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8526 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8527 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8528 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8529 /* Load PBM image IMG for use on frame F. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8530 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8531 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8532 pbm_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8533 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8534 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8535 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8536 int raw_p, x, y; |
25715
feaedc03dbc8
(x_set_background_color): Remove unused variable(s).
Gerd Moellmann <gerd@gnu.org>
parents:
25691
diff
changeset
|
8537 int width, height, max_color_idx = 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8538 XImage *ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8539 Lisp_Object file, specified_file; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8540 enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8541 struct gcpro gcpro1; |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8542 unsigned char *contents = NULL; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8543 unsigned char *end, *p; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8544 int size; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8545 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8546 specified_file = image_spec_value (img->spec, QCfile, NULL); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8547 file = Qnil; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8548 GCPRO1 (file); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8549 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8550 if (STRINGP (specified_file)) |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8551 { |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8552 file = x_find_image_file (specified_file); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8553 if (!STRINGP (file)) |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8554 { |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8555 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8556 UNGCPRO; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8557 return 0; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8558 } |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8559 |
28747
6f90293e6ccb
(slurp_file): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28690
diff
changeset
|
8560 contents = slurp_file (XSTRING (file)->data, &size); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8561 if (contents == NULL) |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8562 { |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8563 image_error ("Error reading `%s'", file, Qnil); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8564 UNGCPRO; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8565 return 0; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8566 } |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8567 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8568 p = contents; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8569 end = contents + size; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8570 } |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8571 else |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8572 { |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8573 Lisp_Object data; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8574 data = image_spec_value (img->spec, QCdata, NULL); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8575 p = XSTRING (data)->data; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8576 end = p + STRING_BYTES (XSTRING (data)); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8577 } |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8578 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8579 /* Check magic number. */ |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8580 if (end - p < 2 || *p++ != 'P') |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8581 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8582 image_error ("Not a PBM image: `%s'", img->spec, Qnil); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8583 error: |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8584 xfree (contents); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8585 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8586 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8587 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8588 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8589 switch (*p++) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8590 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8591 case '1': |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8592 raw_p = 0, type = PBM_MONO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8593 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8594 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8595 case '2': |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8596 raw_p = 0, type = PBM_GRAY; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8597 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8598 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8599 case '3': |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8600 raw_p = 0, type = PBM_COLOR; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8601 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8602 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8603 case '4': |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8604 raw_p = 1, type = PBM_MONO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8605 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8606 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8607 case '5': |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8608 raw_p = 1, type = PBM_GRAY; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8609 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8610 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8611 case '6': |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8612 raw_p = 1, type = PBM_COLOR; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8613 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8614 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8615 default: |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8616 image_error ("Not a PBM image: `%s'", img->spec, Qnil); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8617 goto error; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8618 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8619 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8620 /* Read width, height, maximum color-component. Characters |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8621 starting with `#' up to the end of a line are ignored. */ |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8622 width = pbm_scan_number (&p, end); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8623 height = pbm_scan_number (&p, end); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8624 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8625 if (type != PBM_MONO) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8626 { |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8627 max_color_idx = pbm_scan_number (&p, end); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8628 if (raw_p && max_color_idx > 255) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8629 max_color_idx = 255; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8630 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8631 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8632 if (width < 0 |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8633 || height < 0 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8634 || (type != PBM_MONO && max_color_idx < 0)) |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8635 goto error; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8636 |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8637 if (!x_create_x_image_and_pixmap (f, width, height, 0, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8638 &ximg, &img->pixmap)) |
31686
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
8639 goto error; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8640 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8641 /* Initialize the color hash table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8642 init_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8643 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8644 if (type == PBM_MONO) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8645 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8646 int c = 0, g; |
32549
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8647 struct image_keyword fmt[PBM_LAST]; |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8648 unsigned long fg = FRAME_FOREGROUND_PIXEL (f); |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8649 unsigned long bg = FRAME_BACKGROUND_PIXEL (f); |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8650 |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8651 /* Parse the image specification. */ |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8652 bcopy (pbm_format, fmt, sizeof fmt); |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8653 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm); |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8654 |
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8655 /* Get foreground and background colors, maybe allocate colors. */ |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
8656 if (fmt[PBM_FOREGROUND].count |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
8657 && STRINGP (fmt[PBM_FOREGROUND].value)) |
32549
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8658 fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg); |
37946
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
8659 if (fmt[PBM_BACKGROUND].count |
fe4457964ac0
(enum image_value_type): New enumerator
Gerd Moellmann <gerd@gnu.org>
parents:
37762
diff
changeset
|
8660 && STRINGP (fmt[PBM_BACKGROUND].value)) |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8661 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8662 bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8663 img->background = bg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8664 img->background_valid = 1; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8665 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8666 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8667 for (y = 0; y < height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8668 for (x = 0; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8669 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8670 if (raw_p) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8671 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8672 if ((x & 7) == 0) |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8673 c = *p++; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8674 g = c & 0x80; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8675 c <<= 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8676 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8677 else |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8678 g = pbm_scan_number (&p, end); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8679 |
32549
73521ea30674
(pbm_format): Add :foreground and :background keywords.
Gerd Moellmann <gerd@gnu.org>
parents:
32536
diff
changeset
|
8680 XPutPixel (ximg, x, y, g ? fg : bg); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8681 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8682 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8683 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8684 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8685 for (y = 0; y < height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8686 for (x = 0; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8687 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8688 int r, g, b; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8689 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8690 if (type == PBM_GRAY) |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8691 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8692 else if (raw_p) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8693 { |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8694 r = *p++; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8695 g = *p++; |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8696 b = *p++; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8697 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8698 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8699 { |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8700 r = pbm_scan_number (&p, end); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8701 g = pbm_scan_number (&p, end); |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8702 b = pbm_scan_number (&p, end); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8703 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8704 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8705 if (r < 0 || g < 0 || b < 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8706 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8707 xfree (ximg->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8708 ximg->data = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8709 XDestroyImage (ximg); |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8710 image_error ("Invalid pixel value in image `%s'", |
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8711 img->spec, Qnil); |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8712 goto error; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8713 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8714 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8715 /* RGB values are now in the range 0..max_color_idx. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8716 Scale this to the range 0..0xffff supported by X. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8717 r = (double) r * 65535 / max_color_idx; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8718 g = (double) g * 65535 / max_color_idx; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8719 b = (double) b * 65535 / max_color_idx; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8720 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8721 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8722 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8723 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8724 /* Store in IMG->colors the colors allocated for the image, and |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8725 free the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8726 img->colors = colors_in_color_table (&img->ncolors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8727 free_color_table (); |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8728 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8729 /* Maybe fill in the background field while we have ximg handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8730 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8731 IMAGE_BACKGROUND (img, f, ximg); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8732 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8733 /* Put the image into a pixmap. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8734 x_put_x_image (f, ximg, img->pixmap, width, height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8735 x_destroy_x_image (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8736 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8737 img->width = width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8738 img->height = height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8739 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8740 UNGCPRO; |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8741 xfree (contents); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8742 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8743 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8744 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8745 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8746 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8747 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8748 PNG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8749 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8750 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8751 #if HAVE_PNG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8752 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8753 #include <png.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8754 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8755 /* Function prototypes. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8756 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8757 static int png_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8758 static int png_load P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8759 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8760 /* The symbol `png' identifying images of this type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8761 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8762 Lisp_Object Qpng; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8763 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8764 /* Indices of image specification fields in png_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8765 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8766 enum png_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8767 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8768 PNG_TYPE, |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8769 PNG_DATA, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8770 PNG_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8771 PNG_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8772 PNG_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8773 PNG_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8774 PNG_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8775 PNG_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8776 PNG_MASK, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8777 PNG_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8778 PNG_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8779 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8780 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8781 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8782 of valid user-defined image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8783 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8784 static struct image_keyword png_format[PNG_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8785 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8786 {":type", IMAGE_SYMBOL_VALUE, 1}, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8787 {":data", IMAGE_STRING_VALUE, 0}, |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8788 {":file", IMAGE_STRING_VALUE, 0}, |
28787 | 8789 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
8790 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8791 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
8792 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
8793 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40279
1adbc1480e83
(png_load): Make sure SPECIFIED_BG is a string.
Miles Bader <miles@gnu.org>
parents:
40264
diff
changeset
|
8794 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
8795 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8796 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8797 |
26032
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
8798 /* Structure describing the image type `png'. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8799 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8800 static struct image_type png_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8801 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8802 &Qpng, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8803 png_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8804 png_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8805 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8806 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8807 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8808 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8809 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8810 /* Return non-zero if OBJECT is a valid PNG image specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8811 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8812 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8813 png_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8814 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8815 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8816 struct image_keyword fmt[PNG_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8817 bcopy (png_format, fmt, sizeof fmt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8818 |
28787 | 8819 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8820 return 0; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8821 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8822 /* Must specify either the :data or :file keyword. */ |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
8823 return fmt[PNG_FILE].count + fmt[PNG_DATA].count == 1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8824 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8825 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8826 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8827 /* Error and warning handlers installed when the PNG library |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8828 is initialized. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8829 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8830 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8831 my_png_error (png_ptr, msg) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8832 png_struct *png_ptr; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8833 char *msg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8834 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8835 xassert (png_ptr != NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8836 image_error ("PNG error: %s", build_string (msg), Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8837 longjmp (png_ptr->jmpbuf, 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8838 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8839 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8840 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8841 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8842 my_png_warning (png_ptr, msg) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8843 png_struct *png_ptr; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8844 char *msg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8845 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8846 xassert (png_ptr != NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8847 image_error ("PNG warning: %s", build_string (msg), Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8848 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8849 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8850 /* Memory source for PNG decoding. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8851 |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8852 struct png_memory_storage |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8853 { |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8854 unsigned char *bytes; /* The data */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8855 size_t len; /* How big is it? */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8856 int index; /* Where are we? */ |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8857 }; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8858 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8859 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8860 /* Function set as reader function when reading PNG image from memory. |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8861 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8862 bytes from the input to DATA. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8863 |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8864 static void |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8865 png_read_from_memory (png_ptr, data, length) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8866 png_structp png_ptr; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8867 png_bytep data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8868 png_size_t length; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8869 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8870 struct png_memory_storage *tbr |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8871 = (struct png_memory_storage *) png_get_io_ptr (png_ptr); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8872 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8873 if (length > tbr->len - tbr->index) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8874 png_error (png_ptr, "Read error"); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8875 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8876 bcopy (tbr->bytes + tbr->index, data, length); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8877 tbr->index = tbr->index + length; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8878 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8879 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8880 /* Load PNG image IMG for use on frame F. Value is non-zero if |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8881 successful. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8882 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8883 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8884 png_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8885 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8886 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8887 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8888 Lisp_Object file, specified_file; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8889 Lisp_Object specified_data; |
25715
feaedc03dbc8
(x_set_background_color): Remove unused variable(s).
Gerd Moellmann <gerd@gnu.org>
parents:
25691
diff
changeset
|
8890 int x, y, i; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8891 XImage *ximg, *mask_img = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8892 struct gcpro gcpro1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8893 png_struct *png_ptr = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8894 png_info *info_ptr = NULL, *end_info = NULL; |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
8895 FILE *volatile fp = NULL; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8896 png_byte sig[8]; |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
8897 png_byte * volatile pixels = NULL; |
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
8898 png_byte ** volatile rows = NULL; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8899 png_uint_32 width, height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8900 int bit_depth, color_type, interlace_type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8901 png_byte channels; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8902 png_uint_32 row_bytes; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8903 int transparent_p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8904 double screen_gamma, image_gamma; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8905 int intent; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8906 struct png_memory_storage tbr; /* Data to be read */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8907 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8908 /* Find out what file to load. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8909 specified_file = image_spec_value (img->spec, QCfile, NULL); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8910 specified_data = image_spec_value (img->spec, QCdata, NULL); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8911 file = Qnil; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8912 GCPRO1 (file); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8913 |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8914 if (NILP (specified_data)) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8915 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8916 file = x_find_image_file (specified_file); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8917 if (!STRINGP (file)) |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8918 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8919 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8920 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8921 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8922 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8923 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8924 /* Open the image file. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8925 fp = fopen (XSTRING (file)->data, "rb"); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8926 if (!fp) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8927 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8928 image_error ("Cannot open image file `%s'", file, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8929 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8930 fclose (fp); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8931 return 0; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8932 } |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8933 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8934 /* Check PNG signature. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8935 if (fread (sig, 1, sizeof sig, fp) != sizeof sig |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8936 || !png_check_sig (sig, sizeof sig)) |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8937 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8938 image_error ("Not a PNG file: `%s'", file, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8939 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8940 fclose (fp); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8941 return 0; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8942 } |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8943 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8944 else |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8945 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8946 /* Read from memory. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8947 tbr.bytes = XSTRING (specified_data)->data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8948 tbr.len = STRING_BYTES (XSTRING (specified_data)); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8949 tbr.index = 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8950 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8951 /* Check PNG signature. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8952 if (tbr.len < sizeof sig |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8953 || !png_check_sig (tbr.bytes, sizeof sig)) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8954 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
8955 image_error ("Not a PNG image: `%s'", img->spec, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8956 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8957 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8958 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8959 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8960 /* Need to skip past the signature. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8961 tbr.bytes += sizeof (sig); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
8962 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8963 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8964 /* Initialize read and info structs for PNG lib. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8965 png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8966 my_png_error, my_png_warning); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8967 if (!png_ptr) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8968 { |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8969 if (fp) fclose (fp); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8970 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8971 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8972 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8973 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8974 info_ptr = png_create_info_struct (png_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8975 if (!info_ptr) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8976 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8977 png_destroy_read_struct (&png_ptr, NULL, NULL); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8978 if (fp) fclose (fp); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8979 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8980 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8981 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8982 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8983 end_info = png_create_info_struct (png_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8984 if (!end_info) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8985 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8986 png_destroy_read_struct (&png_ptr, &info_ptr, NULL); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
8987 if (fp) fclose (fp); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8988 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8989 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8990 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8991 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8992 /* Set error jump-back. We come back here when the PNG library |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8993 detects an error. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8994 if (setjmp (png_ptr->jmpbuf)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8995 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8996 error: |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8997 if (png_ptr) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8998 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
8999 xfree (pixels); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9000 xfree (rows); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9001 if (fp) fclose (fp); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9002 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9003 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9004 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9005 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9006 /* Read image info. */ |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9007 if (!NILP (specified_data)) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9008 png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9009 else |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9010 png_init_io (png_ptr, fp); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9011 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9012 png_set_sig_bytes (png_ptr, sizeof sig); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9013 png_read_info (png_ptr, info_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9014 png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9015 &interlace_type, NULL, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9016 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9017 /* If image contains simply transparency data, we prefer to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9018 construct a clipping mask. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9019 if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9020 transparent_p = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9021 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9022 transparent_p = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9023 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9024 /* This function is easier to write if we only have to handle |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9025 one data format: RGB or RGBA with 8 bits per channel. Let's |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9026 transform other formats into that format. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9027 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9028 /* Strip more than 8 bits per channel. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9029 if (bit_depth == 16) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9030 png_set_strip_16 (png_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9031 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9032 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9033 if available. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9034 png_set_expand (png_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9035 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9036 /* Convert grayscale images to RGB. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9037 if (color_type == PNG_COLOR_TYPE_GRAY |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9038 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9039 png_set_gray_to_rgb (png_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9040 |
43670
5505d571541b
(png_load): Set screen_gamma based on f->gamma.
Richard M. Stallman <rms@gnu.org>
parents:
43452
diff
changeset
|
9041 screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9042 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9043 /* Tell the PNG lib to handle gamma correction for us. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9044 |
26293
65861669b393
(png_load) [PNG_READ_sRGB_SUPPORTED]: Put code using
Gerd Moellmann <gerd@gnu.org>
parents:
26088
diff
changeset
|
9045 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9046 if (png_get_sRGB (png_ptr, info_ptr, &intent)) |
43670
5505d571541b
(png_load): Set screen_gamma based on f->gamma.
Richard M. Stallman <rms@gnu.org>
parents:
43452
diff
changeset
|
9047 /* The libpng documentation says this is right in this case. */ |
5505d571541b
(png_load): Set screen_gamma based on f->gamma.
Richard M. Stallman <rms@gnu.org>
parents:
43452
diff
changeset
|
9048 png_set_gamma (png_ptr, screen_gamma, 0.45455); |
26293
65861669b393
(png_load) [PNG_READ_sRGB_SUPPORTED]: Put code using
Gerd Moellmann <gerd@gnu.org>
parents:
26088
diff
changeset
|
9049 else |
65861669b393
(png_load) [PNG_READ_sRGB_SUPPORTED]: Put code using
Gerd Moellmann <gerd@gnu.org>
parents:
26088
diff
changeset
|
9050 #endif |
65861669b393
(png_load) [PNG_READ_sRGB_SUPPORTED]: Put code using
Gerd Moellmann <gerd@gnu.org>
parents:
26088
diff
changeset
|
9051 if (png_get_gAMA (png_ptr, info_ptr, &image_gamma)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9052 /* Image contains gamma information. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9053 png_set_gamma (png_ptr, screen_gamma, image_gamma); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9054 else |
43670
5505d571541b
(png_load): Set screen_gamma based on f->gamma.
Richard M. Stallman <rms@gnu.org>
parents:
43452
diff
changeset
|
9055 /* Use the standard default for the image gamma. */ |
5505d571541b
(png_load): Set screen_gamma based on f->gamma.
Richard M. Stallman <rms@gnu.org>
parents:
43452
diff
changeset
|
9056 png_set_gamma (png_ptr, screen_gamma, 0.45455); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9057 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9058 /* Handle alpha channel by combining the image with a background |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9059 color. Do this only if a real alpha channel is supplied. For |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9060 simple transparency, we prefer a clipping mask. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9061 if (!transparent_p) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9062 { |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9063 png_color_16 *image_bg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9064 Lisp_Object specified_bg |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9065 = image_spec_value (img->spec, QCbackground, NULL); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9066 |
40279
1adbc1480e83
(png_load): Make sure SPECIFIED_BG is a string.
Miles Bader <miles@gnu.org>
parents:
40264
diff
changeset
|
9067 if (STRINGP (specified_bg)) |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9068 /* The user specified `:background', use that. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9069 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9070 XColor color; |
40279
1adbc1480e83
(png_load): Make sure SPECIFIED_BG is a string.
Miles Bader <miles@gnu.org>
parents:
40264
diff
changeset
|
9071 if (x_defined_color (f, XSTRING (specified_bg)->data, &color, 0)) |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9072 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9073 png_color_16 user_bg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9074 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9075 bzero (&user_bg, sizeof user_bg); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9076 user_bg.red = color.red; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9077 user_bg.green = color.green; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9078 user_bg.blue = color.blue; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9079 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9080 png_set_background (png_ptr, &user_bg, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9081 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9082 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9083 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9084 else if (png_get_bKGD (png_ptr, info_ptr, &image_bg)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9085 /* Image contains a background color with which to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9086 combine the image. */ |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9087 png_set_background (png_ptr, image_bg, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9088 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9089 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9090 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9091 /* Image does not contain a background color with which |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9092 to combine the image data via an alpha channel. Use |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9093 the frame's background instead. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9094 XColor color; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9095 Colormap cmap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9096 png_color_16 frame_background; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9097 |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
9098 cmap = FRAME_X_COLORMAP (f); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9099 color.pixel = FRAME_BACKGROUND_PIXEL (f); |
32606
78b4e9f31087
(x_to_xcolors, x_set_mouse_color, lookup_pixel_color)
Gerd Moellmann <gerd@gnu.org>
parents:
32549
diff
changeset
|
9100 x_query_color (f, &color); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9101 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9102 bzero (&frame_background, sizeof frame_background); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9103 frame_background.red = color.red; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9104 frame_background.green = color.green; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9105 frame_background.blue = color.blue; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9106 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9107 png_set_background (png_ptr, &frame_background, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9108 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9109 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9110 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9111 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9112 /* Update info structure. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9113 png_read_update_info (png_ptr, info_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9114 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9115 /* Get number of channels. Valid values are 1 for grayscale images |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9116 and images with a palette, 2 for grayscale images with transparency |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9117 information (alpha channel), 3 for RGB images, and 4 for RGB |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9118 images with alpha channel, i.e. RGBA. If conversions above were |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9119 sufficient we should only have 3 or 4 channels here. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9120 channels = png_get_channels (png_ptr, info_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9121 xassert (channels == 3 || channels == 4); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9122 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9123 /* Number of bytes needed for one row of the image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9124 row_bytes = png_get_rowbytes (png_ptr, info_ptr); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9125 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9126 /* Allocate memory for the image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9127 pixels = (png_byte *) xmalloc (row_bytes * height * sizeof *pixels); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9128 rows = (png_byte **) xmalloc (height * sizeof *rows); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9129 for (i = 0; i < height; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9130 rows[i] = pixels + i * row_bytes; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9131 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9132 /* Read the entire image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9133 png_read_image (png_ptr, rows); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9134 png_read_end (png_ptr, info_ptr); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9135 if (fp) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9136 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9137 fclose (fp); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9138 fp = NULL; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9139 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9140 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9141 /* Create the X image and pixmap. */ |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9142 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9143 &img->pixmap)) |
31686
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
9144 goto error; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9145 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9146 /* Create an image and pixmap serving as mask if the PNG image |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9147 contains an alpha channel. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9148 if (channels == 4 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9149 && !transparent_p |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9150 && !x_create_x_image_and_pixmap (f, width, height, 1, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9151 &mask_img, &img->mask)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9152 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9153 x_destroy_x_image (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9154 XFreePixmap (FRAME_X_DISPLAY (f), img->pixmap); |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
9155 img->pixmap = None; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9156 goto error; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9157 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9158 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9159 /* Fill the X image and mask from PNG data. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9160 init_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9161 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9162 for (y = 0; y < height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9163 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9164 png_byte *p = rows[y]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9165 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9166 for (x = 0; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9167 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9168 unsigned r, g, b; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9169 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9170 r = *p++ << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9171 g = *p++ << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9172 b = *p++ << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9173 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9174 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9175 /* An alpha channel, aka mask channel, associates variable |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9176 transparency with an image. Where other image formats |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9177 support binary transparency---fully transparent or fully |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9178 opaque---PNG allows up to 254 levels of partial transparency. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9179 The PNG library implements partial transparency by combining |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9180 the image with a specified background color. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9181 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9182 I'm not sure how to handle this here nicely: because the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9183 background on which the image is displayed may change, for |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9184 real alpha channel support, it would be necessary to create |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9185 a new image for each possible background. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9186 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9187 What I'm doing now is that a mask is created if we have |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9188 boolean transparency information. Otherwise I'm using |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9189 the frame's background color to combine the image with. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9190 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9191 if (channels == 4) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9192 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9193 if (mask_img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9194 XPutPixel (mask_img, x, y, *p > 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9195 ++p; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9196 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9197 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9198 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9199 |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9200 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9201 /* Set IMG's background color from the PNG image, unless the user |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9202 overrode it. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9203 { |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9204 png_color_16 *bg; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9205 if (png_get_bKGD (png_ptr, info_ptr, &bg)) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9206 { |
40279
1adbc1480e83
(png_load): Make sure SPECIFIED_BG is a string.
Miles Bader <miles@gnu.org>
parents:
40264
diff
changeset
|
9207 img->background = lookup_rgb_color (f, bg->red, bg->green, bg->blue); |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9208 img->background_valid = 1; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9209 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9210 } |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9211 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9212 /* Remember colors allocated for this image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9213 img->colors = colors_in_color_table (&img->ncolors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9214 free_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9215 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9216 /* Clean up. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9217 png_destroy_read_struct (&png_ptr, &info_ptr, &end_info); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9218 xfree (rows); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9219 xfree (pixels); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9220 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9221 img->width = width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9222 img->height = height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9223 |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9224 /* Maybe fill in the background field while we have ximg handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9225 IMAGE_BACKGROUND (img, f, ximg); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9226 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9227 /* Put the image into the pixmap, then free the X image and its buffer. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9228 x_put_x_image (f, ximg, img->pixmap, width, height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9229 x_destroy_x_image (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9230 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9231 /* Same for the mask. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9232 if (mask_img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9233 { |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9234 /* Fill in the background_transparent field while we have the mask |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9235 handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9236 image_background_transparent (img, f, mask_img); |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9237 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9238 x_put_x_image (f, mask_img, img->mask, img->width, img->height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9239 x_destroy_x_image (mask_img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9240 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9241 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9242 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9243 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9244 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9245 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9246 #endif /* HAVE_PNG != 0 */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9247 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9248 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9249 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9250 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9251 JPEG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9252 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9253 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9254 #if HAVE_JPEG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9255 |
25390
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9256 /* Work around a warning about HAVE_STDLIB_H being redefined in |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9257 jconfig.h. */ |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9258 #ifdef HAVE_STDLIB_H |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9259 #define HAVE_STDLIB_H_1 |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9260 #undef HAVE_STDLIB_H |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9261 #endif /* HAVE_STLIB_H */ |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9262 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9263 #include <jpeglib.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9264 #include <jerror.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9265 #include <setjmp.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9266 |
25390
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9267 #ifdef HAVE_STLIB_H_1 |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9268 #define HAVE_STDLIB_H 1 |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9269 #endif |
4404ab9c802b
[HAVE_JPEG]: Work around a warning about HAVE_STDLIB_H
Gerd Moellmann <gerd@gnu.org>
parents:
25363
diff
changeset
|
9270 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9271 static int jpeg_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9272 static int jpeg_load P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9273 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9274 /* The symbol `jpeg' identifying images of this type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9275 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9276 Lisp_Object Qjpeg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9277 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9278 /* Indices of image specification fields in gs_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9279 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9280 enum jpeg_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9281 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9282 JPEG_TYPE, |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9283 JPEG_DATA, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9284 JPEG_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9285 JPEG_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9286 JPEG_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9287 JPEG_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9288 JPEG_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9289 JPEG_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
9290 JPEG_MASK, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9291 JPEG_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9292 JPEG_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9293 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9294 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9295 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9296 of valid user-defined image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9297 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9298 static struct image_keyword jpeg_format[JPEG_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9299 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9300 {":type", IMAGE_SYMBOL_VALUE, 1}, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9301 {":data", IMAGE_STRING_VALUE, 0}, |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9302 {":file", IMAGE_STRING_VALUE, 0}, |
28787 | 9303 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
9304 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9305 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
9306 {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
9307 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9308 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9309 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9310 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9311 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9312 /* Structure describing the image type `jpeg'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9313 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9314 static struct image_type jpeg_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9315 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9316 &Qjpeg, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9317 jpeg_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9318 jpeg_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9319 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9320 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9321 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9322 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9323 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9324 /* Return non-zero if OBJECT is a valid JPEG image specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9325 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9326 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9327 jpeg_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9328 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9329 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9330 struct image_keyword fmt[JPEG_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9331 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9332 bcopy (jpeg_format, fmt, sizeof fmt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9333 |
28787 | 9334 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9335 return 0; |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9336 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
9337 /* Must specify either the :data or :file keyword. */ |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
9338 return fmt[JPEG_FILE].count + fmt[JPEG_DATA].count == 1; |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9339 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9340 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9341 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9342 struct my_jpeg_error_mgr |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9343 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9344 struct jpeg_error_mgr pub; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9345 jmp_buf setjmp_buffer; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9346 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9347 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9348 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9349 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9350 my_error_exit (cinfo) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9351 j_common_ptr cinfo; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9352 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9353 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9354 longjmp (mgr->setjmp_buffer, 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9355 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9356 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9357 |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9358 /* Init source method for JPEG data source manager. Called by |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9359 jpeg_read_header() before any data is actually read. See |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9360 libjpeg.doc from the JPEG lib distribution. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9361 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9362 static void |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9363 our_init_source (cinfo) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9364 j_decompress_ptr cinfo; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9365 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9366 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9367 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9368 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9369 /* Fill input buffer method for JPEG data source manager. Called |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9370 whenever more data is needed. We read the whole image in one step, |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9371 so this only adds a fake end of input marker at the end. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9372 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9373 static boolean |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9374 our_fill_input_buffer (cinfo) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9375 j_decompress_ptr cinfo; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9376 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9377 /* Insert a fake EOI marker. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9378 struct jpeg_source_mgr *src = cinfo->src; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9379 static JOCTET buffer[2]; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9380 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9381 buffer[0] = (JOCTET) 0xFF; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9382 buffer[1] = (JOCTET) JPEG_EOI; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9383 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9384 src->next_input_byte = buffer; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9385 src->bytes_in_buffer = 2; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9386 return TRUE; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9387 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9388 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9389 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9390 /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9391 is the JPEG data source manager. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9392 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9393 static void |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9394 our_skip_input_data (cinfo, num_bytes) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9395 j_decompress_ptr cinfo; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9396 long num_bytes; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9397 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9398 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9399 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9400 if (src) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9401 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9402 if (num_bytes > src->bytes_in_buffer) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9403 ERREXIT (cinfo, JERR_INPUT_EOF); |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9404 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9405 src->bytes_in_buffer -= num_bytes; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9406 src->next_input_byte += num_bytes; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9407 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9408 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9409 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9410 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9411 /* Method to terminate data source. Called by |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9412 jpeg_finish_decompress() after all data has been processed. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9413 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9414 static void |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9415 our_term_source (cinfo) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9416 j_decompress_ptr cinfo; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9417 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9418 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9419 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9420 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9421 /* Set up the JPEG lib for reading an image from DATA which contains |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9422 LEN bytes. CINFO is the decompression info structure created for |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9423 reading the image. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9424 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9425 static void |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9426 jpeg_memory_src (cinfo, data, len) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9427 j_decompress_ptr cinfo; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9428 JOCTET *data; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9429 unsigned int len; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9430 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9431 struct jpeg_source_mgr *src; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9432 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9433 if (cinfo->src == NULL) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9434 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9435 /* First time for this JPEG object? */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9436 cinfo->src = (struct jpeg_source_mgr *) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9437 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9438 sizeof (struct jpeg_source_mgr)); |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9439 src = (struct jpeg_source_mgr *) cinfo->src; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9440 src->next_input_byte = data; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9441 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9442 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9443 src = (struct jpeg_source_mgr *) cinfo->src; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9444 src->init_source = our_init_source; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9445 src->fill_input_buffer = our_fill_input_buffer; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9446 src->skip_input_data = our_skip_input_data; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9447 src->resync_to_restart = jpeg_resync_to_restart; /* Use default method. */ |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9448 src->term_source = our_term_source; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9449 src->bytes_in_buffer = len; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9450 src->next_input_byte = data; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9451 } |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9452 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9453 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9454 /* Load image IMG for use on frame F. Patterned after example.c |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9455 from the JPEG lib. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9456 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9457 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9458 jpeg_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9459 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9460 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9461 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9462 struct jpeg_decompress_struct cinfo; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9463 struct my_jpeg_error_mgr mgr; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9464 Lisp_Object file, specified_file; |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9465 Lisp_Object specified_data; |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
9466 FILE * volatile fp = NULL; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9467 JSAMPARRAY buffer; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9468 int row_stride, x, y; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9469 XImage *ximg = NULL; |
25715
feaedc03dbc8
(x_set_background_color): Remove unused variable(s).
Gerd Moellmann <gerd@gnu.org>
parents:
25691
diff
changeset
|
9470 int rc; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9471 unsigned long *colors; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9472 int width, height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9473 struct gcpro gcpro1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9474 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9475 /* Open the JPEG file. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9476 specified_file = image_spec_value (img->spec, QCfile, NULL); |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9477 specified_data = image_spec_value (img->spec, QCdata, NULL); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9478 file = Qnil; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9479 GCPRO1 (file); |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9480 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9481 if (NILP (specified_data)) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9482 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9483 file = x_find_image_file (specified_file); |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9484 if (!STRINGP (file)) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9485 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9486 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9487 UNGCPRO; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9488 return 0; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9489 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9490 |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9491 fp = fopen (XSTRING (file)->data, "r"); |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9492 if (fp == NULL) |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9493 { |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9494 image_error ("Cannot open `%s'", file, Qnil); |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9495 UNGCPRO; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9496 return 0; |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9497 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9498 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9499 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9500 /* Customize libjpeg's error handling to call my_error_exit when an |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9501 error is detected. This function will perform a longjmp. */ |
29728
f0f1e1365670
fix jpeg error-handling setup
Ken Raeburn <raeburn@raeburn.org>
parents:
29617
diff
changeset
|
9502 cinfo.err = jpeg_std_error (&mgr.pub); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9503 mgr.pub.error_exit = my_error_exit; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9504 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9505 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9506 { |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9507 if (rc == 1) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9508 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9509 /* Called from my_error_exit. Display a JPEG error. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9510 char buffer[JMSG_LENGTH_MAX]; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9511 cinfo.err->format_message ((j_common_ptr) &cinfo, buffer); |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9512 image_error ("Error reading JPEG image `%s': %s", img->spec, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9513 build_string (buffer)); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9514 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9515 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9516 /* Close the input file and destroy the JPEG object. */ |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9517 if (fp) |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
9518 fclose ((FILE *) fp); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9519 jpeg_destroy_decompress (&cinfo); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9520 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9521 /* If we already have an XImage, free that. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9522 x_destroy_x_image (ximg); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9523 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9524 /* Free pixmap and colors. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9525 x_clear_image (f, img); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9526 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9527 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9528 return 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9529 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9530 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9531 /* Create the JPEG decompression object. Let it read from fp. |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9532 Read the JPEG image header. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9533 jpeg_create_decompress (&cinfo); |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9534 |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9535 if (NILP (specified_data)) |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
9536 jpeg_stdio_src (&cinfo, (FILE *) fp); |
27053
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9537 else |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9538 jpeg_memory_src (&cinfo, XSTRING (specified_data)->data, |
3995eec4287f
(enum jpeg_keyword_index): Add JPEG_DATA.
Gerd Moellmann <gerd@gnu.org>
parents:
26980
diff
changeset
|
9539 STRING_BYTES (XSTRING (specified_data))); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9540 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9541 jpeg_read_header (&cinfo, TRUE); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9542 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9543 /* Customize decompression so that color quantization will be used. |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9544 Start decompression. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9545 cinfo.quantize_colors = TRUE; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9546 jpeg_start_decompress (&cinfo); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9547 width = img->width = cinfo.output_width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9548 height = img->height = cinfo.output_height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9549 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9550 /* Create X image and pixmap. */ |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9551 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
31686
577372d71de8
(lookup_image): Block input while loading the image so
Gerd Moellmann <gerd@gnu.org>
parents:
31651
diff
changeset
|
9552 longjmp (mgr.setjmp_buffer, 2); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9553 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9554 /* Allocate colors. When color quantization is used, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9555 cinfo.actual_number_of_colors has been set with the number of |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9556 colors generated, and cinfo.colormap is a two-dimensional array |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9557 of color indices in the range 0..cinfo.actual_number_of_colors. |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9558 No more than 255 colors will be generated. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9559 { |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9560 int i, ir, ig, ib; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9561 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9562 if (cinfo.out_color_components > 2) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9563 ir = 0, ig = 1, ib = 2; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9564 else if (cinfo.out_color_components > 1) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9565 ir = 0, ig = 1, ib = 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9566 else |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9567 ir = 0, ig = 0, ib = 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9568 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9569 /* Use the color table mechanism because it handles colors that |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9570 cannot be allocated nicely. Such colors will be replaced with |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9571 a default color, and we don't have to care about which colors |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9572 can be freed safely, and which can't. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9573 init_color_table (); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9574 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9575 * sizeof *colors); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9576 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9577 for (i = 0; i < cinfo.actual_number_of_colors; ++i) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9578 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9579 /* Multiply RGB values with 255 because X expects RGB values |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9580 in the range 0..0xffff. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9581 int r = cinfo.colormap[ir][i] << 8; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9582 int g = cinfo.colormap[ig][i] << 8; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9583 int b = cinfo.colormap[ib][i] << 8; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9584 colors[i] = lookup_rgb_color (f, r, g, b); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9585 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9586 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9587 /* Remember those colors actually allocated. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9588 img->colors = colors_in_color_table (&img->ncolors); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9589 free_color_table (); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9590 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9591 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9592 /* Read pixels. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9593 row_stride = width * cinfo.output_components; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9594 buffer = cinfo.mem->alloc_sarray ((j_common_ptr) &cinfo, JPOOL_IMAGE, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9595 row_stride, 1); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9596 for (y = 0; y < height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9597 { |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9598 jpeg_read_scanlines (&cinfo, buffer, 1); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9599 for (x = 0; x < cinfo.output_width; ++x) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9600 XPutPixel (ximg, x, y, colors[buffer[0][x]]); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9601 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9602 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9603 /* Clean up. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9604 jpeg_finish_decompress (&cinfo); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9605 jpeg_destroy_decompress (&cinfo); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9606 if (fp) |
31543
9c5e42fa3ba5
(png_load, jpeg_load): Declare some variables volatile
Gerd Moellmann <gerd@gnu.org>
parents:
30601
diff
changeset
|
9607 fclose ((FILE *) fp); |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9608 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9609 /* Maybe fill in the background field while we have ximg handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9610 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9611 IMAGE_BACKGROUND (img, f, ximg); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9612 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9613 /* Put the image into the pixmap. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9614 x_put_x_image (f, ximg, img->pixmap, width, height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9615 x_destroy_x_image (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9616 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9617 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9618 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9619 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9620 #endif /* HAVE_JPEG */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9621 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9622 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9623 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9624 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9625 TIFF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9626 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9627 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9628 #if HAVE_TIFF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9629 |
25335
2de1796b006b
remove tiff34 prefix from include.
Gerd Moellmann <gerd@gnu.org>
parents:
25320
diff
changeset
|
9630 #include <tiffio.h> |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9631 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9632 static int tiff_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9633 static int tiff_load P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9634 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9635 /* The symbol `tiff' identifying images of this type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9636 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9637 Lisp_Object Qtiff; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9638 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9639 /* Indices of image specification fields in tiff_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9640 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9641 enum tiff_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9642 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9643 TIFF_TYPE, |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9644 TIFF_DATA, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9645 TIFF_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9646 TIFF_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9647 TIFF_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9648 TIFF_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9649 TIFF_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9650 TIFF_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
9651 TIFF_MASK, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9652 TIFF_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9653 TIFF_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9654 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9655 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9656 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9657 of valid user-defined image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9658 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9659 static struct image_keyword tiff_format[TIFF_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9660 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9661 {":type", IMAGE_SYMBOL_VALUE, 1}, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9662 {":data", IMAGE_STRING_VALUE, 0}, |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9663 {":file", IMAGE_STRING_VALUE, 0}, |
28787 | 9664 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
9665 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9666 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
9667 {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
9668 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9669 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9670 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9671 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9672 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9673 /* Structure describing the image type `tiff'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9674 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9675 static struct image_type tiff_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9676 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9677 &Qtiff, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9678 tiff_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9679 tiff_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9680 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9681 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9682 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9683 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9684 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9685 /* Return non-zero if OBJECT is a valid TIFF image specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9686 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9687 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9688 tiff_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9689 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9690 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9691 struct image_keyword fmt[TIFF_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9692 bcopy (tiff_format, fmt, sizeof fmt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9693 |
28787 | 9694 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9695 return 0; |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9696 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
9697 /* Must specify either the :data or :file keyword. */ |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
9698 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9699 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9700 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9701 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9702 /* Reading from a memory buffer for TIFF images Based on the PNG |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9703 memory source, but we have to provide a lot of extra functions. |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9704 Blah. |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9705 |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9706 We really only need to implement read and seek, but I am not |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9707 convinced that the TIFF library is smart enough not to destroy |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9708 itself if we only hand it the function pointers we need to |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9709 override. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9710 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9711 typedef struct |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9712 { |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9713 unsigned char *bytes; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9714 size_t len; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9715 int index; |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9716 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9717 tiff_memory_source; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9718 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9719 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9720 static size_t |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9721 tiff_read_from_memory (data, buf, size) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9722 thandle_t data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9723 tdata_t buf; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9724 tsize_t size; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9725 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9726 tiff_memory_source *src = (tiff_memory_source *) data; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9727 |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9728 if (size > src->len - src->index) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9729 return (size_t) -1; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9730 bcopy (src->bytes + src->index, buf, size); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9731 src->index += size; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9732 return size; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9733 } |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9734 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9735 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9736 static size_t |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9737 tiff_write_from_memory (data, buf, size) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9738 thandle_t data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9739 tdata_t buf; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9740 tsize_t size; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9741 { |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9742 return (size_t) -1; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9743 } |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9744 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9745 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9746 static toff_t |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9747 tiff_seek_in_memory (data, off, whence) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9748 thandle_t data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9749 toff_t off; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9750 int whence; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9751 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9752 tiff_memory_source *src = (tiff_memory_source *) data; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9753 int idx; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9754 |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9755 switch (whence) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9756 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9757 case SEEK_SET: /* Go from beginning of source. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9758 idx = off; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9759 break; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9760 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9761 case SEEK_END: /* Go from end of source. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9762 idx = src->len + off; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9763 break; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9764 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9765 case SEEK_CUR: /* Go from current position. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9766 idx = src->index + off; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9767 break; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9768 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9769 default: /* Invalid `whence'. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9770 return -1; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9771 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9772 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9773 if (idx > src->len || idx < 0) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9774 return -1; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9775 |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9776 src->index = idx; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9777 return src->index; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9778 } |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9779 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9780 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9781 static int |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9782 tiff_close_memory (data) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9783 thandle_t data; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9784 { |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9785 /* NOOP */ |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9786 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9787 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9788 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9789 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9790 static int |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9791 tiff_mmap_memory (data, pbase, psize) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9792 thandle_t data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9793 tdata_t *pbase; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9794 toff_t *psize; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9795 { |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9796 /* It is already _IN_ memory. */ |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9797 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9798 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9799 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9800 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9801 static void |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9802 tiff_unmap_memory (data, base, size) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9803 thandle_t data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9804 tdata_t base; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9805 toff_t size; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9806 { |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9807 /* We don't need to do this. */ |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9808 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9809 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9810 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9811 static toff_t |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9812 tiff_size_of_memory (data) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9813 thandle_t data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9814 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9815 return ((tiff_memory_source *) data)->len; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9816 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9817 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
9818 |
39591
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9819 static void |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9820 tiff_error_handler (title, format, ap) |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9821 const char *title, *format; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9822 va_list ap; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9823 { |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9824 char buf[512]; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9825 int len; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9826 |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9827 len = sprintf (buf, "TIFF error: %s ", title); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9828 vsprintf (buf + len, format, ap); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9829 add_to_log (buf, Qnil, Qnil); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9830 } |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9831 |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9832 |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9833 static void |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9834 tiff_warning_handler (title, format, ap) |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9835 const char *title, *format; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9836 va_list ap; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9837 { |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9838 char buf[512]; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9839 int len; |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9840 |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9841 len = sprintf (buf, "TIFF warning: %s ", title); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9842 vsprintf (buf + len, format, ap); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9843 add_to_log (buf, Qnil, Qnil); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9844 } |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9845 |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9846 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9847 /* Load TIFF image IMG for use on frame F. Value is non-zero if |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9848 successful. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9849 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9850 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9851 tiff_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9852 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9853 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9854 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9855 Lisp_Object file, specified_file; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9856 Lisp_Object specified_data; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9857 TIFF *tiff; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9858 int width, height, x, y; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9859 uint32 *buf; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9860 int rc; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9861 XImage *ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9862 struct gcpro gcpro1; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9863 tiff_memory_source memsrc; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9864 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9865 specified_file = image_spec_value (img->spec, QCfile, NULL); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9866 specified_data = image_spec_value (img->spec, QCdata, NULL); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9867 file = Qnil; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9868 GCPRO1 (file); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9869 |
39591
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9870 TIFFSetErrorHandler (tiff_error_handler); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9871 TIFFSetWarningHandler (tiff_warning_handler); |
84263f0294b3
(tiff_error_handler, tiff_warning_handler): New functions.
Gerd Moellmann <gerd@gnu.org>
parents:
39442
diff
changeset
|
9872 |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9873 if (NILP (specified_data)) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9874 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9875 /* Read from a file */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9876 file = x_find_image_file (specified_file); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9877 if (!STRINGP (file)) |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9878 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9879 image_error ("Cannot find image file `%s'", file, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9880 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9881 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9882 } |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9883 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9884 /* Try to open the image file. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9885 tiff = TIFFOpen (XSTRING (file)->data, "r"); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9886 if (tiff == NULL) |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9887 { |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9888 image_error ("Cannot open `%s'", file, Qnil); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9889 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9890 return 0; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
9891 } |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9892 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9893 else |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9894 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9895 /* Memory source! */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9896 memsrc.bytes = XSTRING (specified_data)->data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9897 memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9898 memsrc.index = 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9899 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9900 tiff = TIFFClientOpen ("memory_source", "r", &memsrc, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9901 (TIFFReadWriteProc) tiff_read_from_memory, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9902 (TIFFReadWriteProc) tiff_write_from_memory, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9903 tiff_seek_in_memory, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9904 tiff_close_memory, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9905 tiff_size_of_memory, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9906 tiff_mmap_memory, |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9907 tiff_unmap_memory); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9908 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9909 if (!tiff) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9910 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9911 image_error ("Cannot open memory source for `%s'", img->spec, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9912 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9913 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9914 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
9915 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9916 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9917 /* Get width and height of the image, and allocate a raster buffer |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9918 of width x height 32-bit values. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9919 TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9920 TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9921 buf = (uint32 *) xmalloc (width * height * sizeof *buf); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9922 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9923 rc = TIFFReadRGBAImage (tiff, width, height, buf, 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9924 TIFFClose (tiff); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9925 if (!rc) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9926 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9927 image_error ("Error reading TIFF image `%s'", img->spec, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9928 xfree (buf); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9929 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9930 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9931 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9932 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9933 /* Create the X image and pixmap. */ |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
9934 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9935 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9936 xfree (buf); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9937 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9938 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9939 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9940 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9941 /* Initialize the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9942 init_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9943 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9944 /* Process the pixel raster. Origin is in the lower-left corner. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9945 for (y = 0; y < height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9946 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9947 uint32 *row = buf + y * width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9948 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9949 for (x = 0; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9950 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9951 uint32 abgr = row[x]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9952 int r = TIFFGetR (abgr) << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9953 int g = TIFFGetG (abgr) << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9954 int b = TIFFGetB (abgr) << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9955 XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9956 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9957 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9958 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9959 /* Remember the colors allocated for the image. Free the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9960 img->colors = colors_in_color_table (&img->ncolors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9961 free_color_table (); |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9962 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9963 img->width = width; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9964 img->height = height; |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9965 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9966 /* Maybe fill in the background field while we have ximg handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9967 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
9968 IMAGE_BACKGROUND (img, f, ximg); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9969 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9970 /* Put the image into the pixmap, then free the X image and its buffer. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9971 x_put_x_image (f, ximg, img->pixmap, width, height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9972 x_destroy_x_image (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9973 xfree (buf); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9974 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9975 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9976 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9977 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9978 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9979 #endif /* HAVE_TIFF != 0 */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9980 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9981 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9982 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9983 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9984 GIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9985 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9986 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9987 #if HAVE_GIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9988 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9989 #include <gif_lib.h> |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9990 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9991 static int gif_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9992 static int gif_load P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9993 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9994 /* The symbol `gif' identifying images of this type. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9995 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9996 Lisp_Object Qgif; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9997 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9998 /* Indices of image specification fields in gif_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
9999 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10000 enum gif_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10001 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10002 GIF_TYPE, |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10003 GIF_DATA, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10004 GIF_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10005 GIF_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10006 GIF_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10007 GIF_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10008 GIF_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10009 GIF_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
10010 GIF_MASK, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10011 GIF_IMAGE, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10012 GIF_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10013 GIF_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10014 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10015 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10016 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10017 of valid user-defined image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10018 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10019 static struct image_keyword gif_format[GIF_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10020 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10021 {":type", IMAGE_SYMBOL_VALUE, 1}, |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10022 {":data", IMAGE_STRING_VALUE, 0}, |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10023 {":file", IMAGE_STRING_VALUE, 0}, |
28787 | 10024 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
10025 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10026 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
10027 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10028 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
10029 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40279
1adbc1480e83
(png_load): Make sure SPECIFIED_BG is a string.
Miles Bader <miles@gnu.org>
parents:
40264
diff
changeset
|
10030 {":image", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0}, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10031 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10032 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10033 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10034 /* Structure describing the image type `gif'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10035 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10036 static struct image_type gif_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10037 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10038 &Qgif, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10039 gif_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10040 gif_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10041 x_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10042 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10043 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10044 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
10045 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10046 /* Return non-zero if OBJECT is a valid GIF image specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10047 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10048 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10049 gif_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10050 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10051 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10052 struct image_keyword fmt[GIF_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10053 bcopy (gif_format, fmt, sizeof fmt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10054 |
28787 | 10055 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10056 return 0; |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10057 |
27069
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
10058 /* Must specify either the :data or :file keyword. */ |
b2934c683b5e
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27066
diff
changeset
|
10059 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10060 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10061 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
10062 |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10063 /* Reading a GIF image from memory |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10064 Based on the PNG memory stuff to a certain extent. */ |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10065 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10066 typedef struct |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10067 { |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10068 unsigned char *bytes; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10069 size_t len; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10070 int index; |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10071 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10072 gif_memory_source; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10073 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
10074 |
27153
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10075 /* Make the current memory source available to gif_read_from_memory. |
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10076 It's done this way because not all versions of libungif support |
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10077 a UserData field in the GifFileType structure. */ |
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10078 static gif_memory_source *current_gif_memory_src; |
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10079 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10080 static int |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10081 gif_read_from_memory (file, buf, len) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10082 GifFileType *file; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10083 GifByteType *buf; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10084 int len; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10085 { |
27153
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10086 gif_memory_source *src = current_gif_memory_src; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10087 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10088 if (len > src->len - src->index) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10089 return -1; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10090 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10091 bcopy (src->bytes + src->index, buf, len); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10092 src->index += len; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10093 return len; |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10094 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10095 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10096 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10097 /* Load GIF image IMG for use on frame F. Value is non-zero if |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10098 successful. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10099 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10100 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10101 gif_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10102 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10103 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10104 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10105 Lisp_Object file, specified_file; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10106 Lisp_Object specified_data; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10107 int rc, width, height, x, y, i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10108 XImage *ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10109 ColorMapObject *gif_color_map; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10110 unsigned long pixel_colors[256]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10111 GifFileType *gif; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10112 struct gcpro gcpro1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10113 Lisp_Object image; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10114 int ino, image_left, image_top, image_width, image_height; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10115 gif_memory_source memsrc; |
27066
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10116 unsigned char *raster; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10117 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10118 specified_file = image_spec_value (img->spec, QCfile, NULL); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10119 specified_data = image_spec_value (img->spec, QCdata, NULL); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10120 file = Qnil; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10121 GCPRO1 (file); |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10122 |
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10123 if (NILP (specified_data)) |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10124 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10125 file = x_find_image_file (specified_file); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10126 if (!STRINGP (file)) |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10127 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10128 image_error ("Cannot find image file `%s'", specified_file, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10129 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10130 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10131 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10132 |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10133 /* Open the GIF file. */ |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10134 gif = DGifOpenFileName (XSTRING (file)->data); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10135 if (gif == NULL) |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10136 { |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10137 image_error ("Cannot open `%s'", file, Qnil); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10138 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10139 return 0; |
27058
209b24ba8ddf
Changes to xfns.c to support reading images from a memory buffer instead of forcing them to be on disk. GIF/JPEG/PNG/TIFF currently support this.
William M. Perry <wmperry@aventail.com>
parents:
27053
diff
changeset
|
10140 } |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10141 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10142 else |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10143 { |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10144 /* Read from memory! */ |
27153
31b7a2a8ea20
(current_gif_memory_src): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
27071
diff
changeset
|
10145 current_gif_memory_src = &memsrc; |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10146 memsrc.bytes = XSTRING (specified_data)->data; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10147 memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10148 memsrc.index = 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10149 |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10150 gif = DGifOpen(&memsrc, gif_read_from_memory); |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10151 if (!gif) |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10152 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10153 image_error ("Cannot open memory source `%s'", img->spec, Qnil); |
27060
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10154 UNGCPRO; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10155 return 0; |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10156 } |
4960164efd1c
New image functions adapted to Emacs conventions.
Gerd Moellmann <gerd@gnu.org>
parents:
27058
diff
changeset
|
10157 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10158 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10159 /* Read entire contents. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10160 rc = DGifSlurp (gif); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10161 if (rc == GIF_ERROR) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10162 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10163 image_error ("Error reading `%s'", img->spec, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10164 DGifCloseFile (gif); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10165 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10166 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10167 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10168 |
25620 | 10169 image = image_spec_value (img->spec, QCindex, NULL); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10170 ino = INTEGERP (image) ? XFASTINT (image) : 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10171 if (ino >= gif->ImageCount) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10172 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10173 image_error ("Invalid image number `%s' in image `%s'", |
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10174 image, img->spec); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10175 DGifCloseFile (gif); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10176 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10177 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10178 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10179 |
43426
f260f08997bc
(gif_load): Use correct width and height for GIF images.
Pavel Janík <Pavel@Janik.cz>
parents:
42894
diff
changeset
|
10180 width = img->width = max (gif->SWidth, gif->Image.Left + gif->Image.Width); |
f260f08997bc
(gif_load): Use correct width and height for GIF images.
Pavel Janík <Pavel@Janik.cz>
parents:
42894
diff
changeset
|
10181 height = img->height = max (gif->SHeight, gif->Image.Top + gif->Image.Height); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10182 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10183 /* Create the X image and pixmap. */ |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10184 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10185 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10186 DGifCloseFile (gif); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10187 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10188 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10189 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10190 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10191 /* Allocate colors. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10192 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10193 if (!gif_color_map) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10194 gif_color_map = gif->SColorMap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10195 init_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10196 bzero (pixel_colors, sizeof pixel_colors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10197 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10198 for (i = 0; i < gif_color_map->ColorCount; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10199 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10200 int r = gif_color_map->Colors[i].Red << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10201 int g = gif_color_map->Colors[i].Green << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10202 int b = gif_color_map->Colors[i].Blue << 8; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10203 pixel_colors[i] = lookup_rgb_color (f, r, g, b); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10204 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10205 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10206 img->colors = colors_in_color_table (&img->ncolors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10207 free_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10208 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10209 /* Clear the part of the screen image that are not covered by |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10210 the image from the GIF file. Full animated GIF support |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10211 requires more than can be done here (see the gif89 spec, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10212 disposal methods). Let's simply assume that the part |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10213 not covered by a sub-image is in the frame's background color. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10214 image_top = gif->SavedImages[ino].ImageDesc.Top; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10215 image_left = gif->SavedImages[ino].ImageDesc.Left; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10216 image_width = gif->SavedImages[ino].ImageDesc.Width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10217 image_height = gif->SavedImages[ino].ImageDesc.Height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10218 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10219 for (y = 0; y < image_top; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10220 for (x = 0; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10221 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10222 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10223 for (y = image_top + image_height; y < height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10224 for (x = 0; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10225 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10226 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10227 for (y = image_top; y < image_top + image_height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10228 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10229 for (x = 0; x < image_left; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10230 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10231 for (x = image_left + image_width; x < width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10232 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10233 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10234 |
27066
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10235 /* Read the GIF image into the X image. We use a local variable |
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10236 `raster' here because RasterBits below is a char *, and invites |
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10237 problems with bytes >= 0x80. */ |
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10238 raster = (unsigned char *) gif->SavedImages[ino].RasterBits; |
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10239 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10240 if (gif->SavedImages[ino].ImageDesc.Interlace) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10241 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10242 static int interlace_start[] = {0, 4, 2, 1}; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10243 static int interlace_increment[] = {8, 8, 4, 2}; |
34976
05c36b1fa618
(x_display_info_for_name): Cast 0 to "char *" in the call
Eli Zaretskii <eliz@gnu.org>
parents:
34911
diff
changeset
|
10244 int pass; |
26032
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10245 int row = interlace_start[0]; |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10246 |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10247 pass = 0; |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10248 |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10249 for (y = 0; y < image_height; y++) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10250 { |
26032
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10251 if (row >= image_height) |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10252 { |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10253 row = interlace_start[++pass]; |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10254 while (row >= image_height) |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10255 row = interlace_start[++pass]; |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10256 } |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10257 |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10258 for (x = 0; x < image_width; x++) |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10259 { |
27066
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10260 int i = raster[(y * image_width) + x]; |
26032
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10261 XPutPixel (ximg, x + image_left, row + image_top, |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10262 pixel_colors[i]); |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10263 } |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10264 |
6a349a18b1ad
(gif_load): Fix handling of interlaced GIFs.
Gerd Moellmann <gerd@gnu.org>
parents:
25955
diff
changeset
|
10265 row += interlace_increment[pass]; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10266 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10267 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10268 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10269 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10270 for (y = 0; y < image_height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10271 for (x = 0; x < image_width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10272 { |
27066
30697e7cb5a2
(gif_load): Avoid sign extension and thus out of bounds
Gerd Moellmann <gerd@gnu.org>
parents:
27060
diff
changeset
|
10273 int i = raster[y * image_width + x]; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10274 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10275 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10276 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10277 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10278 DGifCloseFile (gif); |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10279 |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10280 /* Maybe fill in the background field while we have ximg handy. */ |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10281 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10282 IMAGE_BACKGROUND (img, f, ximg); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10283 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10284 /* Put the image into the pixmap, then free the X image and its buffer. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10285 x_put_x_image (f, ximg, img->pixmap, width, height); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10286 x_destroy_x_image (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10287 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10288 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10289 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10290 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10291 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10292 #endif /* HAVE_GIF != 0 */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10293 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10294 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10295 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10296 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10297 Ghostscript |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10298 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10299 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10300 static int gs_image_p P_ ((Lisp_Object object)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10301 static int gs_load P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10302 static void gs_clear_image P_ ((struct frame *f, struct image *img)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10303 |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
10304 /* The symbol `postscript' identifying images of this type. */ |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
10305 |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
10306 Lisp_Object Qpostscript; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10307 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10308 /* Keyword symbols. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10309 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10310 Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10311 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10312 /* Indices of image specification fields in gs_format, below. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10313 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10314 enum gs_keyword_index |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10315 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10316 GS_TYPE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10317 GS_PT_WIDTH, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10318 GS_PT_HEIGHT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10319 GS_FILE, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10320 GS_LOADER, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10321 GS_BOUNDING_BOX, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10322 GS_ASCENT, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10323 GS_MARGIN, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10324 GS_RELIEF, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10325 GS_ALGORITHM, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10326 GS_HEURISTIC_MASK, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
10327 GS_MASK, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10328 GS_BACKGROUND, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10329 GS_LAST |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10330 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10331 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10332 /* Vector of image_keyword structures describing the format |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10333 of valid user-defined image specifications. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10334 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10335 static struct image_keyword gs_format[GS_LAST] = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10336 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10337 {":type", IMAGE_SYMBOL_VALUE, 1}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10338 {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10339 {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10340 {":file", IMAGE_STRING_VALUE, 1}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10341 {":loader", IMAGE_FUNCTION_VALUE, 0}, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10342 {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1}, |
28787 | 10343 {":ascent", IMAGE_ASCENT_VALUE, 0}, |
35275
38e58f530a1a
(Fimage_size, image_ascent): Adapt to the change of image
Gerd Moellmann <gerd@gnu.org>
parents:
35261
diff
changeset
|
10344 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0}, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10345 {":relief", IMAGE_INTEGER_VALUE, 0}, |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
10346 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
10347 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
40264
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10348 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, |
04766dd416bb
(image_background, image_background_transparent)
Miles Bader <miles@gnu.org>
parents:
40204
diff
changeset
|
10349 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10350 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10351 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10352 /* Structure describing the image type `ghostscript'. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10353 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10354 static struct image_type gs_type = |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10355 { |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
10356 &Qpostscript, |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10357 gs_image_p, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10358 gs_load, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10359 gs_clear_image, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10360 NULL |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10361 }; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10362 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10363 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10364 /* Free X resources of Ghostscript image IMG which is used on frame F. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10365 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10366 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10367 gs_clear_image (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10368 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10369 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10370 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10371 /* IMG->data.ptr_val may contain a recorded colormap. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10372 xfree (img->data.ptr_val); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10373 x_clear_image (f, img); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10374 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10375 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10376 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10377 /* Return non-zero if OBJECT is a valid Ghostscript image |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10378 specification. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10379 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10380 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10381 gs_image_p (object) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10382 Lisp_Object object; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10383 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10384 struct image_keyword fmt[GS_LAST]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10385 Lisp_Object tem; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10386 int i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10387 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10388 bcopy (gs_format, fmt, sizeof fmt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10389 |
28787 | 10390 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10391 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10392 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10393 /* Bounding box must be a list or vector containing 4 integers. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10394 tem = fmt[GS_BOUNDING_BOX].value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10395 if (CONSP (tem)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10396 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10397 for (i = 0; i < 4; ++i, tem = XCDR (tem)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10398 if (!CONSP (tem) || !INTEGERP (XCAR (tem))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10399 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10400 if (!NILP (tem)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10401 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10402 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10403 else if (VECTORP (tem)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10404 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10405 if (XVECTOR (tem)->size != 4) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10406 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10407 for (i = 0; i < 4; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10408 if (!INTEGERP (XVECTOR (tem)->contents[i])) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10409 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10410 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10411 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10412 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10413 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10414 return 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10415 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10416 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10417 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10418 /* Load Ghostscript image IMG for use on frame F. Value is non-zero |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10419 if successful. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10420 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10421 static int |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10422 gs_load (f, img) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10423 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10424 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10425 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10426 char buffer[100]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10427 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10428 struct gcpro gcpro1, gcpro2; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10429 Lisp_Object frame; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10430 double in_width, in_height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10431 Lisp_Object pixel_colors = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10432 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10433 /* Compute pixel size of pixmap needed from the given size in the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10434 image specification. Sizes in the specification are in pt. 1 pt |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10435 = 1/72 in, xdpi and ydpi are stored in the frame's X display |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10436 info. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10437 pt_width = image_spec_value (img->spec, QCpt_width, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10438 in_width = XFASTINT (pt_width) / 72.0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10439 img->width = in_width * FRAME_X_DISPLAY_INFO (f)->resx; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10440 pt_height = image_spec_value (img->spec, QCpt_height, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10441 in_height = XFASTINT (pt_height) / 72.0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10442 img->height = in_height * FRAME_X_DISPLAY_INFO (f)->resy; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10443 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10444 /* Create the pixmap. */ |
31693
8e9fb2a048ac
(x_clear_image_1): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
31688
diff
changeset
|
10445 xassert (img->pixmap == None); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10446 img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10447 img->width, img->height, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10448 DefaultDepthOfScreen (FRAME_X_SCREEN (f))); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10449 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10450 if (!img->pixmap) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10451 { |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10452 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10453 return 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10454 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10455 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10456 /* Call the loader to fill the pixmap. It returns a process object |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10457 if successful. We do not record_unwind_protect here because |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10458 other places in redisplay like calling window scroll functions |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10459 don't either. Let the Lisp loader use `unwind-protect' instead. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10460 GCPRO2 (window_and_pixmap_id, pixel_colors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10461 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10462 sprintf (buffer, "%lu %lu", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10463 (unsigned long) FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10464 (unsigned long) img->pixmap); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10465 window_and_pixmap_id = build_string (buffer); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10466 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10467 sprintf (buffer, "%lu %lu", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10468 FRAME_FOREGROUND_PIXEL (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10469 FRAME_BACKGROUND_PIXEL (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10470 pixel_colors = build_string (buffer); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10471 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10472 XSETFRAME (frame, f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10473 loader = image_spec_value (img->spec, QCloader, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10474 if (NILP (loader)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10475 loader = intern ("gs-load-image"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10476 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10477 img->data.lisp_val = call6 (loader, frame, img->spec, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10478 make_number (img->width), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10479 make_number (img->height), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10480 window_and_pixmap_id, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10481 pixel_colors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10482 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10483 return PROCESSP (img->data.lisp_val); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10484 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10485 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10486 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10487 /* Kill the Ghostscript process that was started to fill PIXMAP on |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10488 frame F. Called from XTread_socket when receiving an event |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10489 telling Emacs that Ghostscript has finished drawing. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10490 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10491 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10492 x_kill_gs_process (pixmap, f) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10493 Pixmap pixmap; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10494 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10495 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10496 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10497 int class, i; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10498 struct image *img; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10499 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10500 /* Find the image containing PIXMAP. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10501 for (i = 0; i < c->used; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10502 if (c->images[i]->pixmap == pixmap) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10503 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10504 |
39442
0e0c30478fe3
(x_kill_gs_process): Recognize if someone has cleared
Gerd Moellmann <gerd@gnu.org>
parents:
39277
diff
changeset
|
10505 /* Should someone in between have cleared the image cache, for |
0e0c30478fe3
(x_kill_gs_process): Recognize if someone has cleared
Gerd Moellmann <gerd@gnu.org>
parents:
39277
diff
changeset
|
10506 instance, give up. */ |
0e0c30478fe3
(x_kill_gs_process): Recognize if someone has cleared
Gerd Moellmann <gerd@gnu.org>
parents:
39277
diff
changeset
|
10507 if (i == c->used) |
0e0c30478fe3
(x_kill_gs_process): Recognize if someone has cleared
Gerd Moellmann <gerd@gnu.org>
parents:
39277
diff
changeset
|
10508 return; |
0e0c30478fe3
(x_kill_gs_process): Recognize if someone has cleared
Gerd Moellmann <gerd@gnu.org>
parents:
39277
diff
changeset
|
10509 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10510 /* Kill the GS process. We should have found PIXMAP in the image |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10511 cache and its image should contain a process object. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10512 img = c->images[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10513 xassert (PROCESSP (img->data.lisp_val)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10514 Fkill_process (img->data.lisp_val, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10515 img->data.lisp_val = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10516 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10517 /* On displays with a mutable colormap, figure out the colors |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10518 allocated for the image by looking at the pixels of an XImage for |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10519 img->pixmap. */ |
28144
71ebba3566ec
(X_I18N_INHIBITED): Don't define.
Gerd Moellmann <gerd@gnu.org>
parents:
28096
diff
changeset
|
10520 class = FRAME_X_VISUAL (f)->class; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10521 if (class != StaticColor && class != StaticGray && class != TrueColor) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10522 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10523 XImage *ximg; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10524 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10525 BLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10526 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10527 /* Try to get an XImage for img->pixmep. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10528 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10529 0, 0, img->width, img->height, ~0, ZPixmap); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10530 if (ximg) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10531 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10532 int x, y; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10533 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10534 /* Initialize the color table. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10535 init_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10536 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10537 /* For each pixel of the image, look its color up in the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10538 color table. After having done so, the color table will |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10539 contain an entry for each color used by the image. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10540 for (y = 0; y < img->height; ++y) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10541 for (x = 0; x < img->width; ++x) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10542 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10543 unsigned long pixel = XGetPixel (ximg, x, y); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10544 lookup_pixel_color (f, pixel); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10545 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10546 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10547 /* Record colors in the image. Free color table and XImage. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10548 img->colors = colors_in_color_table (&img->ncolors); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10549 free_color_table (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10550 XDestroyImage (ximg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10551 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10552 #if 0 /* This doesn't seem to be the case. If we free the colors |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10553 here, we get a BadAccess later in x_clear_image when |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10554 freeing the colors. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10555 /* We have allocated colors once, but Ghostscript has also |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10556 allocated colors on behalf of us. So, to get the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10557 reference counts right, free them once. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10558 if (img->ncolors) |
27963
0e2c6e5cca6e
(x_clear_image, x_kill_gs_process): Use x_free_colors.
Gerd Moellmann <gerd@gnu.org>
parents:
27915
diff
changeset
|
10559 x_free_colors (f, img->colors, img->ncolors); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10560 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10561 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10562 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10563 image_error ("Cannot get X image of `%s'; colors will not be freed", |
27071
d647366b1464
(x_create_x_image_and_pixmap): Remove parameter file.
Gerd Moellmann <gerd@gnu.org>
parents:
27069
diff
changeset
|
10564 img->spec, Qnil); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10565 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10566 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10567 } |
37173
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
10568 |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
10569 /* Now that we have the pixmap, compute mask and transform the |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
10570 image if requested. */ |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
10571 BLOCK_INPUT; |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
10572 postprocess_image (f, img); |
2a637d514525
(postprocess_image): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
36869
diff
changeset
|
10573 UNBLOCK_INPUT; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10574 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10575 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10576 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10577 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10578 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10579 Window properties |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10580 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10581 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10582 DEFUN ("x-change-window-property", Fx_change_window_property, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10583 Sx_change_window_property, 2, 3, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10584 doc: /* Change window property PROP to VALUE on the X window of FRAME. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
10585 PROP and VALUE must be strings. FRAME nil or omitted means use the |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10586 selected frame. Value is VALUE. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10587 (prop, value, frame) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10588 Lisp_Object frame, prop, value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10589 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10590 struct frame *f = check_x_frame (frame); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10591 Atom prop_atom; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10592 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
10593 CHECK_STRING (prop); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
10594 CHECK_STRING (value); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10595 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10596 BLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10597 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), XSTRING (prop)->data, False); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10598 XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10599 prop_atom, XA_STRING, 8, PropModeReplace, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10600 XSTRING (value)->data, XSTRING (value)->size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10601 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10602 /* Make sure the property is set when we return. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10603 XFlush (FRAME_X_DISPLAY (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10604 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10605 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10606 return value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10607 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10608 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10609 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10610 DEFUN ("x-delete-window-property", Fx_delete_window_property, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10611 Sx_delete_window_property, 1, 2, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10612 doc: /* Remove window property PROP from X window of FRAME. |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10613 FRAME nil or omitted means use the selected frame. Value is PROP. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10614 (prop, frame) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10615 Lisp_Object prop, frame; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10616 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10617 struct frame *f = check_x_frame (frame); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10618 Atom prop_atom; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10619 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
10620 CHECK_STRING (prop); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10621 BLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10622 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), XSTRING (prop)->data, False); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10623 XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10624 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10625 /* Make sure the property is removed when we return. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10626 XFlush (FRAME_X_DISPLAY (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10627 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10628 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10629 return prop; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10630 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10631 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10632 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10633 DEFUN ("x-window-property", Fx_window_property, Sx_window_property, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10634 1, 2, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10635 doc: /* Value is the value of window property PROP on FRAME. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
10636 If FRAME is nil or omitted, use the selected frame. Value is nil |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
10637 if FRAME hasn't a property with name PROP or if PROP has no string |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10638 value. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
10639 (prop, frame) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10640 Lisp_Object prop, frame; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10641 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10642 struct frame *f = check_x_frame (frame); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10643 Atom prop_atom; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10644 int rc; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10645 Lisp_Object prop_value = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10646 char *tmp_data = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10647 Atom actual_type; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10648 int actual_format; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10649 unsigned long actual_size, bytes_remaining; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10650 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
10651 CHECK_STRING (prop); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10652 BLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10653 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), XSTRING (prop)->data, False); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10654 rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10655 prop_atom, 0, 0, False, XA_STRING, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10656 &actual_type, &actual_format, &actual_size, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10657 &bytes_remaining, (unsigned char **) &tmp_data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10658 if (rc == Success) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10659 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10660 int size = bytes_remaining; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10661 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10662 XFree (tmp_data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10663 tmp_data = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10664 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10665 rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10666 prop_atom, 0, bytes_remaining, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10667 False, XA_STRING, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10668 &actual_type, &actual_format, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10669 &actual_size, &bytes_remaining, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10670 (unsigned char **) &tmp_data); |
39277
df33715cdcf8
(Fx_window_property): Handle case that property gets
Gerd Moellmann <gerd@gnu.org>
parents:
39159
diff
changeset
|
10671 if (rc == Success && tmp_data) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10672 prop_value = make_string (tmp_data, size); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10673 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10674 XFree (tmp_data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10675 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10676 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10677 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10678 return prop_value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10679 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10680 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10681 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10682 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10683 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10684 Busy cursor |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10685 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10686 |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10687 /* If non-null, an asynchronous timer that, when it expires, displays |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10688 an hourglass cursor on all frames. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10689 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10690 static struct atimer *hourglass_atimer; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10691 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10692 /* Non-zero means an hourglass cursor is currently shown. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10693 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10694 static int hourglass_shown_p; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10695 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10696 /* Number of seconds to wait before displaying an hourglass cursor. */ |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10697 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10698 static Lisp_Object Vhourglass_delay; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10699 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10700 /* Default number of seconds to wait before displaying an hourglass |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10701 cursor. */ |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10702 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10703 #define DEFAULT_HOURGLASS_DELAY 1 |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10704 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10705 /* Function prototypes. */ |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10706 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10707 static void show_hourglass P_ ((struct atimer *)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10708 static void hide_hourglass P_ ((void)); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10709 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10710 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10711 /* Cancel a currently active hourglass timer, and start a new one. */ |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10712 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10713 void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10714 start_hourglass () |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10715 { |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10716 EMACS_TIME delay; |
27915
e5b8e194d279
(start_busy_cursor): Allow floats for busy-cursor-delay.
Gerd Moellmann <gerd@gnu.org>
parents:
27902
diff
changeset
|
10717 int secs, usecs = 0; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10718 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10719 cancel_hourglass (); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10720 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10721 if (INTEGERP (Vhourglass_delay) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10722 && XINT (Vhourglass_delay) > 0) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10723 secs = XFASTINT (Vhourglass_delay); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10724 else if (FLOATP (Vhourglass_delay) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10725 && XFLOAT_DATA (Vhourglass_delay) > 0) |
27915
e5b8e194d279
(start_busy_cursor): Allow floats for busy-cursor-delay.
Gerd Moellmann <gerd@gnu.org>
parents:
27902
diff
changeset
|
10726 { |
e5b8e194d279
(start_busy_cursor): Allow floats for busy-cursor-delay.
Gerd Moellmann <gerd@gnu.org>
parents:
27902
diff
changeset
|
10727 Lisp_Object tem; |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10728 tem = Ftruncate (Vhourglass_delay, Qnil); |
27915
e5b8e194d279
(start_busy_cursor): Allow floats for busy-cursor-delay.
Gerd Moellmann <gerd@gnu.org>
parents:
27902
diff
changeset
|
10729 secs = XFASTINT (tem); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10730 usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000; |
27915
e5b8e194d279
(start_busy_cursor): Allow floats for busy-cursor-delay.
Gerd Moellmann <gerd@gnu.org>
parents:
27902
diff
changeset
|
10731 } |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10732 else |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10733 secs = DEFAULT_HOURGLASS_DELAY; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10734 |
27915
e5b8e194d279
(start_busy_cursor): Allow floats for busy-cursor-delay.
Gerd Moellmann <gerd@gnu.org>
parents:
27902
diff
changeset
|
10735 EMACS_SET_SECS_USECS (delay, secs, usecs); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10736 hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10737 show_hourglass, NULL); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10738 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10739 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10740 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10741 /* Cancel the hourglass cursor timer if active, hide a busy cursor if |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10742 shown. */ |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10743 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10744 void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10745 cancel_hourglass () |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10746 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10747 if (hourglass_atimer) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10748 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10749 cancel_atimer (hourglass_atimer); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10750 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10751 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10752 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10753 if (hourglass_shown_p) |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10754 hide_hourglass (); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10755 } |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10756 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10757 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10758 /* Timer function of hourglass_atimer. TIMER is equal to |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10759 hourglass_atimer. |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10760 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10761 Display an hourglass pointer on all frames by mapping the frames' |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10762 hourglass_window. Set the hourglass_p flag in the frames' |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10763 output_data.x structure to indicate that an hourglass cursor is |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10764 shown on the frames. */ |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10765 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10766 static void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10767 show_hourglass (timer) |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10768 struct atimer *timer; |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10769 { |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10770 /* The timer implementation will cancel this timer automatically |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10771 after this function has run. Set hourglass_atimer to null |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10772 so that we know the timer doesn't have to be canceled. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10773 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10774 |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10775 if (!hourglass_shown_p) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10776 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10777 Lisp_Object rest, frame; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10778 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10779 BLOCK_INPUT; |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10780 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10781 FOR_EACH_FRAME (rest, frame) |
34662
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10782 { |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10783 struct frame *f = XFRAME (frame); |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10784 |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10785 if (FRAME_LIVE_P (f) && FRAME_X_P (f) && FRAME_X_DISPLAY (f)) |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10786 { |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10787 Display *dpy = FRAME_X_DISPLAY (f); |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10788 |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10789 #ifdef USE_X_TOOLKIT |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10790 if (f->output_data.x->widget) |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10791 #else |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10792 if (FRAME_OUTER_WINDOW (f)) |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10793 #endif |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10794 { |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10795 f->output_data.x->hourglass_p = 1; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10796 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10797 if (!f->output_data.x->hourglass_window) |
34662
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10798 { |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10799 unsigned long mask = CWCursor; |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10800 XSetWindowAttributes attrs; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10801 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10802 attrs.cursor = f->output_data.x->hourglass_cursor; |
34662
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10803 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10804 f->output_data.x->hourglass_window |
34662
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10805 = XCreateWindow (dpy, FRAME_OUTER_WINDOW (f), |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10806 0, 0, 32000, 32000, 0, 0, |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10807 InputOnly, |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10808 CopyFromParent, |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10809 mask, &attrs); |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10810 } |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10811 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10812 XMapRaised (dpy, f->output_data.x->hourglass_window); |
34662
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10813 XFlush (dpy); |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10814 } |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10815 } |
d8005f5e0a23
(show_busy_cursor): Check for live frames more
Gerd Moellmann <gerd@gnu.org>
parents:
34638
diff
changeset
|
10816 } |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10817 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10818 hourglass_shown_p = 1; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10819 UNBLOCK_INPUT; |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10820 } |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10821 } |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10822 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10823 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10824 /* Hide the hourglass pointer on all frames, if it is currently |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10825 shown. */ |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10826 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10827 static void |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10828 hide_hourglass () |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10829 { |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10830 if (hourglass_shown_p) |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10831 { |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10832 Lisp_Object rest, frame; |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10833 |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10834 BLOCK_INPUT; |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10835 FOR_EACH_FRAME (rest, frame) |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10836 { |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10837 struct frame *f = XFRAME (frame); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10838 |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10839 if (FRAME_X_P (f) |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10840 /* Watch out for newly created frames. */ |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10841 && f->output_data.x->hourglass_window) |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10842 { |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10843 XUnmapWindow (FRAME_X_DISPLAY (f), |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10844 f->output_data.x->hourglass_window); |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10845 /* Sync here because XTread_socket looks at the |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10846 hourglass_p flag that is reset to zero below. */ |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10847 XSync (FRAME_X_DISPLAY (f), False); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10848 f->output_data.x->hourglass_p = 0; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10849 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10850 } |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10851 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
10852 hourglass_shown_p = 0; |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10853 UNBLOCK_INPUT; |
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
10854 } |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10855 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10856 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10857 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10858 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10859 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10860 Tool tips |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10861 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10862 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10863 static Lisp_Object x_create_tip_frame P_ ((struct x_display_info *, |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10864 Lisp_Object, Lisp_Object)); |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10865 static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object, |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
10866 Lisp_Object, int, int, int *, int *)); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10867 |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
10868 /* The frame of a currently visible tooltip. */ |
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
10869 |
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
10870 Lisp_Object tip_frame; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10871 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10872 /* If non-nil, a timer started that hides the last tooltip when it |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10873 fires. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10874 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10875 Lisp_Object tip_timer; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10876 Window tip_window; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10877 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10878 /* If non-nil, a vector of 3 elements containing the last args |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10879 with which x-show-tip was called. See there. */ |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10880 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10881 Lisp_Object last_show_tip_args; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10882 |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
10883 /* Maximum size for tooltips; a cons (COLUMNS . ROWS). */ |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
10884 |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
10885 Lisp_Object Vx_max_tooltip_size; |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
10886 |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10887 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10888 static Lisp_Object |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10889 unwind_create_tip_frame (frame) |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10890 Lisp_Object frame; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10891 { |
34638
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10892 Lisp_Object deleted; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10893 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10894 deleted = unwind_create_frame (frame); |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10895 if (EQ (deleted, Qt)) |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10896 { |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10897 tip_window = None; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10898 tip_frame = Qnil; |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10899 } |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10900 |
abb4510a89f6
(unwind_create_frame): Return t if frame was deleted.
Gerd Moellmann <gerd@gnu.org>
parents:
34598
diff
changeset
|
10901 return deleted; |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10902 } |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10903 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10904 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10905 /* Create a frame for a tooltip on the display described by DPYINFO. |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10906 PARMS is a list of frame parameters. TEXT is the string to |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10907 display in the tip frame. Value is the frame. |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10908 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10909 Note that functions called here, esp. x_default_parameter can |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10910 signal errors, for instance when a specified color name is |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10911 undefined. We have to make sure that we're in a consistent state |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10912 when this happens. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10913 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10914 static Lisp_Object |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10915 x_create_tip_frame (dpyinfo, parms, text) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10916 struct x_display_info *dpyinfo; |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10917 Lisp_Object parms, text; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10918 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10919 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10920 Lisp_Object frame, tem; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10921 Lisp_Object name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10922 long window_prompting = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10923 int width, height; |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10924 int count = BINDING_STACK_SIZE (); |
25715
feaedc03dbc8
(x_set_background_color): Remove unused variable(s).
Gerd Moellmann <gerd@gnu.org>
parents:
25691
diff
changeset
|
10925 struct gcpro gcpro1, gcpro2, gcpro3; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10926 struct kboard *kb; |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
10927 int face_change_count_before = face_change_count; |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10928 Lisp_Object buffer; |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10929 struct buffer *old_buffer; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10930 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10931 check_x (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10932 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10933 /* Use this general default value to start with until we know if |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10934 this frame has a specified name. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10935 Vx_resource_name = Vinvocation_name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10936 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10937 #ifdef MULTI_KBOARD |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10938 kb = dpyinfo->kboard; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10939 #else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10940 kb = &the_only_kboard; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10941 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10942 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10943 /* Get the name of the frame to use for resource lookup. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10944 name = x_get_arg (dpyinfo, parms, Qname, "name", "Name", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10945 if (!STRINGP (name) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10946 && !EQ (name, Qunbound) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10947 && !NILP (name)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10948 error ("Invalid frame name--not a string or nil"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10949 Vx_resource_name = name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10950 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10951 frame = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10952 GCPRO3 (parms, name, frame); |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
10953 f = make_frame (1); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10954 XSETFRAME (frame, f); |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10955 |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10956 buffer = Fget_buffer_create (build_string (" *tip*")); |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10957 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer); |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10958 old_buffer = current_buffer; |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10959 set_buffer_internal_1 (XBUFFER (buffer)); |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
10960 current_buffer->truncate_lines = Qnil; |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10961 Ferase_buffer (); |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10962 Finsert (1, &text); |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10963 set_buffer_internal_1 (old_buffer); |
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
10964 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10965 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; |
34598
afd90be3ed75
(x_create_tip_frame): Use unwind_create_tip_frame,
Gerd Moellmann <gerd@gnu.org>
parents:
34549
diff
changeset
|
10966 record_unwind_protect (unwind_create_tip_frame, frame); |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10967 |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10968 /* By setting the output method, we're essentially saying that |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10969 the frame is live, as per FRAME_LIVE_P. If we get a signal |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10970 from this point on, x_destroy_window might screw up reference |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10971 counts etc. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10972 f->output_method = output_x_window; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10973 f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10974 bzero (f->output_data.x, sizeof (struct x_output)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10975 f->output_data.x->icon_bitmap = -1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10976 f->output_data.x->fontset = -1; |
29882
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10977 f->output_data.x->scroll_bar_foreground_pixel = -1; |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10978 f->output_data.x->scroll_bar_background_pixel = -1; |
39619
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
10979 #ifdef USE_TOOLKIT_SCROLL_BARS |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
10980 f->output_data.x->scroll_bar_top_shadow_pixel = -1; |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
10981 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; |
1e12db2b25f0
(x_set_scroll_bar_background) [USE_TOOLKIT_SCROLL_BARS]:
Miles Bader <miles@gnu.org>
parents:
39591
diff
changeset
|
10982 #endif /* USE_TOOLKIT_SCROLL_BARS */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10983 f->icon_name = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10984 FRAME_X_DISPLAY_INFO (f) = dpyinfo; |
34895
53e52b3525bf
Use #if GLYPH_DEBUG instead of #ifdef GLYPH_DEBUG.
Gerd Moellmann <gerd@gnu.org>
parents:
34662
diff
changeset
|
10985 #if GLYPH_DEBUG |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10986 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10987 dpyinfo_refcount = dpyinfo->reference_count; |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
10988 #endif /* GLYPH_DEBUG */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10989 #ifdef MULTI_KBOARD |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10990 FRAME_KBOARD (f) = kb; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10991 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10992 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10993 f->output_data.x->explicit_parent = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
10994 |
29882
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10995 /* These colors will be set anyway later, but it's important |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10996 to get the color reference counts right, so initialize them! */ |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10997 { |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10998 Lisp_Object black; |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
10999 struct gcpro gcpro1; |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11000 |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11001 black = build_string ("black"); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11002 GCPRO1 (black); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11003 f->output_data.x->foreground_pixel |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11004 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11005 f->output_data.x->background_pixel |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11006 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11007 f->output_data.x->cursor_pixel |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11008 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11009 f->output_data.x->cursor_foreground_pixel |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11010 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11011 f->output_data.x->border_pixel |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11012 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11013 f->output_data.x->mouse_pixel |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11014 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11015 UNGCPRO; |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11016 } |
c12b0f070cd1
(x_create_tip_frame): Initialize frame's colors like
Gerd Moellmann <gerd@gnu.org>
parents:
29866
diff
changeset
|
11017 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11018 /* Set the name; the functions to which we pass f expect the name to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11019 be set. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11020 if (EQ (name, Qunbound) || NILP (name)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11021 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11022 f->name = build_string (dpyinfo->x_id_name); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11023 f->explicit_name = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11024 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11025 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11026 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11027 f->name = name; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11028 f->explicit_name = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11029 /* use the frame's title when getting resources for this frame. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11030 specbind (Qx_resource_name, name); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11031 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11032 |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
11033 /* Extract the window parameters from the supplied values that are |
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
11034 needed to determine window geometry. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11035 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11036 Lisp_Object font; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11037 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11038 font = x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11039 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11040 BLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11041 /* First, try whatever font the caller has specified. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11042 if (STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11043 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11044 tem = Fquery_fontset (font, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11045 if (STRINGP (tem)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11046 font = x_new_fontset (f, XSTRING (tem)->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11047 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11048 font = x_new_font (f, XSTRING (font)->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11049 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11050 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11051 /* Try out a font which we hope has bold and italic variations. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11052 if (!STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11053 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11054 if (!STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11055 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11056 if (! STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11057 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11058 if (! STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11059 /* This was formerly the first thing tried, but it finds too many fonts |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11060 and takes too long. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11061 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11062 /* If those didn't work, look for something which will at least work. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11063 if (! STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11064 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11065 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11066 if (! STRINGP (font)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11067 font = build_string ("fixed"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11068 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11069 x_default_parameter (f, parms, Qfont, font, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11070 "font", "Font", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11071 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11072 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11073 x_default_parameter (f, parms, Qborder_width, make_number (2), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11074 "borderWidth", "BorderWidth", RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11075 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11076 /* This defaults to 2 in order to match xterm. We recognize either |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11077 internalBorderWidth or internalBorder (which is what xterm calls |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11078 it). */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11079 if (NILP (Fassq (Qinternal_border_width, parms))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11080 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11081 Lisp_Object value; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11082 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11083 value = x_get_arg (dpyinfo, parms, Qinternal_border_width, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11084 "internalBorder", "internalBorder", RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11085 if (! EQ (value, Qunbound)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11086 parms = Fcons (Fcons (Qinternal_border_width, value), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11087 parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11088 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11089 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11090 x_default_parameter (f, parms, Qinternal_border_width, make_number (1), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11091 "internalBorderWidth", "internalBorderWidth", |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11092 RES_TYPE_NUMBER); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11093 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11094 /* Also do the stuff which must be set before the window exists. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11095 x_default_parameter (f, parms, Qforeground_color, build_string ("black"), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11096 "foreground", "Foreground", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11097 x_default_parameter (f, parms, Qbackground_color, build_string ("white"), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11098 "background", "Background", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11099 x_default_parameter (f, parms, Qmouse_color, build_string ("black"), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11100 "pointerColor", "Foreground", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11101 x_default_parameter (f, parms, Qcursor_color, build_string ("black"), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11102 "cursorColor", "Foreground", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11103 x_default_parameter (f, parms, Qborder_color, build_string ("black"), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11104 "borderColor", "BorderColor", RES_TYPE_STRING); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11105 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11106 /* Init faces before x_default_parameter is called for scroll-bar |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11107 parameters because that function calls x_set_scroll_bar_width, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11108 which calls change_frame_size, which calls Fset_window_buffer, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11109 which runs hooks, which call Fvertical_motion. At the end, we |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11110 end up in init_iterator with a null face cache, which should not |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11111 happen. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11112 init_frame_faces (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11113 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11114 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11115 window_prompting = x_figure_window_size (f, parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11116 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11117 if (window_prompting & XNegative) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11118 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11119 if (window_prompting & YNegative) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11120 f->output_data.x->win_gravity = SouthEastGravity; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11121 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11122 f->output_data.x->win_gravity = NorthEastGravity; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11123 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11124 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11125 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11126 if (window_prompting & YNegative) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11127 f->output_data.x->win_gravity = SouthWestGravity; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11128 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11129 f->output_data.x->win_gravity = NorthWestGravity; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11130 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11131 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11132 f->output_data.x->size_hint_flags = window_prompting; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11133 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11134 XSetWindowAttributes attrs; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11135 unsigned long mask; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11136 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11137 BLOCK_INPUT; |
33657
e9cf01c7cda6
(x_create_tip_frame): Use CWSaveUnder only if the
Gerd Moellmann <gerd@gnu.org>
parents:
33601
diff
changeset
|
11138 mask = CWBackPixel | CWOverrideRedirect | CWEventMask; |
e9cf01c7cda6
(x_create_tip_frame): Use CWSaveUnder only if the
Gerd Moellmann <gerd@gnu.org>
parents:
33601
diff
changeset
|
11139 if (DoesSaveUnders (dpyinfo->screen)) |
e9cf01c7cda6
(x_create_tip_frame): Use CWSaveUnder only if the
Gerd Moellmann <gerd@gnu.org>
parents:
33601
diff
changeset
|
11140 mask |= CWSaveUnder; |
e9cf01c7cda6
(x_create_tip_frame): Use CWSaveUnder only if the
Gerd Moellmann <gerd@gnu.org>
parents:
33601
diff
changeset
|
11141 |
27987
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
11142 /* Window managers look at the override-redirect flag to determine |
ce9edc646960
(x_defined_color, x_set_mouse_color, lookup_rgb_color)
Gerd Moellmann <gerd@gnu.org>
parents:
27963
diff
changeset
|
11143 whether or net to give windows a decoration (Xlib spec, chapter |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11144 3.2.8). */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11145 attrs.override_redirect = True; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11146 attrs.save_under = True; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11147 attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11148 /* Arrange for getting MapNotify and UnmapNotify events. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11149 attrs.event_mask = StructureNotifyMask; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11150 tip_window |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11151 = FRAME_X_WINDOW (f) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11152 = XCreateWindow (FRAME_X_DISPLAY (f), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11153 FRAME_X_DISPLAY_INFO (f)->root_window, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11154 /* x, y, width, height */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11155 0, 0, 1, 1, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11156 /* Border. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11157 1, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11158 CopyFromParent, InputOutput, CopyFromParent, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11159 mask, &attrs); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11160 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11161 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11162 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11163 x_make_gc (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11164 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11165 x_default_parameter (f, parms, Qauto_raise, Qnil, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11166 "autoRaise", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11167 x_default_parameter (f, parms, Qauto_lower, Qnil, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11168 "autoLower", "AutoRaiseLower", RES_TYPE_BOOLEAN); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11169 x_default_parameter (f, parms, Qcursor_type, Qbox, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11170 "cursorType", "CursorType", RES_TYPE_SYMBOL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11171 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11172 /* Dimensions, especially f->height, must be done via change_frame_size. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11173 Change will not be effected unless different from the current |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11174 f->height. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11175 width = f->width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11176 height = f->height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11177 f->height = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11178 SET_FRAME_WIDTH (f, 0); |
25363
bf0488244270
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25335
diff
changeset
|
11179 change_frame_size (f, height, width, 1, 0, 0); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11180 |
35042
3088c9745e92
(x_create_tip_frame): Call face-set-after-frame-default,
Gerd Moellmann <gerd@gnu.org>
parents:
34976
diff
changeset
|
11181 /* Set up faces after all frame parameters are known. This call |
35508
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11182 also merges in face attributes specified for new frames. |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11183 |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11184 Frame parameters may be changed if .Xdefaults contains |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11185 specifications for the default font. For example, if there is an |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11186 `Emacs.default.attributeBackground: pink', the `background-color' |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11187 attribute of the frame get's set, which let's the internal border |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11188 of the tooltip frame appear in pink. Prevent this. */ |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11189 { |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11190 Lisp_Object bg = Fframe_parameter (frame, Qbackground_color); |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11191 |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11192 /* Set tip_frame here, so that */ |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11193 tip_frame = frame; |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11194 call1 (Qface_set_after_frame_default, frame); |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11195 |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11196 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color))) |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11197 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg), |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11198 Qnil)); |
0bd627ce1af8
(x_create_tip_frame): Prevent changing the tooltip's
Gerd Moellmann <gerd@gnu.org>
parents:
35402
diff
changeset
|
11199 } |
35042
3088c9745e92
(x_create_tip_frame): Call face-set-after-frame-default,
Gerd Moellmann <gerd@gnu.org>
parents:
34976
diff
changeset
|
11200 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11201 f->no_split = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11202 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11203 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11204 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11205 /* It is now ok to make the frame official even if we get an error |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11206 below. And the frame needs to be on Vframe_list or making it |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11207 visible won't work. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11208 Vframe_list = Fcons (frame, Vframe_list); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11209 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11210 /* Now that the frame is official, it counts as a reference to |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11211 its display. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11212 FRAME_X_DISPLAY_INFO (f)->reference_count++; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11213 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11214 /* Setting attributes of faces of the tooltip frame from resources |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11215 and similar will increment face_change_count, which leads to the |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11216 clearing of all current matrices. Since this isn't necessary |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11217 here, avoid it by resetting face_change_count to the value it |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11218 had before we created the tip frame. */ |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11219 face_change_count = face_change_count_before; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11220 |
34524
d4b8782e7f7b
(image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
Gerd Moellmann <gerd@gnu.org>
parents:
34512
diff
changeset
|
11221 /* Discard the unwind_protect. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11222 return unbind_to (count, frame); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11223 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11224 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11225 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11226 /* Compute where to display tip frame F. PARMS is the list of frame |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11227 parameters for F. DX and DY are specified offsets from the current |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11228 location of the mouse. WIDTH and HEIGHT are the width and height |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11229 of the tooltip. Return coordinates relative to the root window of |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11230 the display in *ROOT_X, and *ROOT_Y. */ |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11231 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11232 static void |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11233 compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y) |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11234 struct frame *f; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11235 Lisp_Object parms, dx, dy; |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11236 int width, height; |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11237 int *root_x, *root_y; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11238 { |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11239 Lisp_Object left, top; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11240 int win_x, win_y; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11241 Window root, child; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11242 unsigned pmask; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11243 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11244 /* User-specified position? */ |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11245 left = Fcdr (Fassq (Qleft, parms)); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11246 top = Fcdr (Fassq (Qtop, parms)); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11247 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11248 /* Move the tooltip window where the mouse pointer is. Resize and |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11249 show it. */ |
41449
4416668397d7
(compute_tip_xy): Initialize root_x and root_y from
Jason Rumney <jasonr@gnu.org>
parents:
41132
diff
changeset
|
11250 if (!INTEGERP (left) || !INTEGERP (top)) |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11251 { |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11252 BLOCK_INPUT; |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11253 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11254 &root, &child, root_x, root_y, &win_x, &win_y, &pmask); |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11255 UNBLOCK_INPUT; |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11256 } |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11257 |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11258 if (INTEGERP (top)) |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11259 *root_y = XINT (top); |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11260 else if (*root_y + XINT (dy) - height < 0) |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11261 *root_y -= XINT (dy); |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11262 else |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11263 { |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11264 *root_y -= height; |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11265 *root_y += XINT (dy); |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11266 } |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11267 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11268 if (INTEGERP (left)) |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11269 *root_x = XINT (left); |
42247
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11270 else if (*root_x + XINT (dx) + width <= FRAME_X_DISPLAY_INFO (f)->width) |
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11271 /* It fits to the right of the pointer. */ |
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11272 *root_x += XINT (dx); |
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11273 else if (width + XINT (dx) <= *root_x) |
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11274 /* It fits to the left of the pointer. */ |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11275 *root_x -= width + XINT (dx); |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11276 else |
42247
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11277 /* Put it left-justified on the screen--it ought to fit that way. */ |
35dd407f04cd
(compute_tip_xy): If tooltip won't fit on the screen
Richard M. Stallman <rms@gnu.org>
parents:
42123
diff
changeset
|
11278 *root_x = 0; |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11279 } |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11280 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11281 |
30224
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11282 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11283 doc: /* Show STRING in a "tooltip" window on frame FRAME. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11284 A tooltip window is a small X window displaying a string. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11285 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11286 FRAME nil or omitted means use the selected frame. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11287 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11288 PARMS is an optional list of frame parameters which can be used to |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11289 change the tooltip's appearance. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11290 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11291 Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11292 means use the default timeout of 5 seconds. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11293 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11294 If the list of frame parameters PARAMS contains a `left' parameters, |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11295 the tooltip is displayed at that x-position. Otherwise it is |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11296 displayed at the mouse position, with offset DX added (default is 5 if |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11297 DX isn't specified). Likewise for the y-position; if a `top' frame |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11298 parameter is specified, it determines the y-position of the tooltip |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11299 window, otherwise it is displayed at the mouse position, with offset |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11300 DY added (default is -10). |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11301 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11302 A tooltip's maximum size is specified by `x-max-tooltip-size'. |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11303 Text larger than the specified size is clipped. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11304 (string, frame, parms, timeout, dx, dy) |
30224
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11305 Lisp_Object string, frame, parms, timeout, dx, dy; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11306 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11307 struct frame *f; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11308 struct window *w; |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11309 int root_x, root_y; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11310 struct buffer *old_buffer; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11311 struct text_pos pos; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11312 int i, width, height; |
26980
f0d5e95ccce9
(Fx_show_tip): Gcpro `timeout' too.
Dave Love <fx@gnu.org>
parents:
26978
diff
changeset
|
11313 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11314 int old_windows_or_buffers_changed = windows_or_buffers_changed; |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11315 int count = BINDING_STACK_SIZE (); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11316 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11317 specbind (Qinhibit_redisplay, Qt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11318 |
26980
f0d5e95ccce9
(Fx_show_tip): Gcpro `timeout' too.
Dave Love <fx@gnu.org>
parents:
26978
diff
changeset
|
11319 GCPRO4 (string, parms, frame, timeout); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11320 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
11321 CHECK_STRING (string); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11322 f = check_x_frame (frame); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11323 if (NILP (timeout)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11324 timeout = make_number (5); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11325 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
11326 CHECK_NATNUM (timeout); |
30224
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11327 |
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11328 if (NILP (dx)) |
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11329 dx = make_number (5); |
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11330 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
11331 CHECK_NUMBER (dx); |
30224
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11332 |
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11333 if (NILP (dy)) |
33589
5832e9020859
(Fx_show_tip): Use default y-offset of -10 so that
Gerd Moellmann <gerd@gnu.org>
parents:
33443
diff
changeset
|
11334 dy = make_number (-10); |
30224
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11335 else |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
11336 CHECK_NUMBER (dy); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11337 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11338 if (NILP (last_show_tip_args)) |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11339 last_show_tip_args = Fmake_vector (make_number (3), Qnil); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11340 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11341 if (!NILP (tip_frame)) |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11342 { |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11343 Lisp_Object last_string = AREF (last_show_tip_args, 0); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11344 Lisp_Object last_frame = AREF (last_show_tip_args, 1); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11345 Lisp_Object last_parms = AREF (last_show_tip_args, 2); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11346 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11347 if (EQ (frame, last_frame) |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11348 && !NILP (Fequal (last_string, string)) |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11349 && !NILP (Fequal (last_parms, parms))) |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11350 { |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11351 struct frame *f = XFRAME (tip_frame); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11352 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11353 /* Only DX and DY have changed. */ |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11354 if (!NILP (tip_timer)) |
35402
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11355 { |
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11356 Lisp_Object timer = tip_timer; |
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11357 tip_timer = Qnil; |
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11358 call1 (Qcancel_timer, timer); |
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11359 } |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11360 |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11361 BLOCK_INPUT; |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11362 compute_tip_xy (f, parms, dx, dy, PIXEL_WIDTH (f), |
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11363 PIXEL_HEIGHT (f), &root_x, &root_y); |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11364 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11365 root_x, root_y); |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11366 UNBLOCK_INPUT; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11367 goto start_timer; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11368 } |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11369 } |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11370 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11371 /* Hide a previous tip, if any. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11372 Fx_hide_tip (); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11373 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11374 ASET (last_show_tip_args, 0, string); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11375 ASET (last_show_tip_args, 1, frame); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11376 ASET (last_show_tip_args, 2, parms); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11377 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11378 /* Add default values to frame parameters. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11379 if (NILP (Fassq (Qname, parms))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11380 parms = Fcons (Fcons (Qname, build_string ("tooltip")), parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11381 if (NILP (Fassq (Qinternal_border_width, parms))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11382 parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11383 if (NILP (Fassq (Qborder_width, parms))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11384 parms = Fcons (Fcons (Qborder_width, make_number (1)), parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11385 if (NILP (Fassq (Qborder_color, parms))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11386 parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11387 if (NILP (Fassq (Qbackground_color, parms))) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11388 parms = Fcons (Fcons (Qbackground_color, build_string ("lightyellow")), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11389 parms); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11390 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11391 /* Create a frame for the tooltip, and record it in the global |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11392 variable tip_frame. */ |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
11393 frame = x_create_tip_frame (FRAME_X_DISPLAY_INFO (f), parms, string); |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11394 f = XFRAME (frame); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11395 |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11396 /* Set up the frame's root window. */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11397 w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11398 w->left = w->top = make_number (0); |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11399 |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11400 if (CONSP (Vx_max_tooltip_size) |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11401 && INTEGERP (XCAR (Vx_max_tooltip_size)) |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11402 && XINT (XCAR (Vx_max_tooltip_size)) > 0 |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11403 && INTEGERP (XCDR (Vx_max_tooltip_size)) |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11404 && XINT (XCDR (Vx_max_tooltip_size)) > 0) |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11405 { |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11406 w->width = XCAR (Vx_max_tooltip_size); |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11407 w->height = XCDR (Vx_max_tooltip_size); |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11408 } |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11409 else |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11410 { |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11411 w->width = make_number (80); |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11412 w->height = make_number (40); |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11413 } |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11414 |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11415 f->window_width = XINT (w->width); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11416 adjust_glyphs (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11417 w->pseudo_window_p = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11418 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11419 /* Display the tooltip text in a temporary buffer. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11420 old_buffer = current_buffer; |
36869
a9cbe17061fc
(x_create_tip_frame): Add parameter TEXT. Set the
Gerd Moellmann <gerd@gnu.org>
parents:
36594
diff
changeset
|
11421 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11422 current_buffer->truncate_lines = Qnil; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11423 clear_glyph_matrix (w->desired_matrix); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11424 clear_glyph_matrix (w->current_matrix); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11425 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11426 try_window (FRAME_ROOT_WINDOW (f), pos); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11427 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11428 /* Compute width and height of the tooltip. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11429 width = height = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11430 for (i = 0; i < w->desired_matrix->nrows; ++i) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11431 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11432 struct glyph_row *row = &w->desired_matrix->rows[i]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11433 struct glyph *last; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11434 int row_width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11435 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11436 /* Stop at the first empty row at the end. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11437 if (!row->enabled_p || !row->displays_text_p) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11438 break; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11439 |
25082
ba6bf065b287
(x_create_tip_frame): Don't set bitmapIcon resource.
Gerd Moellmann <gerd@gnu.org>
parents:
25075
diff
changeset
|
11440 /* Let the row go over the full width of the frame. */ |
ba6bf065b287
(x_create_tip_frame): Don't set bitmapIcon resource.
Gerd Moellmann <gerd@gnu.org>
parents:
25075
diff
changeset
|
11441 row->full_width_p = 1; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11442 |
28410
2812a333e746
(free_image_cache): Free the cache structure itself
Gerd Moellmann <gerd@gnu.org>
parents:
28355
diff
changeset
|
11443 /* There's a glyph at the end of rows that is used to place |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11444 the cursor there. Don't include the width of this glyph. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11445 if (row->used[TEXT_AREA]) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11446 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11447 last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11448 row_width = row->pixel_width - last->pixel_width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11449 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11450 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11451 row_width = row->pixel_width; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11452 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11453 height += row->height; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11454 width = max (width, row_width); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11455 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11456 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11457 /* Add the frame's internal border to the width and height the X |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11458 window should have. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11459 height += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11460 width += 2 * FRAME_INTERNAL_BORDER_WIDTH (f); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11461 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11462 /* Move the tooltip window where the mouse pointer is. Resize and |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11463 show it. */ |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11464 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11465 |
30224
b9f781194989
(Fx_show_tip): If frame parameters contain a position,
Gerd Moellmann <gerd@gnu.org>
parents:
29947
diff
changeset
|
11466 BLOCK_INPUT; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11467 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
37253
7c3a00620335
(compute_tip_xy): Add parameters WIDTH and HEIGHT.
Gerd Moellmann <gerd@gnu.org>
parents:
37210
diff
changeset
|
11468 root_x, root_y, width, height); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11469 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11470 UNBLOCK_INPUT; |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11471 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11472 /* Draw into the window. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11473 w->must_be_updated_p = 1; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11474 update_single_window (w, 1); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11475 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11476 /* Restore original current buffer. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11477 set_buffer_internal_1 (old_buffer); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11478 windows_or_buffers_changed = old_windows_or_buffers_changed; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11479 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
11480 start_timer: |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11481 /* Let the tip disappear after timeout seconds. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11482 tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11483 intern ("x-hide-tip")); |
26954
e388d69f4269
(Fx_show_tip): Add missing UNGCPRO.
Dave Love <fx@gnu.org>
parents:
26876
diff
changeset
|
11484 |
e388d69f4269
(Fx_show_tip): Add missing UNGCPRO.
Dave Love <fx@gnu.org>
parents:
26876
diff
changeset
|
11485 UNGCPRO; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11486 return unbind_to (count, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11487 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11488 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11489 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11490 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11491 doc: /* Hide the current tooltip window, if there is any. |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11492 Value is t if tooltip was open, nil otherwise. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11493 () |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11494 { |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11495 int count; |
34476 | 11496 Lisp_Object deleted, frame, timer; |
11497 struct gcpro gcpro1, gcpro2; | |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11498 |
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11499 /* Return quickly if nothing to do. */ |
34476 | 11500 if (NILP (tip_timer) && NILP (tip_frame)) |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11501 return Qnil; |
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11502 |
34476 | 11503 frame = tip_frame; |
11504 timer = tip_timer; | |
11505 GCPRO2 (frame, timer); | |
11506 tip_frame = tip_timer = deleted = Qnil; | |
11507 | |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11508 count = BINDING_STACK_SIZE (); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11509 specbind (Qinhibit_redisplay, Qt); |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11510 specbind (Qinhibit_quit, Qt); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11511 |
34476 | 11512 if (!NILP (timer)) |
35402
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11513 call1 (Qcancel_timer, timer); |
34476 | 11514 |
11515 if (FRAMEP (frame)) | |
11516 { | |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11517 Fdelete_frame (frame, Qnil); |
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11518 deleted = Qt; |
33713
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11519 |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11520 #ifdef USE_LUCID |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11521 /* Bloodcurdling hack alert: The Lucid menu bar widget's |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11522 redisplay procedure is not called when a tip frame over menu |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11523 items is unmapped. Redisplay the menu manually... */ |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11524 { |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11525 struct frame *f = SELECTED_FRAME (); |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11526 Widget w = f->output_data.x->menubar_widget; |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11527 extern void xlwmenu_redisplay P_ ((Widget)); |
39675 | 11528 |
33713
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11529 if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) |
36441
861557fe5809
(Fx_hide_tip): Don't use `None' with widgets; use
Gerd Moellmann <gerd@gnu.org>
parents:
36252
diff
changeset
|
11530 && w != NULL) |
33713
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11531 { |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11532 BLOCK_INPUT; |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11533 xlwmenu_redisplay (w); |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11534 UNBLOCK_INPUT; |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11535 } |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11536 } |
91b2daa9479f
(Fx_hide_tip) [USE_LUCID]: Add a hack to redisplay
Gerd Moellmann <gerd@gnu.org>
parents:
33657
diff
changeset
|
11537 #endif /* USE_LUCID */ |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11538 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11539 |
34476 | 11540 UNGCPRO; |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
11541 return unbind_to (count, deleted); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11542 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11543 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11544 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11545 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11546 /*********************************************************************** |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11547 File selection dialog |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11548 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11549 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11550 #ifdef USE_MOTIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11551 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11552 /* Callback for "OK" and "Cancel" on file selection dialog. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11553 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11554 static void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11555 file_dialog_cb (widget, client_data, call_data) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11556 Widget widget; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11557 XtPointer call_data, client_data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11558 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11559 int *result = (int *) client_data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11560 XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11561 *result = cb->reason; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11562 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11563 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11564 |
37556
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11565 /* Callback for unmapping a file selection dialog. This is used to |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11566 capture the case where a dialog is closed via a window manager's |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11567 closer button, for example. Using a XmNdestroyCallback didn't work |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11568 in this case. */ |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11569 |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11570 static void |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11571 file_dialog_unmap_cb (widget, client_data, call_data) |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11572 Widget widget; |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11573 XtPointer call_data, client_data; |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11574 { |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11575 int *result = (int *) client_data; |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11576 *result = XmCR_CANCEL; |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11577 } |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11578 |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11579 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11580 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 4, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11581 doc: /* Read file name, prompting with PROMPT in directory DIR. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11582 Use a file selection dialog. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11583 Select DEFAULT-FILENAME in the dialog's file selection box, if |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11584 specified. Don't let the user enter a file name in the file |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11585 selection dialog's entry field, if MUSTMATCH is non-nil. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11586 (prompt, dir, default_filename, mustmatch) |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11587 Lisp_Object prompt, dir, default_filename, mustmatch; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11588 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11589 int result; |
25679
8b09c5927f1c
(QCfile): Moved to xdisp.c.
Gerd Moellmann <gerd@gnu.org>
parents:
25646
diff
changeset
|
11590 struct frame *f = SELECTED_FRAME (); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11591 Lisp_Object file = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11592 Widget dialog, text, list, help; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11593 Arg al[10]; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11594 int ac = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11595 extern XtAppContext Xt_app_con; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11596 XmString dir_xmstring, pattern_xmstring; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11597 int count = specpdl_ptr - specpdl; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11598 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11599 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11600 GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
11601 CHECK_STRING (prompt); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40608
diff
changeset
|
11602 CHECK_STRING (dir); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11603 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11604 /* Prevent redisplay. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11605 specbind (Qinhibit_redisplay, Qt); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11606 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11607 BLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11608 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11609 /* Create the dialog with PROMPT as title, using DIR as initial |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11610 directory and using "*" as pattern. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11611 dir = Fexpand_file_name (dir, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11612 dir_xmstring = XmStringCreateLocalized (XSTRING (dir)->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11613 pattern_xmstring = XmStringCreateLocalized ("*"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11614 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11615 XtSetArg (al[ac], XmNtitle, XSTRING (prompt)->data); ++ac; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11616 XtSetArg (al[ac], XmNdirectory, dir_xmstring); ++ac; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11617 XtSetArg (al[ac], XmNpattern, pattern_xmstring); ++ac; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11618 XtSetArg (al[ac], XmNresizePolicy, XmRESIZE_GROW); ++ac; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11619 XtSetArg (al[ac], XmNdialogStyle, XmDIALOG_APPLICATION_MODAL); ++ac; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11620 dialog = XmCreateFileSelectionDialog (f->output_data.x->widget, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11621 "fsb", al, ac); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11622 XmStringFree (dir_xmstring); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11623 XmStringFree (pattern_xmstring); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11624 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11625 /* Add callbacks for OK and Cancel. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11626 XtAddCallback (dialog, XmNokCallback, file_dialog_cb, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11627 (XtPointer) &result); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11628 XtAddCallback (dialog, XmNcancelCallback, file_dialog_cb, |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11629 (XtPointer) &result); |
37556
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11630 XtAddCallback (dialog, XmNunmapCallback, file_dialog_unmap_cb, |
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11631 (XtPointer) &result); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11632 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11633 /* Disable the help button since we can't display help. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11634 help = XmFileSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11635 XtSetSensitive (help, False); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11636 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11637 /* Mark OK button as default. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11638 XtVaSetValues (XmFileSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON), |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11639 XmNshowAsDefault, True, NULL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11640 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11641 /* If MUSTMATCH is non-nil, disable the file entry field of the |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11642 dialog, so that the user must select a file from the files list |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11643 box. We can't remove it because we wouldn't have a way to get at |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11644 the result file name, then. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11645 text = XmFileSelectionBoxGetChild (dialog, XmDIALOG_TEXT); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11646 if (!NILP (mustmatch)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11647 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11648 Widget label; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11649 label = XmFileSelectionBoxGetChild (dialog, XmDIALOG_SELECTION_LABEL); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11650 XtSetSensitive (text, False); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11651 XtSetSensitive (label, False); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11652 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11653 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11654 /* Manage the dialog, so that list boxes get filled. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11655 XtManageChild (dialog); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11656 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11657 /* Select DEFAULT_FILENAME in the files list box. DEFAULT_FILENAME |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11658 must include the path for this to work. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11659 list = XmFileSelectionBoxGetChild (dialog, XmDIALOG_LIST); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11660 if (STRINGP (default_filename)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11661 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11662 XmString default_xmstring; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11663 int item_pos; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11664 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11665 default_xmstring |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11666 = XmStringCreateLocalized (XSTRING (default_filename)->data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11667 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11668 if (!XmListItemExists (list, default_xmstring)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11669 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11670 /* Add a new item if DEFAULT_FILENAME is not in the list. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11671 XmListAddItem (list, default_xmstring, 0); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11672 item_pos = 0; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11673 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11674 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11675 item_pos = XmListItemPos (list, default_xmstring); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11676 XmStringFree (default_xmstring); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11677 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11678 /* Select the item and scroll it into view. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11679 XmListSelectPos (list, item_pos, True); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11680 XmListSetPos (list, item_pos); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11681 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11682 |
38548
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11683 /* Process events until the user presses Cancel or OK. Block |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11684 and unblock input here so that we get a chance of processing |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11685 expose events. */ |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11686 UNBLOCK_INPUT; |
29866
c31c4d7dd0e0
(Fx_file_dialog) [HAVE_MOTIF_2_1]: Handle events
Gerd Moellmann <gerd@gnu.org>
parents:
29728
diff
changeset
|
11687 result = 0; |
37556
171c0f4964a9
(file_dialog_unmap_cb): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
37253
diff
changeset
|
11688 while (result == 0) |
38548
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11689 { |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11690 BLOCK_INPUT; |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11691 XtAppProcessEvent (Xt_app_con, XtIMAll); |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11692 UNBLOCK_INPUT; |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11693 } |
58603538f196
(Fx_file_dialog): Block/unblock input while processing
Gerd Moellmann <gerd@gnu.org>
parents:
38542
diff
changeset
|
11694 BLOCK_INPUT; |
29866
c31c4d7dd0e0
(Fx_file_dialog) [HAVE_MOTIF_2_1]: Handle events
Gerd Moellmann <gerd@gnu.org>
parents:
29728
diff
changeset
|
11695 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11696 /* Get the result. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11697 if (result == XmCR_OK) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11698 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11699 XmString text; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11700 String data; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11701 |
30573
3bb43339533c
(Fx_file_dialog): Use NULL instead of 0 at the end of
Gerd Moellmann <gerd@gnu.org>
parents:
30383
diff
changeset
|
11702 XtVaGetValues (dialog, XmNtextString, &text, NULL); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11703 XmStringGetLtoR (text, XmFONTLIST_DEFAULT_TAG, &data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11704 XmStringFree (text); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11705 file = build_string (data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11706 XtFree (data); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11707 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11708 else |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11709 file = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11710 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11711 /* Clean up. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11712 XtUnmanageChild (dialog); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11713 XtDestroyWidget (dialog); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11714 UNBLOCK_INPUT; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11715 UNGCPRO; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11716 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11717 /* Make "Cancel" equivalent to C-g. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11718 if (NILP (file)) |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11719 Fsignal (Qquit, Qnil); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11720 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11721 return unbind_to (count, file); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11722 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11723 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11724 #endif /* USE_MOTIF */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11725 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11726 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11727 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11728 /*********************************************************************** |
34549
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11729 Keyboard |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11730 ***********************************************************************/ |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11731 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11732 #ifdef HAVE_XKBGETKEYBOARD |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11733 #include <X11/XKBlib.h> |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11734 #include <X11/keysym.h> |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11735 #endif |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11736 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11737 DEFUN ("x-backspace-delete-keys-p", Fx_backspace_delete_keys_p, |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11738 Sx_backspace_delete_keys_p, 0, 1, 0, |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11739 doc: /* Check if both Backspace and Delete keys are on the keyboard of FRAME. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11740 FRAME nil means use the selected frame. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11741 Value is t if we know that both keys are present, and are mapped to the |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11742 usual X keysyms. */) |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11743 (frame) |
34549
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11744 Lisp_Object frame; |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11745 { |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11746 #ifdef HAVE_XKBGETKEYBOARD |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11747 XkbDescPtr kb; |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11748 struct frame *f = check_x_frame (frame); |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11749 Display *dpy = FRAME_X_DISPLAY (f); |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11750 Lisp_Object have_keys; |
34911
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11751 int major, minor, op, event, error; |
34549
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11752 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11753 BLOCK_INPUT; |
34911
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11754 |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11755 /* Check library version in case we're dynamically linked. */ |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11756 major = XkbMajorVersion; |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11757 minor = XkbMinorVersion; |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11758 if (!XkbLibraryVersion (&major, &minor)) |
35191
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11759 { |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11760 UNBLOCK_INPUT; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11761 return Qnil; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11762 } |
34911
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11763 |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11764 /* Check that the server supports XKB. */ |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11765 major = XkbMajorVersion; |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11766 minor = XkbMinorVersion; |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11767 if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) |
35191
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11768 { |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11769 UNBLOCK_INPUT; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11770 return Qnil; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11771 } |
34911
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11772 |
4cdfcac861d7
(Fx_backspace_delete_keys_p): Check library and server
Gerd Moellmann <gerd@gnu.org>
parents:
34895
diff
changeset
|
11773 have_keys = Qnil; |
35191
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11774 kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); |
34549
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11775 if (kb) |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11776 { |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11777 int delete_keycode = 0, backspace_keycode = 0, i; |
35191
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11778 |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11779 if (XkbGetNames (dpy, XkbAllNamesMask, kb) == Success) |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11780 { |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11781 for (i = kb->min_key_code; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11782 (i < kb->max_key_code |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11783 && (delete_keycode == 0 || backspace_keycode == 0)); |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11784 ++i) |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11785 { |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11786 /* The XKB symbolic key names can be seen most easily in |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11787 the PS file generated by `xkbprint -label name |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
11788 $DISPLAY'. */ |
35191
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11789 if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11790 delete_keycode = i; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11791 else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11792 backspace_keycode = i; |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11793 } |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11794 |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11795 XkbFreeNames (kb, 0, True); |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11796 } |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11797 |
3de883052d49
(Fx_backspace_delete_keys_p): Use XkbGetMap and
Gerd Moellmann <gerd@gnu.org>
parents:
35146
diff
changeset
|
11798 XkbFreeClientMap (kb, 0, True); |
34549
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11799 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11800 if (delete_keycode |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11801 && backspace_keycode |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11802 && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11803 && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode) |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11804 have_keys = Qt; |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11805 } |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11806 UNBLOCK_INPUT; |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11807 return have_keys; |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11808 #else /* not HAVE_XKBGETKEYBOARD */ |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11809 return Qnil; |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11810 #endif /* not HAVE_XKBGETKEYBOARD */ |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11811 } |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11812 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11813 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11814 |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
11815 /*********************************************************************** |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11816 Initialization |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11817 ***********************************************************************/ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11818 |
21846 | 11819 void |
389 | 11820 syms_of_xfns () |
11821 { | |
11822 /* This is zero if not using X windows. */ | |
9653
cfc5e15e0baf
(x_sync): Take frame ptr as arg.
Richard M. Stallman <rms@gnu.org>
parents:
9580
diff
changeset
|
11823 x_in_use = 0; |
9014
7b805f79f3b4
(Fx_list_fonts): Use a cache stored in FRAME_X_SCREEN.
Richard M. Stallman <rms@gnu.org>
parents:
8961
diff
changeset
|
11824 |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11825 /* The section below is built by the lisp expression at the top of the file, |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11826 just above where these variables are declared. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11827 /*&&& init symbols here &&&*/ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11828 Qauto_raise = intern ("auto-raise"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11829 staticpro (&Qauto_raise); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11830 Qauto_lower = intern ("auto-lower"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11831 staticpro (&Qauto_lower); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
11832 Qbar = intern ("bar"); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
11833 staticpro (&Qbar); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11834 Qborder_color = intern ("border-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11835 staticpro (&Qborder_color); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11836 Qborder_width = intern ("border-width"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11837 staticpro (&Qborder_width); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
11838 Qbox = intern ("box"); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
11839 staticpro (&Qbox); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11840 Qcursor_color = intern ("cursor-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11841 staticpro (&Qcursor_color); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
11842 Qcursor_type = intern ("cursor-type"); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1786
diff
changeset
|
11843 staticpro (&Qcursor_type); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11844 Qgeometry = intern ("geometry"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11845 staticpro (&Qgeometry); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11846 Qicon_left = intern ("icon-left"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11847 staticpro (&Qicon_left); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11848 Qicon_top = intern ("icon-top"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11849 staticpro (&Qicon_top); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11850 Qicon_type = intern ("icon-type"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11851 staticpro (&Qicon_type); |
12073 | 11852 Qicon_name = intern ("icon-name"); |
11853 staticpro (&Qicon_name); | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11854 Qinternal_border_width = intern ("internal-border-width"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11855 staticpro (&Qinternal_border_width); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11856 Qleft = intern ("left"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11857 staticpro (&Qleft); |
16254
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
11858 Qright = intern ("right"); |
3e8b16badf3d
(Fx_create_frame): Default Qvertical_scroll_bars to `left'.
Richard M. Stallman <rms@gnu.org>
parents:
16156
diff
changeset
|
11859 staticpro (&Qright); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11860 Qmouse_color = intern ("mouse-color"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11861 staticpro (&Qmouse_color); |
1874
19cf50641d6c
* frame.c (Fframe_parameters): Report the `minibuffer' parameter of
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
11862 Qnone = intern ("none"); |
19cf50641d6c
* frame.c (Fframe_parameters): Report the `minibuffer' parameter of
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
11863 staticpro (&Qnone); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11864 Qparent_id = intern ("parent-id"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11865 staticpro (&Qparent_id); |
8942
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
11866 Qscroll_bar_width = intern ("scroll-bar-width"); |
a43f3b56ed47
(x_set_scroll_bar_width): New function.
Karl Heuer <kwzh@gnu.org>
parents:
8845
diff
changeset
|
11867 staticpro (&Qscroll_bar_width); |
2328
82e4fed9cdd6
* xfns.c (Fx_parse_geometry): Renamed from Fx_geometry.
Jim Blandy <jimb@redhat.com>
parents:
2295
diff
changeset
|
11868 Qsuppress_icon = intern ("suppress-icon"); |
82e4fed9cdd6
* xfns.c (Fx_parse_geometry): Renamed from Fx_geometry.
Jim Blandy <jimb@redhat.com>
parents:
2295
diff
changeset
|
11869 staticpro (&Qsuppress_icon); |
389 | 11870 Qundefined_color = intern ("undefined-color"); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11871 staticpro (&Qundefined_color); |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1932
diff
changeset
|
11872 Qvertical_scroll_bars = intern ("vertical-scroll-bars"); |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1932
diff
changeset
|
11873 staticpro (&Qvertical_scroll_bars); |
2294
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
11874 Qvisibility = intern ("visibility"); |
9bce20507666
Use the `visiblity' parameter to determine the initial state of
Jim Blandy <jimb@redhat.com>
parents:
2283
diff
changeset
|
11875 staticpro (&Qvisibility); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11876 Qwindow_id = intern ("window-id"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11877 staticpro (&Qwindow_id); |
23793
3f48dda0547a
(Qouter_window_id): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23411
diff
changeset
|
11878 Qouter_window_id = intern ("outer-window-id"); |
3f48dda0547a
(Qouter_window_id): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
23411
diff
changeset
|
11879 staticpro (&Qouter_window_id); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11880 Qx_frame_parameter = intern ("x-frame-parameter"); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11881 staticpro (&Qx_frame_parameter); |
5671
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
11882 Qx_resource_name = intern ("x-resource-name"); |
5c597b8fbabe
Find lwlib.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5558
diff
changeset
|
11883 staticpro (&Qx_resource_name); |
7251
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
11884 Quser_position = intern ("user-position"); |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
11885 staticpro (&Quser_position); |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
11886 Quser_size = intern ("user-size"); |
02cc4eee5928
(x_figure_window_size): Set USPosition only if user-position
Richard M. Stallman <rms@gnu.org>
parents:
7209
diff
changeset
|
11887 staticpro (&Quser_size); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11888 Qscroll_bar_foreground = intern ("scroll-bar-foreground"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11889 staticpro (&Qscroll_bar_foreground); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11890 Qscroll_bar_background = intern ("scroll-bar-background"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11891 staticpro (&Qscroll_bar_background); |
25528
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
11892 Qscreen_gamma = intern ("screen-gamma"); |
b5dd1bafd001
Include math.h. Add extern declaration for atof in case
Gerd Moellmann <gerd@gnu.org>
parents:
25511
diff
changeset
|
11893 staticpro (&Qscreen_gamma); |
28690
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
11894 Qline_spacing = intern ("line-spacing"); |
01a3287bb747
(x_set_line_spacing): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
28597
diff
changeset
|
11895 staticpro (&Qline_spacing); |
28787 | 11896 Qcenter = intern ("center"); |
11897 staticpro (&Qcenter); | |
30351
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
11898 Qcompound_text = intern ("compound-text"); |
a67fcab978bb
(x_encode_text): New function.
Kenichi Handa <handa@m17n.org>
parents:
30224
diff
changeset
|
11899 staticpro (&Qcompound_text); |
35402
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11900 Qcancel_timer = intern ("cancel-timer"); |
302fbe91e359
(Qcancel_timer): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
35360
diff
changeset
|
11901 staticpro (&Qcancel_timer); |
38183
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
11902 Qwait_for_wm = intern ("wait-for-wm"); |
3ef7b5a020b2
(Qwait_for_wm): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37946
diff
changeset
|
11903 staticpro (&Qwait_for_wm); |
42721
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11904 Qfullscreen = intern ("fullscreen"); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11905 staticpro (&Qfullscreen); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11906 Qfullwidth = intern ("fullwidth"); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11907 staticpro (&Qfullwidth); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11908 Qfullheight = intern ("fullheight"); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11909 staticpro (&Qfullheight); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11910 Qfullboth = intern ("fullboth"); |
462e0bbae65d
(Qfullscreen, Qfullwidth, Qfullheight, Qfullboth): New variables.
Eli Zaretskii <eliz@gnu.org>
parents:
42247
diff
changeset
|
11911 staticpro (&Qfullboth); |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11912 /* This is the end of symbol initialization. */ |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11913 |
26876 | 11914 /* Text property `display' should be nonsticky by default. */ |
11915 Vtext_property_default_nonsticky | |
11916 = Fcons (Fcons (Qdisplay, Qt), Vtext_property_default_nonsticky); | |
11917 | |
11918 | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11919 Qlaplace = intern ("laplace"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
11920 staticpro (&Qlaplace); |
31633
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11921 Qemboss = intern ("emboss"); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11922 staticpro (&Qemboss); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11923 Qedge_detection = intern ("edge-detection"); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11924 staticpro (&Qedge_detection); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11925 Qheuristic = intern ("heuristic"); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11926 staticpro (&Qheuristic); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11927 QCmatrix = intern (":matrix"); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11928 staticpro (&QCmatrix); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11929 QCcolor_adjustment = intern (":color-adjustment"); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11930 staticpro (&QCcolor_adjustment); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11931 QCmask = intern (":mask"); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11932 staticpro (&QCmask); |
829ed9cc42da
(QCmatrix, QCcolor_adjustment, QCmask, Qemboss)
Gerd Moellmann <gerd@gnu.org>
parents:
31543
diff
changeset
|
11933 |
18631
62bcc6aff013
(x_set_font): Funcall Qface_set_after_frame_default.
Richard M. Stallman <rms@gnu.org>
parents:
18612
diff
changeset
|
11934 Qface_set_after_frame_default = intern ("face-set-after-frame-default"); |
62bcc6aff013
(x_set_font): Funcall Qface_set_after_frame_default.
Richard M. Stallman <rms@gnu.org>
parents:
18612
diff
changeset
|
11935 staticpro (&Qface_set_after_frame_default); |
62bcc6aff013
(x_set_font): Funcall Qface_set_after_frame_default.
Richard M. Stallman <rms@gnu.org>
parents:
18612
diff
changeset
|
11936 |
389 | 11937 Fput (Qundefined_color, Qerror_conditions, |
11938 Fcons (Qundefined_color, Fcons (Qerror, Qnil))); | |
11939 Fput (Qundefined_color, Qerror_message, | |
11940 build_string ("Undefined color")); | |
11941 | |
974
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11942 init_x_parm_symbols (); |
4f88a1b78a46
* xfns.c (x_get_arg): Return Qunbound for an unspecified
Jim Blandy <jimb@redhat.com>
parents:
833
diff
changeset
|
11943 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11944 DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11945 doc: /* Non-nil means always draw a cross over disabled images. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11946 Disabled images are those having an `:conversion disabled' property. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11947 A cross is always drawn on black & white displays. */); |
31651
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
11948 cross_disabled_images = 0; |
aef83f9e7dac
(lookup_image): Build mask before applying an algorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
31637
diff
changeset
|
11949 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11950 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11951 doc: /* List of directories to search for bitmap files for X. */); |
12036
035d4ee6cc80
(syms_of_xfns): Allow PATH_BITMAPS to be a colon-separated list.
Karl Heuer <kwzh@gnu.org>
parents:
12019
diff
changeset
|
11952 Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS); |
9563 | 11953 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11954 DEFVAR_LISP ("x-pointer-shape", &Vx_pointer_shape, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11955 doc: /* The shape of the pointer when over text. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11956 Changing the value does not affect existing frames |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11957 unless you set the mouse color. */); |
389 | 11958 Vx_pointer_shape = Qnil; |
11959 | |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11960 DEFVAR_LISP ("x-resource-name", &Vx_resource_name, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11961 doc: /* The name Emacs uses to look up X resources. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11962 `x-get-resource' uses this as the first component of the instance name |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11963 when requesting resource values. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11964 Emacs initially sets `x-resource-name' to the name under which Emacs |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11965 was invoked, or to the value specified with the `-name' or `-rn' |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11966 switches, if present. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11967 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11968 It may be useful to bind this variable locally around a call |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11969 to `x-get-resource'. See also the variable `x-resource-class'. */); |
4146
0c681748d0ce
* xfns.c (Fx_open_connection): Don't trust HAVE_XRMSETDATABASE;
Jim Blandy <jimb@redhat.com>
parents:
3923
diff
changeset
|
11970 Vx_resource_name = Qnil; |
3170
647229114f47
* xfns.c: Make resource manager work correctly even when
Jim Blandy <jimb@redhat.com>
parents:
3141
diff
changeset
|
11971 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11972 DEFVAR_LISP ("x-resource-class", &Vx_resource_class, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11973 doc: /* The class Emacs uses to look up X resources. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11974 `x-get-resource' uses this as the first component of the instance class |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11975 when requesting resource values. |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11976 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11977 Emacs initially sets `x-resource-class' to "Emacs". |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11978 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11979 Setting this variable permanently is not a reasonable thing to do, |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11980 but binding this variable locally around a call to `x-get-resource' |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11981 is a reasonable practice. See also the variable `x-resource-name'. */); |
16966
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
11982 Vx_resource_class = build_string (EMACS_CLASS); |
df9f838f255a
(Vx_resource_class): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16732
diff
changeset
|
11983 |
7683
be3423efbdce
(Vx_sensitive_text_pointer_shape):
Richard M. Stallman <rms@gnu.org>
parents:
7599
diff
changeset
|
11984 #if 0 /* This doesn't really do anything. */ |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11985 DEFVAR_LISP ("x-nontext-pointer-shape", &Vx_nontext_pointer_shape, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11986 doc: /* The shape of the pointer when not over text. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11987 This variable takes effect when you create a new frame |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11988 or when you set the mouse color. */); |
2936
f9956cdb0d1d
(syms_of_xfns): Don't make Lisp vars
Richard M. Stallman <rms@gnu.org>
parents:
2885
diff
changeset
|
11989 #endif |
389 | 11990 Vx_nontext_pointer_shape = Qnil; |
11991 | |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11992 DEFVAR_LISP ("x-hourglass-pointer-shape", &Vx_hourglass_pointer_shape, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11993 doc: /* The shape of the pointer when Emacs is busy. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11994 This variable takes effect when you create a new frame |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
11995 or when you set the mouse color. */); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
11996 Vx_hourglass_pointer_shape = Qnil; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
11997 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11998 DEFVAR_BOOL ("display-hourglass", &display_hourglass_p, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
11999 doc: /* Non-zero means Emacs displays an hourglass pointer on window systems. */); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
12000 display_hourglass_p = 1; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
12001 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12002 DEFVAR_LISP ("hourglass-delay", &Vhourglass_delay, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12003 doc: /* *Seconds to wait before displaying an hourglass pointer. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12004 Value must be an integer or float. */); |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
12005 Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY); |
27864
ea05cbe65943
(inhibit_busy_cursor, busy_count): Removed.
Gerd Moellmann <gerd@gnu.org>
parents:
27798
diff
changeset
|
12006 |
7683
be3423efbdce
(Vx_sensitive_text_pointer_shape):
Richard M. Stallman <rms@gnu.org>
parents:
7599
diff
changeset
|
12007 #if 0 /* This doesn't really do anything. */ |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12008 DEFVAR_LISP ("x-mode-pointer-shape", &Vx_mode_pointer_shape, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12009 doc: /* The shape of the pointer when over the mode line. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12010 This variable takes effect when you create a new frame |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12011 or when you set the mouse color. */); |
2936
f9956cdb0d1d
(syms_of_xfns): Don't make Lisp vars
Richard M. Stallman <rms@gnu.org>
parents:
2885
diff
changeset
|
12012 #endif |
389 | 12013 Vx_mode_pointer_shape = Qnil; |
12014 | |
16396
4e4cc27b2a2a
(x_set_internal_border_width): Only change
Richard M. Stallman <rms@gnu.org>
parents:
16357
diff
changeset
|
12015 DEFVAR_LISP ("x-sensitive-text-pointer-shape", |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12016 &Vx_sensitive_text_pointer_shape, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12017 doc: /* The shape of the pointer when over mouse-sensitive text. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12018 This variable takes effect when you create a new frame |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12019 or when you set the mouse color. */); |
7683
be3423efbdce
(Vx_sensitive_text_pointer_shape):
Richard M. Stallman <rms@gnu.org>
parents:
7599
diff
changeset
|
12020 Vx_sensitive_text_pointer_shape = Qnil; |
6759
e0938c42218c
(syms_of_xfns): Define Vx_cross_pointer_shape.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6610
diff
changeset
|
12021 |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
12022 DEFVAR_LISP ("x-window-horizontal-drag-cursor", |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12023 &Vx_window_horizontal_drag_shape, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12024 doc: /* Pointer shape to use for indicating a window can be dragged horizontally. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12025 This variable takes effect when you create a new frame |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12026 or when you set the mouse color. */); |
33960
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
12027 Vx_window_horizontal_drag_shape = Qnil; |
1f92a2d65681
(Vx_window_horizontal_drag_shape): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
33747
diff
changeset
|
12028 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12029 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12030 doc: /* A string indicating the foreground color of the cursor box. */); |
389 | 12031 Vx_cursor_fore_pixel = Qnil; |
12032 | |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12033 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12034 doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS). |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12035 Text larger than this is clipped. */); |
38574
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
12036 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40)); |
79a0d7b341b3
(Vx_max_tooltip_size): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
38548
diff
changeset
|
12037 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12038 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12039 doc: /* Non-nil if no X window manager is in use. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12040 Emacs doesn't try to figure this out; this is always nil |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12041 unless you set it to something else. */); |
12209
5537ed125771
(syms_of_xfns): Initialize Vx_no_window_manager. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12190
diff
changeset
|
12042 /* We don't have any way to find this out, so set it to nil |
5537ed125771
(syms_of_xfns): Initialize Vx_no_window_manager. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12190
diff
changeset
|
12043 and maybe the user would like to set it to t. */ |
5537ed125771
(syms_of_xfns): Initialize Vx_no_window_manager. Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12190
diff
changeset
|
12044 Vx_no_window_manager = Qnil; |
8170
d92a24366b22
(x_toolkit): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8103
diff
changeset
|
12045 |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12046 DEFVAR_LISP ("x-pixel-size-width-font-regexp", |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12047 &Vx_pixel_size_width_font_regexp, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12048 doc: /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12049 |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12050 Since Emacs gets width of a font matching with this regexp from |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12051 PIXEL_SIZE field of the name, font finding mechanism gets faster for |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12052 such a font. This is especially effective for such large fonts as |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12053 Chinese, Japanese, and Korean. */); |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12054 Vx_pixel_size_width_font_regexp = Qnil; |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12055 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12056 DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12057 doc: /* Time after which cached images are removed from the cache. |
39905
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12058 When an image has not been displayed this many seconds, remove it |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12059 from the image cache. Value must be an integer or nil with nil |
542a86892257
Put doc strings in comments.
Gerd Moellmann <gerd@gnu.org>
parents:
39862
diff
changeset
|
12060 meaning don't clear the cache. */); |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
12061 Vimage_cache_eviction_delay = make_number (30 * 60); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12062 |
8170
d92a24366b22
(x_toolkit): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8103
diff
changeset
|
12063 #ifdef USE_X_TOOLKIT |
39862
da336e9d1ab5
(syms_of_xfns): Update calls to Fprovide.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39812
diff
changeset
|
12064 Fprovide (intern ("x-toolkit"), Qnil); |
12094
a9fda5417acf
(syms_of_xfns): Provide motif in Motif version.
Karl Heuer <kwzh@gnu.org>
parents:
12080
diff
changeset
|
12065 #ifdef USE_MOTIF |
39862
da336e9d1ab5
(syms_of_xfns): Update calls to Fprovide.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39812
diff
changeset
|
12066 Fprovide (intern ("motif"), Qnil); |
37210
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
12067 |
39988
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12068 DEFVAR_LISP ("motif-version-string", &Vmotif_version_string, |
eac4e9ae201c
Change doc-string comments to `new style' [w/`doc:' keyword].
Miles Bader <miles@gnu.org>
parents:
39907
diff
changeset
|
12069 doc: /* Version info for LessTif/Motif. */); |
37210
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
12070 Vmotif_version_string = build_string (XmVERSION_STRING); |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
12071 #endif /* USE_MOTIF */ |
8b47704e0150
(Vmotif_version_string) [USE_MOTIF]: New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
37173
diff
changeset
|
12072 #endif /* USE_X_TOOLKIT */ |
389 | 12073 |
12074 defsubr (&Sx_get_resource); | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12075 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12076 /* X window properties. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12077 defsubr (&Sx_change_window_property); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12078 defsubr (&Sx_delete_window_property); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12079 defsubr (&Sx_window_property); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12080 |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
12081 defsubr (&Sxw_display_color_p); |
8779
12c6296bbb4b
(Fx_display_grayscale_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
8758
diff
changeset
|
12082 defsubr (&Sx_display_grayscale_p); |
26729
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
12083 defsubr (&Sxw_color_defined_p); |
f5dded41adcc
Changes for automatic remapping of X colors on terminal frames:
Eli Zaretskii <eliz@gnu.org>
parents:
26571
diff
changeset
|
12084 defsubr (&Sxw_color_values); |
4279 | 12085 defsubr (&Sx_server_max_request_size); |
2276
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12086 defsubr (&Sx_server_vendor); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12087 defsubr (&Sx_server_version); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12088 defsubr (&Sx_display_pixel_width); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12089 defsubr (&Sx_display_pixel_height); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12090 defsubr (&Sx_display_mm_width); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12091 defsubr (&Sx_display_mm_height); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12092 defsubr (&Sx_display_screens); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12093 defsubr (&Sx_display_planes); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12094 defsubr (&Sx_display_color_cells); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12095 defsubr (&Sx_display_visual_class); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12096 defsubr (&Sx_display_backing_store); |
68328c3af38f
(x_screen): Make this var file scope.
Richard M. Stallman <rms@gnu.org>
parents:
2197
diff
changeset
|
12097 defsubr (&Sx_display_save_under); |
2328
82e4fed9cdd6
* xfns.c (Fx_parse_geometry): Renamed from Fx_geometry.
Jim Blandy <jimb@redhat.com>
parents:
2295
diff
changeset
|
12098 defsubr (&Sx_parse_geometry); |
771 | 12099 defsubr (&Sx_create_frame); |
389 | 12100 defsubr (&Sx_open_connection); |
9690
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
12101 defsubr (&Sx_close_connection); |
f6d4e1acb5a1
(Fx_create_frame): Don't increment refernce_count
Richard M. Stallman <rms@gnu.org>
parents:
9653
diff
changeset
|
12102 defsubr (&Sx_display_list); |
389 | 12103 defsubr (&Sx_synchronize); |
28044
88db4c84b6fd
Remove a buch of really old code in #if 0.
Gerd Moellmann <gerd@gnu.org>
parents:
28010
diff
changeset
|
12104 defsubr (&Sx_focus_frame); |
34549
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
12105 defsubr (&Sx_backspace_delete_keys_p); |
708ea44ef3c0
(Fx_backspace_delete_keys_p): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
34524
diff
changeset
|
12106 |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12107 /* Setting callback functions for fontset handler. */ |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12108 get_font_info_func = x_get_font_info; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12109 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12110 #if 0 /* This function pointer doesn't seem to be used anywhere. |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12111 And the pointer assigned has the wrong type, anyway. */ |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12112 list_fonts_func = x_list_fonts; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12113 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12114 |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12115 load_font_func = x_load_font; |
21549
3b63301ea296
(syms_of_xfns): Initialize find_ccl_program_func.
Kenichi Handa <handa@m17n.org>
parents:
21536
diff
changeset
|
12116 find_ccl_program_func = x_find_ccl_program; |
17048
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12117 query_font_func = x_query_font; |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12118 set_frame_fontset_func = x_set_font; |
2da4e24ceee5
Include charset.h and fontset.h.
Karl Heuer <kwzh@gnu.org>
parents:
16966
diff
changeset
|
12119 check_window_system_func = check_x; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12120 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12121 /* Images. */ |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12122 Qxbm = intern ("xbm"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12123 staticpro (&Qxbm); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12124 QCtype = intern (":type"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12125 staticpro (&QCtype); |
35360
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
12126 QCconversion = intern (":conversion"); |
ba490eed8f66
(QCconversion): Replaces QCalgorithm.
Gerd Moellmann <gerd@gnu.org>
parents:
35275
diff
changeset
|
12127 staticpro (&QCconversion); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12128 QCheuristic_mask = intern (":heuristic-mask"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12129 staticpro (&QCheuristic_mask); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12130 QCcolor_symbols = intern (":color-symbols"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12131 staticpro (&QCcolor_symbols); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12132 QCascent = intern (":ascent"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12133 staticpro (&QCascent); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12134 QCmargin = intern (":margin"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12135 staticpro (&QCmargin); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12136 QCrelief = intern (":relief"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12137 staticpro (&QCrelief); |
25628
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
12138 Qpostscript = intern ("postscript"); |
98e238950125
(x_build_heuristic_mask): Accept a list `(R G B)'
Gerd Moellmann <gerd@gnu.org>
parents:
25620
diff
changeset
|
12139 staticpro (&Qpostscript); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12140 QCloader = intern (":loader"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12141 staticpro (&QCloader); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12142 QCbounding_box = intern (":bounding-box"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12143 staticpro (&QCbounding_box); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12144 QCpt_width = intern (":pt-width"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12145 staticpro (&QCpt_width); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12146 QCpt_height = intern (":pt-height"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12147 staticpro (&QCpt_height); |
25620 | 12148 QCindex = intern (":index"); |
12149 staticpro (&QCindex); | |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12150 Qpbm = intern ("pbm"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12151 staticpro (&Qpbm); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12152 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12153 #if HAVE_XPM |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12154 Qxpm = intern ("xpm"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12155 staticpro (&Qxpm); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12156 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12157 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12158 #if HAVE_JPEG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12159 Qjpeg = intern ("jpeg"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12160 staticpro (&Qjpeg); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12161 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12162 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12163 #if HAVE_TIFF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12164 Qtiff = intern ("tiff"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12165 staticpro (&Qtiff); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12166 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12167 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12168 #if HAVE_GIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12169 Qgif = intern ("gif"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12170 staticpro (&Qgif); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12171 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12172 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12173 #if HAVE_PNG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12174 Qpng = intern ("png"); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12175 staticpro (&Qpng); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12176 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12177 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12178 defsubr (&Sclear_image_cache); |
29938
be81ae7e0218
(Fimage_size): New function.
Gerd Moellmann <gerd@gnu.org>
parents:
29882
diff
changeset
|
12179 defsubr (&Simage_size); |
31637
c1f4bdbf8465
(ALLOC_XPM_COLORS): Define if we can use Emacs' color
Gerd Moellmann <gerd@gnu.org>
parents:
31633
diff
changeset
|
12180 defsubr (&Simage_mask_p); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12181 |
36252
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
12182 hourglass_atimer = NULL; |
a8630c63f7d5
Rename everything containing *busy_cursor* and similar
Gerd Moellmann <gerd@gnu.org>
parents:
35859
diff
changeset
|
12183 hourglass_shown_p = 0; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12184 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12185 defsubr (&Sx_show_tip); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12186 defsubr (&Sx_hide_tip); |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
12187 tip_timer = Qnil; |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12188 staticpro (&tip_timer); |
34450
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
12189 tip_frame = Qnil; |
5de00bff5de3
(Fx_hide_tip): Avoid unnecessary work when there's
Gerd Moellmann <gerd@gnu.org>
parents:
34321
diff
changeset
|
12190 staticpro (&tip_frame); |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12191 |
35067
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
12192 last_show_tip_args = Qnil; |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
12193 staticpro (&last_show_tip_args); |
7ca0048f8615
(x_create_tip_frame): Preserve the value of
Gerd Moellmann <gerd@gnu.org>
parents:
35042
diff
changeset
|
12194 |
24994
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12195 #ifdef USE_MOTIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12196 defsubr (&Sx_file_dialog); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12197 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12198 } |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12199 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12200 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12201 void |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12202 init_xfns () |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12203 { |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12204 image_types = NULL; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12205 Vimage_types = Qnil; |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12206 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12207 define_image_type (&xbm_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12208 define_image_type (&gs_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12209 define_image_type (&pbm_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12210 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12211 #if HAVE_XPM |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12212 define_image_type (&xpm_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12213 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12214 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12215 #if HAVE_JPEG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12216 define_image_type (&jpeg_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12217 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12218 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12219 #if HAVE_TIFF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12220 define_image_type (&tiff_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12221 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12222 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12223 #if HAVE_GIF |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12224 define_image_type (&gif_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12225 #endif |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12226 |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12227 #if HAVE_PNG |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12228 define_image_type (&png_type); |
d549b7ac676d
(x_real_positions): Don't subtract window borders
Gerd Moellmann <gerd@gnu.org>
parents:
24905
diff
changeset
|
12229 #endif |
389 | 12230 } |
12231 | |
12232 #endif /* HAVE_X_WINDOWS */ |